Skip to contentSkip to conversation

atm: ambassador: remove h from printk format specifier

PATCH In review [email protected] 2 participants 6 messages Dec 15, 2020 – Dec 18, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: ambassador: remove h from printk format specifier

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

---
 drivers/atm/ambassador.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/atm/ambassador.c +2 -2
index c039b8a4fefe..6b0fff8c0141 100644
@@ -2169,7 +2169,7 @@ static void setup_pci_dev(struct pci_dev *pci_dev)
 		pci_lat = (lat < MIN_PCI_LATENCY) ? MIN_PCI_LATENCY : lat;
 
 	if (lat != pci_lat) {
-		PRINTK (KERN_INFO, "Changing PCI latency timer from %hu to %hu",
+		PRINTK (KERN_INFO, "Changing PCI latency timer from %u to %u",
 			lat, pci_lat);
 		pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, pci_lat);
 	}
@@ -2300,7 +2300,7 @@ static void __init amb_check_args (void) {
   unsigned int max_rx_size;
   
 #ifdef DEBUG_AMBASSADOR
-  PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+  PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);
 #else
   if (debug)
     PRINTK (KERN_NOTICE, "no debugging support");
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 6 lines · On Tue, 15 Dec 2020 06:22:28 -0800 [email protected] wrote:

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

That's for new code I assume?

What's the harm in leaving this ancient code be?

Quoted 22 lines
drivers/atm/ambassador.c +2 -2
index c039b8a4fefe..6b0fff8c0141 100644
@@ -2169,7 +2169,7 @@ static void setup_pci_dev(struct pci_dev *pci_dev)
 		pci_lat = (lat < MIN_PCI_LATENCY) ? MIN_PCI_LATENCY : lat;
 
 	if (lat != pci_lat) {
-		PRINTK (KERN_INFO, "Changing PCI latency timer from %hu to %hu",
+		PRINTK (KERN_INFO, "Changing PCI latency timer from %u to %u",
 			lat, pci_lat);
 		pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, pci_lat);
 	}
@@ -2300,7 +2300,7 @@ static void __init amb_check_args (void) {
   unsigned int max_rx_size;
 
 #ifdef DEBUG_AMBASSADOR
-  PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+  PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);
 #else
   if (debug)
     PRINTK (KERN_NOTICE, "no debugging support");
author
#2 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · On Tue, 15 Dec 2020 06:22:28 -0800 [email protected] wrote:

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

That's for new code I assume?

What's the harm in leaving this ancient code be?

This change is part of a tree wide cleanup.

drivers/atm status is listed as Maintained in MAINTAINERS so changes like this should be ok.

Should drivers/atm status be changed?

Tom

Quoted 23 lines
Quoted 23 lines
drivers/atm/ambassador.c +2 -2
index c039b8a4fefe..6b0fff8c0141 100644
@@ -2169,7 +2169,7 @@ static void setup_pci_dev(struct pci_dev *pci_dev)
 		pci_lat = (lat < MIN_PCI_LATENCY) ? MIN_PCI_LATENCY : lat;
 
 	if (lat != pci_lat) {
-		PRINTK (KERN_INFO, "Changing PCI latency timer from %hu to %hu",
+		PRINTK (KERN_INFO, "Changing PCI latency timer from %u to %u",
 			lat, pci_lat);
 		pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, pci_lat);
 	}
@@ -2300,7 +2300,7 @@ static void __init amb_check_args (void) {
   unsigned int max_rx_size;
 
 #ifdef DEBUG_AMBASSADOR
-  PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+  PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);
 #else
   if (debug)
     PRINTK (KERN_NOTICE, "no debugging support");
maintainer
#3 lore raw
Quoted 7 lines · On Thu, 17 Dec 2020 05:17:24 -0800 Tom Rix wrote:
Quoted 6 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 15 Dec 2020 06:22:28 -0800 [email protected] wrote:

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

That's for new code I assume?

What's the harm in leaving this ancient code be?

This change is part of a tree wide cleanup.

What's the purpose of the "clean up"? Why is it making the code better?

This is a quote from your change:

- PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+ PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);

Are you sure that the use of %hx is the worst part of that line?

Quoted 4 lines

drivers/atm status is listed as Maintained in MAINTAINERS so changes like this should be ok.

Should drivers/atm status be changed?

Up to Chas, but AFAIU we're probably only a few years away from ATM as a whole walking into the light. So IMHO "Obsolete" would be justified.

author
#4 lore raw
Quoted 20 lines · Jakub Kicinski
Quoted 4 lines · On Thu, 17 Dec 2020 05:17:24 -0800 Tom Rix wrote:
Quoted 3 lines · Jakub Kicinski
Quoted 2 lines · On Tue, 15 Dec 2020 06:22:28 -0800 [email protected] wrote:

From: Tom Rix <[email protected]>

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

That's for new code I assume?

What's the harm in leaving this ancient code be?

This change is part of a tree wide cleanup.

What's the purpose of the "clean up"? Why is it making the code better?

This is a quote from your change:

drivers/atm/ambassador.c +1 -1
-  PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+  PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);
Quoted 1 line

Are you sure that the use of %hx is the worst part of that line?

In this case, it means this bit of code is compliant with the %h checker in checkpatch.

why you are seeing this change for %hx and not the horrible debug &= or the old PRINTK macro is because the change was mechanical.

leveraging the clang build and a special fixit for %h, an allyesconfig for x86_64 cleans this problem from most of the tree in about an hour.  atm/ was just one of the places it hit, there are about 100 more.

If you want the debug &= fixed, i can do that.

The macro is a treewide problem and i can add that to the treewide cleanups i am planning.

Tom

Quoted 8 lines
Quoted 5 lines

drivers/atm status is listed as Maintained in MAINTAINERS so changes like this should be ok.

Should drivers/atm status be changed?

Up to Chas, but AFAIU we're probably only a few years away from ATM as a whole walking into the light. So IMHO "Obsolete" would be justified.

maintainer
#5 lore raw
Quoted 23 lines · On Thu, 17 Dec 2020 14:03:07 -0800 Tom Rix wrote:
Quoted 20 lines · Jakub Kicinski
Quoted 4 lines · On Thu, 17 Dec 2020 05:17:24 -0800 Tom Rix wrote:
Quoted 3 lines · Jakub Kicinski
Quoted 2 lines · On Tue, 15 Dec 2020 06:22:28 -0800 [email protected] wrote:

From: Tom Rix <[email protected]>

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

That's for new code I assume?

What's the harm in leaving this ancient code be?

This change is part of a tree wide cleanup.

What's the purpose of the "clean up"? Why is it making the code better?

This is a quote from your change:

drivers/atm/ambassador.c +1 -1
-  PRINTK (KERN_NOTICE, "debug bitmap is %hx", debug &= DBG_MASK);
+  PRINTK (KERN_NOTICE, "debug bitmap is %x", debug &= DBG_MASK);
Quoted 1 line

Are you sure that the use of %hx is the worst part of that line?

Quoted 7 lines

In this case, it means this bit of code is compliant with the %h checker in checkpatch.

why you are seeing this change for %hx and not the horrible debug &= or the old PRINTK macro is because the change was mechanical.

leveraging the clang build and a special fixit for %h, an allyesconfig for x86_64 cleans this problem from most of the tree in about an hour.  atm/ was just one of the places it hit, there are about 100 more.

If you want the debug &= fixed, i can do that.

No, the opposite of that. I would like to see fewer patches touching prehistoric code for little to no gain :(

Quoted 1 line

The macro is a treewide problem and i can add that to the treewide cleanups i am planning.