linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: light: tsl2583: Fix module unloading
@ 2022-08-25  9:20 Shreeya Patel
  2022-08-25 18:53 ` Dmitry Osipenko
  0 siblings, 1 reply; 3+ messages in thread
From: Shreeya Patel @ 2022-08-25  9:20 UTC (permalink / raw)
  To: jic23, lars
  Cc: krisman, dmitry.osipenko, kernel, linux-iio, linux-kernel, Shreeya Patel

tsl2583 uses devm_iio_device_register() function and
calling iio_device_unregister() in remove breaks the
module unloading.
Fix this by removing call to iio_device_unregister()
from tsl2583_remove().

Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
---
 drivers/iio/light/tsl2583.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index 82662dab87c0..36c25f79e6a6 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -878,8 +878,6 @@ static int tsl2583_remove(struct i2c_client *client)
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
 
-	iio_device_unregister(indio_dev);
-
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: tsl2583: Fix module unloading
  2022-08-25  9:20 [PATCH] iio: light: tsl2583: Fix module unloading Shreeya Patel
@ 2022-08-25 18:53 ` Dmitry Osipenko
  2022-08-28 16:22   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Osipenko @ 2022-08-25 18:53 UTC (permalink / raw)
  To: Shreeya Patel, jic23, lars; +Cc: krisman, kernel, linux-iio, linux-kernel

Hi,

On 8/25/22 12:20, Shreeya Patel wrote:
> tsl2583 uses devm_iio_device_register() function and
> calling iio_device_unregister() in remove breaks the
> module unloading.
> Fix this by removing call to iio_device_unregister()
> from tsl2583_remove().
> 
> Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>

Stable and fixes tags are missing

> ---
>  drivers/iio/light/tsl2583.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> index 82662dab87c0..36c25f79e6a6 100644
> --- a/drivers/iio/light/tsl2583.c
> +++ b/drivers/iio/light/tsl2583.c
> @@ -878,8 +878,6 @@ static int tsl2583_remove(struct i2c_client *client)
>  	struct iio_dev *indio_dev = i2c_get_clientdata(client);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
>  
> -	iio_device_unregister(indio_dev);
> -
>  	pm_runtime_disable(&client->dev);
>  	pm_runtime_set_suspended(&client->dev);
>  

Driver removal sequence should be opposite to the registration order.
Could be better not to use the devm in this case.

-- 
Best regards,
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: tsl2583: Fix module unloading
  2022-08-25 18:53 ` Dmitry Osipenko
@ 2022-08-28 16:22   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-08-28 16:22 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Shreeya Patel, lars, krisman, kernel, linux-iio, linux-kernel

On Thu, 25 Aug 2022 21:53:09 +0300
Dmitry Osipenko <dmitry.osipenko@collabora.com> wrote:

> Hi,
> 
> On 8/25/22 12:20, Shreeya Patel wrote:
> > tsl2583 uses devm_iio_device_register() function and
> > calling iio_device_unregister() in remove breaks the
> > module unloading.
> > Fix this by removing call to iio_device_unregister()
> > from tsl2583_remove().
> > 
> > Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>  
> 
> Stable and fixes tags are missing

Stable tags often added by maintainer when applying the patch
rather than at submission: can take into account how they want to
manage stable backports - some maintainers prefer to run a bunch
of tests before asking for patches to be added to stable. I don't
do that, but I don't always tag fixes for stable if I think there
is some risk associated.

Obviously this one is fine for stable material though and I would
have tagged v2 whilst applying ;)
> 
> > ---
> >  drivers/iio/light/tsl2583.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> > index 82662dab87c0..36c25f79e6a6 100644
> > --- a/drivers/iio/light/tsl2583.c
> > +++ b/drivers/iio/light/tsl2583.c
> > @@ -878,8 +878,6 @@ static int tsl2583_remove(struct i2c_client *client)
> >  	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> >  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> >  
> > -	iio_device_unregister(indio_dev);
> > -
> >  	pm_runtime_disable(&client->dev);
> >  	pm_runtime_set_suspended(&client->dev);
> >    
> 
> Driver removal sequence should be opposite to the registration order.
> Could be better not to use the devm in this case

Agreed. Simplest fix is indeed to do what v2 does.

Nicer tidy up after that is perhaps to switch to
devm_pm_runtime_enable()
which tidies up nicely on that and register a
separate callback with devm_add_action_or_reset() to deal with
the power down.  However, I'm struggling to follow how the device
is powered up in the first place (particularly if we disable runtime
pm to make the flow simpler). 

I think the driver may only "work" today by merit of letting it 
autosuspend then resuming. 

Jonathan


> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-28 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  9:20 [PATCH] iio: light: tsl2583: Fix module unloading Shreeya Patel
2022-08-25 18:53 ` Dmitry Osipenko
2022-08-28 16:22   ` Jonathan Cameron

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).