Skip to contentSkip to conversation

comedi: drivers: Fix - BIT macro used coding style issue

PATCH In review Ranjith 3 participants 4 messages Nov 1, 2015 Staging

lore
Share & tools
lore

Ranjith

author
#0 lore raw

PATCH 1/1 comedi: drivers: Fix - BIT macro used coding style issue

BIT macro is used for defining bit location instead of shifting operator - coding style issue

---
 drivers/staging/comedi/drivers/addi_apci_1032.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1032.c +2 -2
index b37166d..fd5ce21 100644
@@ -85,8 +85,8 @@
 #define APCI1032_STATUS_REG		0x0c
 #define APCI1032_CTRL_REG		0x10
 #define APCI1032_CTRL_INT_OR		(0 << 1)
-#define APCI1032_CTRL_INT_AND		(1 << 1)
-#define APCI1032_CTRL_INT_ENA		(1 << 2)
+#define APCI1032_CTRL_INT_AND		BIT(1)
+#define APCI1032_CTRL_INT_ENA		BIT(2)
 
 struct apci1032_private {
 	unsigned long amcc_iobase;	/* base of AMCC I/O registers */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Ranjith

BIT macro is used for defining bit location instead of shifting operator - coding style issue

#define APCI1032_CTRL_INT_OR (0 << 1)

+#define APCI1032_CTRL_INT_AND BIT(1)

And now you have two styles at the same time. I wouldn't change the current definitions.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Ranjith

BIT macro is used for defining bit location instead of shifting operator - coding style issue

#define APCI1032_CTRL_INT_OR (0 << 1)

+#define APCI1032_CTRL_INT_AND BIT(1)

And now you have two styles at the same time. I wouldn't change the current definitions.

Yes you should, just use BIT(0) for this one.

#3 lore raw
Quoted 5 lines · Greg Kroah-Hartman
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Ranjith

BIT macro is used for defining bit location instead of shifting operator - coding style issue

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

#define APCI1032_CTRL_INT_OR (0 << 1)

+#define APCI1032_CTRL_INT_AND BIT(1)

And now you have two styles at the same time. I wouldn't change the current definitions.

Yes you should, just use BIT(0) for this one.

Oh wait, nevermind, just use the "real" value instead, but using the BIT() macro is the correct thing, don't tell people not to use it.