From: "Adrián Larumbe" <adrian.larumbe@collabora.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
Rob Herring <robh@kernel.org>,
Steven Price <steven.price@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] drm/panfrost: Drop redundant optional clock checks in runtime PM
Date: Tue, 24 Mar 2026 17:10:32 +0000 [thread overview]
Message-ID: <acLFYNHPODCYArCk@sobremesa> (raw)
In-Reply-To: <TY3PR01MB11346DD20F7E2AB23A54A274B864DA@TY3PR01MB11346.jpnprd01.prod.outlook.com>
On 21.03.2026 14:16, Biju Das wrote:
> Hi Adrián Larumbe,
>
> Thanks for the feedback.
>
> > -----Original Message-----
> > From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of Biju Das
> > Sent: 20 March 2026 21:32
> > Subject: RE: [PATCH v2 2/4] drm/panfrost: Drop redundant optional clock checks in runtime PM
> >
> >
> >
> > > -----Original Message-----
> > > From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
> > > Adrián Larumbe
> > > Sent: 20 March 2026 21:20
> > > Subject: Re: [PATCH v2 2/4] drm/panfrost: Drop redundant optional
> > > clock checks in runtime PM
> > >
> > > Hi Biju,
> > >
> > > On 20.03.2026 16:41, Biju wrote:
> > > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > >
> > > > The clk_enable() and clk_disable() APIs already handle NULL clock
> > > > pointers gracefully — clk_enable() returns 0 and clk_disable()
> > > > returns immediately when passed a NULL or optional clock. The
> > > > explicit if
> > > > (pfdev->bus_clock) guards around these calls in the runtime
> > > > suspend/resume paths are therefore unnecessary. Remove them to simplify the code.
> > > >
> > > > Reviewed-by: Steven Price <steven.price@arm.com>
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > ---
> > > > v1->v2:
> > > > * Collected tag
> > > > ---
> > > > drivers/gpu/drm/panfrost/panfrost_device.c | 12 ++++--------
> > > > 1 file changed, 4 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c
> > > > b/drivers/gpu/drm/panfrost/panfrost_device.c
> > > > index dedc13e56631..01e702a0b2f0 100644
> > > > --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> > > > +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
> > > > @@ -429,11 +429,9 @@ static int panfrost_device_runtime_resume(struct device *dev)
> > > > if (ret)
> > > > goto err_clk;
> > > >
> > > > - if (pfdev->bus_clock) {
> > > > - ret = clk_enable(pfdev->bus_clock);
> > > > - if (ret)
> > > > - goto err_bus_clk;
> > > > - }
> > > > + ret = clk_enable(pfdev->bus_clock);
> > > > + if (ret)
> > > > + goto err_bus_clk;
> > > > }
> > >
> > > It seems clk_prepare_enable() can also deal with NULL clock device
> > > pointers gracefully, so maybe you could also do away with pointer checks in panfrost_clk_init?
> >
> > This is the only check and no need to print rate for optional clk. That is the reason I have not
> > touched this.
> >
> > if (pfdev->bus_clock) {
> > rate = clk_get_rate(pfdev->bus_clock);
> > dev_info(pfdev->base.dev, "bus_clock rate = %lu\n", rate);
> >
> > err = clk_prepare_enable(pfdev->bus_clock);
> > if (err)
> > goto disable_clock;
> > }
>
> The above block is good for optional clock.
>
> Otherwise, there will be 2 checks for optional clk.
>
> One here:
>
> if (pfdev->bus_clock) {
> rate = clk_get_rate(pfdev->bus_clock);
> dev_info(pfdev->base.dev, "bus_clock rate = %lu\n", rate);
> }
>
> and one inside the clk_prepare_enable():
>
> err = clk_prepare_enable(pfdev->bus_clock);
>
> Please let me know your thoughts.
You're right, it's probably best to leave it the way it is.
Cheers,
Adrian
> Cheers,
> Biju
>
> >
> > Cheers,
> > Biju
> > >
> > > Other than that,
> > >
> > > Reviewed-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> > >
> > > > panfrost_device_reset(pfdev, true); @@ -464,9 +462,7 @@ static int
> > > > panfrost_device_runtime_suspend(struct device *dev)
> > > > panfrost_gpu_power_off(pfdev);
> > > >
> > > > if (pfdev->comp->pm_features & BIT(GPU_PM_RT)) {
> > > > - if (pfdev->bus_clock)
> > > > - clk_disable(pfdev->bus_clock);
> > > > -
> > > > + clk_disable(pfdev->bus_clock);
> > > > clk_disable(pfdev->clock);
> > > > reset_control_assert(pfdev->rstc);
> > > > }
> > > > --
> > > > 2.43.0
> > >
> > >
> > > Adrian Larumbe
next prev parent reply other threads:[~2026-03-24 17:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 16:41 [PATCH v2 0/4] Add RZ/G3L GFX support Biju
2026-03-20 16:41 ` [PATCH v2 1/4] dt-bindings: gpu: mali-bifrost: Add compatible for RZ/G3L SoC Biju
2026-03-26 14:10 ` Geert Uytterhoeven
2026-03-20 16:41 ` [PATCH v2 2/4] drm/panfrost: Drop redundant optional clock checks in runtime PM Biju
2026-03-20 21:19 ` Adrián Larumbe
2026-03-20 21:32 ` Biju Das
2026-03-21 14:16 ` Biju Das
2026-03-24 17:10 ` Adrián Larumbe [this message]
2026-03-26 8:55 ` Biju Das
2026-03-26 11:58 ` Adrián Larumbe
2026-03-26 15:36 ` Biju Das
2026-03-26 15:32 ` Adrián Larumbe
2026-03-20 16:41 ` [PATCH v2 3/4] drm/panfrost: Add bus_ace optional clock support for RZ/G2L Biju
2026-03-20 21:15 ` Adrián Larumbe
2026-03-26 15:32 ` Adrián Larumbe
2026-03-20 16:41 ` [PATCH v2 4/4] drm/panfrost: Add GPU_PM_RT support for RZ/G3L SoC Biju
2026-03-20 21:14 ` Adrián Larumbe
2026-03-26 15:33 ` Adrián Larumbe
2026-03-27 2:14 ` [PATCH v2 0/4] Add RZ/G3L GFX support Adrián Larumbe
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=acLFYNHPODCYArCk@sobremesa \
--to=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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