All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Chris Healy <cphealy@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] iio: imx7d_adc: Add local struct device pointer in imx7d_adc_probe()
Date: Mon, 22 Apr 2019 11:34:42 +0100	[thread overview]
Message-ID: <20190422113442.57645818@archlinux> (raw)
In-Reply-To: <20190414183504.23286-2-andrew.smirnov@gmail.com>

On Sun, 14 Apr 2019 11:34:59 -0700
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> Use a local "struct device *dev" in imx7d_adc_probe() for brevity. No
> functional change intended.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: linux-iio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
I applied some of these from V1.  Please be sure to only send updates
of patches that were not applied.

Thanks

Jonathan

> ---
>  drivers/iio/adc/imx7d_adc.c | 37 ++++++++++++++++++-------------------
>  1 file changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
> index ad6764fb2a23..3bbd657409d5 100644
> --- a/drivers/iio/adc/imx7d_adc.c
> +++ b/drivers/iio/adc/imx7d_adc.c
> @@ -438,51 +438,51 @@ static int imx7d_adc_probe(struct platform_device *pdev)
>  	struct imx7d_adc *info;
>  	struct iio_dev *indio_dev;
>  	struct resource *mem;
> +	struct device *dev = &pdev->dev;
>  	int irq;
>  	int ret;
>  
> -	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info));
> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*info));
>  	if (!indio_dev) {
>  		dev_err(&pdev->dev, "Failed allocating iio device\n");
>  		return -ENOMEM;
>  	}
>  
>  	info = iio_priv(indio_dev);
> -	info->dev = &pdev->dev;
> +	info->dev = dev;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	info->regs = devm_ioremap_resource(&pdev->dev, mem);
> +	info->regs = devm_ioremap_resource(dev, mem);
>  	if (IS_ERR(info->regs)) {
>  		ret = PTR_ERR(info->regs);
> -		dev_err(&pdev->dev,
> -			"Failed to remap adc memory, err = %d\n", ret);
> +		dev_err(dev, "Failed to remap adc memory, err = %d\n", ret);
>  		return ret;
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
> -		dev_err(&pdev->dev, "No irq resource?\n");
> +		dev_err(dev, "No irq resource?\n");
>  		return irq;
>  	}
>  
> -	info->clk = devm_clk_get(&pdev->dev, "adc");
> +	info->clk = devm_clk_get(dev, "adc");
>  	if (IS_ERR(info->clk)) {
>  		ret = PTR_ERR(info->clk);
> -		dev_err(&pdev->dev, "Failed getting clock, err = %d\n", ret);
> +		dev_err(dev, "Failed getting clock, err = %d\n", ret);
>  		return ret;
>  	}
>  
> -	info->vref = devm_regulator_get(&pdev->dev, "vref");
> +	info->vref = devm_regulator_get(dev, "vref");
>  	if (IS_ERR(info->vref)) {
>  		ret = PTR_ERR(info->vref);
> -		dev_err(&pdev->dev,
> +		dev_err(dev,
>  			"Failed getting reference voltage, err = %d\n", ret);
>  		return ret;
>  	}
>  
>  	ret = regulator_enable(info->vref);
>  	if (ret) {
> -		dev_err(&pdev->dev,
> +		dev_err(dev,
>  			"Can't enable adc reference top voltage, err = %d\n",
>  			ret);
>  		return ret;
> @@ -492,8 +492,8 @@ static int imx7d_adc_probe(struct platform_device *pdev)
>  
>  	init_completion(&info->completion);
>  
> -	indio_dev->name = dev_name(&pdev->dev);
> -	indio_dev->dev.parent = &pdev->dev;
> +	indio_dev->name = dev_name(dev);
> +	indio_dev->dev.parent = dev;
>  	indio_dev->info = &imx7d_adc_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = imx7d_adc_iio_channels;
> @@ -501,16 +501,15 @@ static int imx7d_adc_probe(struct platform_device *pdev)
>  
>  	ret = clk_prepare_enable(info->clk);
>  	if (ret) {
> -		dev_err(&pdev->dev,
> -			"Could not prepare or enable the clock.\n");
> +		dev_err(dev, "Could not prepare or enable the clock.\n");
>  		goto error_adc_clk_enable;
>  	}
>  
> -	ret = devm_request_irq(info->dev, irq,
> -				imx7d_adc_isr, 0,
> -				dev_name(&pdev->dev), info);
> +	ret = devm_request_irq(dev, irq,
> +			       imx7d_adc_isr, 0,
> +			       dev_name(dev), info);
>  	if (ret < 0) {
> -		dev_err(&pdev->dev, "Failed requesting irq, irq = %d\n", irq);
> +		dev_err(dev, "Failed requesting irq, irq = %d\n", irq);
>  		goto error_iio_device_register;
>  	}
>  


  reply	other threads:[~2019-04-22 10:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 18:34 [PATCH v2 0/6] i.MX7D ADC improvements Andrey Smirnov
2019-04-14 18:34 ` [PATCH v2 1/6] iio: imx7d_adc: Add local struct device pointer in imx7d_adc_probe() Andrey Smirnov
2019-04-22 10:34   ` Jonathan Cameron [this message]
2019-04-14 18:35 ` [PATCH v2 2/6] iio: imx7d_adc: Replace pr_err with dev_err Andrey Smirnov
2019-04-14 18:35 ` [PATCH v2 3/6] iio: imx7d_adc: Use devm_platform_ioremap_resource() Andrey Smirnov
2019-04-14 18:35 ` [PATCH v2 4/6] iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume() Andrey Smirnov
2019-04-22 10:07   ` Jonathan Cameron
2019-04-14 18:35 ` [PATCH v2 5/6] iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend() Andrey Smirnov
2019-04-22 10:08   ` Jonathan Cameron
2019-04-14 18:35 ` [PATCH v2 6/6] iio: imx7d_adc: Use devm_iio_device_register() Andrey Smirnov
2019-04-22 10:09   ` 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=20190422113442.57645818@archlinux \
    --to=jic23@kernel.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=cphealy@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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.