Commit cec60bf6 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das16m1: tidy up control/status register defines

Rename the defines for the control/status register/bits. Use the BIT
macro to define the bits.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a782a851
...@@ -66,10 +66,10 @@ ...@@ -66,10 +66,10 @@
#define DAS16M1_AI_REG 0x00 /* 16-bit register */ #define DAS16M1_AI_REG 0x00 /* 16-bit register */
#define DAS16M1_AI_TO_CHAN(x) (((x) >> 0) & 0xf) #define DAS16M1_AI_TO_CHAN(x) (((x) >> 0) & 0xf)
#define DAS16M1_AI_TO_SAMPLE(x) (((x) >> 4) & 0xfff) #define DAS16M1_AI_TO_SAMPLE(x) (((x) >> 4) & 0xfff)
#define DAS16M1_CS 2 #define DAS16M1_CS_REG 0x02
#define EXT_TRIG_BIT 0x1 #define DAS16M1_CS_EXT_TRIG BIT(0)
#define OVRUN 0x20 #define DAS16M1_CS_OVRUN BIT(5)
#define IRQDATA 0x80 #define DAS16M1_CS_IRQDATA BIT(7)
#define DAS16M1_DIO 3 #define DAS16M1_DIO 3
#define DAS16M1_CLEAR_INTR 4 #define DAS16M1_CLEAR_INTR 4
#define DAS16M1_INTR_CONTROL 5 #define DAS16M1_INTR_CONTROL 5
...@@ -272,9 +272,9 @@ static int das16m1_cmd_exec(struct comedi_device *dev, ...@@ -272,9 +272,9 @@ static int das16m1_cmd_exec(struct comedi_device *dev,
* both start and conversion triggers external simultaneously). * both start and conversion triggers external simultaneously).
*/ */
if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT) if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT)
byte |= EXT_TRIG_BIT; byte |= DAS16M1_CS_EXT_TRIG;
outb(byte, dev->iobase + DAS16M1_CS); outb(byte, dev->iobase + DAS16M1_CS_REG);
/* clear interrupt bit */ /* clear interrupt bit */
outb(0, dev->iobase + DAS16M1_CLEAR_INTR); outb(0, dev->iobase + DAS16M1_CLEAR_INTR);
...@@ -301,8 +301,8 @@ static int das16m1_ai_eoc(struct comedi_device *dev, ...@@ -301,8 +301,8 @@ static int das16m1_ai_eoc(struct comedi_device *dev,
{ {
unsigned int status; unsigned int status;
status = inb(dev->iobase + DAS16M1_CS); status = inb(dev->iobase + DAS16M1_CS_REG);
if (status & IRQDATA) if (status & DAS16M1_CS_IRQDATA)
return 0; return 0;
return -EBUSY; return -EBUSY;
} }
...@@ -329,7 +329,7 @@ static int das16m1_ai_rinsn(struct comedi_device *dev, ...@@ -329,7 +329,7 @@ static int das16m1_ai_rinsn(struct comedi_device *dev,
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
unsigned short val; unsigned short val;
/* clear IRQDATA bit */ /* clear DAS16M1_CS_IRQDATA bit */
outb(0, dev->iobase + DAS16M1_CLEAR_INTR); outb(0, dev->iobase + DAS16M1_CLEAR_INTR);
/* trigger conversion */ /* trigger conversion */
outb(0, dev->iobase + DAS16M1_AI_REG); outb(0, dev->iobase + DAS16M1_AI_REG);
...@@ -430,7 +430,7 @@ static void das16m1_handler(struct comedi_device *dev, unsigned int status) ...@@ -430,7 +430,7 @@ static void das16m1_handler(struct comedi_device *dev, unsigned int status)
* This probably won't catch overruns since the card doesn't generate * This probably won't catch overruns since the card doesn't generate
* overrun interrupts, but we might as well try. * overrun interrupts, but we might as well try.
*/ */
if (status & OVRUN) { if (status & DAS16M1_CS_OVRUN) {
async->events |= COMEDI_CB_ERROR; async->events |= COMEDI_CB_ERROR;
dev_err(dev->class_dev, "fifo overflow\n"); dev_err(dev->class_dev, "fifo overflow\n");
} }
...@@ -445,7 +445,7 @@ static int das16m1_poll(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -445,7 +445,7 @@ static int das16m1_poll(struct comedi_device *dev, struct comedi_subdevice *s)
/* prevent race with interrupt handler */ /* prevent race with interrupt handler */
spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
status = inb(dev->iobase + DAS16M1_CS); status = inb(dev->iobase + DAS16M1_CS_REG);
das16m1_handler(dev, status); das16m1_handler(dev, status);
spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
...@@ -464,9 +464,9 @@ static irqreturn_t das16m1_interrupt(int irq, void *d) ...@@ -464,9 +464,9 @@ static irqreturn_t das16m1_interrupt(int irq, void *d)
/* prevent race with comedi_poll() */ /* prevent race with comedi_poll() */
spin_lock(&dev->spinlock); spin_lock(&dev->spinlock);
status = inb(dev->iobase + DAS16M1_CS); status = inb(dev->iobase + DAS16M1_CS_REG);
if ((status & (IRQDATA | OVRUN)) == 0) { if ((status & (DAS16M1_CS_IRQDATA | DAS16M1_CS_OVRUN)) == 0) {
dev_err(dev->class_dev, "spurious interrupt\n"); dev_err(dev->class_dev, "spurious interrupt\n");
spin_unlock(&dev->spinlock); spin_unlock(&dev->spinlock);
return IRQ_NONE; return IRQ_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment