diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-10-15 10:15:52 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 12:00:54 -0700 |
commit | 9a1a6cf8ae5ca58171e117335b9983e3cfa2185c (patch) | |
tree | e5bfb37438374575edc2b7e28a997b9f869ae382 /drivers/staging/comedi/drivers/skel.c | |
parent | staging: comedi: ni_mio_common: remove devpriv macro (diff) | |
download | linux-dev-9a1a6cf8ae5ca58171e117335b9983e3cfa2185c.tar.xz linux-dev-9a1a6cf8ae5ca58171e117335b9983e3cfa2185c.zip |
staging: comedi: drivers: remove remaining devpriv macros
The remaining comedi drivers that still have a devpriv macro
are all pretty straight forward for removing the devpriv
macro.
This macro relies on a local variable having a specific name.
Remove its use by replacing it with a local variable where
used.
The inline function alloc_private(), used to kzalloc the
dev->private memory, returns non-zero if there is an error.
Fix all the alloc_private() calls accordingly and remove any
kernel messages or obvious comments that still exist in the
drivers. Leave a comment in the skel driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/skel.c')
-rw-r--r-- | drivers/staging/comedi/drivers/skel.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index b70cdf300bbd..d2ef7db62479 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -146,12 +146,6 @@ struct skel_private { }; /* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct skel_private *)dev->private) - -/* * The struct comedi_driver structure tells the Comedi core module * which functions to call to configure/deconfigure (attach/detach) * the board, and also about the kernel module that contains @@ -211,6 +205,7 @@ static int skel_ns_to_timer(unsigned int *ns, int round); */ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + struct skel_private *devpriv; struct comedi_subdevice *s; int ret; @@ -229,12 +224,11 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ dev->board_name = thisboard->name; -/* - * Allocate the private structure area. alloc_private() is a - * convenient macro defined in comedidev.h. - */ - if (alloc_private(dev, sizeof(struct skel_private)) < 0) - return -ENOMEM; + /* Allocate the private data */ + ret = alloc_private(dev, sizeof(*devpriv)); + if (ret) + return ret; + devpriv = dev->private; ret = comedi_alloc_subdevices(dev, 3); if (ret) @@ -504,6 +498,7 @@ static int skel_ns_to_timer(unsigned int *ns, int round) static int skel_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct skel_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -525,6 +520,7 @@ static int skel_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, static int skel_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct skel_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); |