[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <516d16e3-6fc6-49ba-a0ce-f451b65a6c1a@collabora.com>
Date: Mon, 13 Jan 2025 13:41:46 +0100
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Matthias Brugger <matthias.bgg@...il.com>,
dri-devel@...ts.freedesktop.org, linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/2] drm/mediatek/hdmi: Use
syscon_regmap_lookup_by_phandle_args
Il 12/01/25 14:47, Krzysztof Kozlowski ha scritto:
> 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.
>
I agree with this change but can you please rebase it over [1]?
The same code got migrated to mtk_hdmi_common.c instead :-)
[1]:
https://lore.kernel.org/r/20250108112744.64686-1-angelogioacchino.delregno@collabora.com
Thanks,
Angelo
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.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;
--
AngeloGioacchino Del Regno
Senior Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
Powered by blists - more mailing lists