diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-02-07 12:09:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-03-16 06:17:59 -0400 |
commit | 17d82b47a215ded05ee3fb8d93b7c1269dbe0083 (patch) | |
tree | 9c97b48bad7e01d1450fa8e53a7cb4e688b3d41f /drivers/iio/industrialio-core.c | |
parent | cddc1424f39e7c04045a6431eaf13a003fb8335a (diff) |
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.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 | ||