summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-03-07 20:40:56 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-17 19:38:52 (GMT)
commit6fe9bb6705f14bc4e72744c6efe95faf6ce0c778 (patch)
tree1999e6720c9f28e77a51f07209eb611b2b279616 /drivers
parent050389f5eb81180410f3033306c5f7d9f7f362a8 (diff)
downloadlinux-6fe9bb6705f14bc4e72744c6efe95faf6ce0c778.tar.xz
staging: comedi: jr3_pci: use comedi_alloc_spriv()
Use the helper function to allocate the subdevice private data. This sets the s->private variable for us and allows the comedi core to automatically kfree() the memory during the (*detach). 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')
-rw-r--r--drivers/staging/comedi/drivers/jr3_pci.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index bfb0a13..f1028b8 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -687,12 +687,10 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
s->n_chan = 8 * 7 + 2;
s->insn_read = jr3_pci_ai_insn_read;
- p = kzalloc(sizeof(*p), GFP_KERNEL);
+ p = comedi_alloc_spriv(s, sizeof(*p));
if (p) {
int j;
- s->private = p;
-
p->channel = &devpriv->iobase->channel[i].data;
dev_dbg(dev->class_dev, "p->channel %p %p (%tx)\n",
p->channel, devpriv->iobase,
@@ -780,16 +778,11 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
static void jr3_pci_detach(struct comedi_device *dev)
{
- int i;
struct jr3_pci_dev_private *devpriv = dev->private;
if (devpriv) {
del_timer_sync(&devpriv->timer);
- if (dev->subdevices) {
- for (i = 0; i < devpriv->n_channels; i++)
- kfree(dev->subdevices[i].private);
- }
if (devpriv->iobase)
iounmap(devpriv->iobase);
}