All of lore.kernel.org
 help / color / mirror / Atom feed
From: jic23@kernel.org (Jonathan Cameron)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 2/3] iio: adc: meson-saradc: use of_device_get_match_data
Date: Mon, 24 Sep 2018 21:15:20 +0100	[thread overview]
Message-ID: <20180924211520.2e26a4e0@archlinux> (raw)
In-Reply-To: <20180922222102.12023-3-martin.blumenstingl@googlemail.com>

On Sun, 23 Sep 2018 00:21:01 +0200
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:

> This simplifies our _probe function by using of_device_get_match_data
> instead of open-coding it. No functional changes.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/meson_saradc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index b97b06bf7713..9d8f2139debc 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -978,11 +978,11 @@ MODULE_DEVICE_TABLE(of, meson_sar_adc_of_match);
>  
>  static int meson_sar_adc_probe(struct platform_device *pdev)
>  {
> +	const struct meson_sar_adc_data *match_data;
>  	struct meson_sar_adc_priv *priv;
>  	struct iio_dev *indio_dev;
>  	struct resource *res;
>  	void __iomem *base;
> -	const struct of_device_id *match;
>  	int irq, ret;
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
> @@ -994,13 +994,13 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	priv = iio_priv(indio_dev);
>  	init_completion(&priv->done);
>  
> -	match = of_match_device(meson_sar_adc_of_match, &pdev->dev);
> -	if (!match) {
> -		dev_err(&pdev->dev, "failed to match device\n");
> +	match_data = of_device_get_match_data(&pdev->dev);
> +	if (!match_data) {
> +		dev_err(&pdev->dev, "failed to get match data\n");
>  		return -ENODEV;
>  	}
>  
> -	priv->data = match->data;
> +	priv->data = match_data;
>  
>  	indio_dev->name = priv->data->name;
>  	indio_dev->dev.parent = &pdev->dev;

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org, linux-iio@vger.kernel.org,
	knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Subject: Re: [PATCH 2/3] iio: adc: meson-saradc: use of_device_get_match_data
Date: Mon, 24 Sep 2018 21:15:20 +0100	[thread overview]
Message-ID: <20180924211520.2e26a4e0@archlinux> (raw)
In-Reply-To: <20180922222102.12023-3-martin.blumenstingl@googlemail.com>

On Sun, 23 Sep 2018 00:21:01 +0200
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:

> This simplifies our _probe function by using of_device_get_match_data
> instead of open-coding it. No functional changes.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/meson_saradc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index b97b06bf7713..9d8f2139debc 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -978,11 +978,11 @@ MODULE_DEVICE_TABLE(of, meson_sar_adc_of_match);
>  
>  static int meson_sar_adc_probe(struct platform_device *pdev)
>  {
> +	const struct meson_sar_adc_data *match_data;
>  	struct meson_sar_adc_priv *priv;
>  	struct iio_dev *indio_dev;
>  	struct resource *res;
>  	void __iomem *base;
> -	const struct of_device_id *match;
>  	int irq, ret;
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
> @@ -994,13 +994,13 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	priv = iio_priv(indio_dev);
>  	init_completion(&priv->done);
>  
> -	match = of_match_device(meson_sar_adc_of_match, &pdev->dev);
> -	if (!match) {
> -		dev_err(&pdev->dev, "failed to match device\n");
> +	match_data = of_device_get_match_data(&pdev->dev);
> +	if (!match_data) {
> +		dev_err(&pdev->dev, "failed to get match data\n");
>  		return -ENODEV;
>  	}
>  
> -	priv->data = match->data;
> +	priv->data = match_data;
>  
>  	indio_dev->name = priv->data->name;
>  	indio_dev->dev.parent = &pdev->dev;

  reply	other threads:[~2018-09-24 20:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-22 22:20 [PATCH 0/3] meson-saradc: small code improvements Martin Blumenstingl
2018-09-22 22:20 ` Martin Blumenstingl
2018-09-22 22:21 ` [PATCH 1/3] iio: adc: meson-saradc: remove #define MESON_SAR_ADC_DELTA_10_TS_C_SHIFT Martin Blumenstingl
2018-09-22 22:21   ` Martin Blumenstingl
2018-09-24 20:13   ` Jonathan Cameron
2018-09-24 20:13     ` Jonathan Cameron
2018-09-22 22:21 ` [PATCH 2/3] iio: adc: meson-saradc: use of_device_get_match_data Martin Blumenstingl
2018-09-22 22:21   ` Martin Blumenstingl
2018-09-24 20:15   ` Jonathan Cameron [this message]
2018-09-24 20:15     ` Jonathan Cameron
2018-09-22 22:21 ` [PATCH 3/3] iio: adc: meson-saradc: simplify access to meson_sar_adc_param Martin Blumenstingl
2018-09-22 22:21   ` Martin Blumenstingl
2018-09-24 20:17   ` Jonathan Cameron
2018-09-24 20:17     ` 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=20180924211520.2e26a4e0@archlinux \
    --to=jic23@kernel.org \
    --cc=linus-amlogic@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.