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, patches@linaro.org,
	Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Subject: Re: [PATCH 2/8] iio: exynos_adc: Use devm_iio_device_alloc
Date: Sat, 27 Jul 2013 12:25:14 +0100	[thread overview]
Message-ID: <51F3AE1A.7060005@kernel.org> (raw)
In-Reply-To: <1374490981-24373-3-git-send-email-sachin.kamat@linaro.org>

On 07/22/13 12:02, Sachin Kamat wrote:
> Using devm_iio_device_alloc makes code simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/adc/exynos_adc.c |   23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 9809fc9..d25b262 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -33,6 +33,7 @@
>  #include <linux/of_irq.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/of_platform.h>
> +#include <linux/err.h>
>  
>  #include <linux/iio/iio.h>
>  #include <linux/iio/machine.h>
> @@ -261,7 +262,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  	if (!np)
>  		return ret;
>  
> -	indio_dev = iio_device_alloc(sizeof(struct exynos_adc));
> +	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc));
>  	if (!indio_dev) {
>  		dev_err(&pdev->dev, "failed allocating iio device\n");
>  		return -ENOMEM;
> @@ -271,23 +272,18 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	info->regs = devm_ioremap_resource(&pdev->dev, mem);
> -	if (IS_ERR(info->regs)) {
> -		ret = PTR_ERR(info->regs);
> -		goto err_iio;
> -	}
> +	if (IS_ERR(info->regs))
> +		return PTR_ERR(info->regs);
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  	info->enable_reg = devm_ioremap_resource(&pdev->dev, mem);
> -	if (IS_ERR(info->enable_reg)) {
> -		ret = PTR_ERR(info->enable_reg);
> -		goto err_iio;
> -	}
> +	if (IS_ERR(info->enable_reg))
> +		return PTR_ERR(info->enable_reg);
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
>  		dev_err(&pdev->dev, "no irq resource?\n");
> -		ret = irq;
> -		goto err_iio;
> +		return irq;
>  	}
>  
>  	info->irq = irq;
> @@ -299,7 +295,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed requesting irq, irq = %d\n",
>  							info->irq);
> -		goto err_iio;
> +		return ret;
>  	}
>  
>  	writel(1, info->enable_reg);
> @@ -365,8 +361,6 @@ err_iio_dev:
>  	iio_device_unregister(indio_dev);
>  err_irq:
>  	free_irq(info->irq, info);
> -err_iio:
> -	iio_device_free(indio_dev);
>  	return ret;
>  }
>  
> @@ -382,7 +376,6 @@ static int exynos_adc_remove(struct platform_device *pdev)
>  	writel(0, info->enable_reg);
>  	iio_device_unregister(indio_dev);
>  	free_irq(info->irq, info);
> -	iio_device_free(indio_dev);
>  
>  	return 0;
>  }
> 

  reply	other threads:[~2013-07-27 10:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 11:02 [PATCH 0/8] Use devm_iio_device_alloc Sachin Kamat
2013-07-22 11:02 ` [PATCH 1/8] iio: at91: " Sachin Kamat
2013-07-27 11:24   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 2/8] iio: exynos_adc: " Sachin Kamat
2013-07-27 11:25   ` Jonathan Cameron [this message]
2013-07-22 11:02 ` [PATCH 3/8] iio: max1363: " Sachin Kamat
2013-07-27 11:25   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 4/8] iio: frequency: adf4350: Use devm_* APIs Sachin Kamat
2013-07-27 11:26   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 5/8] staging: iio: mxs-lradc: Use devm_iio_device_alloc Sachin Kamat
2013-07-22 22:04   ` Marek Vasut
2013-07-27 11:29     ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 6/8] staging: iio: spear_adc: " Sachin Kamat
2013-07-27 11:29   ` Jonathan Cameron
2013-07-22 11:03 ` [PATCH 7/8] staging: iio: light: isl29018: " Sachin Kamat
2013-07-22 15:16   ` Rhyland Klein
2013-07-27 11:30     ` Jonathan Cameron
2013-07-22 11:03 ` [PATCH 8/8] staging: iio: light: isl29028: " Sachin Kamat
2013-07-27 11:31   ` 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=51F3AE1A.7060005@kernel.org \
    --to=jic23@kernel.org \
    --cc=ch.naveen@samsung.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=patches@linaro.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).