Re: [PATCH 11/11] iio: adc: viperboard_adc: Use devm_iio_device_alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/23/13 09:58, Sachin Kamat wrote:
> Using devm_iio_device_alloc makes code simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> Cc: Lars Poeschel <poeschel@xxxxxxxxxxx>
Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/adc/viperboard_adc.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c
> index 56ac481..09727a7 100644
> --- a/drivers/iio/adc/viperboard_adc.c
> +++ b/drivers/iio/adc/viperboard_adc.c
> @@ -124,7 +124,7 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	/* registering iio */
> -	indio_dev = iio_device_alloc(sizeof(*adc));
> +	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc));
>  	if (!indio_dev) {
>  		dev_err(&pdev->dev, "failed allocating iio device\n");
>  		return -ENOMEM;
> @@ -142,16 +142,12 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
>  	ret = iio_device_register(indio_dev);
>  	if (ret) {
>  		dev_err(&pdev->dev, "could not register iio (adc)");
> -		goto error;
> +		return ret;
>  	}
>  
>  	platform_set_drvdata(pdev, indio_dev);
>  
>  	return 0;
> -
> -error:
> -	iio_device_free(indio_dev);
> -	return ret;
>  }
>  
>  static int vprbrd_adc_remove(struct platform_device *pdev)
> @@ -159,7 +155,6 @@ static int vprbrd_adc_remove(struct platform_device *pdev)
>  	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>  
>  	iio_device_unregister(indio_dev);
> -	iio_device_free(indio_dev);
>  
>  	return 0;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux