Skip to contentSkip to conversation

usb: host: ehci.h: fix single statement macros

PATCH In review Geyslan G. Bem 2 participants 4 messages Dec 10, 2015 – Dec 11, 2015

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

PATCH v3 4/9 usb: host: ehci.h: fix single statement macros

Don't use the 'do {} while (0)' wrapper in a single statement macro.

Caught by checkpatch: "WARNING: Single statement macros should not use a do {} while (0) loop"

---
Change in v3:
- There's no need to evaluate COUNT(x) in #ifdef EHCI_STATS false branch. Thus an empty #define is the choice.

---
 drivers/usb/host/ehci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci.h +2 -2
index cfeebd8..c86194f 100644
@@ -244,9 +244,9 @@ struct ehci_hcd {			/* one per controller */
 	/* irq statistics */
 #ifdef EHCI_STATS
 	struct ehci_stats	stats;
-#	define COUNT(x) do { (x)++; } while (0)
+#	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x) do {} while (0)
+#	define COUNT(x)
 #endif
 
 	/* debug files */
Signature · 1 line
2.6.3
#1 lore raw
Quoted 10 lines · Geyslan G. Bem

Don't use the 'do {} while (0)' wrapper in a single statement macro.

Caught by checkpatch: "WARNING: Single statement macros should not use a do {} while (0) loop"

---
Change in v3:
- There's no need to evaluate COUNT(x) in #ifdef EHCI_STATS false branch. Thus an empty #define is the choice.

Odd numbering scheme of patches, I can't figure this out...

Can you resend this whole series so I know I got it all correct?

thanks,

greg k-h

#2 lore raw

2015-12-11 13:30 GMT-03:00 Greg Kroah-Hartman <[email protected]>:

Quoted 6 lines · Geyslan G. Bem
Quoted 5 lines

Don't use the 'do {} while (0)' wrapper in a single statement macro.

Caught by checkpatch: "WARNING: Single statement macros should not use a do {} while (0) loop"

Quoted 7 lines
Quoted 5 lines

---
Change in v3:
- There's no need to evaluate COUNT(x) in #ifdef EHCI_STATS false branch. Thus an empty #define is the choice.

Odd numbering scheme of patches, I can't figure this out...

Greg,

I sent new versions only to modified ones.
9 is v1.
4 is v3.
rest is v2.

Next time I'll send new versions for all.

Quoted 2 lines

Can you resend this whole series so I know I got it all correct?

I hope so. :-) Messing around with branches and merges here. I tell you soon.

Quoted 4 lines

thanks,

greg k-h

Signature · 4 lines
Regards,

Geyslan G. Bem
hackingbits.com
#3 lore raw

2015-12-11 17:55 GMT-03:00 Geyslan G. Bem <[email protected]>:

Quoted 21 lines

2015-12-11 13:30 GMT-03:00 Greg Kroah-Hartman <[email protected]>:

Quoted 6 lines · Geyslan G. Bem
Quoted 5 lines

Don't use the 'do {} while (0)' wrapper in a single statement macro.

Caught by checkpatch: "WARNING: Single statement macros should not use a do {} while (0) loop"

Quoted 7 lines
Quoted 5 lines

---
Change in v3:
- There's no need to evaluate COUNT(x) in #ifdef EHCI_STATS false branch. Thus an empty #define is the choice.

Odd numbering scheme of patches, I can't figure this out...

Greg,

I sent new versions only to modified ones.
9 is v1.
4 is v3.
rest is v2.

Quoted 5 lines

Next time I'll send new versions for all.

Quoted 2 lines

Can you resend this whole series so I know I got it all correct?

I hope so. :-) Messing around with branches and merges here. I tell you soon.

Greg, please, grab them.

[PATCH resend 0/9] usb: host: ehci.h cleanup

Quoted 13 lines
Quoted 5 lines

thanks,

greg k-h

--
Regards,

Geyslan G. Bem
hackingbits.com

Signature · 4 lines
Regards,

Geyslan G. Bem
hackingbits.com