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

staging: comedi: pcmmio: there is only one asic

The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o.

Remove the 'asics' struct array in the private data and add members for
the single 'asic_iobase' and the spinlock used by the asic.
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 b16f405a
...@@ -268,11 +268,9 @@ struct pcmmio_subdev_private { ...@@ -268,11 +268,9 @@ struct pcmmio_subdev_private {
* feel free to suggest moving the variable to the struct comedi_device struct. * feel free to suggest moving the variable to the struct comedi_device struct.
*/ */
struct pcmmio_private { struct pcmmio_private {
/* stuff for DIO */ unsigned long asic_iobase;
struct {
unsigned long iobase;
spinlock_t spinlock; spinlock_t spinlock;
} asics[MAX_ASICS];
struct pcmmio_subdev_private *sprivs; struct pcmmio_subdev_private *sprivs;
unsigned int ao_readback[8]; unsigned int ao_readback[8];
}; };
...@@ -369,8 +367,7 @@ static void switch_page(struct comedi_device *dev, int asic, int page) ...@@ -369,8 +367,7 @@ static void switch_page(struct comedi_device *dev, int asic, int page)
{ {
struct pcmmio_private *devpriv = dev->private; struct pcmmio_private *devpriv = dev->private;
outb(page << REG_PAGE_BITOFFSET, outb(page << REG_PAGE_BITOFFSET, devpriv->asic_iobase + REG_PAGELOCK);
devpriv->asics[asic].iobase + REG_PAGELOCK);
} }
static void init_asics(struct comedi_device *dev) static void init_asics(struct comedi_device *dev)
...@@ -381,7 +378,7 @@ static void init_asics(struct comedi_device *dev) ...@@ -381,7 +378,7 @@ static void init_asics(struct comedi_device *dev)
for (asic = 0; asic < 1; ++asic) { for (asic = 0; asic < 1; ++asic) {
int port, page; int port, page;
unsigned long baseaddr = devpriv->asics[asic].iobase; unsigned long baseaddr = devpriv->asic_iobase;
switch_page(dev, asic, 0); /* switch back to page 0 */ switch_page(dev, asic, 0); /* switch back to page 0 */
...@@ -422,7 +419,7 @@ static void pcmmio_stop_intr(struct comedi_device *dev, ...@@ -422,7 +419,7 @@ static void pcmmio_stop_intr(struct comedi_device *dev,
switch_page(dev, asic, PAGE_ENAB); switch_page(dev, asic, PAGE_ENAB);
for (port = firstport; port < firstport + nports; ++port) { for (port = firstport; port < firstport + nports; ++port) {
/* disable all intrs for this subdev.. */ /* disable all intrs for this subdev.. */
outb(0, devpriv->asics[asic].iobase + REG_ENAB0 + port); outb(0, devpriv->asic_iobase + REG_ENAB0 + port);
} }
} }
...@@ -437,12 +434,11 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) ...@@ -437,12 +434,11 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
if (irq == dev->irq) { if (irq == dev->irq) {
unsigned long flags; unsigned long flags;
unsigned triggered = 0; unsigned triggered = 0;
unsigned long iobase = devpriv->asics[asic].iobase; unsigned long iobase = devpriv->asic_iobase;
/* it is an interrupt for ASIC #asic */ /* it is an interrupt for ASIC #asic */
unsigned char int_pend; unsigned char int_pend;
spin_lock_irqsave(&devpriv->asics[asic].spinlock, spin_lock_irqsave(&devpriv->spinlock, flags);
flags);
int_pend = inb(iobase + REG_INT_PENDING) & 0x07; int_pend = inb(iobase + REG_INT_PENDING) & 0x07;
...@@ -477,8 +473,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) ...@@ -477,8 +473,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
++got1; ++got1;
} }
spin_unlock_irqrestore(&devpriv->asics[asic].spinlock, spin_unlock_irqrestore(&devpriv->spinlock, flags);
flags);
if (triggered) { if (triggered) {
struct comedi_subdevice *s; struct comedi_subdevice *s;
...@@ -648,11 +643,9 @@ static int pcmmio_start_intr(struct comedi_device *dev, ...@@ -648,11 +643,9 @@ static int pcmmio_start_intr(struct comedi_device *dev,
pol_bits >> (subpriv->dio.intr.first_chan + pol_bits >> (subpriv->dio.intr.first_chan +
(port - firstport) * 8) & 0xff; (port - firstport) * 8) & 0xff;
/* set enab intrs for this subdev.. */ /* set enab intrs for this subdev.. */
outb(enab, outb(enab, devpriv->asic_iobase + REG_ENAB0 + port);
devpriv->asics[asic].iobase + REG_ENAB0 + port);
switch_page(dev, asic, PAGE_POL); switch_page(dev, asic, PAGE_POL);
outb(pol, outb(pol, devpriv->asic_iobase + REG_ENAB0 + port);
devpriv->asics[asic].iobase + REG_ENAB0 + port);
} }
} }
return 0; return 0;
...@@ -968,11 +961,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -968,11 +961,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (!devpriv) if (!devpriv)
return -ENOMEM; return -ENOMEM;
for (asic = 0; asic < MAX_ASICS; ++asic) { devpriv->asic_iobase = dev->iobase + 16;
devpriv->asics[asic].iobase = spin_lock_init(&devpriv->spinlock);
dev->iobase + 16 + asic * ASIC_IOSIZE;
spin_lock_init(&devpriv->asics[asic].spinlock);
}
chans_left = CHANS_PER_ASIC * 1; chans_left = CHANS_PER_ASIC * 1;
n_dio_subdevs = CALC_N_DIO_SUBDEVS(chans_left); n_dio_subdevs = CALC_N_DIO_SUBDEVS(chans_left);
...@@ -1045,8 +1035,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1045,8 +1035,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
++asic; ++asic;
thisasic_chanct = 0; thisasic_chanct = 0;
} }
subpriv->iobases[byte_no] = subpriv->iobases[byte_no] = devpriv->asic_iobase + port;
devpriv->asics[asic].iobase + port;
if (thisasic_chanct < if (thisasic_chanct <
CHANS_PER_PORT * INTR_PORTS_PER_ASIC CHANS_PER_PORT * INTR_PORTS_PER_ASIC
......
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