All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Himangi Saraogi <himangi774@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] staging: iio: adis16203: Use devm_iio_device_register
Date: Thu, 17 Jul 2014 22:47:09 +0200	[thread overview]
Message-ID: <53C8364D.6010908@metafoo.de> (raw)
In-Reply-To: <20140717204040.GA22788@himangi-Dell>

On 07/17/2014 10:40 PM, Himangi Saraogi wrote:
> This patch introduces the use of iio_device_register and does away with
> the call to the corressponding unregister function in the probe and
> remove functions of the driver respectively.
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>

No, you changed the relative order in which iio_device_unregister() and 
adis_cleanup_buffer_and_trigger() are called, this opens up the way for race 
conditions. Rule of thumb: Don't convert drivers to managed functions if 
this will change the order in which functions will called on device removal.

- Lars

> ---
>   drivers/staging/iio/accel/adis16203_core.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c
> index 409a28e..5077779 100644
> --- a/drivers/staging/iio/accel/adis16203_core.c
> +++ b/drivers/staging/iio/accel/adis16203_core.c
> @@ -175,7 +175,7 @@ static int adis16203_probe(struct spi_device *spi)
>   	if (ret)
>   		goto error_cleanup_buffer_trigger;
>
> -	ret = iio_device_register(indio_dev);
> +	ret = devm_iio_device_register(&spi->dev, indio_dev);
>   	if (ret)
>   		goto error_cleanup_buffer_trigger;
>
> @@ -191,7 +191,6 @@ static int adis16203_remove(struct spi_device *spi)
>   	struct iio_dev *indio_dev = spi_get_drvdata(spi);
>   	struct adis *st = iio_priv(indio_dev);
>
> -	iio_device_unregister(indio_dev);
>   	adis_cleanup_buffer_and_trigger(st, indio_dev);
>
>   	return 0;
>


  reply	other threads:[~2014-07-17 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 20:40 [PATCH] staging: iio: adis16203: Use devm_iio_device_register Himangi Saraogi
2014-07-17 20:47 ` Lars-Peter Clausen [this message]
2014-07-17 21:08   ` Julia Lawall

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=53C8364D.6010908@metafoo.de \
    --to=lars@metafoo.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himangi774@gmail.com \
    --cc=jic23@kernel.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.