Commit 557e3619 authored by Sanjana Sanikommu's avatar Sanjana Sanikommu Committed by Greg Kroah-Hartman
Browse files

staging: comedi: Prefer using BIT macro in various files.



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: default avatarSanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9a3aebc0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading