summaryrefslogtreecommitdiffstats
path: root/drivers/iio/industrialio-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r--drivers/iio/industrialio-core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 8848f16c547..6d8b0278564 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -847,7 +847,7 @@ static void iio_dev_release(struct device *device)
kfree(indio_dev);
}
-static struct device_type iio_dev_type = {
+struct device_type iio_device_type = {
.name = "iio_device",
.release = iio_dev_release,
};
@@ -869,7 +869,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
if (dev) {
dev->dev.groups = dev->groups;
- dev->dev.type = &iio_dev_type;
+ dev->dev.type = &iio_device_type;
dev->dev.bus = &iio_bus_type;
device_initialize(&dev->dev);
dev_set_drvdata(&dev->dev, (void *)dev);
@@ -960,6 +960,10 @@ int iio_device_register(struct iio_dev *indio_dev)
{
int ret;
+ /* If the calling driver did not initialize of_node, do it here */
+ if (!indio_dev->dev.of_node && indio_dev->dev.parent)
+ indio_dev->dev.of_node = indio_dev->dev.parent->of_node;
+
/* configure elements for the chrdev */
indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);