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

staging: comedi: addi_apci_2200: remove devpriv->iobase usage

The iobase address stored in devpriv->iobase is also stored in
dev->iobase. Use that instead.
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 aad47448
...@@ -65,9 +65,7 @@ static int apci2200_di_insn_bits(struct comedi_device *dev, ...@@ -65,9 +65,7 @@ static int apci2200_di_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; data[1] = inw(dev->iobase + APCI2200_DIGITAL_IP);
data[1] = inw(devpriv->iobase + APCI2200_DIGITAL_IP);
return insn->n; return insn->n;
} }
...@@ -77,16 +75,15 @@ static int apci2200_do_insn_bits(struct comedi_device *dev, ...@@ -77,16 +75,15 @@ static int apci2200_do_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int mask = data[0]; unsigned int mask = data[0];
unsigned int bits = data[1]; unsigned int bits = data[1];
s->state = inw(devpriv->iobase + APCI2200_DIGITAL_OP); s->state = inw(dev->iobase + APCI2200_DIGITAL_OP);
if (mask) { if (mask) {
s->state &= ~mask; s->state &= ~mask;
s->state |= (bits & mask); s->state |= (bits & mask);
outw(s->state, devpriv->iobase + APCI2200_DIGITAL_OP); outw(s->state, dev->iobase + APCI2200_DIGITAL_OP);
} }
data[1] = s->state; data[1] = s->state;
...@@ -120,21 +117,16 @@ static int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, ...@@ -120,21 +117,16 @@ static int i_APCI2200_ConfigWatchdog(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if (data[0] == 0) { if (data[0] == 0) {
/* Disable the watchdog */ /* Disable the watchdog */
outw(0x0, outw(0x0, dev->iobase + APCI2200_WATCHDOG +
devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE);
APCI2200_WATCHDOG_ENABLEDISABLE);
/* Loading the Reload value */ /* Loading the Reload value */
outw(data[1], outw(data[1], dev->iobase + APCI2200_WATCHDOG +
devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE);
APCI2200_WATCHDOG_RELOAD_VALUE);
data[1] = data[1] >> 16; data[1] = data[1] >> 16;
outw(data[1], outw(data[1], dev->iobase + APCI2200_WATCHDOG +
devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE + 2);
APCI2200_WATCHDOG_RELOAD_VALUE + 2);
} /* if(data[0]==0) */ } /* if(data[0]==0) */
else { else {
printk("\nThe input parameters are wrong\n"); printk("\nThe input parameters are wrong\n");
...@@ -170,21 +162,18 @@ static int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, ...@@ -170,21 +162,18 @@ static int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
switch (data[0]) { switch (data[0]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ outw(0x0, dev->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_ENABLEDISABLE);
break; break;
case 1: /* start the watchdog */ case 1: /* start the watchdog */
outw(0x0001, outw(0x0001, dev->iobase + APCI2200_WATCHDOG +
devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE);
APCI2200_WATCHDOG_ENABLEDISABLE);
break; break;
case 2: /* Software trigger */ case 2: /* Software trigger */
outw(0x0201, outw(0x0201, dev->iobase + APCI2200_WATCHDOG +
devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE);
APCI2200_WATCHDOG_ENABLEDISABLE);
break; break;
default: default:
printk("\nSpecified functionality does not exist\n"); printk("\nSpecified functionality does not exist\n");
...@@ -219,10 +208,7 @@ static int i_APCI2200_ReadWatchdog(struct comedi_device *dev, ...@@ -219,10 +208,7 @@ static int i_APCI2200_ReadWatchdog(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; data[0] = inw(dev->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_STATUS) & 0x1;
data[0] =
inw(devpriv->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_STATUS) & 0x1;
return insn->n; return insn->n;
} }
...@@ -32,14 +32,12 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d) ...@@ -32,14 +32,12 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
static int apci2200_reset(struct comedi_device *dev) static int apci2200_reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private; outw(0x0, dev->iobase + APCI2200_DIGITAL_OP);
outw(0x0, dev->iobase + APCI2200_WATCHDOG +
outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP);
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_ENABLEDISABLE); APCI2200_WATCHDOG_ENABLEDISABLE);
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + outw(0x0, dev->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_RELOAD_VALUE); APCI2200_WATCHDOG_RELOAD_VALUE);
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + outw(0x0, dev->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_RELOAD_VALUE + 2); APCI2200_WATCHDOG_RELOAD_VALUE + 2);
return 0; return 0;
...@@ -87,7 +85,6 @@ static int apci2200_auto_attach(struct comedi_device *dev, ...@@ -87,7 +85,6 @@ static int apci2200_auto_attach(struct comedi_device *dev,
return ret; return ret;
dev->iobase = pci_resource_start(pcidev, 1); dev->iobase = pci_resource_start(pcidev, 1);
devpriv->iobase = dev->iobase;
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0); devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
......
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