summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-07-29 22:01:42 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-30 23:55:16 (GMT)
commitadcd16a2983c4f29cabd0af3bc2881e97348a4ee (patch)
tree2605db270c833cdb1da28fe8e97b9c01d6675320 /drivers
parent7c555f06fb6afc9e83b8b375e8cf131cfe355e95 (diff)
downloadlinux-adcd16a2983c4f29cabd0af3bc2881e97348a4ee.tar.xz
staging: comedi: ni_labpc: refactor labpc_8255_mmio()
Refactor the 8255 support code in preperation for using the comedi_device 'mmio' member. 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')
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 819eeec..7f5072b 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1048,14 +1048,17 @@ static int labpc_ao_insn_read(struct comedi_device *dev,
return 1;
}
-static int labpc_8255_mmio(int dir, int port, int data, unsigned long iobase)
+static int labpc_8255_mmio(int dir, int port, int data, unsigned long arg)
{
+ struct comedi_device *dev = (struct comedi_device *)arg;
+ void __iomem *mmio = (void __iomem *)dev->iobase + DIO_BASE_REG;
+
if (dir) {
- writeb(data, (void __iomem *)(iobase + port));
+ writeb(data, mmio + port);
return 0;
}
- return readb((void __iomem *)(iobase + port));
+ return readb(mmio + port);
}
/* lowlevel write to eeprom/dac */
@@ -1413,9 +1416,13 @@ int labpc_common_attach(struct comedi_device *dev,
/* 8255 dio */
s = &dev->subdevices[2];
- ret = subdev_8255_init(dev, s,
- (board->has_mmio) ? labpc_8255_mmio : NULL,
- dev->iobase + DIO_BASE_REG);
+ if (board->has_mmio) {
+ ret = subdev_8255_init(dev, s, labpc_8255_mmio,
+ (unsigned long)dev);
+ } else {
+ ret = subdev_8255_init(dev, s, NULL,
+ dev->iobase + DIO_BASE_REG);
+ }
if (ret)
return ret;