Linux-IIO Archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH v2 1/1] iio: adc: twl4030-madc: Make use of device properties
Date: Sun, 10 Mar 2024 15:16:54 +0000	[thread overview]
Message-ID: <20240310151654.754c5da0@jic23-huawei> (raw)
In-Reply-To: <20240304144037.1036390-1-andriy.shevchenko@linux.intel.com>

On Mon,  4 Mar 2024 16:40:06 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
> 
> Include mod_devicetable.h explicitly to replace the dropped of.h
> which included mod_devicetable.h indirectly.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks Andy,

Applied this to the togreg-cleanup branch of iio.git.

I wondered whether there were any users of the platform_data /
board file path left. Seems that the support for the parent mfd
platform data was ripped out by Uwe in 2022 but not the sub drivers.

Anyone want to do the work to drop it from here and the other sub drivers?

Jonathan

> ---
> v2: converted leftover (Jonathan)
>  drivers/iio/adc/twl4030-madc.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 4a247ca25a44..0253064fadec 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -19,10 +19,12 @@
>  #include <linux/interrupt.h>
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/property.h>
>  #include <linux/slab.h>
>  #include <linux/mfd/twl.h>
> -#include <linux/module.h>
>  #include <linux/stddef.h>
>  #include <linux/mutex.h>
>  #include <linux/bitops.h>
> @@ -30,7 +32,6 @@
>  #include <linux/types.h>
>  #include <linux/gfp.h>
>  #include <linux/err.h>
> -#include <linux/of.h>
>  #include <linux/regulator/consumer.h>
>  
>  #include <linux/iio/iio.h>
> @@ -744,14 +745,14 @@ static int twl4030_madc_set_power(struct twl4030_madc_data *madc, int on)
>   */
>  static int twl4030_madc_probe(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
> +	struct twl4030_madc_platform_data *pdata = dev_get_platdata(dev);
>  	struct twl4030_madc_data *madc;
> -	struct twl4030_madc_platform_data *pdata = dev_get_platdata(&pdev->dev);
> -	struct device_node *np = pdev->dev.of_node;
>  	int irq, ret;
>  	u8 regval;
>  	struct iio_dev *iio_dev = NULL;
>  
> -	if (!pdata && !np) {
> +	if (!pdata && !dev_fwnode(dev)) {
>  		dev_err(&pdev->dev, "neither platform data nor Device Tree node available\n");
>  		return -EINVAL;
>  	}
> @@ -779,7 +780,7 @@ static int twl4030_madc_probe(struct platform_device *pdev)
>  	if (pdata)
>  		madc->use_second_irq = (pdata->irq_line != 1);
>  	else
> -		madc->use_second_irq = of_property_read_bool(np,
> +		madc->use_second_irq = device_property_read_bool(dev,
>  				       "ti,system-uses-second-madc-irq");
>  
>  	madc->imr = madc->use_second_irq ? TWL4030_MADC_IMR2 :
> @@ -905,20 +906,18 @@ static void twl4030_madc_remove(struct platform_device *pdev)
>  	regulator_disable(madc->usb3v1);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id twl_madc_of_match[] = {
>  	{ .compatible = "ti,twl4030-madc", },
> -	{ },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(of, twl_madc_of_match);
> -#endif
>  
>  static struct platform_driver twl4030_madc_driver = {
>  	.probe = twl4030_madc_probe,
>  	.remove_new = twl4030_madc_remove,
>  	.driver = {
>  		   .name = "twl4030_madc",
> -		   .of_match_table = of_match_ptr(twl_madc_of_match),
> +		   .of_match_table = twl_madc_of_match,
>  	},
>  };
>  


      reply	other threads:[~2024-03-10 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 14:40 [PATCH v2 1/1] iio: adc: twl4030-madc: Make use of device properties Andy Shevchenko
2024-03-10 15:16 ` 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=20240310151654.754c5da0@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).