summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-06-24 23:55:14 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-23 21:04:59 (GMT)
commit54db996e6dab51571718e8e97c26fdc695e254ac (patch)
tree807414f92945a7243df7f089fcdeb87bebf390e5 /drivers/staging/comedi/drivers.c
parentb0d67ac7771683b08a29fc21101e785a724cb7a6 (diff)
downloadlinux-fsl-qoriq-54db996e6dab51571718e8e97c26fdc695e254ac.tar.xz
staging: comedi: drivers: introduce comedi_alloc_devpriv()
Introduce a helper function to allocate memory and set the comedi_device private data pointer. 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.c')
-rw-r--r--drivers/staging/comedi/drivers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index e25eba5..87df796 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -57,6 +57,18 @@ static void comedi_clear_hw_dev(struct comedi_device *dev)
dev->hw_dev = NULL;
}
+/**
+ * comedi_alloc_devpriv() - Allocate memory for the device private data.
+ * @dev: comedi_device struct
+ * @size: size of the memory to allocate
+ */
+void *comedi_alloc_devpriv(struct comedi_device *dev, size_t size)
+{
+ dev->private = kzalloc(size, GFP_KERNEL);
+ return dev->private;
+}
+EXPORT_SYMBOL_GPL(comedi_alloc_devpriv);
+
int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices)
{
struct comedi_subdevice *s;