]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: hwdrv_apci1564: remove magic numbers in apci1564_counter_insn_read()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 7 Aug 2015 18:45:14 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:34:57 +0000 (18:34 -0700)
Use the bit defines from addi_tcw.h to remove the magic numbers in this
function.

Add the missing define for ADDI_TCW_STATUS_HARDWARE_TRIG.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
drivers/staging/comedi/drivers/addi_tcw.h

index 1315554fb0962d635f01169acba230dd07f5c239..f0c0d58383ca7fb06a8cb88c2da4383689d531cb 100644 (file)
@@ -178,10 +178,10 @@ static int apci1564_counter_insn_read(struct comedi_device *dev,
        data[0] = inl(iobase + ADDI_TCW_VAL_REG);
 
        status = inl(iobase + ADDI_TCW_STATUS_REG);
-       data[1] = (status >> 1) & 1;    /* software trigger status */
-       data[2] = (status >> 2) & 1;    /* hardware trigger status */
-       data[3] = (status >> 3) & 1;    /* software clear status */
-       data[4] = (status >> 0) & 1;    /* overflow status */
+       data[1] = (status & ADDI_TCW_STATUS_SOFT_TRIG) ? 1 : 0;
+       data[2] = (status & ADDI_TCW_STATUS_HARDWARE_TRIG) ? 1 : 0;
+       data[3] = (status & ADDI_TCW_STATUS_SOFT_CLR) ? 1 : 0;
+       data[4] = (status & ADDI_TCW_STATUS_OVERFLOW) ? 1 : 0;
 
        return insn->n;
 }
index f6f0175a0d79b2fb45a70d990d27d596842f4093..db6d5a4e88890bbae007cd943d9b87ee52ffc2b8 100644 (file)
@@ -49,6 +49,7 @@
 
 #define ADDI_TCW_STATUS_REG            0x10
 #define ADDI_TCW_STATUS_SOFT_CLR       BIT(3)
+#define ADDI_TCW_STATUS_HARDWARE_TRIG  BIT(2)
 #define ADDI_TCW_STATUS_SOFT_TRIG      BIT(1)
 #define ADDI_TCW_STATUS_OVERFLOW       BIT(0)