Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
This commit makes Kconfig error out if it finds a symbol suffixed with
'_MODULE'. This restriction does not exist if the module feature is not
supported (at least from the Kconfig perspective).
It detected one error:
error: SND_SOC_DM365_VOICE_CODEC_MODULE: symbol name must not end with '_MODULE'
Rename it to SND_SOC_DM365_VOICE_CODEC_MODULAR. Commit 147162f57515
("ASoC: ti: fix SND_SOC_DM365_VOICE_CODEC dependencies") added it for
internal use. So, this renaming has no impact on users.
Remove a comment from drivers/net/wireless/intel/iwlwifi/Kconfig since
this is a hard error now.
Add a comment to include/linux/kconfig.h in order not to worry observant
developers.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/Kconfig | 1 -
include/linux/kconfig.h | 3 ++
scripts/kconfig/parser.y | 40 +++++++++++++++++++++-
sound/soc/ti/Kconfig | 2 +-
4 files changed, 43 insertions(+), 3 deletions(-)
@@ -475,6 +475,37 @@ assign_val: %%+/*+ * Symbols suffixed with '_MODULE' would cause a macro conflict in autoconf.h,+ * and also confuse the interaction between syncconfig and fixdep.+ * Error out if a symbol with the '_MODULE' suffix is found.+ */+static int sym_check_name(struct symbol *sym)+{+ static const char *suffix = "_MODULE";+ static const size_t suffix_len = strlen("_MODULE");+ char *name;+ size_t len;++ name = sym->name;++ if (!name)+ return 0;++ len = strlen(name);++ if (len < suffix_len)+ return 0;++ if (strcmp(name + len - suffix_len, suffix))+ return 0;++ fprintf(stderr, "error: %s: symbol name must not end with '%s'\n",+ name, suffix);++ return -1;+}+ void conf_parse(const char *name) { struct symbol *sym;
@@ -493,8 +524,15 @@ void conf_parse(const char *name) if (yynerrs) exit(1);- if (!modules_sym)++ if (modules_sym) {+ for_all_symbols(i, sym) {+ if (sym_check_name(sym))+ yynerrs++;+ }+ } else { modules_sym = sym_find( "n" );+ } if (!menu_has_prompt(&rootmenu)) { current_entry = &rootmenu;
From: Péter Ujfalusi <hidden> Date: 2021-08-25 11:59:33
Hi,
On 25/08/2021 07:16, Masahiro Yamada wrote:
quoted hunk
Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
This commit makes Kconfig error out if it finds a symbol suffixed with
'_MODULE'. This restriction does not exist if the module feature is not
supported (at least from the Kconfig perspective).
It detected one error:
error: SND_SOC_DM365_VOICE_CODEC_MODULE: symbol name must not end with '_MODULE'
Rename it to SND_SOC_DM365_VOICE_CODEC_MODULAR. Commit 147162f57515
("ASoC: ti: fix SND_SOC_DM365_VOICE_CODEC dependencies") added it for
internal use. So, this renaming has no impact on users.
Remove a comment from drivers/net/wireless/intel/iwlwifi/Kconfig since
this is a hard error now.
Add a comment to include/linux/kconfig.h in order not to worry observant
developers.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/Kconfig | 1 -
include/linux/kconfig.h | 3 ++
scripts/kconfig/parser.y | 40 +++++++++++++++++++++-
sound/soc/ti/Kconfig | 2 +-
4 files changed, 43 insertions(+), 3 deletions(-)
@@ -475,6 +475,37 @@ assign_val: %%+/*+ * Symbols suffixed with '_MODULE' would cause a macro conflict in autoconf.h,+ * and also confuse the interaction between syncconfig and fixdep.+ * Error out if a symbol with the '_MODULE' suffix is found.+ */+static int sym_check_name(struct symbol *sym)+{+ static const char *suffix = "_MODULE";+ static const size_t suffix_len = strlen("_MODULE");+ char *name;+ size_t len;++ name = sym->name;++ if (!name)+ return 0;++ len = strlen(name);++ if (len < suffix_len)+ return 0;++ if (strcmp(name + len - suffix_len, suffix))+ return 0;++ fprintf(stderr, "error: %s: symbol name must not end with '%s'\n",+ name, suffix);++ return -1;+}+ void conf_parse(const char *name) { struct symbol *sym;
@@ -493,8 +524,15 @@ void conf_parse(const char *name) if (yynerrs) exit(1);- if (!modules_sym)++ if (modules_sym) {+ for_all_symbols(i, sym) {+ if (sym_check_name(sym))+ yynerrs++;+ }+ } else { modules_sym = sym_find( "n" );+ } if (!menu_has_prompt(&rootmenu)) { current_entry = &rootmenu;
This Kconfig option is only used to select the codecs needed for the
voice mode, I think it would be better to use something like
SND_SOC_DM365_SELECT_VOICE_CODECS ?
def_tristate y
depends on SND_SOC_DM365_VOICE_CODEC && SND_SOC
select MFD_DAVINCI_VOICECODEC
From: Boris Kolpackov <hidden> Date: 2021-08-25 15:42:20
Masahiro Yamada [off-list ref] writes:
Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
It seem to me the problem is in autoconf.h/fixdep, not in the Kconfig
language.
This commit makes Kconfig error out if it finds a symbol suffixed with
'_MODULE'.
I know you don't care, but I will voice my objection, for the record:
Kconfig is used by projects other than the Linux kernel and some of
them do not use the autoconf.h functionality. For such projects this
restriction seems arbitrary and potentially backwards-incompatible.
On Thu, Aug 26, 2021 at 12:42 AM Boris Kolpackov
[off-list ref] wrote:
Masahiro Yamada [off-list ref] writes:
quoted
Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
It seem to me the problem is in autoconf.h/fixdep, not in the Kconfig
language.
Partly a Kconfig problem since autoconf.h is generated by Kconfig.
So, what is your suggestion for doing this correctly?
(of course without breaking the compatibility
because this is how the kernel is configured/built
for more than 20 years)
quoted
This commit makes Kconfig error out if it finds a symbol suffixed with
'_MODULE'.
I know you don't care, but I will voice my objection, for the record:
Kconfig is used by projects other than the Linux kernel and some of
them do not use the autoconf.h functionality. For such projects this
restriction seems arbitrary and potentially backwards-incompatible.
I am not sure what your worry is, but this check resides in
"if (modules_sym)" conditional, so projects using Kconfig but
not module functionality (e.g. buildroot) will not be affected.
--
Best Regards
Masahiro Yamada
On Wed, Aug 25, 2021 at 8:59 PM Péter Ujfalusi [off-list ref] wrote:
Hi,
On 25/08/2021 07:16, Masahiro Yamada wrote:
quoted
Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
This commit makes Kconfig error out if it finds a symbol suffixed with
'_MODULE'. This restriction does not exist if the module feature is not
supported (at least from the Kconfig perspective).
It detected one error:
error: SND_SOC_DM365_VOICE_CODEC_MODULE: symbol name must not end with '_MODULE'
Rename it to SND_SOC_DM365_VOICE_CODEC_MODULAR. Commit 147162f57515
("ASoC: ti: fix SND_SOC_DM365_VOICE_CODEC dependencies") added it for
internal use. So, this renaming has no impact on users.
Remove a comment from drivers/net/wireless/intel/iwlwifi/Kconfig since
this is a hard error now.
Add a comment to include/linux/kconfig.h in order not to worry observant
developers.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/Kconfig | 1 -
include/linux/kconfig.h | 3 ++
scripts/kconfig/parser.y | 40 +++++++++++++++++++++-
sound/soc/ti/Kconfig | 2 +-
4 files changed, 43 insertions(+), 3 deletions(-)
@@ -475,6 +475,37 @@ assign_val: %%+/*+ * Symbols suffixed with '_MODULE' would cause a macro conflict in autoconf.h,+ * and also confuse the interaction between syncconfig and fixdep.+ * Error out if a symbol with the '_MODULE' suffix is found.+ */+static int sym_check_name(struct symbol *sym)+{+ static const char *suffix = "_MODULE";+ static const size_t suffix_len = strlen("_MODULE");+ char *name;+ size_t len;++ name = sym->name;++ if (!name)+ return 0;++ len = strlen(name);++ if (len < suffix_len)+ return 0;++ if (strcmp(name + len - suffix_len, suffix))+ return 0;++ fprintf(stderr, "error: %s: symbol name must not end with '%s'\n",+ name, suffix);++ return -1;+}+ void conf_parse(const char *name) { struct symbol *sym;
@@ -493,8 +524,15 @@ void conf_parse(const char *name) if (yynerrs) exit(1);- if (!modules_sym)++ if (modules_sym) {+ for_all_symbols(i, sym) {+ if (sym_check_name(sym))+ yynerrs++;+ }+ } else { modules_sym = sym_find( "n" );+ } if (!menu_has_prompt(&rootmenu)) { current_entry = &rootmenu;
This Kconfig option is only used to select the codecs needed for the
voice mode, I think it would be better to use something like
SND_SOC_DM365_SELECT_VOICE_CODECS ?
I do not have a strong opinion.
I am fine with any name unless it ends with _MODULE.
The sound subsystem maintainers and Arnd,
author of 147162f575152db800 are CC'ed.
If they suggest a better name, I'd be happy to adopt it.
--
Best Regards
Masahiro Yamada
From: Boris Kolpackov <hidden> Date: 2021-08-26 12:16:18
Masahiro Yamada [off-list ref] writes:
On Thu, Aug 26, 2021 at 12:42 AM Boris Kolpackov
[off-list ref] wrote:
quoted
Masahiro Yamada [off-list ref] writes:
quoted
Kconfig (syncconfig) generates include/generated/autoconf.h to make
CONFIG options available to the pre-processor.
The macros are suffixed with '_MODULE' for symbols with the value 'm'.
Here is a conflict; CONFIG_FOO=m results in '#define CONFIG_FOO_MODULE 1',
but CONFIG_FOO_MODULE=y also results in the same define.
fixdep always assumes CONFIG_FOO_MODULE comes from CONFIG_FOO=m, so the
dependency is not properly tracked for symbols that end with '_MODULE'.
It seem to me the problem is in autoconf.h/fixdep, not in the Kconfig
language.
So, what is your suggestion for doing this correctly?
(of course without breaking the compatibility
because this is how the kernel is configured/built
for more than 20 years)
Yes, I appreciate that fixing this properly may not be an option
due to backwards-compatibility. How about then moving the check
from the language closer to the place where it will actually be
an issue. Specifically, can the error be triggered when we are
about to write #define to autoconf.h and see that the name ends
with _MODULE?
quoted
I know you don't care, but I will voice my objection, for the record:
Kconfig is used by projects other than the Linux kernel and some of
them do not use the autoconf.h functionality. For such projects this
restriction seems arbitrary and potentially backwards-incompatible.
I am not sure what your worry is, but this check resides in
"if (modules_sym)" conditional, so projects using Kconfig but
not module functionality (e.g. buildroot) will not be affected.
This Kconfig option is only used to select the codecs needed for the
voice mode, I think it would be better to use something like
SND_SOC_DM365_SELECT_VOICE_CODECS ?
I do not have a strong opinion.
I am fine with any name unless it ends with _MODULE.
The sound subsystem maintainers and Arnd,
author of 147162f575152db800 are CC'ed.
If they suggest a better name, I'd be happy to adopt it.
Can you resend (a separate patch would be even better) with
SND_SOC_DM365_SELECT_VOICE_CODECS
for sound/soc/ti/Kconfig ?
Thank you,
Péter