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.d...@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