summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-core.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-02-07 21:09:00 +0400
committerJonathan Cameron <jic23@kernel.org>2013-03-16 14:17:59 +0400
commit17d82b47a215ded05ee3fb8d93b7c1269dbe0083 (patch)
tree9c97b48bad7e01d1450fa8e53a7cb4e688b3d41f /drivers/iio/industrialio-core.c
parentcddc1424f39e7c04045a6431eaf13a003fb8335a (diff)
downloadlinux-17d82b47a215ded05ee3fb8d93b7c1269dbe0083.tar.xz
iio: Add OF support
Provide bindings and parse OF data during initialization. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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 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)
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);