From: Nikhil Gautam <nikhilgtr@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/3] iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes
Date: Tue, 21 Jul 2026 18:37:29 +0530 [thread overview]
Message-ID: <8db678fd-ba0c-4e1c-a401-205b40f07c4a@gmail.com> (raw)
In-Reply-To: <al57yj3AQoHpef6I@ashevche-desk.local>
On 21-07-2026 01:19 am, Andy Shevchenko wrote:
> On Tue, Jul 21, 2026 at 01:09:09AM +0530, Nikhil Gautam wrote:
>> The IIO core does not filter duplicate writes to the event enable
>> attribute, so writing the same value twice invokes
>> write_event_config() twice. Enabling twice leaks a runtime PM
>> reference, preventing the device from ever suspending again;
>> disabling twice underflows the usage count and triggers a
>> "Runtime PM usage count underflow" warning.
>>
>> Bail out early when the requested state matches the current state.
>> While at it, switch to pm_runtime_resume_and_get() so a failed
>> resume is propagated to userspace instead of silently marking the
>> event enabled.
>> Fixes: 97d642e23037c ("iio: light: Add a driver for Sharp GP2AP002x00F")
>>
>> Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
> No blank lines in the tag block.
ACK, Will update in v2
> ...
>
>> } else {
>> pm_runtime_mark_last_busy(gp2ap002->dev);
> At some point consider dropping this dup call.
ACK, Will update in v2
>> pm_runtime_put_autosuspend(gp2ap002->dev);
>> - gp2ap002->enabled = false;
>> }
next prev parent reply other threads:[~2026-07-21 13:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 19:39 [PATCH v1 0/3] iio: light: gp2ap002: runtime PM and error path fixes Nikhil Gautam
2026-07-20 19:39 ` [PATCH v1 1/3] iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes Nikhil Gautam
2026-07-20 19:49 ` Andy Shevchenko
2026-07-21 13:07 ` Nikhil Gautam [this message]
2026-07-20 19:39 ` [PATCH v1 2/3] iio: light: gp2ap002: re-enable irq if runtime suspend fails Nikhil Gautam
2026-07-20 19:39 ` [PATCH v1 3/3] iio: light: gp2ap002: Fix regulator leaks in runtime resume error path Nikhil Gautam
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=8db678fd-ba0c-4e1c-a401-205b40f07c4a@gmail.com \
--to=nikhilgtr@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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