Skip to contentSkip to conversation

usbnet: allow type check of devdbg arguments in non-debug build

PATCH Applied Steve Glendinning 4 participants 10 messages Sep 15, 2008 – Jan 20, 2009

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

PATCH 1/1 usbnet: allow type check of devdbg arguments in non-debug build

improve usbnet's devdbg to always type-check diagnostic arguments, like dev_dbg (device.h). This makes no change to the resulting size of usbnet modules.

---
 include/linux/usb/usbnet.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/usb/usbnet.h +3 -1
index ba09fe8..7d38222 100644
@@ -197,7 +197,9 @@ extern int usbnet_nway_reset(struct net_device *net);
 #define devdbg(usbnet, fmt, arg...) \
 	printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
 #else
-#define devdbg(usbnet, fmt, arg...) do {} while(0)
+#define devdbg(usbnet, fmt, arg...) \
+	({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
+		## arg); 0; })
 #endif
 
 #define deverr(usbnet, fmt, arg...) \
Signature · 1 line
1.5.5.1
Applied
#1 lore raw
Quoted 14 lines · Steve Glendinning

improve usbnet's devdbg to always type-check diagnostic arguments, like dev_dbg (device.h). This makes no change to the resulting size of usbnet modules.

---
 include/linux/usb/usbnet.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/usb/usbnet.h +0 -0
index ba09fe8..7d38222 100644

include/linux/usb/usbnet.h extern int usbnet_nway_reset(struct net_device *net); · line 203

Quoted 8 lines
include/linux/usb/usbnet.h +3 -1
@@ -197,7 +197,9 @@ extern int usbnet_nway_reset(struct net_device *net);
 #define devdbg(usbnet, fmt, arg...) \
 	printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
 #else
-#define devdbg(usbnet, fmt, arg...) do {} while(0)
+#define devdbg(usbnet, fmt, arg...) \
+	({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
+		## arg); 0; })
 #endif

applied

#2 lore raw

PATCH 1/1 usbnet: allow type check of devdbg arguments in non-debug build

In reply to Steve Glendinning

From: Steve Glendinning <[email protected]>
Subject: usbnet: allow type check of devdbg arguments in non-debug build

Improve usbnet's devdbg to always type-check diagnostic arguments, like dev_dbg (device.h). This makes no change to the resulting size of usbnet modules.

---
[ refreshed against 2.6.29-rc1 GIT ]

 include/linux/usb/usbnet.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/usb/usbnet.h +3 -1
@@ -197,7 +197,9 @@ extern int usbnet_nway_reset(struct net_
 #define devdbg(usbnet, fmt, arg...) \
 	printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
 #else
-#define devdbg(usbnet, fmt, arg...) do {} while(0)
+#define devdbg(usbnet, fmt, arg...) \
+	({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
+		## arg); 0; })
 #endif
 
 #define deverr(usbnet, fmt, arg...) \
maintainer
#4 lore raw

From: David Miller <[email protected]>
Date: Mon, 19 Jan 2009 17:12:00 -0800 (PST)

Quoted 11 lines

From: David Brownell <[email protected]>
Date: Fri, 16 Jan 2009 23:19:44 -0800

Quoted 6 lines

Improve usbnet's devdbg to always type-check diagnostic arguments, like dev_dbg (device.h). This makes no change to the resulting size of usbnet modules.

Applied, thanks.

I have to back this out, it breaks the build:

drivers/net/wireless/rndis_wlan.c: In function 'rndis_translate_scan':
drivers/net/wireless/rndis_wlan.c:1664: error: 'usbdev' undeclared (first use in this function) drivers/net/wireless/rndis_wlan.c:1664: error: (Each undeclared identifier is reported only once drivers/net/wireless/rndis_wlan.c:1664: error: for each function it appears in.) make[3]: *** [drivers/net/wireless/rndis_wlan.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [drivers/net/wireless] Error 2
make[2]: *** Waiting for unfinished jobs....

I bet there are other similar gremlins like this in the tree.

#5 lore raw
Quoted 26 lines · David Miller

From: David Miller <[email protected]>
Date: Mon, 19 Jan 2009 17:12:00 -0800 (PST)

Quoted 11 lines

From: David Brownell <[email protected]>
Date: Fri, 16 Jan 2009 23:19:44 -0800

Quoted 6 lines

Improve usbnet's devdbg to always type-check diagnostic arguments, like dev_dbg (device.h). This makes no change to the resulting size of usbnet modules.

Applied, thanks.

I have to back this out, it breaks the build:

drivers/net/wireless/rndis_wlan.c: In function 'rndis_translate_scan':
drivers/net/wireless/rndis_wlan.c:1664: error: 'usbdev' undeclared (first use in this function) drivers/net/wireless/rndis_wlan.c:1664: error: (Each undeclared identifier is reported only once drivers/net/wireless/rndis_wlan.c:1664: error: for each function it appears in.) make[3]: *** [drivers/net/wireless/rndis_wlan.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [drivers/net/wireless] Error 2
make[2]: *** Waiting for unfinished jobs....

Quoted 1 line

I bet there are other similar gremlins like this in the tree.

Maybe, but that's after all part of why we want this kind of patch merged ... after the first gremlines are fixed!

In this case I'll guess this is the root cause of the bug:

#ifdef DEBUG
        struct usbnet *usbdev = netdev_priv(dev);

#endif

CC'd someone more involved in rndis_wlan than me ...

- Dave

maintainer
#6 lore raw

From: David Brownell <[email protected]>
Date: Mon, 19 Jan 2009 18:04:08 -0800

Quoted 2 lines

Maybe, but that's after all part of why we want this kind of patch merged ... after the first gremlines are fixed!

When you submit a change like this that can have potential warning and build failure effects across the entire tree, the onus is on you to do an allmodconfig sanity check build or similar and add any necessary fixes to your change.

#7 lore raw
Quoted 8 lines · David Miller
Quoted 2 lines

Maybe, but that's after all part of why we want this kind of patch merged ... after the first gremlines are fixed!

When you submit a change like this that can have potential warning and build failure effects across the entire tree, the onus is on you to do an allmodconfig sanity check build or similar and add any necessary fixes to your change.

It's actually Steve's patch ... Steve?

#8 lore raw

David Brownell <[email protected]> wrote on 20/01/2009 05:11:48:

Quoted 12 lines · David Miller
Quoted 8 lines
Quoted 2 lines

Maybe, but that's after all part of why we want this kind of patch merged ... after the first gremlines are fixed!

When you submit a change like this that can have potential warning and build failure effects across the entire tree, the onus is on you to do an allmodconfig sanity check build or similar and add any necessary fixes to your change.

It's actually Steve's patch ... Steve?

Sorry, my bad - I tested compilation of usbnet drivers in drivers/net/usb but missed this wireless usbnet driver hiding in drivers/net/wireless. allmodconfig was what i was looking for, thanks David!

I've fixed this compilation breakage now, updated patchset to follow.

Steve

maintainer
#9 lore raw

From: [email protected]
Date: Tue, 20 Jan 2009 10:56:09 +0000

Quoted 2 lines

I've fixed this compilation breakage now, updated patchset to follow.

But you added a new warning for the non-DEBUG case during the intermediate steps between the patches.

Please respin this all into a single patch in order to make the transition cleanly, for all cases.