Message ID | 20240708082220.22115-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: renesas: rcar-du: rcar_lvds: Fix PM imbalance if RPM_ACTIVE | expand |
Hi Biju, On Mon, Jul 8, 2024 at 10:22 AM Biju Das <biju.das.jz@bp.renesas.com> wrote: > The pm_runtime_resume_and_get() returns 1 if RPM is active, in this > case it won't call a put. This will result in PM imbalance as it > treat this as an error and propagate this to caller and the caller > never calls corresponding put(). Fix this issue by checking error > condition only. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Thanks for your patch, but the code for pm_runtime_resume_and_get() seems to disagree? https://elixir.bootlin.com/linux/latest/source/include/linux/pm_runtime.h#L436 Gr{oetje,eeting}s, Geert
Hi Geert, > -----Original Message----- > From: Geert Uytterhoeven <geert@linux-m68k.org> > Sent: Monday, July 8, 2024 10:11 AM > Subject: Re: [PATCH] drm: renesas: rcar-du: rcar_lvds: Fix PM imbalance if RPM_ACTIVE > > Hi Biju, > > On Mon, Jul 8, 2024 at 10:22 AM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > The pm_runtime_resume_and_get() returns 1 if RPM is active, in this > > case it won't call a put. This will result in PM imbalance as it treat > > this as an error and propagate this to caller and the caller never > > calls corresponding put(). Fix this issue by checking error condition > > only. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Thanks for your patch, but the code for pm_runtime_resume_and_get() seems to disagree? > https://elixir.bootlin.com/linux/latest/source/include/linux/pm_runtime.h#L436 Oops. Missed that. Sorry for the noisy patch. Cheers, Biju
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c b/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c index 92ba43a6fe38..471a2d3bc203 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c @@ -361,7 +361,7 @@ static void rcar_lvds_enable(struct drm_bridge *bridge, int ret; ret = pm_runtime_resume_and_get(lvds->dev); - if (ret) + if (ret < 0) return; /* Enable the companion LVDS encoder in dual-link mode. */ @@ -550,7 +550,7 @@ int rcar_lvds_pclk_enable(struct drm_bridge *bridge, unsigned long freq, dev_dbg(lvds->dev, "enabling LVDS PLL, freq=%luHz\n", freq); ret = pm_runtime_resume_and_get(lvds->dev); - if (ret) + if (ret < 0) return ret; rcar_lvds_pll_setup_d3_e3(lvds, freq, dot_clk_only);
The pm_runtime_resume_and_get() returns 1 if RPM is active, in this case it won't call a put. This will result in PM imbalance as it treat this as an error and propagate this to caller and the caller never calls corresponding put(). Fix this issue by checking error condition only. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)