diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-04-13 20:02:02 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-04-28 20:22:55 +0200 |
commit | 813665564b3d7c74412fe2877520f1d254ce948a (patch) | |
tree | 7a453f74159640f6073c376b237cd408612fd988 /drivers/iio/industrialio-core.c | |
parent | iio: light: tsl2772: Make use of device properties (diff) | |
download | linux-813665564b3d7c74412fe2877520f1d254ce948a.tar.xz linux-813665564b3d7c74412fe2877520f1d254ce948a.zip |
iio: core: Convert to use firmware node handle instead of OF node
Switch the IIO core to use firmware node handle instead of OF node.
This will allow to get label from firmware on non-OF systems.
Note, this doesn't change of_iio_*() APIs for now.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220413180202.19220-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index a8c4e85c2bb5..adf054c7a75e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1907,20 +1907,22 @@ static const struct iio_buffer_setup_ops noop_ring_setup_ops; int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod) { struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); - const char *label; + struct fwnode_handle *fwnode; int ret; if (!indio_dev->info) return -EINVAL; iio_dev_opaque->driver_module = this_mod; - /* 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; - label = of_get_property(indio_dev->dev.of_node, "label", NULL); - if (label) - indio_dev->label = label; + /* If the calling driver did not initialize firmware node, do it here */ + if (dev_fwnode(&indio_dev->dev)) + fwnode = dev_fwnode(&indio_dev->dev); + else + fwnode = dev_fwnode(indio_dev->dev.parent); + device_set_node(&indio_dev->dev, fwnode); + + fwnode_property_read_string(fwnode, "label", &indio_dev->label); ret = iio_check_unique_scan_index(indio_dev); if (ret < 0) |