diff mbox series

[2/2] drm/mediatek/hdmi: Simplify with dev_err_probe

Message ID 20250112134708.46100-2-krzysztof.kozlowski@linaro.org (mailing list archive)
State New
Headers show
Series [1/2] drm/mediatek/hdmi: Use syscon_regmap_lookup_by_phandle_args | expand

Commit Message

Krzysztof Kozlowski Jan. 12, 2025, 1:47 p.m. UTC
Use dev_err_probe() to make error code and deferred probe handling
simpler.

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

Comments

AngeloGioacchino Del Regno Jan. 13, 2025, 12:41 p.m. UTC | #1
Il 12/01/25 14:47, Krzysztof Kozlowski ha scritto:
> Use dev_err_probe() to make error code and deferred probe handling
> simpler.
> 

That's already done in [1] so you can drop this commit.

[1]: 
https://lore.kernel.org/r/20250108112744.64686-1-angelogioacchino.delregno@collabora.com

Cheers,
Angelo

> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>   drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++---------------
>   1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 4b0eb7dc25d8..22935fdc5afe 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1429,19 +1429,13 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
>   	int ret;
>   
>   	ret = mtk_hdmi_get_all_clk(hdmi, np);
> -	if (ret) {
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "Failed to get clocks: %d\n", ret);
> -
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to get clocks\n");
>   
>   	/* The CEC module handles HDMI hotplug detection */
>   	cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
> -	if (!cec_np) {
> -		dev_err(dev, "Failed to find CEC node\n");
> -		return -EINVAL;
> -	}
> +	if (!cec_np)
> +		return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n");
>   
>   	cec_pdev = of_find_device_by_node(cec_np);
>   	if (!cec_pdev) {
> @@ -1492,10 +1486,9 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
>   
>   	i2c_np = of_parse_phandle(remote, "ddc-i2c-bus", 0);
>   	if (!i2c_np) {
> -		dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
> -			remote);
> +		ret = dev_err_probe(dev, -EINVAL, "Failed to find ddc-i2c-bus node in %pOF\n",
> +				    remote);
>   		of_node_put(remote);
> -		ret = -EINVAL;
>   		goto put_device;
>   	}
>   	of_node_put(remote);
> @@ -1503,8 +1496,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
>   	hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
>   	of_node_put(i2c_np);
>   	if (!hdmi->ddc_adpt) {
> -		dev_err(dev, "Failed to get ddc i2c adapter by node\n");
> -		ret = -EINVAL;
> +		ret = dev_err_probe(dev, -EINVAL, "Failed to get ddc i2c adapter by node\n");
>   		goto put_device;
>   	}
>
Krzysztof Kozlowski Jan. 13, 2025, 1:07 p.m. UTC | #2
On 13/01/2025 13:41, AngeloGioacchino Del Regno wrote:
> Il 12/01/25 14:47, Krzysztof Kozlowski ha scritto:
>> Use dev_err_probe() to make error code and deferred probe handling
>> simpler.
>>
> 
> That's already done in [1] so you can drop this commit.
> 
> [1]: 
> https://lore.kernel.org/r/20250108112744.64686-1-angelogioacchino.delregno@collabora.com
> 
Eh, this was first in v3 in the middle of Dec, so why you cannot get it
merged first? Creating such 34-behemoths causes simple cleanups to
unnecessarily wait.

Best regards,
Krzysztof
AngeloGioacchino Del Regno Jan. 13, 2025, 1:48 p.m. UTC | #3
Il 13/01/25 14:07, Krzysztof Kozlowski ha scritto:
> On 13/01/2025 13:41, AngeloGioacchino Del Regno wrote:
>> Il 12/01/25 14:47, Krzysztof Kozlowski ha scritto:
>>> Use dev_err_probe() to make error code and deferred probe handling
>>> simpler.
>>>
>>
>> That's already done in [1] so you can drop this commit.
>>
>> [1]:
>> https://lore.kernel.org/r/20250108112744.64686-1-angelogioacchino.delregno@collabora.com
>>
> Eh, this was first in v3 in the middle of Dec, so why you cannot get it
> merged first? Creating such 34-behemoths causes simple cleanups to
> unnecessarily wait.
> 

Getting the series partially merged is okay for me, no complaints about that,
but then ... in v4, there are two minor comments to address (one of which
is a one-char nitpick!) that might as well be done while applying, depending
on what CK thinks about that, so there's no real benefit in getting 28 commits
out of 34 picked instead of, well, just everything...

Cheers!
Angelo
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 4b0eb7dc25d8..22935fdc5afe 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1429,19 +1429,13 @@  static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 	int ret;
 
 	ret = mtk_hdmi_get_all_clk(hdmi, np);
-	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get clocks: %d\n", ret);
-
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to get clocks\n");
 
 	/* The CEC module handles HDMI hotplug detection */
 	cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
-	if (!cec_np) {
-		dev_err(dev, "Failed to find CEC node\n");
-		return -EINVAL;
-	}
+	if (!cec_np)
+		return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n");
 
 	cec_pdev = of_find_device_by_node(cec_np);
 	if (!cec_pdev) {
@@ -1492,10 +1486,9 @@  static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 
 	i2c_np = of_parse_phandle(remote, "ddc-i2c-bus", 0);
 	if (!i2c_np) {
-		dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
-			remote);
+		ret = dev_err_probe(dev, -EINVAL, "Failed to find ddc-i2c-bus node in %pOF\n",
+				    remote);
 		of_node_put(remote);
-		ret = -EINVAL;
 		goto put_device;
 	}
 	of_node_put(remote);
@@ -1503,8 +1496,7 @@  static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 	hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
 	of_node_put(i2c_np);
 	if (!hdmi->ddc_adpt) {
-		dev_err(dev, "Failed to get ddc i2c adapter by node\n");
-		ret = -EINVAL;
+		ret = dev_err_probe(dev, -EINVAL, "Failed to get ddc i2c adapter by node\n");
 		goto put_device;
 	}