staging: comedi: Prefer using BIT macro in various files.
authorSanjana Sanikommu <sanjana99reddy99@gmail.com>
Sun, 31 Mar 2019 10:47:30 +0000 (16:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Apr 2019 17:31:11 +0000 (19:31 +0200)
Challenge suggested by coccinelle.

Replace bit shifting on 1 with the BIT(x) macro.
Coccinelle script:

@@
constant c;
@@

-(1 << c)
+BIT(c)

Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/das08.c
drivers/staging/comedi/drivers/dyna_pci10xx.c
drivers/staging/comedi/drivers/ni_at_ao.c
drivers/staging/comedi/drivers/ni_daq_700.c
drivers/staging/comedi/drivers/ni_mio_common.c

index 08ffe26c5d43f0724aaab89984aef3ceacb26f12..65f60c2b702a6cd6adeec6c3e80f1ea2c15e0a55 100644 (file)
@@ -2464,7 +2464,7 @@ static int pci230_auto_attach(struct comedi_device *dev,
        devpriv->adcg = 0;
        devpriv->adccon = PCI230_ADC_TRIG_NONE | PCI230_ADC_IM_SE |
                          PCI230_ADC_IR_BIP;
-       outw(1 << 0, devpriv->daqio + PCI230_ADCEN);
+       outw(BIT(0), devpriv->daqio + PCI230_ADCEN);
        outw(devpriv->adcg, devpriv->daqio + PCI230_ADCG);
        outw(devpriv->adccon | PCI230_ADC_FIFO_RESET,
             devpriv->daqio + PCI230_ADCCON);
index 327ecf9aea3080cd82ab9242441deb4f33a02697..65e5f2e6c122cdf036b98dc5b58280e8e07565d0 100644 (file)
@@ -236,9 +236,9 @@ static int das08_ai_insn_read(struct comedi_device *dev,
                         * COMEDI 16-bit bipolar data value for 0V is 0x8000.
                         */
                        if (msb & 0x80)
-                               data[n] = (1 << 15) + magnitude;
+                               data[n] = BIT(15) + magnitude;
                        else
-                               data[n] = (1 << 15) - magnitude;
+                               data[n] = BIT(15) - magnitude;
                } else {
                        dev_err(dev->class_dev, "bug! unknown ai encoding\n");
                        return -1;
index e50536731d11d71bb71d66e0d34d5b1ae1d2b4d2..9bdd5bf2eb99ccaaff764c7637284e39b46f79f3 100644 (file)
@@ -54,7 +54,7 @@ static int dyna_pci10xx_ai_eoc(struct comedi_device *dev,
        unsigned int status;
 
        status = inw_p(dev->iobase);
-       if (status & (1 << 15))
+       if (status & BIT(15))
                return 0;
        return -EBUSY;
 }
index aad0b295ee2b2e1fbdd20986f033eca41a58c714..814895d01ffa10a80c8da1bf3ed0502b5091c7c2 100644 (file)
@@ -244,7 +244,7 @@ static int atao_calib_insn_write(struct comedi_device *dev,
 
                /* write the channel and last data value to the caldac */
                /* clock the bitstring to the caldac; MSB -> LSB */
-               for (bit = 1 << 10; bit; bit >>= 1) {
+               for (bit = BIT(10); bit; bit >>= 1) {
                        bits = (bit & bitstring) ? ATAO_CFG2_SDATA : 0;
 
                        outw(bits, dev->iobase + ATAO_CFG2_REG);
index b9e525b9beb9478bd0701a79a3d7fe3b5807a89d..81fd4c26a16f2fcd76a2aff4f29af82545ee50a8 100644 (file)
@@ -239,7 +239,7 @@ static int daq700_auto_attach(struct comedi_device *dev,
        s->type = COMEDI_SUBD_AI;
        s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
        s->n_chan = 16;
-       s->maxdata = (1 << 12) - 1;
+       s->maxdata = BIT(12) - 1;
        s->range_table = &range_daq700_ai;
        s->insn_read = daq700_ai_rinsn;
        daq700_ai_config(dev, s);
index a9616f136c617146652545182da569721b84ecce..248950cf6d4114464fa363c8ea3088547215f555 100644 (file)
@@ -4800,7 +4800,7 @@ static int cs5529_do_conversion(struct comedi_device *dev,
        if (data) {
                *data = ni_ao_win_inw(dev, NI67XX_CAL_DATA_REG);
                /* cs5529 returns 16 bit signed data in bipolar mode */
-               *data ^= (1 << 15);
+               *data ^= BIT(15);
        }
        return 0;
 }
@@ -6209,7 +6209,7 @@ static int ni_E_init(struct comedi_device *dev,
                s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_INTERNAL;
                /*  one channel for each analog output channel */
                s->n_chan = board->n_aochan;
-               s->maxdata = (1 << 16) - 1;
+               s->maxdata = BIT(16) - 1;
                s->range_table = &range_unknown;        /* XXX */
                s->insn_read = cs5529_ai_insn_read;
                s->insn_config = NULL;