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 5/6] iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend()
Date: Mon, 22 Apr 2019 11:08:50 +0100	[thread overview]
Message-ID: <20190422110850.0c710e47@archlinux> (raw)
In-Reply-To: <20190414183504.23286-6-andrew.smirnov@gmail.com>

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

> Since imx7d_adc_remove() does exactly the same thing as
> imx7d_adc_suspend() we can use the latter together with
> devm_add_action_or_reset() to simplify the former. Rename
> imx7d_adc_suspend() to imx7d_adc_disable() for clarity while at it.
> 
> 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
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to see if they can find anything we missed.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/imx7d_adc.c | 46 +++++++++++++++++++------------------
>  1 file changed, 24 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
> index 0922ee08546b..c5b0dc7d0e49 100644
> --- a/drivers/iio/adc/imx7d_adc.c
> +++ b/drivers/iio/adc/imx7d_adc.c
> @@ -461,6 +461,24 @@ static int imx7d_adc_enable(struct device *dev)
>  	return 0;
>  }
>  
> +static int imx7d_adc_disable(struct device *dev)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +	struct imx7d_adc *info = iio_priv(indio_dev);
> +
> +	imx7d_adc_power_down(info);
> +
> +	clk_disable_unprepare(info->clk);
> +	regulator_disable(info->vref);
> +
> +	return 0;
> +}
> +
> +static void __imx7d_adc_disable(void *data)
> +{
> +	imx7d_adc_disable(data);
> +}
> +
>  static int imx7d_adc_probe(struct platform_device *pdev)
>  {
>  	struct imx7d_adc *info;
> @@ -531,11 +549,13 @@ static int imx7d_adc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> +	ret = devm_add_action_or_reset(dev, __imx7d_adc_disable,
> +				       &indio_dev->dev);
> +	if (ret)
> +		return ret;
> +
>  	ret = iio_device_register(indio_dev);
>  	if (ret) {
> -		imx7d_adc_power_down(info);
> -		clk_disable_unprepare(info->clk);
> -		regulator_disable(info->vref);
>  		dev_err(&pdev->dev, "Couldn't register the device.\n");
>  		return ret;
>  	}
> @@ -546,32 +566,14 @@ static int imx7d_adc_probe(struct platform_device *pdev)
>  static int imx7d_adc_remove(struct platform_device *pdev)
>  {
>  	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> -	struct imx7d_adc *info = iio_priv(indio_dev);
>  
>  	iio_device_unregister(indio_dev);
>  
> -	imx7d_adc_power_down(info);
> -
> -	clk_disable_unprepare(info->clk);
> -	regulator_disable(info->vref);
> -
>  	return 0;
>  }
>  
> -static int __maybe_unused imx7d_adc_suspend(struct device *dev)
> -{
> -	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> -	struct imx7d_adc *info = iio_priv(indio_dev);
> -
> -	imx7d_adc_power_down(info);
> -
> -	clk_disable_unprepare(info->clk);
> -	regulator_disable(info->vref);
> -
> -	return 0;
> -}
>  
> -static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_suspend, imx7d_adc_enable);
> +static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, imx7d_adc_enable);
>  
>  static struct platform_driver imx7d_adc_driver = {
>  	.probe		= imx7d_adc_probe,


  reply	other threads:[~2019-04-22 10:08 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
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 [this message]
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=20190422110850.0c710e47@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.