lkml.org 
[lkml]   [2014]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] iio: adc: viperboard: Call platform_set_drvdata before devm_iio_device_register
On 02/01/2014 03:39 PM, Johannes Thumshirn wrote:
> Call platform_set_drvdata before devm_iio_device_register to avoid possible
> race condition when accessing driver data.

I don't think the driver data is accessed from within any of the IIO device
callbacks. In fact I don't think it is accessed at all with the latest
conversion to devm_iio_device_register(). So I think the call to
platform_set_drvdata can just be removed.

>
> Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
> ---
> drivers/iio/adc/viperboard_adc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c
> index d0add8f..7d9bd05 100644
> --- a/drivers/iio/adc/viperboard_adc.c
> +++ b/drivers/iio/adc/viperboard_adc.c
> @@ -133,14 +133,14 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
> indio_dev->channels = vprbrd_adc_iio_channels;
> indio_dev->num_channels = ARRAY_SIZE(vprbrd_adc_iio_channels);
>
> + platform_set_drvdata(pdev, indio_dev);
> +
> ret = devm_iio_device_register(&pdev->dev, indio_dev);
> if (ret) {
> dev_err(&pdev->dev, "could not register iio (adc)");
> return ret;
> }
>
> - platform_set_drvdata(pdev, indio_dev);
> -
> return 0;
> }
>
>



\
 
 \ /
  Last update: 2014-02-01 16:01    [W:0.120 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site