From: Jonathan Cameron <jic23@kernel.org>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de, jic23@cam.ac.uk
Subject: Re: [PATCH 02/14] iio: dac: ad5360: Use devm_* APIs
Date: Mon, 19 Aug 2013 20:23:03 +0100 [thread overview]
Message-ID: <52127097.3090203@kernel.org> (raw)
In-Reply-To: <1376912305-6423-2-git-send-email-sachin.kamat@linaro.org>
On 08/19/13 12:38, Sachin Kamat wrote:
> devm_* APIs are device managed and make code simpler.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git
Thanks,
Jonathan
> ---
> drivers/iio/dac/ad5360.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
> index 80923af..d2da71e 100644
> --- a/drivers/iio/dac/ad5360.c
> +++ b/drivers/iio/dac/ad5360.c
> @@ -459,7 +459,7 @@ static int ad5360_probe(struct spi_device *spi)
> unsigned int i;
> int ret;
>
> - indio_dev = iio_device_alloc(sizeof(*st));
> + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> if (indio_dev == NULL) {
> dev_err(&spi->dev, "Failed to allocate iio device\n");
> return -ENOMEM;
> @@ -480,13 +480,13 @@ static int ad5360_probe(struct spi_device *spi)
> ret = ad5360_alloc_channels(indio_dev);
> if (ret) {
> dev_err(&spi->dev, "Failed to allocate channel spec: %d\n", ret);
> - goto error_free;
> + return ret;
> }
>
> for (i = 0; i < st->chip_info->num_vrefs; ++i)
> st->vref_reg[i].supply = ad5360_vref_name[i];
>
> - ret = regulator_bulk_get(&st->spi->dev, st->chip_info->num_vrefs,
> + ret = devm_regulator_bulk_get(&st->spi->dev, st->chip_info->num_vrefs,
> st->vref_reg);
> if (ret) {
> dev_err(&spi->dev, "Failed to request vref regulators: %d\n", ret);
> @@ -496,7 +496,7 @@ static int ad5360_probe(struct spi_device *spi)
> ret = regulator_bulk_enable(st->chip_info->num_vrefs, st->vref_reg);
> if (ret) {
> dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", ret);
> - goto error_free_reg;
> + goto error_free_channels;
> }
>
> ret = iio_device_register(indio_dev);
> @@ -509,12 +509,8 @@ static int ad5360_probe(struct spi_device *spi)
>
> error_disable_reg:
> regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg);
> -error_free_reg:
> - regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg);
> error_free_channels:
> kfree(indio_dev->channels);
> -error_free:
> - iio_device_free(indio_dev);
>
> return ret;
> }
> @@ -529,9 +525,6 @@ static int ad5360_remove(struct spi_device *spi)
> kfree(indio_dev->channels);
>
> regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg);
> - regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg);
> -
> - iio_device_free(indio_dev);
>
> return 0;
> }
>
next prev parent reply other threads:[~2013-08-19 18:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 11:38 [PATCH 01/14] iio: dac: ad5064: Use devm_* APIs Sachin Kamat
2013-08-19 11:38 ` [PATCH 02/14] iio: dac: ad5360: " Sachin Kamat
2013-08-19 19:23 ` Jonathan Cameron [this message]
2013-08-19 11:38 ` [PATCH 03/14] iio: dac: ad5380: " Sachin Kamat
2013-08-19 19:23 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 04/14] iio: dac: ad5421: " Sachin Kamat
2013-08-19 19:24 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 05/14] iio: dac: ad5446: " Sachin Kamat
2013-08-19 19:25 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 06/14] iio: dac: ad5449: " Sachin Kamat
2013-08-19 19:26 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 07/14] iio: dac: ad5504: " Sachin Kamat
2013-08-19 19:27 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 08/14] iio: dac: ad5624r_spi: " Sachin Kamat
2013-08-19 19:28 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 09/14] iio: dac: ad5686: " Sachin Kamat
2013-08-19 19:30 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 10/14] iio: dac: ad5755: Use devm_iio_device_alloc Sachin Kamat
2013-08-19 19:33 ` Jonathan Cameron
2013-08-20 13:47 ` Sachin Kamat
2013-08-19 11:38 ` [PATCH 11/14] iio: dac: ad5764: Use devm_* APIs Sachin Kamat
2013-08-19 19:33 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 12/14] iio: dac: ad5791: " Sachin Kamat
2013-08-19 19:35 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 13/14] iio: dac: ad7303: " Sachin Kamat
2013-08-19 19:36 ` Jonathan Cameron
2013-08-19 11:38 ` [PATCH 14/14] iio: dac: max517: Use devm_iio_device_alloc Sachin Kamat
2013-08-19 19:38 ` Jonathan Cameron
2013-08-19 19:20 ` [PATCH 01/14] iio: dac: ad5064: Use devm_* APIs 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=52127097.3090203@kernel.org \
--to=jic23@kernel.org \
--cc=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--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 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.