From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio <linux-iio@vger.kernel.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Quentin Schulz <quentin.schulz@bootlin.com>
Subject: Re: [PATCH v2 1/5] iio:adc:axp20x: Convert from OF to generic fw / device properties
Date: Tue, 21 Jul 2020 21:29:02 +0300 [thread overview]
Message-ID: <CAHp75VehvPa3Z-or4zGmEOgj-+8cXfJSj5w-ghbnCSVPumyPTQ@mail.gmail.com> (raw)
In-Reply-To: <20200721171444.825099-2-jic23@kernel.org>
On Tue, Jul 21, 2020 at 8:16 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Whilst fairly unlikely anyone will ever use this driver with anything
> other than DT, we are trying to move IIO over to the generic interfaces
> where easy to do so.
>
> In this case this involved moving to generic check on presence
> of fw_node, generic device_get_match_data and dropping the of_match_ptr
Please refer to the
- fwnode
- function()
as established practice in the documentation (and thus commit messages).
> protection. Also relevant header changes to have property.h and
> mod_devicetable.h only.
>
> Also drop the casting away of a const in favour of retaining
> the const throughout.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> ---
> v1->v2
>
> * Avoid the casting away of const by keeping it const throughout.
>
> drivers/iio/adc/axp20x_adc.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
> index 798ff2d89691..3e0c0233b431 100644
> --- a/drivers/iio/adc/axp20x_adc.c
> +++ b/drivers/iio/adc/axp20x_adc.c
> @@ -9,10 +9,10 @@
> #include <linux/interrupt.h>
> #include <linux/io.h>
> #include <linux/module.h>
> -#include <linux/of.h>
> -#include <linux/of_device.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> @@ -67,7 +67,7 @@ struct axp_data;
>
> struct axp20x_adc_iio {
> struct regmap *regmap;
> - struct axp_data *data;
> + const struct axp_data *data;
> };
>
> enum axp20x_adc_channel_v {
> @@ -670,15 +670,15 @@ static int axp20x_probe(struct platform_device *pdev)
> info->regmap = axp20x_dev->regmap;
> indio_dev->modes = INDIO_DIRECT_MODE;
>
> - if (!pdev->dev.of_node) {
> + if (!dev_fwnode(&pdev->dev)) {
After the below change I think you may use positive conditional.
> const struct platform_device_id *id;
>
> id = platform_get_device_id(pdev);
> - info->data = (struct axp_data *)id->driver_data;
> + info->data = (const struct axp_data *)id->driver_data;
> } else {
> struct device *dev = &pdev->dev;
This is probably good to have for the entire ->probe(). Or drop it
here completely.
> - info->data = (struct axp_data *)of_device_get_match_data(dev);
> + info->data = device_get_match_data(dev);
> }
>
> indio_dev->name = platform_get_device_id(pdev)->name;
> @@ -742,7 +742,7 @@ static int axp20x_remove(struct platform_device *pdev)
> static struct platform_driver axp20x_adc_driver = {
> .driver = {
> .name = "axp20x-adc",
> - .of_match_table = of_match_ptr(axp20x_adc_of_match),
> + .of_match_table = axp20x_adc_of_match,
> },
> .id_table = axp20x_adc_id_match,
> .probe = axp20x_probe,
> --
> 2.27.0
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-07-21 18:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 17:14 [PATCH v2 0/5] iio:adc more of_match_ptr and similar removal Jonathan Cameron
2020-07-21 17:14 ` [PATCH v2 1/5] iio:adc:axp20x: Convert from OF to generic fw / device properties Jonathan Cameron
2020-07-21 18:29 ` Andy Shevchenko [this message]
2020-07-21 17:14 ` [PATCH v2 2/5] iio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official Jonathan Cameron
2020-07-21 18:30 ` Andy Shevchenko
2020-08-09 14:09 ` Jonathan Cameron
2021-09-02 9:23 ` Jonathan Cameron
2021-09-02 10:03 ` Andy Shevchenko
2020-07-21 17:14 ` [PATCH v2 3/5] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
2020-07-21 18:31 ` Andy Shevchenko
2020-08-09 14:08 ` Jonathan Cameron
2020-07-21 17:14 ` [PATCH v2 4/5] iio:adc:ti-adc128s052: drop of_match_ptr protection Jonathan Cameron
2020-07-21 18:32 ` Andy Shevchenko
2020-08-09 14:07 ` Jonathan Cameron
2020-07-21 17:14 ` [PATCH v2 5/5] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h Jonathan Cameron
2020-07-21 18:34 ` Andy Shevchenko
2020-08-09 14:05 ` Jonathan Cameron
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=CAHp75VehvPa3Z-or4zGmEOgj-+8cXfJSj5w-ghbnCSVPumyPTQ@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=quentin.schulz@bootlin.com \
/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).