diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-03 22:01:50 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 18:36:02 (GMT) |
commit | 472dfe77b91d8026c3ccda22c60db0e92bc27863 (patch) | |
tree | 8b3e7d5062921c59e710c770a368a3d26858e47f /drivers/staging/comedi/kcomedilib | |
parent | 3781bc5425f985c2ceffa3b2111e1d0eeb38cc24 (diff) | |
download | linux-fsl-qoriq-472dfe77b91d8026c3ccda22c60db0e92bc27863.tar.xz |
Staging: comedi: kcomedilib: make it typesafe
If we really are passing in a struct comedi_device, then say we are,
don't mess around with void pointers for no reason.
This also fixes up the comedi_bond.c driver, which is the only
user of the kcomedilib code.
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/comedi/kcomedilib')
-rw-r--r-- | drivers/staging/comedi/kcomedilib/kcomedilib_main.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index fa0db41..863aae4 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -41,7 +41,7 @@ MODULE_AUTHOR("David Schleef <ds@schleef.org>"); MODULE_DESCRIPTION("Comedi kernel library"); MODULE_LICENSE("GPL"); -void *comedi_open(const char *filename) +struct comedi_device *comedi_open(const char *filename) { struct comedi_device_file_info *dev_file_info; struct comedi_device *dev; @@ -66,11 +66,11 @@ void *comedi_open(const char *filename) if (!try_module_get(dev->driver->module)) return NULL; - return (void *)dev; + return dev; } EXPORT_SYMBOL(comedi_open); -int comedi_close(void *d) +int comedi_close(struct comedi_device *d) { struct comedi_device *dev = (struct comedi_device *)d; @@ -132,8 +132,8 @@ error: return ret; } -int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan, - unsigned int io) +int comedi_dio_config(struct comedi_device *dev, unsigned int subdev, + unsigned int chan, unsigned int io) { struct comedi_insn insn; @@ -148,8 +148,8 @@ int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan, } EXPORT_SYMBOL(comedi_dio_config); -int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask, - unsigned int *bits) +int comedi_dio_bitfield(struct comedi_device *dev, unsigned int subdev, + unsigned int mask, unsigned int *bits) { struct comedi_insn insn; unsigned int data[2]; @@ -172,10 +172,9 @@ int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask, } EXPORT_SYMBOL(comedi_dio_bitfield); -int comedi_find_subdevice_by_type(void *d, int type, unsigned int subd) +int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, + unsigned int subd) { - struct comedi_device *dev = (struct comedi_device *)d; - if (subd > dev->n_subdevices) return -ENODEV; @@ -187,9 +186,8 @@ int comedi_find_subdevice_by_type(void *d, int type, unsigned int subd) } EXPORT_SYMBOL(comedi_find_subdevice_by_type); -int comedi_get_n_channels(void *d, unsigned int subdevice) +int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) { - struct comedi_device *dev = (struct comedi_device *)d; struct comedi_subdevice *s = dev->subdevices + subdevice; return s->n_chan; |