All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/bridge: ti-sn65dsi86: Simplify refclk handling
@ 2021-03-04 23:51 ` Douglas Anderson
  0 siblings, 0 replies; 40+ messages in thread
From: Douglas Anderson @ 2021-03-04 23:51 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, Sam Ravnborg
  Cc: Stephen Boyd, linux-arm-msm, robdclark, Douglas Anderson,
	Daniel Vetter, David Airlie, dri-devel, linux-kernel

The clock framework makes it simple to deal with an optional clock.
You can call clk_get_optional() and if the clock isn't specified it'll
just return NULL without complaint. It's valid to pass NULL to
enable/disable/prepare/unprepare. Let's make use of this to simplify
things a tiny bit.

NOTE: this makes things look a tad bit asymmetric now since we check
for NULL before clk_prepare_enable() but not for
clk_disable_unprepare(). This seemed OK to me. We already have to
check for NULL in the enable case anyway so why not avoid the extra
call?

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index f27306c51e4d..942019842ff4 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -1261,14 +1261,9 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	pdata->refclk = devm_clk_get(pdata->dev, "refclk");
-	if (IS_ERR(pdata->refclk)) {
-		ret = PTR_ERR(pdata->refclk);
-		if (ret == -EPROBE_DEFER)
-			return ret;
-		DRM_DEBUG_KMS("refclk not found\n");
-		pdata->refclk = NULL;
-	}
+	pdata->refclk = devm_clk_get_optional(pdata->dev, "refclk");
+	if (IS_ERR(pdata->refclk))
+		return PTR_ERR(pdata->refclk);
 
 	ret = ti_sn_bridge_parse_dsi_host(pdata);
 	if (ret)
-- 
2.30.1.766.gb4fecdf3b7-goog


^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2021-03-30  3:20 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 23:51 [PATCH 1/3] drm/bridge: ti-sn65dsi86: Simplify refclk handling Douglas Anderson
2021-03-04 23:51 ` Douglas Anderson
2021-03-04 23:52 ` [PATCH 2/3] drm/bridge: ti-sn65dsi86: Move code in prep for EDID read fix Douglas Anderson
2021-03-04 23:52   ` Douglas Anderson
2021-03-05 10:07   ` Robert Foss
2021-03-05 10:07     ` Robert Foss
2021-03-12  2:50   ` Bjorn Andersson
2021-03-12  2:50     ` Bjorn Andersson
2021-03-13 20:25   ` Stephen Boyd
2021-03-13 20:25     ` Stephen Boyd
2021-03-13 21:12   ` Laurent Pinchart
2021-03-13 21:12     ` Laurent Pinchart
2021-03-15 16:31     ` Doug Anderson
2021-03-15 16:31       ` Doug Anderson
2021-03-15 16:41       ` Laurent Pinchart
2021-03-15 16:41         ` Laurent Pinchart
2021-03-04 23:52 ` [PATCH 3/3] drm/bridge: ti-sn65dsi86: Properly get the EDID, but only if refclk Douglas Anderson
2021-03-04 23:52   ` Douglas Anderson
2021-03-12  2:59   ` Bjorn Andersson
2021-03-12  2:59     ` Bjorn Andersson
2021-03-13 21:16   ` Laurent Pinchart
2021-03-13 21:16     ` Laurent Pinchart
2021-03-15 16:25     ` Doug Anderson
2021-03-15 16:25       ` Doug Anderson
2021-03-16 21:46       ` Laurent Pinchart
2021-03-16 21:46         ` Laurent Pinchart
2021-03-17  0:44         ` Doug Anderson
2021-03-17  0:44           ` Doug Anderson
2021-03-30  2:57           ` Doug Anderson
2021-03-30  2:57             ` Doug Anderson
2021-03-30  3:19             ` Laurent Pinchart
2021-03-30  3:19               ` Laurent Pinchart
2021-03-05 10:00 ` [PATCH 1/3] drm/bridge: ti-sn65dsi86: Simplify refclk handling Robert Foss
2021-03-05 10:00   ` Robert Foss
2021-03-12  2:49 ` Bjorn Andersson
2021-03-12  2:49   ` Bjorn Andersson
2021-03-13 20:23 ` Stephen Boyd
2021-03-13 20:23   ` Stephen Boyd
2021-03-13 21:02 ` Laurent Pinchart
2021-03-13 21:02   ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.