[Linux-kernel-mentees] [RFC PATCH] checkpatch: correctly detect lines of help text

Joe Perches joe at perches.com
Thu Dec 3 19:04:11 UTC 2020

On Thu, 2020-12-03 at 10:31 -0800, Randy Dunlap wrote:
> On 12/3/20 9:58 AM, Joe Perches wrote:
> > On Wed, 2020-12-02 at 10:59 -0800, Randy Dunlap wrote:
> > 
> > > There are also large hunks of block/Kconfig and drivers/hid/Kconfig
> > > that don't use any indentation for help text...
> > > in case that matters here.
> > 
> > Maybe something like this could help.
> > 
> > Indent the unindented help blocks by 2 spaces and reflow where appropriate.
> > 
> > ---
> >  block/Kconfig       | 105 +++++-----
> >  drivers/hid/Kconfig | 549 +++++++++++++++++++++++++++-------------------------
> >  2 files changed, 335 insertions(+), 319 deletions(-)
> LGTM. Thanks.

btw: there appears to be ~750 help sections in Kconfig files
that do not use 2 space indentation for the help content vs
the ~14000 help sections that do use 2 space indentation.

Maybe there's some value in standardizing on the 2 space style.

A trivial script to show the sections that don't use 2 spaces:

$ git grep -n -A1 -P "^\s*help\s*$" -- '*/Kconfig*' |
  grep -v '^--$' |
  perl -e 'while (<>) {
    my $line1 = $_;
    my $line2 = <>;

    my $l1 = $line1;
    my $l2 = $line2;


    $l1 =~ s/^.*:\d+:(\s*).*/$1/;
    $l2 =~ s/^.*-\d+-(\s*).*/$1/;

    if ("$l1  " ne "$l2") {
	print "$line1";
	print "$line2";

Change the ne to eq to see the matches.

For instance, a head -50 of the above is:

arch/Kconfig:84:	help
arch/Kconfig-85-	 This option enables a transparent branch optimization that
arch/Kconfig:127:	help
arch/Kconfig-128-	 If function tracer is enabled and the arch supports full
arch/Kconfig:167:	help
arch/Kconfig-168-	 Modern versions of GCC (since 4.4) have builtin functions
arch/Kconfig:1056:       help
arch/Kconfig-1057-          An architecture should select this if its syscall numbering is sparse
arch/alpha/Kconfig:147:	help
arch/alpha/Kconfig-148-	  XL-233 and XL-266-based Alpha systems.
arch/arm/Kconfig:1001:       help
arch/arm/Kconfig-1002-	 This option enables the workaround for the 775420 Cortex-A9 (r2p2,
arch/arm/Kconfig-nommu:9:	help
arch/arm/Kconfig-nommu-10-	 Say Y to manually set the base addresses and sizes.
arch/arm/Kconfig.debug:24:	help
arch/arm/Kconfig.debug-25-		Generate a warning if any W+X mappings are found at boot.
arch/arm/mach-aspeed/Kconfig:21:	help
arch/arm/mach-aspeed/Kconfig-22-	 Say yes if you intend to run on an Aspeed ast2400 or similar
arch/arm/mach-aspeed/Kconfig:31:	help
arch/arm/mach-aspeed/Kconfig-32-	 Say yes if you intend to run on an Aspeed ast2500 or similar
arch/arm/mach-aspeed/Kconfig:42:	help
arch/arm/mach-aspeed/Kconfig-43-	 Say yes if you intend to run on an Aspeed ast2600 or similar
arch/arm/mach-imx/Kconfig:230:	help
arch/arm/mach-imx/Kconfig-231-		This enables support for Freescale i.MX7 Dual processor.
arch/arm/mach-ixp4xx/Kconfig:41:    help
arch/arm/mach-ixp4xx/Kconfig-42-	  Say 'Y' here if you want your kernel to support the Giant
arch/arm/mach-ixp4xx/Kconfig:178:	help
arch/arm/mach-ixp4xx/Kconfig-179-		This board is currently inside the Linksys WRV54G Gateways.
arch/arm/mach-ixp4xx/Kconfig:216:	help
arch/arm/mach-ixp4xx/Kconfig-217-          IXP4xx provides two methods of accessing PCI memory space:
arch/arm/mach-omap1/Kconfig:61:	help
arch/arm/mach-omap1/Kconfig-62-          TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
arch/arm/mach-omap1/Kconfig:68:    	help
arch/arm/mach-omap1/Kconfig-69-	  TI OMAP 1610/1611B H2 board support. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:75:    	help
arch/arm/mach-omap1/Kconfig-76-	  TI OMAP 1710 H3 board support. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:88:    	help
arch/arm/mach-omap1/Kconfig-89-	  TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
arch/arm/mach-omap1/Kconfig:95:    	help
arch/arm/mach-omap1/Kconfig-96-	  The OSK supports an optional add-on board with a Quarter-VGA
arch/arm/mach-omap1/Kconfig:103:    	help
arch/arm/mach-omap1/Kconfig-104-	  Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:110:    	help
arch/arm/mach-omap1/Kconfig-111-	  Support for TI OMAP 850 F-Sample board. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:126:	help
arch/arm/mach-omap1/Kconfig-127-	 Support for the Palm Zire71 PDA. To boot the kernel,
arch/arm/mach-omap1/Kconfig:175:	help
arch/arm/mach-omap1/Kconfig-176-          Support for generic OMAP-1510, 1610 or 1710 board with
arch/arm/mach-prima2/Kconfig:24:	help
arch/arm/mach-prima2/Kconfig-25-          Support for CSR SiRFSoC ARM Cortex A9 Platform

More information about the Linux-kernel-mentees mailing list