Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54db996e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b0d67ac7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -357,6 +357,7 @@ void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,

/* drivers.c - general comedi driver functions */

void *comedi_alloc_devpriv(struct comedi_device *, size_t);
int comedi_alloc_subdevices(struct comedi_device *, int);

int comedi_load_firmware(struct comedi_device *, struct device *,
+12 −0
Original line number Diff line number Diff line
@@ -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;