diff options
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 8848f16c547b..6d8b02785647 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) | |||
847 | kfree(indio_dev); | 847 | kfree(indio_dev); |
848 | } | 848 | } |
849 | 849 | ||
850 | static struct device_type iio_dev_type = { | 850 | struct device_type iio_device_type = { |
851 | .name = "iio_device", | 851 | .name = "iio_device", |
852 | .release = iio_dev_release, | 852 | .release = iio_dev_release, |
853 | }; | 853 | }; |
@@ -869,7 +869,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv) | |||
869 | 869 | ||
870 | if (dev) { | 870 | if (dev) { |
871 | dev->dev.groups = dev->groups; | 871 | dev->dev.groups = dev->groups; |
872 | dev->dev.type = &iio_dev_type; | 872 | dev->dev.type = &iio_device_type; |
873 | dev->dev.bus = &iio_bus_type; | 873 | dev->dev.bus = &iio_bus_type; |
874 | device_initialize(&dev->dev); | 874 | device_initialize(&dev->dev); |
875 | dev_set_drvdata(&dev->dev, (void *)dev); | 875 | dev_set_drvdata(&dev->dev, (void *)dev); |
@@ -960,6 +960,10 @@ int iio_device_register(struct iio_dev *indio_dev) | |||
960 | { | 960 | { |
961 | int ret; | 961 | int ret; |
962 | 962 | ||
963 | /* If the calling driver did not initialize of_node, do it here */ | ||
964 | if (!indio_dev->dev.of_node && indio_dev->dev.parent) | ||
965 | indio_dev->dev.of_node = indio_dev->dev.parent->of_node; | ||
966 | |||
963 | /* configure elements for the chrdev */ | 967 | /* configure elements for the chrdev */ |
964 | indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id); | 968 | indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id); |
965 | 969 | ||