aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcmmio.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-12-09 15:31:00 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-17 10:02:13 -0800
commit72c7692a9d737926090b51fd132ae816d1556713 (patch)
treee74405b33a07b8dfc5891f62a6409b788668e90b /drivers/staging/comedi/drivers/pcmmio.c
parentstaging: comedi: pcmmio: introduce pcmmio_dio_write() (diff)
downloadlinux-dev-72c7692a9d737926090b51fd132ae816d1556713.tar.xz
linux-dev-72c7692a9d737926090b51fd132ae816d1556713.zip
staging: comedi: pcmmio: simplify pcmmio_dio_insn_config()
Currently this function uses the subdevice private data to get the iobase address needed to update the channel configuration. This subdevice private data is in the process of being removed. Use the subdevice 'index' to determine the base 'port' needed to access the correct digital i/o registers. The pcmmio_dio_write() function can then be used to update the configuration. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/pcmmio.c')
-rw-r--r--drivers/staging/comedi/drivers/pcmmio.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c
index 873fcf3e87aa..84be517bb237 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -348,24 +348,16 @@ static int pcmmio_dio_insn_config(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned int *data)
{
- struct pcmmio_subdev_private *subpriv = s->private;
- unsigned int chan = CR_CHAN(insn->chanspec);
- int byte_no = chan / 8;
- int bit_no = chan % 8;
+ /* subdevice 2 uses ports 0-2, subdevice 3 uses ports 3-5 */
+ int port = s->index == 2 ? 0 : 3;
int ret;
ret = comedi_dio_insn_config(dev, s, insn, data, 0);
if (ret)
return ret;
- if (data[0] == INSN_CONFIG_DIO_INPUT) {
- unsigned long ioaddr = subpriv->iobases[byte_no];
- unsigned char val;
-
- val = inb(ioaddr);
- val &= ~(1 << bit_no);
- outb(val, ioaddr);
- }
+ if (data[0] == INSN_CONFIG_DIO_INPUT)
+ pcmmio_dio_write(dev, s->io_bits, 0, port);
return insn->n;
}