From: Jonathan Cameron <jic23@kernel.org>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: lee.jones@linaro.org, robh+dt@kernel.org, lars@metafoo.de,
sre@kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-pm@vger.kernel.org, leonard.crestez@nxp.com,
letux-kernel@openphoenux.org
Subject: Re: [PATCH 3/4] iio: rn5t618: Add devicetree support
Date: Sat, 3 Jul 2021 17:12:00 +0100 [thread overview]
Message-ID: <20210703171200.0b6a4d3b@jic23-huawei> (raw)
In-Reply-To: <20210703084224.31623-4-andreas@kemnade.info>
On Sat, 3 Jul 2021 10:42:23 +0200
Andreas Kemnade <andreas@kemnade.info> wrote:
> Add devicetree support to be able to easily get the channels
> from another device.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> drivers/iio/adc/rn5t618-adc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/rn5t618-adc.c b/drivers/iio/adc/rn5t618-adc.c
> index 7010c4276947..feba19f91574 100644
> --- a/drivers/iio/adc/rn5t618-adc.c
> +++ b/drivers/iio/adc/rn5t618-adc.c
> @@ -12,6 +12,7 @@
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/mfd/rn5t618.h>
> +#include <linux/of_device.h>
Why?
mod_devicetable.h probably the one you want.
> #include <linux/platform_device.h>
> #include <linux/completion.h>
> #include <linux/regmap.h>
> @@ -218,6 +219,7 @@ static int rn5t618_adc_probe(struct platform_device *pdev)
> init_completion(&adc->conv_completion);
>
> iio_dev->name = dev_name(&pdev->dev);
> + iio_dev->dev.of_node = pdev->dev.of_node;
That should (now) be set by the IIO core for you via the devm_iio_device_register()
call below if it's not already set.
> iio_dev->info = &rn5t618_adc_iio_info;
> iio_dev->modes = INDIO_DIRECT_MODE;
> iio_dev->channels = rn5t618_adc_iio_channels;
> @@ -242,9 +244,19 @@ static int rn5t618_adc_probe(struct platform_device *pdev)
> return devm_iio_device_register(adc->dev, iio_dev);
> }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id rn5t618_adc_of_match[] = {
> + { .compatible = "ricoh,rc5t619-adc", },
> + { .compatible = "ricoh,rn5t618-adc", },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, rn5t618_adc_of_match);
> +#endif
> +
> static struct platform_driver rn5t618_adc_driver = {
> .driver = {
> - .name = "rn5t618-adc",
> + .name = "rn5t618-adc",
> + .of_match_table = of_match_ptr(rn5t618_adc_of_match),
Given cost of that table is totally trivial (and I'm trying to get rid
of this pattern in IIO as it's noisy and adds little :) drop the
of_match_ptr protection and the ifdefs above.
> },
> .probe = rn5t618_adc_probe,
> };
next prev parent reply other threads:[~2021-07-03 16:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-03 8:42 [PATCH 0/4] mfd: rn5t618: Extend ADC support Andreas Kemnade
2021-07-03 8:42 ` [PATCH 1/4] dt-bindings: mfd: ricoh,rn5t618: ADC related nodes and properties Andreas Kemnade
2021-07-03 16:02 ` Jonathan Cameron
2021-07-03 16:43 ` Andreas Kemnade
2021-07-12 14:41 ` Rob Herring
2021-07-03 8:42 ` [PATCH 2/4] mfd: rn5t618: Add of compatibles for ADC and power Andreas Kemnade
2021-07-03 16:04 ` Jonathan Cameron
2021-07-03 16:31 ` Andreas Kemnade
2021-07-04 16:17 ` Jonathan Cameron
2021-07-05 7:36 ` Lee Jones
2021-07-05 8:31 ` Jonathan Cameron
2021-07-05 10:03 ` Andreas Kemnade
2021-07-05 7:37 ` Lee Jones
2021-07-03 8:42 ` [PATCH 3/4] iio: rn5t618: Add devicetree support Andreas Kemnade
2021-07-03 16:12 ` Jonathan Cameron [this message]
2021-07-03 8:42 ` [PATCH 4/4] power: supply: rn5t618: Add voltage_now property Andreas Kemnade
2021-07-03 11:41 ` kernel test robot
2021-07-03 14:35 ` kernel test robot
2021-07-03 15:29 ` Andreas Kemnade
2021-07-03 16:12 ` Jonathan Cameron
2021-07-03 15:59 ` [PATCH 0/4] mfd: rn5t618: Extend ADC support Jonathan Cameron
2021-07-03 16:39 ` Andreas Kemnade
2021-07-03 16:55 ` [Letux-kernel] " Andreas Kemnade
2021-07-04 16:10 ` Jonathan Cameron
2021-07-05 11:18 ` Andreas Kemnade
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=20210703171200.0b6a4d3b@jic23-huawei \
--to=jic23@kernel.org \
--cc=andreas@kemnade.info \
--cc=devicetree@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=leonard.crestez@nxp.com \
--cc=letux-kernel@openphoenux.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@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;
as well as URLs for NNTP newsgroup(s).