Skip to contentSkip to conversation

docs: Fix bitfield handling in kernel-doc

PATCH Applied Donald Hunter 3 participants 4 messages Mar 26, 2024 – Mar 29, 2024 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: Fix bitfield handling in kernel-doc

kernel-doc doesn't handle bitfields that are specified with symbolic name, e.g. u32 cs_index_mask : SPI_CS_CNT_MAX

This results in the following warnings when running make htmldocs:

include/linux/spi/spi.h:246: warning: Function parameter or struct member 'cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_device' include/linux/spi/spi.h:246: warning: Excess struct member 'cs_index_mask' description in 'spi_device'

Update the regexp for bitfields to accept all word chars, not just digits.

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index 967f1abb0edb..cb1be22afc65 100755
@@ -1541,7 +1541,7 @@ sub create_parameterlist($$$$) {
                     save_struct_actual($2);
 
                     push_parameter($2, "$type $1", $arg, $file, $declaration_name);
-                } elsif ($param =~ m/(.*?):(\d+)/) {
+                } elsif ($param =~ m/(.*?):(\w+)/) {
                     if ($type ne "") { # skip unnamed bit-fields
                         save_struct_actual($1);
                         push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
Signature · 1 line
2.44.0
reviewer Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 5 lines · Donald Hunter

kernel-doc doesn't handle bitfields that are specified with symbolic name, e.g. u32 cs_index_mask : SPI_CS_CNT_MAX

This results in the following warnings when running make htmldocs:

Quoted 7 lines

include/linux/spi/spi.h:246: warning: Function parameter or struct member 'cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_device' include/linux/spi/spi.h:246: warning: Excess struct member 'cs_index_mask' description in 'spi_device'

Update the regexp for bitfields to accept all word chars, not just digits.

Thanks.

That takes care of item #2 on my kernel-doc issues list:
https://lore.kernel.org/linux-doc/[email protected]/

Quoted 17 lines
---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index 967f1abb0edb..cb1be22afc65 100755
@@ -1541,7 +1541,7 @@ sub create_parameterlist($$$$) {
                     save_struct_actual($2);
 
                     push_parameter($2, "$type $1", $arg, $file, $declaration_name);
-                } elsif ($param =~ m/(.*?):(\d+)/) {
+                } elsif ($param =~ m/(.*?):(\w+)/) {
                     if ($type ne "") { # skip unnamed bit-fields
                         save_struct_actual($1);
                         push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
Signature · 1 line
#Randy
maintainer Applied
#2 lore raw
In reply to Donald Hunter
Quoted 21 lines · Donald Hunter

kernel-doc doesn't handle bitfields that are specified with symbolic name, e.g. u32 cs_index_mask : SPI_CS_CNT_MAX

This results in the following warnings when running make htmldocs:

include/linux/spi/spi.h:246: warning: Function parameter or struct member 'cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_device' include/linux/spi/spi.h:246: warning: Excess struct member 'cs_index_mask' description in 'spi_device'

Update the regexp for bitfields to accept all word chars, not just digits.

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +0 -0
index 967f1abb0edb..cb1be22afc65 100755

scripts/kernel-doc sub create_parameterlist($$$$) { · line 1545

Quoted 6 lines
scripts/kernel-doc +1 -1
@@ -1541,7 +1541,7 @@ sub create_parameterlist($$$$) {
                     save_struct_actual($2);
 
                     push_parameter($2, "$type $1", $arg, $file, $declaration_name);
-                } elsif ($param =~ m/(.*?):(\d+)/) {
+                } elsif ($param =~ m/(.*?):(\w+)/) {
                     if ($type ne "") { # skip unnamed bit-fields

This patch changes this warning:

./include/linux/spi/spi.h:778: warning: Function parameter or struct member 'last_cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_controller'

to:

./include/linux/spi/spi.h:778: warning: Function parameter or struct member 'last_cs_index_mask' not described in 'spi_controller'

We might get a grumble from Stephen on that, but so be it, it's a step in the right direction, anyway.

Applied, thanks.

jon

reviewer
#3 lore raw
Quoted 32 lines · Jonathan Corbet
Quoted 21 lines · Donald Hunter

kernel-doc doesn't handle bitfields that are specified with symbolic name, e.g. u32 cs_index_mask : SPI_CS_CNT_MAX

This results in the following warnings when running make htmldocs:

include/linux/spi/spi.h:246: warning: Function parameter or struct member 'cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_device' include/linux/spi/spi.h:246: warning: Excess struct member 'cs_index_mask' description in 'spi_device'

Update the regexp for bitfields to accept all word chars, not just digits.

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +0 -0
index 967f1abb0edb..cb1be22afc65 100755

scripts/kernel-doc sub create_parameterlist($$$$) { · line 1545

Quoted 6 lines
scripts/kernel-doc +1 -1
@@ -1541,7 +1541,7 @@ sub create_parameterlist($$$$) {
                     save_struct_actual($2);
 
                     push_parameter($2, "$type $1", $arg, $file, $declaration_name);
-                } elsif ($param =~ m/(.*?):(\d+)/) {
+                } elsif ($param =~ m/(.*?):(\w+)/) {
                     if ($type ne "") { # skip unnamed bit-fields

This patch changes this warning:

Quoted 8 lines

./include/linux/spi/spi.h:778: warning: Function parameter or struct member 'last_cs_index_mask:SPI_CS_CNT_MAX' not described in 'spi_controller'

to:

./include/linux/spi/spi.h:778: warning: Function parameter or struct member 'last_cs_index_mask' not described in 'spi_controller'

We might get a grumble from Stephen on that, but so be it, it's a step in the right direction, anyway.

I have submitted a patch for that one (new warning).

Signature · 1 line
#Randy