summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/adc/ad7280a.c
diff options
context:
space:
mode:
authorHaneen Mohammed <hamohammed.sa@gmail.com>2015-03-26 02:23:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-26 10:36:59 +0100
commit418880f5708dec9fdb2eaa7a61175fa1d8ab4110 (patch)
tree37dd974f18badf1e816c33371a8c64079efbf2b8 /drivers/staging/iio/adc/ad7280a.c
parente273eb01feb15593d9cb3607a59d96ab12e4c0c2 (diff)
Staging: iio: use the BIT macro in adc
This patch replaces bit shifting on: 0,1,2, and 3 with the BIT(x) macro. Issue addressed by checkpatcg.pl. This was done with the help of Coccinelle: @r1@ identifier x; constant int g; @@ ( 0<<\(x\|g\) | 1<<\(x\|g\) | 2<<\(x\|g\) | 3<<\(x\|g\) ) @script:python b@ g2 <<r1.g; y; @@ coccinelle.y = int(g2) + 1 @c@ constant int r1.g; identifier b.y; @@ ( -(1 << g) +BIT(g) | -(0 << g) + 0 | -(2 << g) +BIT(y) | -(3 << g) +(BIT(y)| BIT(g)) ) Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio/adc/ad7280a.c')
-rw-r--r--drivers/staging/iio/adc/ad7280a.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index e7d45ee2fac6..d98e229c46bf 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -55,37 +55,37 @@
#define AD7280A_CNVST_CONTROL 0x1D /* D7 to D0, Read/write */
/* Bits and Masks */
-#define AD7280A_CTRL_HB_CONV_INPUT_ALL (0 << 6)
-#define AD7280A_CTRL_HB_CONV_INPUT_6CELL_AUX1_3_4 (1 << 6)
-#define AD7280A_CTRL_HB_CONV_INPUT_6CELL (2 << 6)
-#define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST (3 << 6)
-#define AD7280A_CTRL_HB_CONV_RES_READ_ALL (0 << 4)
-#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL_AUX1_3_4 (1 << 4)
-#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL (2 << 4)
-#define AD7280A_CTRL_HB_CONV_RES_READ_NO (3 << 4)
-#define AD7280A_CTRL_HB_CONV_START_CNVST (0 << 3)
-#define AD7280A_CTRL_HB_CONV_START_CS (1 << 3)
-#define AD7280A_CTRL_HB_CONV_AVG_DIS (0 << 1)
-#define AD7280A_CTRL_HB_CONV_AVG_2 (1 << 1)
-#define AD7280A_CTRL_HB_CONV_AVG_4 (2 << 1)
-#define AD7280A_CTRL_HB_CONV_AVG_8 (3 << 1)
+#define AD7280A_CTRL_HB_CONV_INPUT_ALL 0
+#define AD7280A_CTRL_HB_CONV_INPUT_6CELL_AUX1_3_4 BIT(6)
+#define AD7280A_CTRL_HB_CONV_INPUT_6CELL BIT(7)
+#define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST (BIT(7) | BIT(6))
+#define AD7280A_CTRL_HB_CONV_RES_READ_ALL 0
+#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL_AUX1_3_4 BIT(4)
+#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL BIT(5)
+#define AD7280A_CTRL_HB_CONV_RES_READ_NO (BIT(5) | BIT(4))
+#define AD7280A_CTRL_HB_CONV_START_CNVST 0
+#define AD7280A_CTRL_HB_CONV_START_CS BIT(3)
+#define AD7280A_CTRL_HB_CONV_AVG_DIS 0
+#define AD7280A_CTRL_HB_CONV_AVG_2 BIT(1)
+#define AD7280A_CTRL_HB_CONV_AVG_4 BIT(2)
+#define AD7280A_CTRL_HB_CONV_AVG_8 (BIT(2) | BIT(1))
#define AD7280A_CTRL_HB_CONV_AVG(x) ((x) << 1)
-#define AD7280A_CTRL_HB_PWRDN_SW (1 << 0)
+#define AD7280A_CTRL_HB_PWRDN_SW BIT(0)
-#define AD7280A_CTRL_LB_SWRST (1 << 7)
-#define AD7280A_CTRL_LB_ACQ_TIME_400ns (0 << 5)
-#define AD7280A_CTRL_LB_ACQ_TIME_800ns (1 << 5)
-#define AD7280A_CTRL_LB_ACQ_TIME_1200ns (2 << 5)
-#define AD7280A_CTRL_LB_ACQ_TIME_1600ns (3 << 5)
+#define AD7280A_CTRL_LB_SWRST BIT(7)
+#define AD7280A_CTRL_LB_ACQ_TIME_400ns 0
+#define AD7280A_CTRL_LB_ACQ_TIME_800ns BIT(5)
+#define AD7280A_CTRL_LB_ACQ_TIME_1200ns BIT(6)
+#define AD7280A_CTRL_LB_ACQ_TIME_1600ns (BIT(6) | BIT(5))
#define AD7280A_CTRL_LB_ACQ_TIME(x) ((x) << 5)
-#define AD7280A_CTRL_LB_MUST_SET (1 << 4)
-#define AD7280A_CTRL_LB_THERMISTOR_EN (1 << 3)
-#define AD7280A_CTRL_LB_LOCK_DEV_ADDR (1 << 2)
-#define AD7280A_CTRL_LB_INC_DEV_ADDR (1 << 1)
-#define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN (1 << 0)
-
-#define AD7280A_ALERT_GEN_STATIC_HIGH (1 << 6)
-#define AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN (3 << 6)
+#define AD7280A_CTRL_LB_MUST_SET BIT(4)
+#define AD7280A_CTRL_LB_THERMISTOR_EN BIT(3)
+#define AD7280A_CTRL_LB_LOCK_DEV_ADDR BIT(2)
+#define AD7280A_CTRL_LB_INC_DEV_ADDR BIT(1)
+#define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN BIT(0)
+
+#define AD7280A_ALERT_GEN_STATIC_HIGH BIT(6)
+#define AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN (BIT(7) | BIT(6))
#define AD7280A_ALL_CELLS (0xAD << 16)