Skip to contentSkip to conversation

Staging: comedi: Prefer using the BIT macro

PATCH Superseded Aybuke Ozdemir 2 participants 2 messages Feb 10, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: Prefer using the BIT macro

From: aybuke <[email protected]>

Replace all instances of bit shifting on 1 with the BIT(x) macro. In addition, convert other non-1 shift operations with the equivalent BIT(x) macro for uniformity. Issue pointed out by checkpatch.

CHECK: Prefer using the BIT macro

---
 drivers/staging/comedi/comedi.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/comedi/comedi.h +5 -5
index f0d1b15..9b7d0cb 100644
@@ -72,12 +72,12 @@
 #define CR_AREF(a)	(((a) >> 24) & 0x03)
 
 #define CR_FLAGS_MASK	0xfc000000
-#define CR_ALT_FILTER	(1 << 26)
+#define CR_ALT_FILTER	BIT(26)
 #define CR_DITHER	CR_ALT_FILTER
 #define CR_DEGLITCH	CR_ALT_FILTER
-#define CR_ALT_SOURCE	(1 << 27)
-#define CR_EDGE		(1 << 30)
-#define CR_INVERT	(1 << 31)
+#define CR_ALT_SOURCE	BIT(27)
+#define CR_EDGE		BIT(30)
+#define CR_INVERT	BIT(31)
 
 #define AREF_GROUND	0x00	/* analog ref = analog ground */
 #define AREF_COMMON	0x01	/* analog ref = analog common */
@@ -510,7 +510,7 @@ struct comedi_bufinfo {
 #define RANGE_LENGTH(b)		((b) & 0xffff)
 
 #define RF_UNIT(flags)		((flags) & 0xff)
-#define RF_EXTERNAL		(1 << 8)
+#define RF_EXTERNAL		BIT(8)
 
 #define UNIT_volt		0
 #define UNIT_mA			1
Signature · 1 line
2.1.4
#1 lore raw
Quoted 1 line · Aybuke Ozdemir

From: aybuke <[email protected]>

This should be your full name. Probably you don't need the From line, since you already have your full name in the from line generated by your mailer.

Quoted 7 lines

Replace all instances of bit shifting on 1 with the BIT(x) macro. In addition, convert other non-1 shift operations with the equivalent BIT(x) macro for uniformity. Issue pointed out by checkpatch.

CHECK: Prefer using the BIT macro

Again, full name needed.

Quoted 12 lines
---
 drivers/staging/comedi/comedi.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/comedi/comedi.h +0 -0
index f0d1b15..9b7d0cb 100644
@@ -72,12 +72,12 @@
 #define CR_AREF(a)	(((a) >> 24) & 0x03)
 
 #define CR_FLAGS_MASK	0xfc000000

drivers/staging/comedi/comedi.h line 80

Quoted 10 lines
drivers/staging/comedi/comedi.h +4 -4
-#define CR_ALT_FILTER	(1 << 26)
+#define CR_ALT_FILTER	BIT(26)
 #define CR_DITHER	CR_ALT_FILTER
 #define CR_DEGLITCH	CR_ALT_FILTER
-#define CR_ALT_SOURCE	(1 << 27)
-#define CR_EDGE		(1 << 30)
-#define CR_INVERT	(1 << 31)
+#define CR_ALT_SOURCE	BIT(27)
+#define CR_EDGE		BIT(30)
+#define CR_INVERT	BIT(31)

It woud be good to align everything in the same way.

julia

Quoted 22 lines
drivers/staging/comedi/comedi.h +1 -2
 #define AREF_GROUND	0x00	/* analog ref = analog ground */
 #define AREF_COMMON	0x01	/* analog ref = analog common */
@@ -510,7 +510,7 @@ struct comedi_bufinfo {
 #define RANGE_LENGTH(b)		((b) & 0xffff)
 
 #define RF_UNIT(flags)		((flags) & 0xff)
-#define RF_EXTERNAL		(1 << 8)
+#define RF_EXTERNAL		BIT(8)
 
 #define UNIT_volt		0
 #define UNIT_mA			1
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455117464-17485-1-git-send-email-aybuke.147%40gmail.com.
For more options, visit https://groups.google.com/d/optout.