mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damon Ding <damon.ding@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>,
	andy.yan@rock-chips.com, hjc@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
Subject: Re: [PATCH v1] drm/rockchip: analogix_dp: Apply devm_clk_get_optional() for &rockchip_dp_device.grfclk
Date: Sun, 24 Aug 2025 14:36:07 +0800	[thread overview]
Message-ID: <8513b4b6-0b59-4b42-864b-0fe0423cd7fd@rock-chips.com> (raw)
In-Reply-To: <7656195.LvFx2qVVIh@phil>

Hi Heiko,

On 8/24/2025 2:08 PM, Heiko Stuebner wrote:
> 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.
> 

Yeah, I will use dev_err_probe() instead in the next version.

In addition, it should be nice to modify the other similar codes in 
rockchip_dp_of_probe(). I will add another commit to do it.

Best regards,
Damon


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24  3:19 Damon Ding
2025-08-24  6:08 ` Heiko Stuebner
2025-08-24  6:36   ` Damon Ding [this message]

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=8513b4b6-0b59-4b42-864b-0fe0423cd7fd@rock-chips.com \
    --to=damon.ding@rock-chips.com \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --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

all inboxes | Powered by JetHome®