1. 21 Jul, 2024 6 commits
  2. 20 Jul, 2024 8 commits
  3. 16 Jul, 2024 9 commits
  4. 15 Jul, 2024 17 commits
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL · c5209080
      Masahiro Yamada authored
      Commit d5940c60 ("kbuild: deb-pkg improve maintainer address
      generation") supported the "name <email>" form for DEBEMAIL, with
      behavior slightly different from devscripts.
      
      In Kbuild, if DEBEMAIL is given in the form "name <email>", it is used
      as-is, and DEBFULLNAME is ignored.
      
      In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set,
      as described in 'man debchange':
      
        If this variable has the form "name <email>", then the maintainer name
        will also be taken from here if neither DEBFULLNAME nor NAME is set.
      
      This commit removes support for the "name <email> form for DEBEMAIL,
      as the current behavior is already different from debchange, and the
      Debian manual suggests setting the email address and name separately in
      DEBEMAIL and DEBFULLNAME. [1]
      
      If there are any complaints about this removal, we can re-add it,
      with better alignment with the debchange implementation. [2]
      
      [1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup
      [2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      c5209080
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: remove support for EMAIL environment variable · 62767619
      Masahiro Yamada authored
      Commit edec611d ("kbuild, deb-pkg: improve maintainer
      identification") added the EMAIL and NAME environment variables.
      
      Commit d5940c60 ("kbuild: deb-pkg improve maintainer address
      generation") removed support for NAME, but kept support for EMAIL.
      
      The EMAIL and NAME environment variables are supported by some tools
      (see 'man debchange'), but not by all.
      
      We should support both of them, or neither of them. We should not stop
      halfway.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      62767619
    • Masahiro Yamada's avatar
      kconfig: refactor error messages in sym_check_print_recursive() · d5afb482
      Masahiro Yamada authored
      Improve the error messages and clean up redundant code.
      
      [1] remove redundant next_sym->name checks
      
      If 'next_sym' is a choice, the first 'if' block is executed. In the
      subsequent 'else if' blocks, 'next_sym" is not a choice, hence
      next_sym->name is not NULL.
      
      [2] remove redundant sym->name checks
      
      A choice is never selected or implied by anyone because it has no name
      (it is syntactically impossible). If it is, sym->name is not NULL.
      
      [3] Show the location of choice instead of "<choice>"
      
      "part of choice <choice>" does not convey useful information. Since a
      choice has no name, it is more informative to display the file name and
      line number.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d5afb482
    • Masahiro Yamada's avatar
      kconfig: improve error message for recursive dependency in choice · d67624d8
      Masahiro Yamada authored
      Kconfig detects recursive dependencies in a choice block, but the error
      message is unclear.
      
      [Test Code]
      
          choice
                  prompt "choose"
                  depends on A
      
          config A
                  bool "A"
      
          config B
                  bool "B"
      
          endchoice
      
      [Result]
      
          Kconfig:1:error: recursive dependency detected!
          Kconfig:1:      choice <choice> contains symbol A
          Kconfig:5:      symbol A is part of choice <choice>
          For a resolution refer to Documentation/kbuild/kconfig-language.rst
          subsection "Kconfig recursive dependency limitations"
      
      The phrase "contains symbol A" does not accurately describe the problem.
      The issue is that the choice depends on A, which is a member of itself.
      
      The first if-block does not print a sensible message. Remove it.
      
      This commit improves the error message to:
      
          Kconfig:1:error: recursive dependency detected!
          Kconfig:1:      symbol <choice> symbol is visible depending on A
          Kconfig:5:      symbol A is part of choice <choice>
          For a resolution refer to Documentation/kbuild/kconfig-language.rst
          subsection "Kconfig recursive dependency limitations"
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d67624d8
    • Masahiro Yamada's avatar
      kconfig: improve error message for dependency between choice members · 1a7d0ea8
      Masahiro Yamada authored
      A choice member must not depend on another member within the same choice
      block.
      
      Kconfig detects this, but the error message is not sensible.
      
      [Test Code]
      
          choice
                  prompt "choose"
      
          config A
                  bool "A"
                  depends on B
      
          config B
                  bool "B"
      
          endchoice
      
      [Result]
      
          Kconfig:1:error: recursive dependency detected!
          Kconfig:1:      choice <choice> contains symbol A
          Kconfig:4:      symbol A is part of choice B
          Kconfig:8:      symbol B is part of choice <choice>
          For a resolution refer to Documentation/kbuild/kconfig-language.rst
          subsection "Kconfig recursive dependency limitations"
      
      The phrase "part of choice B" is weird because B is not a choice block,
      but a choice member.
      
      To determine whether the current symbol is a part of a choice block,
      sym_is_choice(next_sym) must be checked.
      
      This commit improves the error message to:
      
          Kconfig:1:error: recursive dependency detected!
          Kconfig:1:      choice <choice> contains symbol A
          Kconfig:4:      symbol A symbol is visible depending on B
          Kconfig:8:      symbol B is part of choice <choice>
          For a resolution refer to Documentation/kbuild/kconfig-language.rst
          subsection "Kconfig recursive dependency limitations"
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      1a7d0ea8
    • Masahiro Yamada's avatar
      kconfig: fix conditional prompt behavior for choice · d533828e
      Masahiro Yamada authored
      When a prompt is followed by "if <expr>", the symbol is configurable
      when the if-conditional evaluates to true.
      
      A typical usage is as follows:
      
          menuconfig BLOCK
                  bool "Enable the block layer" if EXPERT
                  default y
      
      When EXPERT=n, the prompt is hidden, but this config entry is still
      active, and BLOCK is set to its default value 'y'. When EXPERT=y, the
      prompt is shown, making BLOCK a user-configurable option.
      
      This usage is common throughout the kernel tree, but it has never worked
      within a choice block.
      
      [Test Code]
      
          config EXPERT
                  bool "Allow expert users to modify more options"
      
          choice
                  prompt "Choose" if EXPERT
      
          config A
                  bool "A"
      
          config B
                  bool "B"
      
          endchoice
      
      [Result]
      
          # CONFIG_EXPERT is not set
      
      When the prompt is hidden, the choice block should produce the default
      without asking for the user's preference. Hence, the output should be:
      
          # CONFIG_EXPERT is not set
          CONFIG_A=y
          # CONFIG_B is not set
      
      Removing unnecessary hacks fixes the issue.
      
      This commit also changes the behavior of 'select' by choice members.
      
      [Test Code 2]
      
          config MODULES
                  def_bool y
                  modules
      
          config DEP
                  def_tristate m
      
          if DEP
      
          choice
                  prompt "choose"
      
          config A
                  bool "A"
                  select C
      
          endchoice
      
          config B
                  def_bool y
                  select D
      
          endif
      
          config C
                  tristate
      
          config D
                  tristate
      
      The current output is as follows:
      
          CONFIG_MODULES=y
          CONFIG_DEP=m
          CONFIG_A=y
          CONFIG_B=y
          CONFIG_C=y
          CONFIG_D=m
      
      With this commit, the output will be changed as follows:
      
          CONFIG_MODULES=y
          CONFIG_DEP=m
          CONFIG_A=y
          CONFIG_B=y
          CONFIG_C=m
          CONFIG_D=m
      
      CONFIG_C will be changed to 'm' because 'select C' will inherit the
      dependency on DEP, which is 'm'.
      
      This change is aligned with the behavior of 'select' outside a choice
      block; 'select D' depends on DEP, therefore D is selected by (B && DEP).
      
      Note:
      
      With this commit, allmodconfig will set CONFIG_USB_ROLE_SWITCH to 'm'
      instead of 'y'. I did not see any build regression with this change.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d533828e
    • Masahiro Yamada's avatar
      treewide: change conditional prompt for choices to 'depends on' · b9d73218
      Masahiro Yamada authored
      While Documentation/kbuild/kconfig-language.rst provides a brief
      explanation, there are recurring confusions regarding the usage of a
      prompt followed by 'if <expr>'. This conditional controls _only_ the
      prompt.
      
      A typical usage is as follows:
      
          menuconfig BLOCK
                  bool "Enable the block layer" if EXPERT
                  default y
      
      When EXPERT=n, the prompt is hidden, but this config entry is still
      active, and BLOCK is set to its default value 'y'. This is reasonable
      because you are likely want to enable the block device support. When
      EXPERT=y, the prompt is shown, allowing you to toggle BLOCK.
      
      Please note that it is different from 'depends on EXPERT', which would
      enable and disable the entire config entry.
      
      However, this conditional prompt has never worked in a choice block.
      
      The following two work in the same way: when EXPERT is disabled, the
      choice block is entirely disabled.
      
      [Test Code 1]
      
          choice
                  prompt "choose" if EXPERT
      
          config A
                  bool "A"
      
          config B
                  bool "B"
      
          endchoice
      
      [Test Code 2]
      
          choice
                  prompt "choose"
                  depends on EXPERT
      
          config A
                  bool "A"
      
          config B
                  bool "B"
      
          endchoice
      
      I believe the first case should hide only the prompt, producing the
      default:
      
         CONFIG_A=y
         # CONFIG_B is not set
      
      The next commit will change (fix) the behavior of the conditional prompt
      in choice blocks.
      
      I see several choice blocks wrongly using a conditional prompt, where
      'depends on' makes more sense.
      
      To preserve the current behavior, this commit converts such misuses.
      
      I did not touch the following entry in arch/x86/Kconfig:
      
          choice
                  prompt "Memory split" if EXPERT
                  default VMSPLIT_3G
      
      This is truly the correct use of the conditional prompt; when EXPERT=n,
      this choice block should silently select the reasonable VMSPLIT_3G,
      although the resulting PAGE_OFFSET will not be affected anyway.
      
      Presumably, the one in fs/jffs2/Kconfig is also correct, but I converted
      it to 'depends on' to avoid any potential behavioral change.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b9d73218
    • Masahiro Yamada's avatar
      kconfig: remove E_LIST expression type · 7c9bb07a
      Masahiro Yamada authored
      E_LIST was preveously used to form an expression tree consisting of
      choice members.
      
      It is no longer used.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      7c9bb07a
    • Masahiro Yamada's avatar
      kconfig: remove P_CHOICE property · ca4c74ba
      Masahiro Yamada authored
      P_CHOICE is a pseudo property used to link a choice with its members.
      
      There is no more code relying on this, except for some debug code.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ca4c74ba
    • Masahiro Yamada's avatar
      kconfig: use sym_get_choice_menu() in sym_check_deps() · b139b43e
      Masahiro Yamada authored
      Choices and their members are associated via the P_CHOICE property.
      
      Currently, prop_get_symbol(sym_get_choice_prop()) is used to obtain
      the choice of the given choice member.
      
      Replace it with sym_get_choice_menu(), which retrieves the choice
      without relying on P_CHOICE.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b139b43e
    • Masahiro Yamada's avatar
      kconfig: use sym_get_choice_menu() in sym_check_choice_deps() · 609fc409
      Masahiro Yamada authored
      Choices and their members are associated via the P_CHOICE property.
      
      Currently, prop_get_symbol(sym_get_choice_prop()) is used to obtain
      the choice of the given choice member.
      
      Replace it with sym_get_choice_menu(), which retrieves the choice
      without relying on P_CHOICE.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      609fc409
    • Masahiro Yamada's avatar
      kconfig: use sym_get_choice_menu() in sym_check_print_recursive() · d8f8bbcf
      Masahiro Yamada authored
      Choices and their members are associated via the P_CHOICE property.
      
      Currently, prop_get_symbol(sym_get_choice_prop()) is used to obtain
      the choice of the given choice member.
      
      Replace it with sym_get_choice_menu(), which retrieves the choice
      without relying on P_CHOICE.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d8f8bbcf
    • Masahiro Yamada's avatar
      kconfig: remove expr_list_for_each_sym() macro · 8926bc90
      Masahiro Yamada authored
      All users of this macro have been converted. Remove it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      8926bc90
    • Masahiro Yamada's avatar
      kconfig: use menu_list_for_each_sym() in sym_choice_default() · 6e6d0e91
      Masahiro Yamada authored
      Choices and their members are associated via the P_CHOICE property.
      
      Currently, sym_get_choice_prop() and expr_list_for_each_sym() are
      used to iterate on choice members.
      
      Replace them with menu_for_each_sub_entry(), which achieves the same
      without relying on P_CHOICE.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      6e6d0e91
    • Masahiro Yamada's avatar
      kconfig: change sym_choice_default() to take the choice menu · e8fcd915
      Masahiro Yamada authored
      Change the argument of sym_choice_default() to ease further cleanups.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e8fcd915
    • Masahiro Yamada's avatar
      kconfig: remove conf_unsaved in conf_read_simple() · cca31837
      Masahiro Yamada authored
      This variable is unnecessary. Call conf_set_changed(true) directly.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cca31837
    • Masahiro Yamada's avatar
      kconfig: remove sym_get_choice_value() · bd0db4b6
      Masahiro Yamada authored
      sym_get_choice_value(menu->sym) is equivalent to sym_calc_choice(menu).
      
      Convert all call sites of sym_get_choice_value() and then remove it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      bd0db4b6