* [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable
@ 2026-09-25 14:09 Jiale Yao
2026-09-25 14:17 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Jiale Yao @ 2026-09-25 14:09 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
Bjorn Helgaas, Matti Vaittinen, Danilo Krummrich, linux-iio,
linux-kernel
Cc: Jiale Yao
The IIO core does not filter duplicate writes to the event enable
attribute. kxcjk1013_write_event_config() already ignores repeated
enable requests, but a repeated disable request still calls
kxcjk1013_set_power_state(data, false), dropping a runtime PM reference
that was not acquired for this request. This can underflow the runtime
PM usage count and trigger a "Runtime PM usage count underflow" warning.
Return early when the requested state already matches ev_enable_state.
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/iio/accel/kxcjk-1013.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 166fb786425f..8994c9e8e048 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -1030,7 +1030,7 @@ static int kxcjk1013_write_event_config(struct iio_dev *indio_dev,
struct kxcjk1013_data *data = iio_priv(indio_dev);
int ret;
- if (state && data->ev_enable_state)
+ if (state == data->ev_enable_state)
return 0;
mutex_lock(&data->mutex);
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable
2026-09-25 14:09 [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable Jiale Yao
@ 2026-09-25 14:17 ` Andy Shevchenko
2026-09-25 14:38 ` jiale yao
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-09-25 14:17 UTC (permalink / raw)
To: Jiale Yao
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
Bjorn Helgaas, Matti Vaittinen, Danilo Krummrich, linux-iio,
linux-kernel
On Fri, Sep 25, 2026 at 10:09:43PM +0800, Jiale Yao wrote:
> The IIO core does not filter duplicate writes to the event enable
> attribute. kxcjk1013_write_event_config() already ignores repeated
> enable requests, but a repeated disable request still calls
> kxcjk1013_set_power_state(data, false), dropping a runtime PM reference
> that was not acquired for this request. This can underflow the runtime
> PM usage count and trigger a "Runtime PM usage count underflow" warning.
>
> Return early when the requested state already matches ev_enable_state.
Sounds like a bug that needs to be fixed and hence Fixes tag to be applied.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable
2026-09-25 14:17 ` Andy Shevchenko
@ 2026-09-25 14:38 ` jiale yao
2026-09-26 0:49 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: jiale yao @ 2026-09-25 14:38 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
Bjorn Helgaas, Matti Vaittinen, Danilo Krummrich, linux-iio,
linux-kernel
At 2026-09-25 22:17:19, "Andy Shevchenko" <andriy.shevchenko@intel.com> wrote:
>On Fri, Sep 25, 2026 at 10:09:43PM +0800, Jiale Yao wrote:
>> The IIO core does not filter duplicate writes to the event enable
>> attribute. kxcjk1013_write_event_config() already ignores repeated
>> enable requests, but a repeated disable request still calls
>> kxcjk1013_set_power_state(data, false), dropping a runtime PM reference
>> that was not acquired for this request. This can underflow the runtime
>> PM usage count and trigger a "Runtime PM usage count underflow" warning.
>>
>> Return early when the requested state already matches ev_enable_state.
>
>Sounds like a bug that needs to be fixed and hence Fixes tag to be applied.
Sure, I'll add the Fixes tag in v2, 24h later, for any other comments before sending it.
>
>--
>With Best Regards,
>Andy Shevchenko
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable
2026-09-25 14:38 ` jiale yao
@ 2026-09-26 0:49 ` Jonathan Cameron
2026-09-26 6:48 ` jiale yao
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2026-09-26 0:49 UTC (permalink / raw)
To: jiale yao
Cc: Andy Shevchenko, David Lechner, Nuno Sá,
Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
Bjorn Helgaas, Matti Vaittinen, Danilo Krummrich, linux-iio,
linux-kernel
On Fri, 25 Sep 2026 22:38:07 +0800 (CST)
"jiale yao" <19888972804@163.com> wrote:
> At 2026-09-25 22:17:19, "Andy Shevchenko" <andriy.shevchenko@intel.com> wrote:
> >On Fri, Sep 25, 2026 at 10:09:43PM +0800, Jiale Yao wrote:
> >> The IIO core does not filter duplicate writes to the event enable
> >> attribute. kxcjk1013_write_event_config() already ignores repeated
> >> enable requests, but a repeated disable request still calls
> >> kxcjk1013_set_power_state(data, false), dropping a runtime PM reference
> >> that was not acquired for this request. This can underflow the runtime
> >> PM usage count and trigger a "Runtime PM usage count underflow" warning.
> >>
> >> Return early when the requested state already matches ev_enable_state.
> >
> >Sounds like a bug that needs to be fixed and hence Fixes tag to be applied.
> Sure, I'll add the Fixes tag in v2, 24h later, for any other comments before sending it.
For a simple request for a fixes tag, I'm also fine with you just
replying with that tag. b4 will pick it up (though technically in the
wrong place so I'll massage things whilst applying)
Fix looks good to me.
Jonathan
> >
> >--
> >With Best Regards,
> >Andy Shevchenko
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable
2026-09-26 0:49 ` Jonathan Cameron
@ 2026-09-26 6:48 ` jiale yao
0 siblings, 0 replies; 5+ messages in thread
From: jiale yao @ 2026-09-26 6:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, David Lechner, Nuno Sá,
Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
Bjorn Helgaas, Matti Vaittinen, Danilo Krummrich, linux-iio,
linux-kernel
At 2026-09-26 08:49:42, "Jonathan Cameron" <jic23@kernel.org> wrote:
>On Fri, 25 Sep 2026 22:38:07 +0800 (CST)
>"jiale yao" <19888972804@163.com> wrote:
>
>> At 2026-09-25 22:17:19, "Andy Shevchenko" <andriy.shevchenko@intel.com> wrote:
>> >On Fri, Sep 25, 2026 at 10:09:43PM +0800, Jiale Yao wrote:
>> >> The IIO core does not filter duplicate writes to the event enable
>> >> attribute. kxcjk1013_write_event_config() already ignores repeated
>> >> enable requests, but a repeated disable request still calls
>> >> kxcjk1013_set_power_state(data, false), dropping a runtime PM reference
>> >> that was not acquired for this request. This can underflow the runtime
>> >> PM usage count and trigger a "Runtime PM usage count underflow" warning.
>> >>
>> >> Return early when the requested state already matches ev_enable_state.
>> >
>> >Sounds like a bug that needs to be fixed and hence Fixes tag to be applied.
>> Sure, I'll add the Fixes tag in v2, 24h later, for any other comments before sending it.
>For a simple request for a fixes tag, I'm also fine with you just
>replying with that tag. b4 will pick it up (though technically in the
>wrong place so I'll massage things whilst applying)
Thanks.
Fixes: b4b491c0832e ("iio: accel: kxcjk-1013: Support thresholds")
>
>Fix looks good to me.
>
>Jonathan
>
>> >
>> >--
>> >With Best Regards,
>> >Andy Shevchenko
>> >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-26 6:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 14:09 [PATCH] iio: accel: kxcjk-1013: reject duplicate event disable Jiale Yao
2026-09-25 14:17 ` Andy Shevchenko
2026-09-25 14:38 ` jiale yao
2026-09-26 0:49 ` Jonathan Cameron
2026-09-26 6:48 ` jiale yao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®