how to fix MACRO_ARG_REUSE

2023-08-23 Thread jim . cromie
on a recent submit to LKML
https://lore.kernel.org/lkml/20230801170255.163237-1-jim.cro...@gmail.com/

I got a Patchwork CI warning in report:
https://patchwork.freedesktop.org/series/113363/


1a864a4fe7ce dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression

-:445: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_var' - possible
side-effects?
#445: FILE: include/linux/dynamic_debug.h:120:
+#define DYNDBG_CLASSMAP_USE_(_var, _uname) \
+extern struct ddebug_class_map _var; \
+struct ddebug_class_user __used \
+__section("__dyndbg_class_users") _uname = { \
+  .user_mod_name = KBUILD_MODNAME, \
+  .map = &_var, \
  }

_var is expanded 2x, the "extra" time is to declare it as "extern",
meaning its exported elsewhere.

the usual fix for macro problems like this is __typeof();
something like:
#define foo(a,b,...) \
  typeof(a) _a = a; \
  ...

but I dont see how to use it -
I need _var to name the struct exported from another module,
and I need to take its &-address.

Is there a trick / technique I can use ?

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


forcibly disable config

2023-08-23 Thread Oleksii
Hello, dear community,

I want to ask what is a proper way to disable config forcibly.

For example, I have some config somewhere in common Kconfig:
config NAME
bool "some short description" if EXPERT
default y

When I do the command `make olddefconfig`, it will generate a new
config based on old .config.
So my expectation was if I put CONFIG_NAME=n to .config and then ran
the command, I'll get CONFIG_NAME=n in the final .config, but it
doesn't work.

If you update 'config NAME' from `default y` to `default n`, all will
be fine, but it is not the best solution to touch common Kconfig.
If you use 'make defconfig' and put `# CONFIG_NAME is not set`, then
all will be fine too, but my CI uses 'make olddefconfig`, which ignores
`*_defconfig`.
Also, I tried to override CONFIG_NAME in arch-specific Kconfig in the
following way:
config NAME
bool
default n
and it works for olddefconfig, but if you use `make randconfig`, it
still can set CONFIG_NAME=y.

I tried debugging the conf utility and found that [1] CONFIG_NAME is
set to n, but [2] it takes `default y` from the original in Kconfig
common, ignoring what I write to .config.
Is it expected behavior?

Could you please let me know the right solution?


[1]
https://github.com/torvalds/linux/blob/master/scripts/kconfig/confdata.c#L490


[2]
https://github.com/torvalds/linux/blob/master/scripts/kconfig/symbol.c#L394


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies