Staging: iio: cdc: Prefer using the BIT macro
Subsystems (4)
PATCH 4/6 Staging: iio: cdc: Prefer using the BIT macro
This patch replaces bit shifting on 1 with the BIT(x) macro
This was done with coccinelle:
@@ int g; @@
-(1 << g)
+BIT(g)
--- drivers/staging/iio/cdc/ad7746.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/cdc/ad7746.c +4 -4
@@ -46,10 +46,10 @@#define AD7746_REG_VOLT_GAINL 18/* Status Register Bit Designations (AD7746_REG_STATUS) */ -#define AD7746_STATUS_EXCERR (1 << 3) -#define AD7746_STATUS_RDY (1 << 2) -#define AD7746_STATUS_RDYVT (1 << 1) -#define AD7746_STATUS_RDYCAP (1 << 0) +#define AD7746_STATUS_EXCERR BIT(3) +#define AD7746_STATUS_RDY BIT(2) +#define AD7746_STATUS_RDYVT BIT(1) +#define AD7746_STATUS_RDYCAP BIT(0)/* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */ #define AD7746_CAPSETUP_CAPEN (1 << 7)
Signature · 1 line
2.1.4
PATCH 5/6 Staging: lustre: ptlrpc: Prefer using the BIT macro
This patch replaces bit shifting on 1 with the BIT(x) macro
This was done with coccinelle:
@@ int g; @@
-(1 << g)
+BIT(g)
--- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +3 -3
@@ -789,17 +789,17 @@ enum rmf_flags {/** * The field is a string, must be NUL-terminated. */ -RMF_F_STRING =1 <<0 , +RMF_F_STRING =BIT (0 ),/** * The field's buffer size need not match the declared \a rmf_size. */ -RMF_F_NO_SIZE_CHECK =1 <<1 , +RMF_F_NO_SIZE_CHECK =BIT (1 ),/** * The field's buffer size must be a whole multiple of the declared \a * rmf_size and the \a rmf_swabber function must work on the declared \a * rmf_size worth of bytes. */ - RMF_F_STRUCT_ARRAY = 1 << 2 + RMF_F_STRUCT_ARRAY = BIT(2) };struct req_capsule ;
Signature · 1 line
2.1.4
PATCH 6/6 Staging: comedi: Prefer using the BIT macro
In reply to Shraddha BarkeThis patch replaces bit shifting on 1 with the BIT(x) macro
This was done with coccinelle:
@@ int g; @@
-(1 << g)
+BIT(g)
--- drivers/staging/comedi/drivers/mpc624.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/mpc624.c +15 -15
@@ -66,24 +66,24 @@ Configuration Options:#define MPC624_IRQ_MASK 6/* IRQ masking enable/disable */ /* Register bits' names */ -#define MPC624_ADBUSY (1<<5) -#define MPC624_ADSDO (1<<4) -#define MPC624_ADFO (1<<3) -#define MPC624_ADCS (1<<2) -#define MPC624_ADSCK (1<<1) -#define MPC624_ADSDI (1<<0) +#define MPC624_ADBUSY BIT(5) +#define MPC624_ADSDO BIT(4) +#define MPC624_ADFO BIT(3) +#define MPC624_ADCS BIT(2) +#define MPC624_ADSCK BIT(1) +#define MPC624_ADSDI BIT(0)/* SDI Speed/Resolution Programming bits */ -#define MPC624_OSR4 (1<<31) -#define MPC624_OSR3 (1<<30) -#define MPC624_OSR2 (1<<29) -#define MPC624_OSR1 (1<<28) -#define MPC624_OSR0 (1<<27) +#define MPC624_OSR4 BIT(31) +#define MPC624_OSR3 BIT(30) +#define MPC624_OSR2 BIT(29) +#define MPC624_OSR1 BIT(28) +#define MPC624_OSR0 BIT(27)/* 32-bit output value bits' names */ -#define MPC624_EOC_BIT (1<<31) -#define MPC624_DMY_BIT (1<<30) -#define MPC624_SGN_BIT (1<<29) +#define MPC624_EOC_BIT BIT(31) +#define MPC624_DMY_BIT BIT(30) +#define MPC624_SGN_BIT BIT(29)/* Conversion speeds */ /* OSR4 OSR3 OSR2 OSR1 OSR0 Conversion rate RMS noise ENOB^
@@ -189,7 +189,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,outb (0 , dev->iobase +MPC624_ADC );udelay (1 ); -if (data_out & (1 <<31 )) {/* the next bit is a 1 */ +if (data_out &BIT (31 )) {/* the next bit is a 1 */ /* Set the ADSDI line (send to MPC624) */ outb (MPC624_ADSDI , dev->iobase +MPC624_ADC );udelay (1 );
Signature · 1 line
2.1.4
Jonathan Cameron
maintainerQuoted 9 lines · Shraddha Barke
This patch replaces bit shifting on 1 with the BIT(x) macro
This was done with coccinelle:
@@ int g; @@(quoted diff) +1
-1-(1 << g) +BIT(g)Signed-off-by Shraddha Barke <[email protected]>
Something odd happened here as this is only a small proportion of the cases that should be updated in this file. There's one at the bottom of the patch for starters!
This driver also uses a lot of cases of 0 shifted to represent the opposite state for a given bit in the register. The effective documentation provided by that is lost if we convert the bit set ones over like this. Might seem odd, but perhaps we need a ZERO(X) macro as well (which is of course always 0) to cover that approach.
Jonathan
Quoted 24 lines
--- drivers/staging/iio/cdc/ad7746.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/iio/cdc/ad7746.c +4
-4@@ -46,10 +46,10 @@#define AD7746_REG_VOLT_GAINL 18/* Status Register Bit Designations (AD7746_REG_STATUS) */ -#define AD7746_STATUS_EXCERR (1 << 3) -#define AD7746_STATUS_RDY (1 << 2) -#define AD7746_STATUS_RDYVT (1 << 1) -#define AD7746_STATUS_RDYCAP (1 << 0) +#define AD7746_STATUS_EXCERR BIT(3) +#define AD7746_STATUS_RDY BIT(2) +#define AD7746_STATUS_RDYVT BIT(1) +#define AD7746_STATUS_RDYCAP BIT(0)/* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */ #define AD7746_CAPSETUP_CAPEN (1 << 7)
Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · Shraddha Barke
This patch replaces bit shifting on 1 with the BIT(x) macro
This was done with coccinelle:
@@ int g; @@(quoted diff) +1
-1-(1 << g) +BIT(g)
Quoted 6 lines
Quoted 1 line
Signed-off-by Shraddha Barke <[email protected]>Something odd happened here as this is only a small proportion of the cases that should be updated in this file. There's one at the bottom of the patch for starters!
I didn't apply BIT(x) for mixed cases.I think I should drop this patch
altogether but
Greg has added it. Will it cause problems ? :(
Quoted 35 lines
This driver also uses a lot of cases of 0 shifted to represent the opposite state for a given bit in the register. The effective documentation provided by that is lost if we convert the bit set ones over like this. Might seem odd, but perhaps we need a ZERO(X) macro as well (which is of course always 0) to cover that approach.
Jonathan
Review
Quoted 5 lines
--- drivers/staging/iio/cdc/ad7746.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/staging/iio/cdc/ad7746.cQuoted 7 lines
index e6e9eaa..10fa372 100644
drivers/staging/iio/cdc/ad7746.c +0
-0@@ -46,10 +46,10 @@#define AD7746_REG_VOLT_GAINL 18/* Status Register Bit Designations (AD7746_REG_STATUS) */ drivers/staging/iio/cdc/ad7746.c line 54
Quoted 10 lines
drivers/staging/iio/cdc/ad7746.c +4
-4-#define AD7746_STATUS_EXCERR (1 << 3) -#define AD7746_STATUS_RDY (1 << 2) -#define AD7746_STATUS_RDYVT (1 << 1) -#define AD7746_STATUS_RDYCAP (1 << 0) +#define AD7746_STATUS_EXCERR BIT(3) +#define AD7746_STATUS_RDY BIT(2) +#define AD7746_STATUS_RDYVT BIT(1) +#define AD7746_STATUS_RDYCAP BIT(0)/* Capacitive Channel Setup Register Bit Designations (
AD7746_REG_CAP_SETUP) */Quoted 2 lines
drivers/staging/iio/cdc/ad7746.c +0
-0#define AD7746_CAPSETUP_CAPEN (1 << 7)
Greg Kroah-Hartman
maintainerQuoted 19 lines · Shraddha Barke
On Sat, Sep 12, 2015 at 3:17 PM, Jonathan Cameron <[email protected]> wrote:
On 10/09/15 17:32, Shraddha Barke wrote: > This patch replaces bit shifting on 1 with the BIT(x) macro > > This was done with coccinelle: > @@ int g; @@ > > -(1 << g) > +BIT(g) > > Signed-off-by: Shraddha Barke <[email protected]> Something odd happened here as this is only a small proportion of the cases that should be updated in this file. There's one at the bottom of the patch for starters!
Quoted 3 lines
I didn't apply BIT(x) for mixed cases.I think I should drop this patch altogether but
Greg has added it. Will it cause problems ? :(
Greg can always drop it :)