From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 DA6C538734D; Thu, 26 Mar 2026 11:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774526367; cv=pass; b=H1ZoUbIE5JXGd3paNRT1R/Xn6FfOTRGFFoRutVs4AoIWMIE5TrD0iOed2LQC+QVUSCoqngZpK7UB6meAlTgn8A5S9tcNEJMvoMsHAnZzotZJ47NRlRzGs2UGsg666ysomNm84xvPpCon/G092zpvDeTG43SNXOh0yDVrCBohxqM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774526367; c=relaxed/simple; bh=HKV+pqDUW70yS1IkUgHPQGOB1Ixw8VVKBshT19NRnpU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NDZkJowoth9vHrisyIFMLsvOsoRazYT+70KjNY971lUqkZLCjgcbyBTktu4tBwceDg0mWtg+k2fOHxYiG4uCnm8O4m9O5fKR5ilr0mvhYRIqFeS1wO0w5S1cWA2vqHqLg9RRUI5T81TwWuPbIhGS+iAy44XBsj8AvScJLgQ31bw= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=FaX23d+e; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="FaX23d+e" ARC-Seal: i=1; a=rsa-sha256; t=1774526345; cv=none; d=zohomail.com; s=zohoarc; b=eibIxsY4jbugMMsUsRzfo4YlKvNyygN1G/z8U3/IkGyIh8Zq0DkQhFwzN4tw5pi+hEU0gh5jdWnl2z78AMpnuEn2NsjfJO/AjvITE58ayAf9z2v4DsrSNNP3tasAgHD6TlCrTncyfu6cQIgf2sRZWnj9sTxmV1CwuSf1xUmvNN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774526345; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ul3Elmvarjeo2F5dZsfHqeijZFTBr3ip2K2uSBcgO+g=; b=E/1m/krGiAxQ4hNv/5Mpn4vgVj5fFNbwsCMTFv0u41/ZCLamFFB9qv+Xvse2/lTguR/ApgPRASdggCk4N2A1UNyNMtEI0SiNy815MXaBW8sPXVVVPQjUN92Ki87TR0vCnOxVBfKOgrlsjggAPj1XtZ5YBkpWahI2ewD3DbWdg9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1774526345; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:Message-Id:Reply-To; bh=Ul3Elmvarjeo2F5dZsfHqeijZFTBr3ip2K2uSBcgO+g=; b=FaX23d+eST4NvBkpuAforAXC1w55gz/e6Ca5LBk3is7dXSXr9k1BIT/VPol8QgIu +dOHKibJ4DnlVUQM9Bagr2q1Ws43B6EOTWcy4O9+xOMyAXEs/wPBnFMYTQTdjoibHd0 yrEdWG4ZlahccvvmnXiakw2qLuzG79LoXwr8otCM= Received: by mx.zohomail.com with SMTPS id 1774526344009716.8538221987557; Thu, 26 Mar 2026 04:59:04 -0700 (PDT) Date: Thu, 26 Mar 2026 11:58:59 +0000 From: =?utf-8?Q?Adri=C3=A1n?= Larumbe To: Biju Das Cc: Boris Brezillon , Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Geert Uytterhoeven , Prabhakar Mahadev Lad , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH v2 2/4] drm/panfrost: Drop redundant optional clock checks in runtime PM Message-ID: References: <20260320164158.487406-1-biju.das.jz@bp.renesas.com> <20260320164158.487406-3-biju.das.jz@bp.renesas.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 26.03.2026 08:55, Biju Das wrote: > Hi Adrian, > > > -----Original Message----- > > From: Adrián Larumbe > > Sent: 24 March 2026 17:11 > > Subject: Re: [PATCH v2 2/4] drm/panfrost: Drop redundant optional clock checks in runtime PM > > > > On 21.03.2026 14:16, Biju Das wrote: > > > Hi Adrián Larumbe, > > > > > > Thanks for the feedback. > > > > > > > -----Original Message----- > > > > From: dri-devel 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 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 > > > > > > > > > > > > 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 > > > > > > Signed-off-by: Biju Das > > > > > > --- > > > > > > 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. > > If you are happy with the series, can you please merge it? Will do, I'll add my Rb's and let you know when it's merged. > Cheers, > Biju Adrian Larumbe