Re: [PATCH 8/8] iio: amplifiers: ad8366: Use devm_iio_device_register

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

 




Sachin Kamat <sachin.kamat@xxxxxxxxxx> wrote:
>devm_iio_device_register simplifies the code.
>
>Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
Is there not a race here?
>---
> drivers/iio/amplifiers/ad8366.c |    4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/drivers/iio/amplifiers/ad8366.c
>b/drivers/iio/amplifiers/ad8366.c
>index ba6f6a9..6af459c 100644
>--- a/drivers/iio/amplifiers/ad8366.c
>+++ b/drivers/iio/amplifiers/ad8366.c
>@@ -162,7 +162,7 @@ static int ad8366_probe(struct spi_device *spi)
> 	indio_dev->channels = ad8366_channels;
> 	indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
> 
>-	ret = iio_device_register(indio_dev);
>+	ret = devm_iio_device_register(&spi->dev, indio_dev);
> 	if (ret)
> 		goto error_disable_reg;
> 
>@@ -183,8 +183,6 @@ static int ad8366_remove(struct spi_device *spi)
> 	struct ad8366_state *st = iio_priv(indio_dev);
> 	struct regulator *reg = st->reg;
> 
>-	iio_device_unregister(indio_dev);
>-
> 	if (!IS_ERR(reg))
> 		regulator_disable(reg);

So now the reg will be disabled before the user space interfaces have gone away?

I wondered about a similar patch when the alloc patches turned up and concluded that there were too many cases like this to make it a good idea...

> 

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--
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