linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-iio@vger.kernel.org, jic23@cam.ac.uk,
	Michael Hennerich <hennerich@blackfin.uclinux.org>
Subject: Re: [PATCH 1/3] iio: amplifiers: ad8366: Use devm_* APIs
Date: Sat, 03 Aug 2013 21:00:07 +0100	[thread overview]
Message-ID: <51FD6147.5090101@kernel.org> (raw)
In-Reply-To: <1375165463-23453-1-git-send-email-sachin.kamat@linaro.org>

On 07/30/13 07:24, Sachin Kamat wrote:
> devm_* APIs are device managed and make code simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Michael Hennerich <hennerich@blackfin.uclinux.org>
Applied to the togreg branch of iio.git

Thanks.
> ---
> This series compile tested on togreg branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
> ---
>  drivers/iio/amplifiers/ad8366.c |   13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
> index d354554..d0a79a4 100644
> --- a/drivers/iio/amplifiers/ad8366.c
> +++ b/drivers/iio/amplifiers/ad8366.c
> @@ -139,17 +139,17 @@ static int ad8366_probe(struct spi_device *spi)
>  	struct ad8366_state *st;
>  	int ret;
>  
> -	indio_dev = iio_device_alloc(sizeof(*st));
> +	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
>  	if (indio_dev == NULL)
>  		return -ENOMEM;
>  
>  	st = iio_priv(indio_dev);
>  
> -	st->reg = regulator_get(&spi->dev, "vcc");
> +	st->reg = devm_regulator_get(&spi->dev, "vcc");
>  	if (!IS_ERR(st->reg)) {
>  		ret = regulator_enable(st->reg);
>  		if (ret)
> -			goto error_put_reg;
> +			return ret;
>  	}
>  
>  	spi_set_drvdata(spi, indio_dev);
> @@ -173,11 +173,6 @@ static int ad8366_probe(struct spi_device *spi)
>  error_disable_reg:
>  	if (!IS_ERR(st->reg))
>  		regulator_disable(st->reg);
> -error_put_reg:
> -	if (!IS_ERR(st->reg))
> -		regulator_put(st->reg);
> -
> -	iio_device_free(indio_dev);
>  
>  	return ret;
>  }
> @@ -195,8 +190,6 @@ static int ad8366_remove(struct spi_device *spi)
>  		regulator_put(reg);
>  	}
>  
> -	iio_device_free(indio_dev);
> -
>  	return 0;
>  }
>  
> 

      parent reply	other threads:[~2013-08-03 19:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30  6:24 [PATCH 1/3] iio: amplifiers: ad8366: Use devm_* APIs Sachin Kamat
2013-07-30  6:24 ` [PATCH 2/3] iio: frequency: ad9523: " Sachin Kamat
2013-08-03 20:01   ` Jonathan Cameron
2013-07-30  6:24 ` [PATCH 3/3] iio: pressure: st_pressure: Use devm_iio_device_alloc Sachin Kamat
2013-08-03 20:03   ` Jonathan Cameron
2013-08-03 20:00 ` 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=51FD6147.5090101@kernel.org \
    --to=jic23@kernel.org \
    --cc=hennerich@blackfin.uclinux.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=sachin.kamat@linaro.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 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).