From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.andi.de1.cc (mail.andi.de1.cc [178.238.236.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A65A8392836 for ; Sat, 25 Jul 2026 19:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.238.236.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785009064; cv=none; b=ZhCeM9LkQs+brSiwn+aX+dQ3/P6cczvKPdf9CLiGQnpXrm1MrsVF4hPk9/p7BBU+E+OAFpCzAdbdH1VX46unD9GG7UqproUfO4i7LNN/NTaHttLfmsrWpdkLo/u2yrpN+wk8opUtM8oGWswfB9Rt7W/ilTkT06JZDETZOlxluKE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785009064; c=relaxed/simple; bh=L6T6BGUstnyGuF/7hebstedSlMxJBHXjwMGyJx8FJfg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P1FexoLb4zc6pw1Ra6Qf6q1QRQ5R1QWbfESSAoGj/OwXBGJjfnMF/0NXmawhmM9wwOnCSxv8LTibVVVeaX99b4z+l9qAY+uRWTQbyfTrfGe212woTH5xd26QF7s5kZ7qaGTBu5ugdi5DCZIK3Jgu/VJs8p6iyyJ+PGcgEpsvue0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kemnade.info; spf=pass smtp.mailfrom=kemnade.info; dkim=pass (2048-bit key) header.d=kemnade.info header.i=@kemnade.info header.b=tqf/F8XZ; arc=none smtp.client-ip=178.238.236.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kemnade.info Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kemnade.info Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kemnade.info header.i=@kemnade.info header.b="tqf/F8XZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=References:In-Reply-To:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description; bh=mTm1nATyx1+kuh0kObliD7Qus9swVkLqiGdVoLPb13s=; t=1785009062; x=1786218662; b=tqf/F8XZGDXyEGvLmx22Ze5rWrJSiqOhC3CpDLHASySDl+rxxWS3Imh/F+7RVyedg/eGAn63Eho 1VyUO1B++M27H0Ig+P7rSqIwuFRWdpx3ND5BH6ipkDr56cksDV8awo8ir3q5xyN4ci2x4UZLjLaq6 ucV/vVBAu9cjlTR1C5W7r5NrAACdegenL5BmNAW3ZUR7EMqraXSlw/ePUZgVF2yn/6T67yvOUhTW8 InuoiQ3yJQ1tde4VQPjQA4UwJCydx07G2U8NG1puAusIDt3L5J0t5+BNYw7GALiEcH0HO3QJcB9zh NO0jHkz2GjSVZQ2iqNjwIZ2jsRp+SORCbGfg==; Date: Sat, 25 Jul 2026 21:50:55 +0200 From: Andreas Kemnade To: robby.cai@oss.nxp.com Cc: lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: Re: [PATCH v2 2/2] regulator: fp9931: Fix Runtime PM usage count underflow in v3p3 ops Message-ID: <20260725215055.6239bae6@akphone> In-Reply-To: <20260724103441.800522-3-robby.cai@oss.nxp.com> References: <20260724103441.800522-1-robby.cai@oss.nxp.com> <20260724103441.800522-3-robby.cai@oss.nxp.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; aarch64-alpine-linux-musl) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 24 Jul 2026 18:34:41 +0800 robby.cai@oss.nxp.com wrote: > From: Robby Cai > > The fp9931_v3p3_enable() callback acquires a Runtime PM reference > which remains held until fp9931_v3p3_disable() releases it. > > Device-level Runtime PM lifetime is also managed through the shared > VCOM enable path: fp9931_set_enable() acquires a reference and > fp9931_clear_enable() releases it. > > As a result, the Runtime PM usage count may already have reached 0 > before fp9931_v3p3_disable() is invoked. In that case, > fp9931_v3p3_disable() calls pm_runtime_put_autosuspend() on an > already-zero count, triggering: > > fp9931 1-0018: Runtime PM usage count underflow! > > Holding a Runtime PM reference across the V3P3 regulator lifetime is > unnecessary. V3P3 only needs the device to be runtime-active for the > duration of the register access. > > Fix this by scoping the Runtime PM reference lifetime to the register > access itself, pairing pm_runtime_resume_and_get() and > pm_runtime_put_autosuspend() within each callback. > > Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver") > Signed-off-by: Robby Cai > --- > drivers/regulator/fp9931.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c > index ff743a8b0dfe..0d926546221a 100644 > --- a/drivers/regulator/fp9931.c > +++ b/drivers/regulator/fp9931.c > @@ -214,8 +214,7 @@ static int fp9931_v3p3_enable(struct > regulator_dev *rdev) return ret; > > ret = regulator_enable_regmap(rdev); > - if (ret < 0) > - pm_runtime_put_autosuspend(data->dev); > + pm_runtime_put_autosuspend(data->dev); > if autosuspend kicks in, the whole chip will be powered off, so if no vcom/vposneg is enabled, v3p3 will also be disabled. Regards, Andreas