diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-08-12 11:41:26 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-08-16 12:23:26 -0700 |
commit | 4085e93b9fecfad454159694c19efc36e7ac1cdf (patch) | |
tree | e53ed74de9d0b56b77c95019c1cab3d2128cd07f /drivers/staging/comedi/drivers/8255.h | |
parent | 2b1a3fcfdf4067290cafffb5bc348c158e170fd7 (diff) |
staging: comedi: 8255: refactor how the (*io) function works
Currently, all users of is module that use the default (*io) function
pass an 'iobase' to subdev_8255_init() of the form:
dev->iobase + OFFSET_TO_8255_BASE_REG
Now that the (*io) callback includes the comedi_device 'dev' pointer
the 'dev->iobase' does not need to be included.
Modify the default (*io) function, subdev_8255_io(), to automatically
add the dev->iobase to the address when reading/writing the port.
For aesthetics, rename the subdevice private data member to 'regbase'.
Also, rename the local variables in this module that are used to
access this member.
Add a comment in dev_8255_attach() about the 'iobase' that is passed
to subdev_8255_init(). For manually attached 8255 devices the io
region is requested with __comedi_request_region() which does not
set dev->iobase. For these devices the 'regbase' is actually the
'iobase'.
Remove the, now unnecessary, dev->iobase from all the callers of
subdev_8255_init(). There are a couple drivers that only passed the
dev->iobase. For those drivers pass a 'regbase' of 0x00.
Note that the das16m1 driver is a bit goofy. The devpriv->extra_iobase
is requested using __comedi_request_region() which does not set the
dev->iobase. But the starting address passed is dev->iobase + DAS16M1_82C55
so a 'regbase' of DAS16M1_82C55 is passed to subdev_8255_init().
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/8255.h')
-rw-r--r-- | drivers/staging/comedi/drivers/8255.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h index c2c20db2f1d0..978f0a7f8c1f 100644 --- a/drivers/staging/comedi/drivers/8255.h +++ b/drivers/staging/comedi/drivers/8255.h @@ -24,11 +24,11 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*io)(struct comedi_device *, int, int, int, unsigned long), - unsigned long iobase); + unsigned long regbase); int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*io)(struct comedi_device *, int, int, int, unsigned long), - unsigned long iobase); + unsigned long regbase); void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s); |