Linux IIO development
 help / color / mirror / Atom feed
From: Wadim Mueller <wafgo01@gmail.com>
To: Li Youhong <dayou5941@163.com>, jic23@kernel.org
Cc: maxwell@maxwelld.cc, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, linux-iio@vger.kernel.org,
	Li Youhong <liyouhong@kylinos.cn>
Subject: Re: [PATCH] iio: flow: slf3s: disable regulator if measurement restart fails
Date: Fri, 04 Sep 2026 09:21:06 +0200	[thread overview]
Message-ID: <87ld9hwkgt.fsf@gmail.com> (raw)
In-Reply-To: <20260901025010.356735-1-dayou5941@163.com>

On 2026-09-01 10:50, Li Youhong wrote:

> From: Li Youhong <liyouhong@kylinos.cn>
>
> 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. Disable vdd on that path so a
> failed resume does not leave the supply on.
>
> Fixes: d240b0b8a1ce ("iio: flow: add Sensirion SLF3S liquid flow sensor driver")
> Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
> ---
>  drivers/iio/flow/slf3s.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/flow/slf3s.c b/drivers/iio/flow/slf3s.c
> index dfa7c1409045..9b63ceb3768a 100644
> --- a/drivers/iio/flow/slf3s.c
> +++ b/drivers/iio/flow/slf3s.c
> @@ -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);
> -- 
> 2.25.1

Fixes the unbalanced regulator refcount across resume retries, as                             described.

Reviewed-by: Wadim Mueller <wafgo01@gmail.com>

      parent reply	other threads:[~2026-09-04  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  2:50 [PATCH] iio: flow: slf3s: disable regulator if measurement restart fails Li Youhong
2026-09-03 15:15 ` Andy Shevchenko
2026-09-04  7:21 ` Wadim Mueller [this message]

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=87ld9hwkgt.fsf@gmail.com \
    --to=wafgo01@gmail.com \
    --cc=andy@kernel.org \
    --cc=dayou5941@163.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=liyouhong@kylinos.cn \
    --cc=maxwell@maxwelld.cc \
    --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