public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Adrián Larumbe <adrian.larumbe@collabora.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: Sat, 21 Mar 2026 14:16:12 +0000	[thread overview]
Message-ID: <TY3PR01MB11346DD20F7E2AB23A54A274B864DA@TY3PR01MB11346.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <TY3PR01MB11346F3DF5ACB55B5FE8DC96F864CA@TY3PR01MB11346.jpnprd01.prod.outlook.com>

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.

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

  reply	other threads:[~2026-03-21 14:16 UTC|newest]

Thread overview: 15+ 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-21 17:29   ` Claude review: " Claude Code Review Bot
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 [this message]
2026-03-21 17:29   ` Claude review: " Claude Code Review Bot
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-21 17:29   ` Claude review: " Claude Code Review Bot
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-21 17:29   ` Claude review: " Claude Code Review Bot
2026-03-21 17:29 ` Claude review: Add RZ/G3L GFX support Claude Code Review Bot

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=TY3PR01MB11346DD20F7E2AB23A54A274B864DA@TY3PR01MB11346.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.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