diff mbox series

[linux-next] drm/panel: samsung: Simplify with dev_err_probe()

Message ID 061ed94a003362bb7d7e9d3e4d38358c5b91c8a3.1704186827.git.chen.haonan2@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series [linux-next] drm/panel: samsung: Simplify with dev_err_probe() | expand

Commit Message

chenguanxi11234@163.com Jan. 3, 2024, 2:17 p.m. UTC
From: Chen Haonan <chen.haonan2@zte.com.cn>

dev_err_probe() can check if the error code is -EPROBE_DEFER 
and can return the error code, replacing dev_err() with it 
simplifies the code.

Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
---
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jessica Zhang Jan. 3, 2024, 5:37 p.m. UTC | #1
On 1/3/2024 6:17 AM, chenguanxi11234@163.com wrote:
> From: Chen Haonan <chen.haonan2@zte.com.cn>
> 
> dev_err_probe() can check if the error code is -EPROBE_DEFER
> and can return the error code, replacing dev_err() with it
> simplifies the code.
> 
> Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>

Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>

> ---
>   drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index 79f611963c61..f4103e762b53 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -194,10 +194,8 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
>   	s6->reset_gpio = devm_gpiod_get_optional(dev, "reset",
>   						GPIOD_OUT_HIGH);
>   	if (IS_ERR(s6->reset_gpio)) {
> -		ret = PTR_ERR(s6->reset_gpio);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "failed to request GPIO (%d)\n", ret);
> -		return ret;
> +		return dev_err_probe(dev, PTR_ERR(s6->reset_gpio),
> +							 "failed to request GPIO\n");
>   	}
>   
>   	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,
> -- 
> 2.25.1
>
Neil Armstrong Jan. 12, 2024, 9:35 a.m. UTC | #2
On 03/01/2024 15:17, chenguanxi11234@163.com wrote:
> From: Chen Haonan <chen.haonan2@zte.com.cn>
> 
> dev_err_probe() can check if the error code is -EPROBE_DEFER
> and can return the error code, replacing dev_err() with it
> simplifies the code.
> 
> Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
> ---
>   drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index 79f611963c61..f4103e762b53 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -194,10 +194,8 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
>   	s6->reset_gpio = devm_gpiod_get_optional(dev, "reset",
>   						GPIOD_OUT_HIGH);
>   	if (IS_ERR(s6->reset_gpio)) {
> -		ret = PTR_ERR(s6->reset_gpio);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "failed to request GPIO (%d)\n", ret);
> -		return ret;
> +		return dev_err_probe(dev, PTR_ERR(s6->reset_gpio),
> +							 "failed to request GPIO\n");
>   	}
>   
>   	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,

This patch fails to apply on current drm-misc-next, please refresh.

Neil
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 79f611963c61..f4103e762b53 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -194,10 +194,8 @@  static int s6d16d0_probe(struct mipi_dsi_device *dsi)
 	s6->reset_gpio = devm_gpiod_get_optional(dev, "reset",
 						GPIOD_OUT_HIGH);
 	if (IS_ERR(s6->reset_gpio)) {
-		ret = PTR_ERR(s6->reset_gpio);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "failed to request GPIO (%d)\n", ret);
-		return ret;
+		return dev_err_probe(dev, PTR_ERR(s6->reset_gpio),
+							 "failed to request GPIO\n");
 	}
 
 	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,