staging: comedi: das16m1: tidy up digital input/output register defines
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 3 May 2016 19:29:46 +0000 (12:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Jun 2016 03:42:21 +0000 (20:42 -0700)
The digtial inputs and outputs are read/written using the same register
offset but they are different logical registers. Physically they are the
same register with the hi 4 bits returning the inputs and the lo 4 bits
driving the outputs.

For aesthetics, use two different defines for the registers.

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/das16m1.c

index 49eb8296b9ef7236ea5dfb35a3b52b03d2de83bc..e85d9898a78de4726eeb98fbd4f49befb1772dda 100644 (file)
@@ -70,7 +70,8 @@
 #define DAS16M1_CS_EXT_TRIG            BIT(0)
 #define DAS16M1_CS_OVRUN               BIT(5)
 #define DAS16M1_CS_IRQDATA             BIT(7)
-#define DAS16M1_DIO            3
+#define DAS16M1_DI_REG                 0x03
+#define DAS16M1_DO_REG                 0x03
 #define DAS16M1_CLEAR_INTR     4
 #define DAS16M1_INTR_CONTROL   5
 #define   EXT_PACER              0x2
@@ -351,7 +352,7 @@ static int das16m1_di_rbits(struct comedi_device *dev,
 {
        unsigned int bits;
 
-       bits = inb(dev->iobase + DAS16M1_DIO) & 0xf;
+       bits = inb(dev->iobase + DAS16M1_DI_REG) & 0xf;
        data[1] = bits;
        data[0] = 0;
 
@@ -364,7 +365,7 @@ static int das16m1_do_wbits(struct comedi_device *dev,
                            unsigned int *data)
 {
        if (comedi_dio_update_state(s, data))
-               outb(s->state, dev->iobase + DAS16M1_DIO);
+               outb(s->state, dev->iobase + DAS16M1_DO_REG);
 
        data[1] = s->state;
 
@@ -596,7 +597,7 @@ static int das16m1_attach(struct comedi_device *dev,
                return ret;
 
        /*  initialize digital output lines */
-       outb(0, dev->iobase + DAS16M1_DIO);
+       outb(0, dev->iobase + DAS16M1_DO_REG);
 
        /* set the interrupt level */
        devpriv->control_state = das16m1_irq_bits(dev->irq) << 4;