From: Jonathan Cameron <jic23@kernel.org>
To: Shreeya Patel <shreeya.patel@collabora.com>
Cc: lars@metafoo.de, krisman@collabora.com,
dmitry.osipenko@collabora.com, kernel@collabora.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: light: tsl2583: Fix module unloading
Date: Sun, 28 Aug 2022 17:33:27 +0100 [thread overview]
Message-ID: <20220828173327.7949ad73@jic23-huawei> (raw)
In-Reply-To: <20220826122352.288438-1-shreeya.patel@collabora.com>
On Fri, 26 Aug 2022 17:53:52 +0530
Shreeya Patel <shreeya.patel@collabora.com> wrote:
> 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.
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.
>
> Cc: stable@vger.kernel.org
> 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 of
runtime_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
> Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
> ---
> 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(-)
>
> diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> index 82662dab87c0..94d75ec687c3 100644
> --- a/drivers/iio/light/tsl2583.c
> +++ b/drivers/iio/light/tsl2583.c
> @@ -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__);
next prev parent reply other threads:[~2022-08-28 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 12:23 [PATCH v2] iio: light: tsl2583: Fix module unloading Shreeya Patel
2022-08-28 16:33 ` Jonathan Cameron [this message]
2022-08-31 13:50 ` Shreeya Patel
2022-09-08 18:55 ` Shreeya Patel
2022-09-11 9:58 ` Jonathan Cameron
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=20220828173327.7949ad73@jic23-huawei \
--to=jic23@kernel.org \
--cc=dmitry.osipenko@collabora.com \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shreeya.patel@collabora.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox