iio: light: tsl2583: Fix module unloading
Subsystems (2)
PATCH v2 1/1 iio: light: tsl2583: Fix module unloading
tsl2583 uses devm_iio_device_register() function and calling iio_device_unregister() in remove breaks the module unloading.
Fix this by using iio_device_register() instead of devm_iio_device_register() function in probe.
---
Changes in v2
- Use iio_device_register() instead of devm_iio_device_register()
- Add fixes and stable tags
drivers/iio/light/tsl2583.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/tsl2583.c +1 -1
@@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, TSL2583_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&clientp->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret) {dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);
Signature · 1 line
2.30.2
Quoted 5 lines · On Fri, 26 Aug 2022 17:53:52 +0530 Shreeya Patel <[email protected]>…
tsl2583 uses
devm_iio_device_register()function and callingiio_device_unregister()in remove breaks the module unloading.
Fix this by usingiio_device_register()instead ofdevm_iio_device_register()function in probe.
Not sure why you are wrapping at 55 chars. I rewrapped this whilst applying.
Reworded it a little too as I was touching it anyway.
Applied to the fixes-togreg branch of iio.git.
Quoted 3 lines
Fixes 371894f5d1a0 ("iio: tsl2583: add runtime power management support")
I took a look at this patch and it introduces the issue I just pointed out in replying to your v1 by dropping the
/* Make sure the chip is on */
Which was correct even with runtime pm because it covered the case ofruntime_pm being disabled. We probably need to bring that back as well,
perhaps as part of a cleanup patch taking this fully devm_
This driver has another issue for working if runtime PM isn't built into the kernel which is that it checks the return of pm_runtime_put_autosuspend() which calls
static inline int __pm_runtime_suspend(struct device *dev, int rpmflags)
{
return -ENOSYS;
}I've been meaning to do an audit for drivers that have this problem for a while, but not yet gotten to it.
An ideal IIO driver needs to work correctly whether or not CONFIG_PM is enabled.
Jonathan
Quoted 22 lines
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2
- Useiio_device_register()instead ofdevm_iio_device_register()
- Add fixes and stable tagsdrivers/iio/light/tsl2583.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/tsl2583.c +1
-1@@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, TSL2583_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&clientp->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret) {dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);
Quoted 14 lines · Jonathan Cameron
Quoted 5 lines · On Fri, 26 Aug 2022 17:53:52 +0530 Shreeya Patel <[email protected]>…
tsl2583 uses
devm_iio_device_register()function and callingiio_device_unregister()in remove breaks the module unloading.
Fix this by usingiio_device_register()instead ofdevm_iio_device_register()function in probe.Not sure why you are wrapping at 55 chars. I rewrapped this whilst applying.
Reworded it a little too as I was touching it anyway.
Applied to the fixes-togreg branch of iio.git.
Quoted 8 lines
Quoted 2 lines
Fixes 371894f5d1a0 ("iio: tsl2583: add runtime power management support")I took a look at this patch and it introduces the issue I just pointed out in replying to your v1 by dropping the
/* Make sure the chip is on */
Which was correct even with runtime pm because it covered the case ofruntime_pmbeing disabled. We probably need to bring that back as well,
perhaps as part of a cleanup patch taking this fullydevm_
Hi Jonathan,
I can work on fixing some of the issues with this driver in my free time. Thanks for taking a look at the patch and letting me know.
FYI, I am also planning to work on ADT7316 driver to move out of staging. I have the adt7516 eval board with me which I'll be using for testing.
Thanks,
Shreeya Patel
Quoted 41 lines
This driver has another issue for working if runtime PM isn't built into the kernel which is that it checks the return of
pm_runtime_put_autosuspend()which callsstatic inline int
__pm_runtime_suspend(struct device *dev, int rpmflags){ return -ENOSYS; }I've been meaning to do an audit for drivers that have this problem for a while, but not yet gotten to it.
An ideal IIO driver needs to work correctly whether or not
CONFIG_PMis enabled.Jonathan
Quoted 22 lines
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2
- Useiio_device_register()instead ofdevm_iio_device_register()
- Add fixes and stable tagsdrivers/iio/light/tsl2583.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/tsl2583.c +1
-1@@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, TSL2583_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&clientp->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret) {dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Fri, 26 Aug 2022 17:53:52 +0530 Shreeya Patel <[email protected]>…
tsl2583 uses
devm_iio_device_register()function and callingiio_device_unregister()in remove breaks the module unloading.
Fix this by usingiio_device_register()instead ofdevm_iio_device_register()function in probe.
Quoted 5 lines
Not sure why you are wrapping at 55 chars. I rewrapped this whilst applying.
Reworded it a little too as I was touching it anyway.
Applied to the fixes-togreg branch of iio.git.
Hi Jonathan,
I was wondering if this got picked by you. I don't see it in fixes-togreg that's why wanted to just confirm if you aren't looking for some extra changes in this.
Thanks
Shreeya Patel
Quoted 51 lines
Quoted 3 lines
Fixes 371894f5d1a0 ("iio: tsl2583: add runtime power management support")I took a look at this patch and it introduces the issue I just pointed out in replying to your v1 by dropping the
/* Make sure the chip is on */
Which was correct even with runtime pm because it covered the case ofruntime_pmbeing disabled. We probably need to bring that back as well,
perhaps as part of a cleanup patch taking this fullydevm_This driver has another issue for working if runtime PM isn't built into the kernel which is that it checks the return of
pm_runtime_put_autosuspend()which callsstatic inline int
__pm_runtime_suspend(struct device *dev, int rpmflags){ return -ENOSYS; }I've been meaning to do an audit for drivers that have this problem for a while, but not yet gotten to it.
An ideal IIO driver needs to work correctly whether or not
CONFIG_PMis enabled.Jonathan
Quoted 22 lines
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2
- Useiio_device_register()instead ofdevm_iio_device_register()
- Add fixes and stable tagsdrivers/iio/light/tsl2583.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/tsl2583.c +1
-1@@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, TSL2583_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&clientp->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret) {dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);
Jonathan Cameron
maintainerQuoted 13 lines · On Fri, 9 Sep 2022 00:25:49 +0530 Shreeya Patel <[email protected]>…
Quoted 12 lines · Jonathan Cameron
Quoted 5 lines · On Fri, 26 Aug 2022 17:53:52 +0530 Shreeya Patel <[email protected]>…
tsl2583 uses
devm_iio_device_register()function and callingiio_device_unregister()in remove breaks the module unloading.
Fix this by usingiio_device_register()instead ofdevm_iio_device_register()function in probe.Not sure why you are wrapping at 55 chars. I rewrapped this whilst applying.
Reworded it a little too as I was touching it anyway.
Quoted 9 lines
Quoted 1 line
Applied to the fixes-togreg branch of iio.git.
Hi Jonathan,
I was wondering if this got picked by you. I don't see it in fixes-togreg that's why wanted to just confirm if you aren't looking for some extra changes in this.
oops. I forgot to push that branch out. Done so now.
Jonathan
Quoted 54 lines
Thanks
Shreeya PatelQuoted 51 lines
Quoted 3 lines
Fixes 371894f5d1a0 ("iio: tsl2583: add runtime power management support")I took a look at this patch and it introduces the issue I just pointed out in replying to your v1 by dropping the
/* Make sure the chip is on */
Which was correct even with runtime pm because it covered the case ofruntime_pmbeing disabled. We probably need to bring that back as well,
perhaps as part of a cleanup patch taking this fullydevm_This driver has another issue for working if runtime PM isn't built into the kernel which is that it checks the return of
pm_runtime_put_autosuspend()which callsstatic inline int
__pm_runtime_suspend(struct device *dev, int rpmflags){ return -ENOSYS; }I've been meaning to do an audit for drivers that have this problem for a while, but not yet gotten to it.
An ideal IIO driver needs to work correctly whether or not
CONFIG_PMis enabled.Jonathan
Quoted 22 lines
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2
- Useiio_device_register()instead ofdevm_iio_device_register()
- Add fixes and stable tagsdrivers/iio/light/tsl2583.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/tsl2583.c +1
-1@@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, TSL2583_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&clientp->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret) {dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);