Skip to contentSkip to conversation

checkpatch: add judgment condition for Kconfig help test

PATCH In review Cixi Geng 4 participants 6 messages Nov 16, 2023 – Nov 18, 2023

Subsystems (2)
lore
Share & tools
lore

Cixi Geng

author
#0 lore raw

PATCH 1/1 checkpatch: add judgment condition for Kconfig help test

From: Cixi Geng <[email protected]>

The has_help only counted the situation which the patch file add a help line, when the config was renamed and modify description, the has_help is zero for the "help" line not added.

here is one case:
the modify file: drivers/iio/adc/Kconfig line(1047)

-config SC27XX_ADC
+config SPRD_ADC
tristate "Spreadtrum SC27xx series PMICs ADC" depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
- Say yes here to build support for the integrated ADC inside the
- Spreadtrum SC27xx series PMICs.
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

the checkpatch result:
WARNING: please write a help paragraph that fully describes the config symbol #23: FILE: drivers/iio/adc/Kconfig:1050:
+config SPRD_ADC
+ tristate "Spreadtrum's ADC PMICs driver"
depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

total: 0 errors, 1 warnings, 17 lines checked

Fixes b8709bce9089 ("checkpatch: improve Kconfig help test")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 25fdb7fda112..402009d08505 100755
@@ -3616,7 +3616,7 @@ sub process {
 					$needs_help = 1;
 					next;
 				}
-				if ($f =~ /^\+\s*help\s*$/) {
+				if ($f =~ /^\+\s*help\s*$/ || $f =~ /^\s*help\s*$/) {
 					$has_help = 1;
 					next;
 				}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 36 lines · Cixi Geng

From: Cixi Geng <[email protected]>

The has_help only counted the situation which the patch file add a help line, when the config was renamed and modify description, the has_help is zero for the "help" line not added.

here is one case:
the modify file: drivers/iio/adc/Kconfig line(1047)

-config SC27XX_ADC
+config SPRD_ADC
tristate "Spreadtrum SC27xx series PMICs ADC" depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
- Say yes here to build support for the integrated ADC inside the
- Spreadtrum SC27xx series PMICs.
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

the checkpatch result:
WARNING: please write a help paragraph that fully describes the config symbol #23: FILE: drivers/iio/adc/Kconfig:1050:
+config SPRD_ADC
+ tristate "Spreadtrum's ADC PMICs driver"
depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

Quoted 4 lines

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

total: 0 errors, 1 warnings, 17 lines checked

This confuses me. What are you trying to achieve there?

Confused...

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#2 lore raw
Quoted 1 line · Bagas Sanjaya

On Thu, Nov 16, 2023 at 11:39:04PM +0800, Cixi Geng wrote:

...

Quoted 10 lines
Quoted 10 lines

the checkpatch result:
WARNING: please write a help paragraph that fully describes the config symbol #23: FILE: drivers/iio/adc/Kconfig:1050:

help
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

Quoted 6 lines
Quoted 4 lines

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

total: 0 errors, 1 warnings, 17 lines checked

This confuses me. What are you trying to achieve there?

Is the indentation correct in each line? No TABs/spaces mix?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 15 lines · Andy Shevchenko
Quoted 1 line · Bagas Sanjaya

On Thu, Nov 16, 2023 at 11:39:04PM +0800, Cixi Geng wrote:

...

Quoted 10 lines
Quoted 10 lines

the checkpatch result:
WARNING: please write a help paragraph that fully describes the config symbol #23: FILE: drivers/iio/adc/Kconfig:1050:

help
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

total: 0 errors, 1 warnings, 17 lines checked

This confuses me. What are you trying to achieve there?

Is the indentation correct in each line? No TABs/spaces mix?

IDK as I'm not the patch author...

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#4 lore raw
In reply to Cixi Geng

Hi--

Quoted 20 lines · Cixi Geng

From: Cixi Geng <[email protected]>

The has_help only counted the situation which the patch file add a help line, when the config was renamed and modify description, the has_help is zero for the "help" line not added.

here is one case:
the modify file: drivers/iio/adc/Kconfig line(1047)

-config SC27XX_ADC
+config SPRD_ADC
tristate "Spreadtrum SC27xx series PMICs ADC" depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
- Say yes here to build support for the integrated ADC inside the
- Spreadtrum SC27xx series PMICs.
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

Quoted 2 lines

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

OK, I made those changes to that Kconfig file and ran checkpatch. I didn't get any of the following checkpatch results.

Are you using a current version of checkpatch?

Quoted 37 lines

the checkpatch result:
WARNING: please write a help paragraph that fully describes the config symbol #23: FILE: drivers/iio/adc/Kconfig:1050:
+config SPRD_ADC
+ tristate "Spreadtrum's ADC PMICs driver"
depends on MFD_SC27XX_PMIC || COMPILE_TEST
+ depends on ARCH_SPRD
help
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Say yes here to build support for the integrated ADC inside of the
+ Spreadtrum SC27xx and UMPxx series PMICs.

This driver can also be built as a module. If so, the module will be called sc27xx_adc.

total: 0 errors, 1 warnings, 17 lines checked

Fixes b8709bce9089 ("checkpatch: improve Kconfig help test")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 25fdb7fda112..402009d08505 100755
@@ -3616,7 +3616,7 @@ sub process {
 					$needs_help = 1;
 					next;
 				}
-				if ($f =~ /^\+\s*help\s*$/) {
+				if ($f =~ /^\+\s*help\s*$/ || $f =~ /^\s*help\s*$/) {
 					$has_help = 1;
 					next;
 				}
Signature · 1 line
~Randy
author
#5 lore raw
Quoted 25 lines · Randy Dunlap

Hi--

Quoted 22 lines · Cixi Geng

From: Cixi Geng <[email protected]>

The has_help only counted the  situation which the patch file add a help line, when the config was renamed and  modify description, the has_help is zero for the "help" line not added.

here is one case:
    the modify file: drivers/iio/adc/Kconfig  line(1047)

    -config SC27XX_ADC
    +config SPRD_ADC
        tristate "Spreadtrum SC27xx series PMICs ADC" depends on MFD_SC27XX_PMIC || COMPILE_TEST
    +   depends on ARCH_SPRD
        help
    -     Say yes here to build support for the integrated ADC inside the
    -     Spreadtrum SC27xx series PMICs.
    +     Say yes here to build support for the integrated ADC inside of the
    +     Spreadtrum SC27xx and UMPxx series PMICs.

Quoted 8 lines
Quoted 3 lines

          This driver can also be built as a module. If so, the module
          will be called sc27xx_adc.

OK, I made those changes to that Kconfig file and ran checkpatch. I didn't get any of the following checkpatch results.

Are you using a current version of checkpatch?

yes, I'am sure there is some wrong result about the patch, My local verion is based on (7475e51b8796 (HEAD -> local, origin/master, origin/HEAD) Merge tag 'net-6.7-rc2' of
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net)

my steps is modify the Kconfig, generate a test commit. and git format this commit, then run ./scripts/checkpatch.pl 0001-test.patch.

Quoted 45 lines
Quoted 44 lines

the checkpatch result:
    WARNING: please write a help paragraph that fully describes the config symbol
    #23: FILE: drivers/iio/adc/Kconfig:1050:
    +config SPRD_ADC
    +   tristate "Spreadtrum's ADC PMICs driver"
        depends on MFD_SC27XX_PMIC || COMPILE_TEST
    +   depends on ARCH_SPRD
        help
    +     Say yes here to build support for the integrated ADC inside of the
    +     Say yes here to build support for the integrated ADC inside of the
    +     Say yes here to build support for the integrated ADC inside of the
    +     Spreadtrum SC27xx and UMPxx series PMICs.

          This driver can also be built as a module. If so, the module
          will be called sc27xx_adc.

    total: 0 errors, 1 warnings, 17 lines checked

Fixes b8709bce9089 ("checkpatch: improve Kconfig help test")

---
 scripts/checkpatch.pl | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 25fdb7fda112..402009d08505 100755
@@ -3616,7 +3616,7 @@ sub process {
                                         $needs_help = 1;
                                         next;
                                 }
-                               if ($f =~ /^\+\s*help\s*$/) {
+                               if ($f =~ /^\+\s*help\s*$/ || $f =~
 /^\s*help\s*$/) {
                                         $has_help = 1;
                                         next;

                                }