Skip to contentSkip to conversation

staging:bcm2048 : Add parentheses around variable x

PATCH In review Tabrez khan 3 participants 4 messages Dec 3, 2016 – Feb 15, 2017

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

PATCH 1/1 staging:bcm2048 : Add parentheses around variable x

Add parentheses around variable x for the readability purpose.

This warning was found using checkpatch.pl.

---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/bcm2048/radio-bcm2048.c +1 -1
index 4d9bd02..2f28dd0 100644
@@ -185,7 +185,7 @@
 #define v4l2_to_dev(f)	((f * BCM2048_FREQV4L2_MULTI) / BCM2048_FREQDEV_UNIT)
 
 #define msb(x)                  ((u8)((u16)x >> 8))
-#define lsb(x)                  ((u8)((u16)x &  0x00FF))
+#define lsb(x)                  ((u8)((u16)(x) &  0x00FF))
 #define compose_u16(msb, lsb)	(((u16)msb << 8) | lsb)
 
 #define BCM2048_DEFAULT_POWERING_DELAY	20
Signature · 1 line
2.7.4
#1 lore raw

Em Sat, 3 Dec 2016 15:14:26 +0530
Tabrez khan <[email protected]> escreveu:

Quoted 14 lines

Add parentheses around variable x for the readability purpose.

This warning was found using checkpatch.pl.

---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/bcm2048/radio-bcm2048.c +0 -0
index 4d9bd02..2f28dd0 100644

drivers/staging/media/bcm2048/radio-bcm2048.c line 188

Quoted 5 lines
drivers/staging/media/bcm2048/radio-bcm2048.c +1 -1
@@ -185,7 +185,7 @@
 #define v4l2_to_dev(f)	((f * BCM2048_FREQV4L2_MULTI) / BCM2048_FREQDEV_UNIT)
 
 #define msb(x)                  ((u8)((u16)x >> 8))
-#define lsb(x)                  ((u8)((u16)x &  0x00FF))
+#define lsb(x)                  ((u8)((u16)(x) &  0x00FF))

If you're willing to do that, you should do on all macros. Also, plese remove the extra space before the hexa value.

drivers/staging/media/bcm2048/radio-bcm2048.c line 191

Quoted 3 lines
drivers/staging/media/bcm2048/radio-bcm2048.c +0 -0
 #define compose_u16(msb, lsb)	(((u16)msb << 8) | lsb)
 
 #define BCM2048_DEFAULT_POWERING_DELAY	20

Thanks,
Mauro

#3 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 2 lines · Tabrez khan

Add parentheses around variable x for the readability purpose.

It's not really about readability...

regards,
dan carpenter

I will resend it again.

Signature · 2 lines
Regards
Tabrez Khan