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

staging: comedi: adl_pci9111: remove pci9111_ai_range_[gs]et macros

These macros rely on a local variable having a specific name.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ae479ee5
...@@ -98,8 +98,8 @@ a multiple of chanlist_len*convert_arg. ...@@ -98,8 +98,8 @@ a multiple of chanlist_len*convert_arg.
#define PCI9111_REGISTER_AD_CHANNEL_CONTROL 0x06 /* Channel #define PCI9111_REGISTER_AD_CHANNEL_CONTROL 0x06 /* Channel
selection */ selection */
#define PCI9111_REGISTER_AD_CHANNEL_READBACK 0x06 #define PCI9111_REGISTER_AD_CHANNEL_READBACK 0x06
#define PCI9111_REGISTER_INPUT_SIGNAL_RANGE 0x08 #define PCI9111_AI_RANGE_REG 0x08
#define PCI9111_REGISTER_RANGE_STATUS_READBACK 0x08 #define PCI9111_RANGE_STATUS_REG 0x08
#define PCI9111_REGISTER_TRIGGER_MODE_CONTROL 0x0A #define PCI9111_REGISTER_TRIGGER_MODE_CONTROL 0x0A
#define PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK 0x0A #define PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK 0x0A
#define PCI9111_REGISTER_SOFTWARE_TRIGGER 0x0E #define PCI9111_REGISTER_SOFTWARE_TRIGGER 0x0E
...@@ -165,15 +165,15 @@ a multiple of chanlist_len*convert_arg. ...@@ -165,15 +165,15 @@ a multiple of chanlist_len*convert_arg.
} while (0) } while (0)
#define pci9111_is_fifo_full() \ #define pci9111_is_fifo_full() \
((inb(dev->iobase + PCI9111_REGISTER_RANGE_STATUS_READBACK)& \ ((inb(dev->iobase + PCI9111_RANGE_STATUS_REG)& \
PCI9111_FIFO_FULL_MASK) == 0) PCI9111_FIFO_FULL_MASK) == 0)
#define pci9111_is_fifo_half_full() \ #define pci9111_is_fifo_half_full() \
((inb(dev->iobase + PCI9111_REGISTER_RANGE_STATUS_READBACK)& \ ((inb(dev->iobase + PCI9111_RANGE_STATUS_REG)& \
PCI9111_FIFO_HALF_FULL_MASK) == 0) PCI9111_FIFO_HALF_FULL_MASK) == 0)
#define pci9111_is_fifo_empty() \ #define pci9111_is_fifo_empty() \
((inb(dev->iobase + PCI9111_REGISTER_RANGE_STATUS_READBACK)& \ ((inb(dev->iobase + PCI9111_RANGE_STATUS_REG)& \
PCI9111_FIFO_EMPTY_MASK) == 0) PCI9111_FIFO_EMPTY_MASK) == 0)
#define pci9111_ai_channel_set(channel) \ #define pci9111_ai_channel_set(channel) \
...@@ -184,14 +184,6 @@ a multiple of chanlist_len*convert_arg. ...@@ -184,14 +184,6 @@ a multiple of chanlist_len*convert_arg.
(inb(dev->iobase + PCI9111_REGISTER_AD_CHANNEL_READBACK) \ (inb(dev->iobase + PCI9111_REGISTER_AD_CHANNEL_READBACK) \
&PCI9111_CHANNEL_MASK) &PCI9111_CHANNEL_MASK)
#define pci9111_ai_range_set(range) \
outb((range)&PCI9111_RANGE_MASK, \
dev->iobase + PCI9111_REGISTER_INPUT_SIGNAL_RANGE)
#define pci9111_ai_range_get() \
(inb(dev->iobase + PCI9111_REGISTER_RANGE_STATUS_READBACK) \
&PCI9111_RANGE_MASK)
static const struct comedi_lrange pci9111_hr_ai_range = { static const struct comedi_lrange pci9111_hr_ai_range = {
5, 5,
{ {
...@@ -612,7 +604,8 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, ...@@ -612,7 +604,8 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
/* Set gain */ /* Set gain */
/* This is the same gain on every channel */ /* This is the same gain on every channel */
pci9111_ai_range_set(CR_RANGE(async_cmd->chanlist[0])); outb(CR_RANGE(async_cmd->chanlist[0]) & PCI9111_RANGE_MASK,
dev->iobase + PCI9111_AI_RANGE_REG);
/* Set counter */ /* Set counter */
...@@ -860,13 +853,17 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, ...@@ -860,13 +853,17 @@ static int pci9111_ai_insn_read(struct comedi_device *dev,
unsigned int maxdata = s->maxdata; unsigned int maxdata = s->maxdata;
unsigned int invert = (maxdata + 1) >> 1; unsigned int invert = (maxdata + 1) >> 1;
unsigned int shift = (maxdata == 0xffff) ? 0 : 4; unsigned int shift = (maxdata == 0xffff) ? 0 : 4;
unsigned int current_range;
int timeout; int timeout;
int i; int i;
pci9111_ai_channel_set(chan); pci9111_ai_channel_set(chan);
if ((pci9111_ai_range_get()) != range) current_range = inb(dev->iobase + PCI9111_RANGE_STATUS_REG);
pci9111_ai_range_set(range); if ((current_range & PCI9111_RANGE_MASK) != range) {
outb(range & PCI9111_RANGE_MASK,
dev->iobase + PCI9111_AI_RANGE_REG);
}
pci9111_fifo_reset(); pci9111_fifo_reset();
......
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