Le 29/01/2024 à 12:28, Jiri Slaby a écrit : > On 27. 01. 24, 23:00, Yoann Congal wrote: >> CONFIG_BASE_SMALL is currently a type int but is only used as a boolean >> equivalent to !CONFIG_BASE_FULL. >> >> So, remove it entirely and move every usage to !CONFIG_BASE_FULL. >> >> In addition, recent kconfig changes (see the discussion in Closes: tag) >> revealed that using: >> config SOMETHING >> default "some value" if X >> does not work as expected if X is not of type bool. >> >> CONFIG_BASE_SMALL was used that way in init/Kconfig: >> config LOG_CPU_MAX_BUF_SHIFT >> default 12 if !BASE_SMALL >> default 0 if BASE_SMALL >> >> Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 to >> CONFIG_LOG_CPU_MAX_BUF_SHIFT=0 for some defconfigs, but that will not be >> a big impact due to this code in kernel/printk/printk.c: >> /* by default this will only continue through for large > 64 CPUs */ >> if (cpu_extra <= __LOG_BUF_LEN / 2) >> return; >> >> Signed-off-by: Yoann Congal <yoann.congal@xxxxxxxx> >> Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> >> Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@xxxxxxxxxxxxxx/ >> Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable") >> --- >> v1 patch was named "treewide: Change CONFIG_BASE_SMALL to bool type" >> https://lore.kernel.org/all/20240126163032.1613731-1-yoann.congal@xxxxxxxx/ >> >> v1 -> v2: Applied Masahiro Yamada's comments (Thanks!): >> * Changed from "Change CONFIG_BASE_SMALL to type bool" to >> "Remove it and switch usage to !CONFIG_BASE_FULL" >> * Fixed "Fixes:" tag and reference to the mailing list thread. >> * Added a note about CONFIG_LOG_CPU_MAX_BUF_SHIFT changing. > ... >> --- a/drivers/tty/vt/vc_screen.c >> +++ b/drivers/tty/vt/vc_screen.c >> @@ -51,7 +51,7 @@ >> #include <asm/unaligned.h> >> #define HEADER_SIZE 4u >> -#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) >> +#define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_FULL) ? PAGE_SIZE : 256) > > Why is the IS_ENABLED() addition needed? You don't say anything about that in the commit log. > > thanks, It is needed because we go from using CONFIG_BASE_*SMALL* which is of type _int_ (so either defined to 0 or some other non-zero value) to CONFIG_BASE_*FULL* which is of type _bool_ (so, it is either enabled or not). If I understood correctly, the proper way to check a config of type bool inside of a C function is with IS_ENABLED(). Another way to say this is : CONFIG_BASE_SMALL != 0 is equivalent to !IS_ENABLED(CONFIG_BASE_FULL) Finally, CONFIG_XXX is not defined if CONFIG_XXX is a type bool and disabled so : CONFIG_XXX? "yes":"no"; ... does not compile. I will try to explain it better in the v3 commit log. Thanks! Regards, -- Yoann Congal Smile ECS - Tech Expert