Commit 0d596bb2 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: core: rename 'dev' -> 'indio_dev' in iio_device_alloc()

The 'dev' variable name usually refers to 'struct device' types. However in
iio_device_alloc() this was used for the 'struct iio_dev' type, which was
sometimes causing minor confusions.

This change renames the variable to 'indio_dev', which is the usual name
used around IIO for 'struct iio_dev' type objects.
It makes grepping a bit easier as well.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-22-alexandru.ardelean@analog.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f73f7f4d
...@@ -1604,7 +1604,7 @@ struct device_type iio_device_type = { ...@@ -1604,7 +1604,7 @@ struct device_type iio_device_type = {
struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
{ {
struct iio_dev_opaque *iio_dev_opaque; struct iio_dev_opaque *iio_dev_opaque;
struct iio_dev *dev; struct iio_dev *indio_dev;
size_t alloc_size; size_t alloc_size;
alloc_size = sizeof(struct iio_dev_opaque); alloc_size = sizeof(struct iio_dev_opaque);
...@@ -1617,31 +1617,31 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) ...@@ -1617,31 +1617,31 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
if (!iio_dev_opaque) if (!iio_dev_opaque)
return NULL; return NULL;
dev = &iio_dev_opaque->indio_dev; indio_dev = &iio_dev_opaque->indio_dev;
dev->priv = (char *)iio_dev_opaque + indio_dev->priv = (char *)iio_dev_opaque +
ALIGN(sizeof(struct iio_dev_opaque), IIO_ALIGN); ALIGN(sizeof(struct iio_dev_opaque), IIO_ALIGN);
dev->dev.parent = parent; indio_dev->dev.parent = parent;
dev->dev.type = &iio_device_type; indio_dev->dev.type = &iio_device_type;
dev->dev.bus = &iio_bus_type; indio_dev->dev.bus = &iio_bus_type;
device_initialize(&dev->dev); device_initialize(&indio_dev->dev);
dev_set_drvdata(&dev->dev, (void *)dev); dev_set_drvdata(&indio_dev->dev, (void *)indio_dev);
mutex_init(&dev->mlock); mutex_init(&indio_dev->mlock);
mutex_init(&dev->info_exist_lock); mutex_init(&indio_dev->info_exist_lock);
INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list); INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list);
dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); indio_dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
if (dev->id < 0) { if (indio_dev->id < 0) {
/* cannot use a dev_err as the name isn't available */ /* cannot use a dev_err as the name isn't available */
pr_err("failed to get device id\n"); pr_err("failed to get device id\n");
kfree(iio_dev_opaque); kfree(iio_dev_opaque);
return NULL; return NULL;
} }
dev_set_name(&dev->dev, "iio:device%d", dev->id); dev_set_name(&indio_dev->dev, "iio:device%d", indio_dev->id);
INIT_LIST_HEAD(&iio_dev_opaque->buffer_list); INIT_LIST_HEAD(&iio_dev_opaque->buffer_list);
INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers); INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers);
return dev; return indio_dev;
} }
EXPORT_SYMBOL(iio_device_alloc); EXPORT_SYMBOL(iio_device_alloc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment