iio: flow: slf3s: disable regulator if measurement restart fails
Subsystems (2)
PATCH v2 1/1 iio: flow: slf3s: disable regulator if measurement restart fails
From: Li Youhong <[email protected]>
slf3s_resume() enables the vdd regulator and then starts continuous measurement. If slf3s_start_meas() fails, resume returns an error while leaving the regulator enabled.
After a failed resume the device stays suspended until another resume attempt. That later resume will call regulator_enable() again. Without a matching disable on the failed path, the regulator enable count is skewed and the supply can remain on even after a successful suspend.
Disable vdd when slf3s_start_meas() fails so the enable/disable pairing stays balanced across resume retries.
---
v2:
- Expand the commit message to explain resume-retry regulator refcounting v1 Link: https://lore.kernel.org/all/[email protected]/
drivers/iio/flow/slf3s.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/flow/slf3s.c +5 -1
@@ -487,7 +487,11 @@ static int slf3s_resume(struct device *dev)fsleep (SLF3S_POWER_UP_DELAY_US ); -return slf3s_start_meas (sf, sf->medium); + ret =slf3s_start_meas (sf, sf->medium); +if (ret) +regulator_disable (sf->vdd); + +return ret; } static DEFINE_SIMPLE_DEV_PM_OPS(slf3s_pm_ops, slf3s_suspend, slf3s_resume);
Signature · 1 line
2.25.1
Quoted 11 lines · On Fri, 4 Sep 2026 09:09:02 +0800 "Li Youhong" <[email protected]> wrote:
From: Li Youhong <[email protected]>
slf3s_resume()enables the vdd regulator and then starts continuous measurement. Ifslf3s_start_meas()fails, resume returns an error while leaving the regulator enabled.After a failed resume the device stays suspended until another resume attempt. That later resume will call
regulator_enable()again. Without a matching disable on the failed path, the regulator enable count is skewed and the supply can remain on even after a successful suspend.
Quoted 6 lines
Disable vdd when
slf3s_start_meas()fails so the enable/disable pairing stays balanced across resume retries.Fixes d240b0b8a1ce ("iio: flow: add Sensirion SLF3S liquid flow sensor driver")Signed-off-by Li Youhong <[email protected]>---
LGTM.
Signature · 2 lines
Kind regards, Joshua Crofts
Jonathan Cameron
maintainerQuoted 17 lines · On Fri, 4 Sep 2026 10:00:54 +0200 Joshua Crofts <[email protected]>…
Quoted 14 lines · On Fri, 4 Sep 2026 09:09:02 +0800 "Li Youhong" <[email protected]> wrote:
From: Li Youhong <[email protected]>
slf3s_resume()enables the vdd regulator and then starts continuous measurement. Ifslf3s_start_meas()fails, resume returns an error while leaving the regulator enabled.After a failed resume the device stays suspended until another resume attempt. That later resume will call
regulator_enable()again. Without a matching disable on the failed path, the regulator enable count is skewed and the supply can remain on even after a successful suspend.Disable vdd when
slf3s_start_meas()fails so the enable/disable pairing stays balanced across resume retries.
Quoted 8 lines
Quoted 3 lines
Fixes d240b0b8a1ce ("iio: flow: add Sensirion SLF3S liquid flow sensor driver")Signed-off-by Li Youhong <[email protected]>---
LGTM.
Reviewed-by Joshua Crofts <[email protected]>
I'm not entirely sure where we are on this, but Wadim has some related patches. If we can figure out a consensus that would be good. From tracking point of view I'm marking this one as changes requested.
Jonathan