linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Johannes Thumshirn <morbidrsa@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Sachin Kamat <sachin.kamat@linaro.org>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: viperboard: Call platform_set_drvdata before devm_iio_device_register
Date: Sat, 01 Feb 2014 15:46:05 +0100	[thread overview]
Message-ID: <52ED08AD.9060403@metafoo.de> (raw)
In-Reply-To: <1391265593-13986-1-git-send-email-morbidrsa@gmail.com>

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;
>  }
>  
> 


  reply	other threads:[~2014-02-01 14:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 14:39 [PATCH] iio: adc: viperboard: Call platform_set_drvdata before devm_iio_device_register Johannes Thumshirn
2014-02-01 14:46 ` Lars-Peter Clausen [this message]
2014-02-01 14:49   ` Johannes Thumshirn

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=52ED08AD.9060403@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morbidrsa@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --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).