Re: [PATCH 07/11] iio: adc: lp8788_adc: Use devm_* APIs

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

 



On 07/23/13 09:58, Sachin Kamat wrote:
> devm_* APIs are device managed and make code simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> Cc: Milo Kim <milo.kim@xxxxxx>
Applied to the togreg branch of iio.git

> ---
>  drivers/iio/adc/lp8788_adc.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/lp8788_adc.c b/drivers/iio/adc/lp8788_adc.c
> index 62bc39e..5c8c915 100644
> --- a/drivers/iio/adc/lp8788_adc.c
> +++ b/drivers/iio/adc/lp8788_adc.c
> @@ -194,7 +194,7 @@ static int lp8788_adc_probe(struct platform_device *pdev)
>  	struct lp8788_adc *adc;
>  	int ret;
>  
> -	indio_dev = iio_device_alloc(sizeof(*adc));
> +	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc));
>  	if (!indio_dev)
>  		return -ENOMEM;
>  
> @@ -205,7 +205,7 @@ static int lp8788_adc_probe(struct platform_device *pdev)
>  	indio_dev->dev.of_node = pdev->dev.of_node;
>  	ret = lp8788_iio_map_register(indio_dev, lp->pdata, adc);
>  	if (ret)
> -		goto err_iio_map;
> +		return ret;
>  
>  	mutex_init(&adc->lock);
>  
> @@ -226,8 +226,6 @@ static int lp8788_adc_probe(struct platform_device *pdev)
>  
>  err_iio_device:
>  	iio_map_array_unregister(indio_dev);
> -err_iio_map:
> -	iio_device_free(indio_dev);
>  	return ret;
>  }
>  
> @@ -237,7 +235,6 @@ static int lp8788_adc_remove(struct platform_device *pdev)
>  
>  	iio_device_unregister(indio_dev);
>  	iio_map_array_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