staging: comedi: das08: rename DAS08_MUX() and DAS08_MUX_MASK
authorIan Abbott <abbotti@mev.co.uk>
Fri, 5 Jun 2015 17:30:17 +0000 (18:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Jun 2015 00:06:40 +0000 (17:06 -0700)
The `DAS08_MUX_MASK` macro is a bitmask for the control register
corresponding to the analog input multiplexor channel selection bits.
Rename it to `DAS08_CONTROL_MUX_MASK` and add a comment.  Note that the
current setting of the multiplexor can also be read from the same bit
positions in the status register, but the driver does not use it.  Add a
comment to that effect.

The `DAS08_MUX(x)` macro takes an analog input channel number and
returns the corresponding analog input multiplexor channel selection
bits for the control register.  Rename it to `DAS08_CONTROL_MUX(x)` and
add a comment.

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

index b43bc2d6ff5f5749562a8301a3d085fbec116876..f0ee617028db9da64d70057e61ce0ff720cde668 100644 (file)
 /* digital inputs (not "JR" boards) */
 #define DAS08_STATUS_DI(x)     (((x) & 0x70) >> 4)
 #define DAS08_CONTROL_REG      0x02    /* (W) control */
-#define   DAS08_MUX_MASK       0x7
-#define   DAS08_MUX(x)         ((x) & DAS08_MUX_MASK)
+/*
+ * Note: The AI multiplexor channel can also be read from status register using
+ * the same mask.
+ */
+#define DAS08_CONTROL_MUX_MASK 0x7     /* multiplexor channel mask */
+#define DAS08_CONTROL_MUX(x)   ((x) & DAS08_CONTROL_MUX_MASK) /* mux channel */
 #define   DAS08_INTE                   (1<<3)
 #define   DAS08_DO_MASK                0xf0
 #define   DAS08_OP(x)          (((x) << 4) & DAS08_DO_MASK)
@@ -238,8 +242,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
        /* set multiplexer */
        /*  lock to prevent race with digital output */
        spin_lock(&dev->spinlock);
-       devpriv->do_mux_bits &= ~DAS08_MUX_MASK;
-       devpriv->do_mux_bits |= DAS08_MUX(chan);
+       devpriv->do_mux_bits &= ~DAS08_CONTROL_MUX_MASK;
+       devpriv->do_mux_bits |= DAS08_CONTROL_MUX(chan);
        outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL_REG);
        spin_unlock(&dev->spinlock);