public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args
@ 2025-01-12 13:47 Krzysztof Kozlowski
  2025-01-12 13:47 ` [PATCH 2/2] drm/mediatek/hdmi: Simplify with dev_err_probe Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-12 13:47 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, dri-devel,
	linux-mediatek, linux-kernel, linux-arm-kernel
  Cc: Krzysztof Kozlowski

Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument.  Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

There is also no real benefit in printing errors on missing syscon
argument, because this is done just too late: runtime check on
static/build-time data.  Dtschema and Devicetree bindings offer the
static/build-time check for this already.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ca82bc829cb9..4b0eb7dc25d8 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1458,15 +1458,11 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 	 * MMSYS_CONFIG device and the register offset of the HDMI_SYS_CFG
 	 * registers it contains.
 	 */
-	regmap = syscon_regmap_lookup_by_phandle(np, "mediatek,syscon-hdmi");
-	ret = of_property_read_u32_index(np, "mediatek,syscon-hdmi", 1,
-					 &hdmi->sys_offset);
-	if (IS_ERR(regmap))
-		ret = PTR_ERR(regmap);
-	if (ret) {
-		dev_err(dev,
-			"Failed to get system configuration registers: %d\n",
-			ret);
+	regmap = syscon_regmap_lookup_by_phandle_args(np, "mediatek,syscon-hdmi",
+						      1, &hdmi->sys_offset);
+	if (IS_ERR(regmap)) {
+		ret = dev_err_probe(dev, PTR_ERR(regmap),
+				    "Failed to get system configuration registers\n");
 		goto put_device;
 	}
 	hdmi->sys_regmap = regmap;
-- 
2.43.0



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

end of thread, other threads:[~2025-02-13 10:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-12 13:47 [PATCH 1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
2025-01-12 13:47 ` [PATCH 2/2] drm/mediatek/hdmi: Simplify with dev_err_probe Krzysztof Kozlowski
2025-01-13 12:41   ` AngeloGioacchino Del Regno
2025-01-13 13:07     ` Krzysztof Kozlowski
2025-01-13 13:48       ` AngeloGioacchino Del Regno
2025-02-12 20:33         ` Krzysztof Kozlowski
2025-02-13 10:07           ` Krzysztof Kozlowski
2025-02-13 10:39             ` AngeloGioacchino Del Regno
2025-01-13 12:41 ` [PATCH 1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args AngeloGioacchino Del Regno
2025-01-13 13:05   ` Krzysztof Kozlowski
2025-01-13 13:58     ` AngeloGioacchino Del Regno
2025-01-13 14:27       ` Krzysztof Kozlowski
2025-01-13 14:31         ` Krzysztof Kozlowski
2025-01-13 15:02           ` AngeloGioacchino Del Regno
2025-02-13  6:39 ` CK Hu (胡俊光)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox