Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: andy.yan@rock-chips.com, hjc@rock-chips.com,
	Damon Ding <damon.ding@rock-chips.com>
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	dmitry.baryshkov@oss.qualcomm.com,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Damon Ding <damon.ding@rock-chips.com>
Subject: Re: [PATCH v1] drm/rockchip: analogix_dp: Apply devm_clk_get_optional() for &rockchip_dp_device.grfclk
Date: Sun, 24 Aug 2025 08:08:19 +0200	[thread overview]
Message-ID: <7656195.LvFx2qVVIh@phil> (raw)
In-Reply-To: <20250824031932.3204920-1-damon.ding@rock-chips.com>

Hi Damon,

Am Sonntag, 24. August 2025, 05:19:32 Mitteleuropäische Sommerzeit schrieb Damon Ding:
> The "grf" clock is optional for Rockchip eDP controller(RK3399 needs
> while RK3288 and RK3588 do not).
> 
> It can make the code more consice to use devm_clk_get_optional()
> instead of devm_clk_get() with extra checks.
> 
> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> index d30f0983a53a..d0f78ab9faa6 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -335,12 +335,8 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
>  		return PTR_ERR(dp->grf);
>  	}
>  
> -	dp->grfclk = devm_clk_get(dev, "grf");
> -	if (PTR_ERR(dp->grfclk) == -ENOENT) {
> -		dp->grfclk = NULL;
> -	} else if (PTR_ERR(dp->grfclk) == -EPROBE_DEFER) {
> -		return -EPROBE_DEFER;
> -	} else if (IS_ERR(dp->grfclk)) {
> +	dp->grfclk = devm_clk_get_optional(dev, "grf");
> +	if (IS_ERR(dp->grfclk)) {
>  		DRM_DEV_ERROR(dev, "failed to get grf clock\n");
>  		return PTR_ERR(dp->grfclk);

generall I definitly I agree, but you're loosing the
"don't print anything for EPROBE_DEFER" handling.

Additionally DRM_DEV_ERROR says in the code
"this is deprecated in favor of drm_err() or dev_err()." .

Also this in the probe-path, so to catch both issues, I'd sugest
using dev_err_probe() for the message, which handles EPROBE_DEFER
automatically.

Heiko




  reply	other threads:[~2025-08-24  6:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24  3:19 [PATCH v1] drm/rockchip: analogix_dp: Apply devm_clk_get_optional() for &rockchip_dp_device.grfclk Damon Ding
2025-08-24  6:08 ` Heiko Stuebner [this message]
2025-08-24  6:36   ` Damon Ding

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=7656195.LvFx2qVVIh@phil \
    --to=heiko@sntech.de \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=damon.ding@rock-chips.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hjc@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --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