summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-08-12 22:41:19 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-08-16 23:23:25 +0400
commit09d6dd7490ee7f1dda926e309df370e28679a71c (patch)
treeccf3c54cb2ba0aa2828f93ca955cf02abbb03f26 /drivers
parent4f9c63fe5333b27ab23ed399830c7977f6970744 (diff)
downloadlinux-09d6dd7490ee7f1dda926e309df370e28679a71c.tar.xz
staging: comedi: 8255: add a comedi_device param to the (*io) callback
The 8255 driver uses an (*io) callback to read/write the registers of the 8255 device. The default callback provided by the driver uses inb()/outb() calls to access to registers based on an 'iobase' that was initialized during the subdev_8255_init() and a 'port' value. The users of this module can optionally provide a custom (*io) callback to handle the read/write in another manner. Make the (*io) callback a bit more flexible by also passing the comedi_device pointer as a parameter. 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/8255.c33
-rw-r--r--drivers/staging/comedi/drivers/8255.h6
-rw-r--r--drivers/staging/comedi/drivers/8255_pci.c3
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas64.c6
-rw-r--r--drivers/staging/comedi/drivers/daqboard2000.c3
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c3
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c3
-rw-r--r--drivers/staging/comedi/drivers/pcl724.c3
8 files changed, 36 insertions, 24 deletions
diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index a33a19622745..212e547ba77f 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -94,10 +94,11 @@ I/O port base address can be found in the output of 'lspci -v'.
struct subdev_8255_private {
unsigned long iobase;
- int (*io)(int, int, int, unsigned long);
+ int (*io)(struct comedi_device *, int, int, int, unsigned long);
};
-static int subdev_8255_io(int dir, int port, int data, unsigned long iobase)
+static int subdev_8255_io(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long iobase)
{
if (dir) {
outb(data, iobase + port);
@@ -113,8 +114,8 @@ void subdev_8255_interrupt(struct comedi_device *dev,
unsigned long iobase = spriv->iobase;
unsigned short d;
- d = spriv->io(0, _8255_DATA, 0, iobase);
- d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);
+ d = spriv->io(dev, 0, _8255_DATA, 0, iobase);
+ d |= (spriv->io(dev, 0, _8255_DATA + 1, 0, iobase) << 8);
comedi_buf_put(s, d);
s->async->events |= COMEDI_CB_EOS;
@@ -136,18 +137,18 @@ static int subdev_8255_insn(struct comedi_device *dev,
mask = comedi_dio_update_state(s, data);
if (mask) {
if (mask & 0xff)
- spriv->io(1, _8255_DATA, s->state & 0xff, iobase);
+ spriv->io(dev, 1, _8255_DATA, s->state & 0xff, iobase);
if (mask & 0xff00)
- spriv->io(1, _8255_DATA + 1, (s->state >> 8) & 0xff,
- iobase);
+ spriv->io(dev, 1, _8255_DATA + 1,
+ (s->state >> 8) & 0xff, iobase);
if (mask & 0xff0000)
- spriv->io(1, _8255_DATA + 2, (s->state >> 16) & 0xff,
- iobase);
+ spriv->io(dev, 1, _8255_DATA + 2,
+ (s->state >> 16) & 0xff, iobase);
}
- v = spriv->io(0, _8255_DATA, 0, iobase);
- v |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);
- v |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16);
+ v = spriv->io(dev, 0, _8255_DATA, 0, iobase);
+ v |= (spriv->io(dev, 0, _8255_DATA + 1, 0, iobase) << 8);
+ v |= (spriv->io(dev, 0, _8255_DATA + 2, 0, iobase) << 16);
data[1] = v;
@@ -172,7 +173,7 @@ static void subdev_8255_do_config(struct comedi_device *dev,
if (!(s->io_bits & 0xf00000))
config |= CR_C_HI_IO;
- spriv->io(1, _8255_CR, config, iobase);
+ spriv->io(dev, 1, _8255_CR, config, iobase);
}
static int subdev_8255_insn_config(struct comedi_device *dev,
@@ -261,7 +262,8 @@ static int subdev_8255_cancel(struct comedi_device *dev,
}
int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
unsigned long iobase)
{
struct subdev_8255_private *spriv;
@@ -288,7 +290,8 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
EXPORT_SYMBOL_GPL(subdev_8255_init);
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
unsigned long iobase)
{
int ret;
diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h
index 795d232a6c02..c2c20db2f1d0 100644
--- a/drivers/staging/comedi/drivers/8255.h
+++ b/drivers/staging/comedi/drivers/8255.h
@@ -22,10 +22,12 @@
#include "../comedidev.h"
int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
unsigned long iobase);
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
unsigned long iobase);
void subdev_8255_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s);
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c
index f21e6567ac2f..cee3d18370fa 100644
--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -190,7 +190,8 @@ static int pci_8255_mite_init(struct pci_dev *pcidev)
return 0;
}
-static int pci_8255_mmio(int dir, int port, int data, unsigned long iobase)
+static int pci_8255_mmio(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long iobase)
{
void __iomem *mmio_base = (void __iomem *)iobase;
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index fa12614cef2a..fafde70cbb51 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -3369,7 +3369,8 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}
-static int dio_callback(int dir, int port, int data, unsigned long arg)
+static int dio_callback(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long arg)
{
void __iomem *iobase = (void __iomem *)arg;
@@ -3380,7 +3381,8 @@ static int dio_callback(int dir, int port, int data, unsigned long arg)
return readb(iobase + port);
}
-static int dio_callback_4020(int dir, int port, int data, unsigned long arg)
+static int dio_callback_4020(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long arg)
{
void __iomem *iobase = (void __iomem *)arg;
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
index cd369cd40114..d728fbd6d3a0 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -651,7 +651,8 @@ static void daqboard2000_initializeDac(struct comedi_device *dev)
daqboard2000_dacDisarm(dev);
}
-static int daqboard2000_8255_cb(int dir, int port, int data,
+static int daqboard2000_8255_cb(struct comedi_device *dev,
+ int dir, int port, int data,
unsigned long ioaddr)
{
void __iomem *mmio_base = (void __iomem *)ioaddr;
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 126d65cb39f2..fa108b9dd603 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1035,7 +1035,8 @@ 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 arg)
+static int labpc_8255_mmio(struct comedi_device *cdev,
+ int dir, int port, int data, unsigned long arg)
{
struct comedi_device *dev = (struct comedi_device *)arg;
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 297c95d2e0a3..07659053f4d3 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -4176,7 +4176,8 @@ static int ni_freq_out_insn_config(struct comedi_device *dev,
return insn->n;
}
-static int ni_8255_callback(int dir, int port, int data, unsigned long arg)
+static int ni_8255_callback(struct comedi_device *cdev,
+ int dir, int port, int data, unsigned long arg)
{
struct comedi_device *dev = (struct comedi_device *)arg;
diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c
index c7f8eb1cf8de..946b058eee6f 100644
--- a/drivers/staging/comedi/drivers/pcl724.c
+++ b/drivers/staging/comedi/drivers/pcl724.c
@@ -81,7 +81,8 @@ static const struct pcl724_board boardtypes[] = {
},
};
-static int pcl724_8255mapped_io(int dir, int port, int data,
+static int pcl724_8255mapped_io(struct comedi_device *dev,
+ int dir, int port, int data,
unsigned long iobase)
{
int movport = SIZE_8255 * (iobase >> 12);