From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "krzysztof.kozlowski@linaro.org" <krzysztof.kozlowski@linaro.org>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args
Date: Thu, 13 Feb 2025 06:39:28 +0000 [thread overview]
Message-ID: <bb903722cf60d6efdfdc64598faf21e45f72e128.camel@mediatek.com> (raw)
In-Reply-To: <20250112134708.46100-1-krzysztof.kozlowski@linaro.org>
On Sun, 2025-01-12 at 14:47 +0100, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> 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.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
I've not decided to apply this patch first or Angelo's patch first.
I'll fix conflict when I apply both patch.
Regards,
CK
>
> 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
>
>
WARNING: multiple messages have this Message-ID (diff)
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "krzysztof.kozlowski@linaro.org" <krzysztof.kozlowski@linaro.org>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args
Date: Thu, 13 Feb 2025 06:39:28 +0000 [thread overview]
Message-ID: <bb903722cf60d6efdfdc64598faf21e45f72e128.camel@mediatek.com> (raw)
In-Reply-To: <20250112134708.46100-1-krzysztof.kozlowski@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 2459 bytes --]
On Sun, 2025-01-12 at 14:47 +0100, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> 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.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
I've not decided to apply this patch first or Angelo's patch first.
I'll fix conflict when I apply both patch.
Regards,
CK
>
> 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
>
>
[-- Attachment #2: Type: text/html, Size: 5875 bytes --]
next prev parent reply other threads:[~2025-02-13 6:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
2025-02-13 6:39 ` CK Hu (胡俊光)
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=bb903722cf60d6efdfdc64598faf21e45f72e128.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=simona@ffwll.ch \
/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 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.