Skip to contentSkip to conversation

comedi: ni_6527: Fix coding style - use BIT macro

PATCH In review Ranjith Thangavel 2 participants 2 messages Nov 11, 2015 – Nov 12, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 comedi: ni_6527: Fix coding style - use BIT macro

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

---
 drivers/staging/comedi/drivers/ni_6527.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/comedi/drivers/ni_6527.c +12 -12
index 62a817e..b340b98 100644
@@ -42,24 +42,24 @@
 #define NI6527_DO_REG(x)		(0x03 + (x))
 #define NI6527_ID_REG			0x06
 #define NI6527_CLR_REG			0x07
-#define NI6527_CLR_EDGE			(1 << 3)
-#define NI6527_CLR_OVERFLOW		(1 << 2)
-#define NI6527_CLR_FILT			(1 << 1)
-#define NI6527_CLR_INTERVAL		(1 << 0)
+#define NI6527_CLR_EDGE			BIT(3)
+#define NI6527_CLR_OVERFLOW		BIT(2)
+#define NI6527_CLR_FILT			BIT(1)
+#define NI6527_CLR_INTERVAL		BIT(0)
 #define NI6527_CLR_IRQS			(NI6527_CLR_EDGE | NI6527_CLR_OVERFLOW)
 #define NI6527_CLR_RESET_FILT		(NI6527_CLR_FILT | NI6527_CLR_INTERVAL)
 #define NI6527_FILT_INTERVAL_REG(x)	(0x08 + (x))
 #define NI6527_FILT_ENA_REG(x)		(0x0c + (x))
 #define NI6527_STATUS_REG		0x14
-#define NI6527_STATUS_IRQ		(1 << 2)
-#define NI6527_STATUS_OVERFLOW		(1 << 1)
-#define NI6527_STATUS_EDGE		(1 << 0)
+#define NI6527_STATUS_IRQ		BIT(2)
+#define NI6527_STATUS_OVERFLOW	BIT(1)
+#define NI6527_STATUS_EDGE		BIT(0)
 #define NI6527_CTRL_REG			0x15
-#define NI6527_CTRL_FALLING		(1 << 4)
-#define NI6527_CTRL_RISING		(1 << 3)
-#define NI6527_CTRL_IRQ			(1 << 2)
-#define NI6527_CTRL_OVERFLOW		(1 << 1)
-#define NI6527_CTRL_EDGE		(1 << 0)
+#define NI6527_CTRL_FALLING		BIT(4)
+#define NI6527_CTRL_RISING		BIT(3)
+#define NI6527_CTRL_IRQ			BIT(2)
+#define NI6527_CTRL_OVERFLOW	BIT(1)
+#define NI6527_CTRL_EDGE		BIT(0)
 #define NI6527_CTRL_DISABLE_IRQS	0
 #define NI6527_CTRL_ENABLE_IRQS		(NI6527_CTRL_FALLING | \
 					 NI6527_CTRL_RISING | \
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 40 lines · Ranjith Thangavel

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

---
  drivers/staging/comedi/drivers/ni_6527.c |   24 ++++++++++++------------
  1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/comedi/drivers/ni_6527.c +7 -10
index 62a817e..b340b98 100644
@@ -42,24 +42,24 @@
  #define NI6527_DO_REG(x)		(0x03 + (x))
  #define NI6527_ID_REG			0x06
  #define NI6527_CLR_REG			0x07
-#define NI6527_CLR_EDGE			(1 << 3)
-#define NI6527_CLR_OVERFLOW		(1 << 2)
-#define NI6527_CLR_FILT			(1 << 1)
-#define NI6527_CLR_INTERVAL		(1 << 0)
+#define NI6527_CLR_EDGE			BIT(3)
+#define NI6527_CLR_OVERFLOW		BIT(2)
+#define NI6527_CLR_FILT			BIT(1)
+#define NI6527_CLR_INTERVAL		BIT(0)
  #define NI6527_CLR_IRQS			(NI6527_CLR_EDGE | NI6527_CLR_OVERFLOW)
  #define NI6527_CLR_RESET_FILT		(NI6527_CLR_FILT | NI6527_CLR_INTERVAL)
  #define NI6527_FILT_INTERVAL_REG(x)	(0x08 + (x))
  #define NI6527_FILT_ENA_REG(x)		(0x0c + (x))
  #define NI6527_STATUS_REG		0x14
-#define NI6527_STATUS_IRQ		(1 << 2)
-#define NI6527_STATUS_OVERFLOW		(1 << 1)
-#define NI6527_STATUS_EDGE		(1 << 0)
+#define NI6527_STATUS_IRQ		BIT(2)
+#define NI6527_STATUS_OVERFLOW	BIT(1)
+#define NI6527_STATUS_EDGE		BIT(0)
  #define NI6527_CTRL_REG			0x15
-#define NI6527_CTRL_FALLING		(1 << 4)
-#define NI6527_CTRL_RISING		(1 << 3)
-#define NI6527_CTRL_IRQ			(1 << 2)

drivers/staging/comedi/drivers/ni_6527.c line 65

Quoted 10 lines
drivers/staging/comedi/drivers/ni_6527.c +5 -2
-#define NI6527_CTRL_OVERFLOW		(1 << 1)
-#define NI6527_CTRL_EDGE		(1 << 0)
+#define NI6527_CTRL_FALLING		BIT(4)
+#define NI6527_CTRL_RISING		BIT(3)
+#define NI6527_CTRL_IRQ			BIT(2)
+#define NI6527_CTRL_OVERFLOW	BIT(1)
+#define NI6527_CTRL_EDGE		BIT(0)
  #define NI6527_CTRL_DISABLE_IRQS	0
  #define NI6527_CTRL_ENABLE_IRQS		(NI6527_CTRL_FALLING | \
  					 NI6527_CTRL_RISING | \

Again, the column with the macro values is a bit misaligned. Could you fix it please?

Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]> )=-
-=(                          Web: http://www.mev.co.uk/  )=-