staging: iio: Replace a bit shift by a use of BIT.
Subsystems (4)
PATCH v2 1/1 staging: iio: Replace a bit shift by a use of BIT.
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@
-1 << c
+BIT(c)
---
changes in v2
-remove/correct the wrong code.
drivers/staging/iio/cdc/ad7150.c | 2 +- drivers/staging/iio/cdc/ad7746.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/iio/cdc/ad7150.c +1 -1
@@ -232,7 +232,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,if (ret <0 ) goto error_ret; - cfg = ret & ~((0x03 <<5 ) | (0x1 <<7 )); + cfg = ret & ~((0x03 <<5 ) |BIT (7 ));switch (type) {case IIO_EV_TYPE_MAG_ADAPTIVE :
drivers/staging/iio/cdc/ad7746.c +8 -8
@@ -45,10 +45,10 @@#define AD7746_STATUS_RDYCAP BIT(0)/* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */ -#define AD7746_CAPSETUP_CAPEN (1 << 7) -#define AD7746_CAPSETUP_CIN2 (1 << 6)/* AD7746 only */ -#define AD7746_CAPSETUP_CAPDIFF (1 << 5) -#define AD7746_CAPSETUP_CACHOP (1 << 0) +#define AD7746_CAPSETUP_CAPEN (BIT(7)) +#define AD7746_CAPSETUP_CIN2 (BIT(6))/* AD7746 only */ +#define AD7746_CAPSETUP_CAPDIFF (BIT(5)) +#define AD7746_CAPSETUP_CACHOP (BIT(0))/* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */ #define AD7746_VTSETUP_VTEN (1 << 7)
@@ -56,9 +56,9 @@#define AD7746_VTSETUP_VTMD_EXT_TEMP (1 << 5)#define AD7746_VTSETUP_VTMD_VDD_MON (2 << 5)#define AD7746_VTSETUP_VTMD_EXT_VIN (3 << 5) -#define AD7746_VTSETUP_EXTREF (1 << 4) -#define AD7746_VTSETUP_VTSHORT (1 << 1) -#define AD7746_VTSETUP_VTCHOP (1 << 0) +#define AD7746_VTSETUP_EXTREF (BIT(4)) +#define AD7746_VTSETUP_VTSHORT (BIT(1)) +#define AD7746_VTSETUP_VTCHOP (BIT(0))/* Excitation Setup Register Bit Designations (AD7746_REG_EXC_SETUP) */ #define AD7746_EXCSETUP_CLKCTRL BIT(7)
@@ -82,7 +82,7 @@#define AD7746_CONF_MODE_GAIN_CAL (6 << 0)/* CAPDAC Register Bit Designations (AD7746_REG_CAPDACx) */ -#define AD7746_CAPDAC_DACEN (1 << 7) +#define AD7746_CAPDAC_DACEN (BIT(7))#define AD7746_CAPDAC_DACP (x) ((x) & 0x7F)/*
Signature · 1 line
2.11.0
Jonathan Cameron
maintainerQuoted 10 lines · Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@-1 << c
+BIT(c)Signed-off-by Arushi Singhal <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 63 lines
---
changes in v2
-remove/correct the wrong code.drivers/staging/iio/cdc/ad7150.c | 2 +- drivers/staging/iio/cdc/ad7746.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/staging/iio/cdc/ad7150.c +1
-1@@ -232,7 +232,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,if (ret <0 ) goto error_ret; - cfg = ret & ~((0x03 <<5 ) | (0x1 <<7 )); + cfg = ret & ~((0x03 <<5 ) |BIT (7 ));switch (type) {case IIO_EV_TYPE_MAG_ADAPTIVE :drivers/staging/iio/cdc/ad7746.c +8
-8@@ -45,10 +45,10 @@#define AD7746_STATUS_RDYCAP BIT(0)/* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */ -#define AD7746_CAPSETUP_CAPEN (1 << 7) -#define AD7746_CAPSETUP_CIN2 (1 << 6)/* AD7746 only */ -#define AD7746_CAPSETUP_CAPDIFF (1 << 5) -#define AD7746_CAPSETUP_CACHOP (1 << 0) +#define AD7746_CAPSETUP_CAPEN (BIT(7)) +#define AD7746_CAPSETUP_CIN2 (BIT(6))/* AD7746 only */ +#define AD7746_CAPSETUP_CAPDIFF (BIT(5)) +#define AD7746_CAPSETUP_CACHOP (BIT(0))/* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */ #define AD7746_VTSETUP_VTEN (1 << 7)@@ -56,9 +56,9 @@#define AD7746_VTSETUP_VTMD_EXT_TEMP (1 << 5)#define AD7746_VTSETUP_VTMD_VDD_MON (2 << 5)#define AD7746_VTSETUP_VTMD_EXT_VIN (3 << 5) -#define AD7746_VTSETUP_EXTREF (1 << 4) -#define AD7746_VTSETUP_VTSHORT (1 << 1) -#define AD7746_VTSETUP_VTCHOP (1 << 0) +#define AD7746_VTSETUP_EXTREF (BIT(4)) +#define AD7746_VTSETUP_VTSHORT (BIT(1)) +#define AD7746_VTSETUP_VTCHOP (BIT(0))/* Excitation Setup Register Bit Designations (AD7746_REG_EXC_SETUP) */ #define AD7746_EXCSETUP_CLKCTRL BIT(7)@@ -82,7 +82,7 @@#define AD7746_CONF_MODE_GAIN_CAL (6 << 0)/* CAPDAC Register Bit Designations (AD7746_REG_CAPDACx) */ -#define AD7746_CAPDAC_DACEN (1 << 7) +#define AD7746_CAPDAC_DACEN (BIT(7))#define AD7746_CAPDAC_DACP (x) ((x) & 0x7F)/*
Quoted 37 lines · Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@-1 << c
+BIT(c)Signed-off-by Arushi Singhal <[email protected]>---
changes in v2
-remove/correct the wrong code.drivers/staging/iio/cdc/ad7150.c | 2 +- drivers/staging/iio/cdc/ad7746.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/staging/iio/cdc/ad7150.c +1
-1@@ -232,7 +232,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,if (ret <0 ) goto error_ret; - cfg = ret & ~((0x03 <<5 ) | (0x1 <<7 )); + cfg = ret & ~((0x03 <<5 ) |BIT (7 ));switch (type) {case IIO_EV_TYPE_MAG_ADAPTIVE :drivers/staging/iio/cdc/ad7746.c +0
-0@@ -45,10 +45,10 @@#define AD7746_STATUS_RDYCAP BIT(0)
drivers/staging/iio/cdc/ad7746.c line 51
Quoted 10 lines
drivers/staging/iio/cdc/ad7746.c +4
-4/* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */ -#define AD7746_CAPSETUP_CAPEN (1 << 7) -#define AD7746_CAPSETUP_CIN2 (1 << 6)/* AD7746 only */ -#define AD7746_CAPSETUP_CAPDIFF (1 << 5) -#define AD7746_CAPSETUP_CACHOP (1 << 0) +#define AD7746_CAPSETUP_CAPEN (BIT(7)) +#define AD7746_CAPSETUP_CIN2 (BIT(6))/* AD7746 only */ +#define AD7746_CAPSETUP_CAPDIFF (BIT(5)) +#define AD7746_CAPSETUP_CACHOP (BIT(0))
The parentheses here are not needed.
Quoted 4 lines
drivers/staging/iio/cdc/ad7746.c +0
-0/* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */ #define AD7746_VTSETUP_VTEN (1 << 7)
drivers/staging/iio/cdc/ad7746.c line 62
Quoted 10 lines
drivers/staging/iio/cdc/ad7746.c +3
-3@@ -56,9 +56,9 @@#define AD7746_VTSETUP_VTMD_EXT_TEMP (1 << 5)#define AD7746_VTSETUP_VTMD_VDD_MON (2 << 5)#define AD7746_VTSETUP_VTMD_EXT_VIN (3 << 5) -#define AD7746_VTSETUP_EXTREF (1 << 4) -#define AD7746_VTSETUP_VTSHORT (1 << 1) -#define AD7746_VTSETUP_VTCHOP (1 << 0) +#define AD7746_VTSETUP_EXTREF (BIT(4)) +#define AD7746_VTSETUP_VTSHORT (BIT(1)) +#define AD7746_VTSETUP_VTCHOP (BIT(0))
Same here.
drivers/staging/iio/cdc/ad7746.c line 85
Quoted 8 lines
drivers/staging/iio/cdc/ad7746.c +1
-1/* Excitation Setup Register Bit Designations (AD7746_REG_EXC_SETUP) */ #define AD7746_EXCSETUP_CLKCTRL BIT(7)@@ -82,7 +82,7 @@#define AD7746_CONF_MODE_GAIN_CAL (6 << 0)/* CAPDAC Register Bit Designations (AD7746_REG_CAPDACx) */ -#define AD7746_CAPDAC_DACEN (1 << 7) +#define AD7746_CAPDAC_DACEN (BIT(7))
Here too.
julia
Quoted 13 lines
drivers/staging/iio/cdc/ad7746.c +0
-1#define AD7746_CAPDAC_DACP (x) ((x) & 0x7F)/* -- 2.11.0
--
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/20170322164234.GA18805%40arushi-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.
drivers/staging/iio/cdc/ad7746.c line 51
Quoted 9 lines · Arushi Singhal
/* Capacitive Channel Setup Register Bit Designations (
AD7746_REG_CAP_SETUP) */drivers/staging/iio/cdc/ad7746.c +4
-4-#define AD7746_CAPSETUP_CAPEN (1 << 7) -#define AD7746_CAPSETUP_CIN2 (1 << 6)/* AD7746 only */ -#define AD7746_CAPSETUP_CAPDIFF (1 << 5) -#define AD7746_CAPSETUP_CACHOP (1 << 0) +#define AD7746_CAPSETUP_CAPEN (BIT(7)) +#define AD7746_CAPSETUP_CIN2 (BIT(6))/* AD7746 only */ +#define AD7746_CAPSETUP_CAPDIFF (BIT(5)) +#define AD7746_CAPSETUP_CACHOP (BIT(0))
Extra parens.
regards,
dan carpenter