From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v1 1/1] iio: core: Convert to use firmware node handle instead of OF node
Date: Sat, 16 Apr 2022 12:17:08 +0100 [thread overview]
Message-ID: <20220416121708.37018ce9@jic23-huawei> (raw)
In-Reply-To: <20220413180202.19220-1-andriy.shevchenko@linux.intel.com>
On Wed, 13 Apr 2022 21:02:02 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 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>
Applied to the togreg branch of iio.git and pushed out as testing for
0-day to poke at this and see if we missed anything.
Thanks,
Jonathan
> ---
> drivers/iio/industrialio-core.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 2f48e9a97274..ffbe76806e07 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1893,20 +1893,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)
prev parent reply other threads:[~2022-04-16 11:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 18:02 [PATCH v1 1/1] iio: core: Convert to use firmware node handle instead of OF node Andy Shevchenko
2022-04-13 18:07 ` Andy Shevchenko
2022-04-14 7:17 ` Nuno Sá
2022-04-14 12:53 ` Andy Shevchenko
2022-04-16 11:17 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220416121708.37018ce9@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox