diff mbox series

[RESEND,v2] drm/panel: JDI LT070ME05000 simplify with dev_err_probe()

Message ID 20230812185239.378582-1-david@ixit.cz (mailing list archive)
State New, archived
Headers show
Series [RESEND,v2] drm/panel: JDI LT070ME05000 simplify with dev_err_probe() | expand

Commit Message

David Heidelberg Aug. 12, 2023, 6:52 p.m. UTC
Use the dev_err_probe() helper to simplify error handling during probe.
This also handle scenario, when EDEFER is returned and useless error is printed.

Fixes error:
panel-jdi-lt070me05000 4700000.dsi.0: cannot get enable-gpio -517

Signed-off-by: David Heidelberg <david@ixit.cz>
---
resend:
 - applies cleanly on -next
v2:
 - original v1 patch name "drm/panel: JDI LT070ME05000 remove useless warning"
 - use dev_err_probe function

 .../gpu/drm/panel/panel-jdi-lt070me05000.c    | 36 ++++++++-----------
 1 file changed, 14 insertions(+), 22 deletions(-)

Comments

Neil Armstrong Aug. 14, 2023, 12:40 p.m. UTC | #1
On 12/08/2023 20:52, David Heidelberg wrote:
> Use the dev_err_probe() helper to simplify error handling during probe.
> This also handle scenario, when EDEFER is returned and useless error is printed.
> 
> Fixes error:
> panel-jdi-lt070me05000 4700000.dsi.0: cannot get enable-gpio -517
> 
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
> resend:
>   - applies cleanly on -next
> v2:
>   - original v1 patch name "drm/panel: JDI LT070ME05000 remove useless warning"
>   - use dev_err_probe function
> 
>   .../gpu/drm/panel/panel-jdi-lt070me05000.c    | 36 ++++++++-----------
>   1 file changed, 14 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> index e94c98f00391..f9a69f347068 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -400,38 +400,30 @@ static int jdi_panel_add(struct jdi_panel *jdi)
>   
>   	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(jdi->supplies),
>   				      jdi->supplies);
> -	if (ret < 0) {
> -		dev_err(dev, "failed to init regulator, ret=%d\n", ret);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret,
> +				     "failed to init regulator, ret=%d\n", ret);
>   
>   	jdi->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
>   	if (IS_ERR(jdi->enable_gpio)) {
> -		ret = PTR_ERR(jdi->enable_gpio);
> -		dev_err(dev, "cannot get enable-gpio %d\n", ret);
> -		return ret;
> +		return dev_err_probe(dev, PTR_ERR(jdi->enable_gpio),
> +				     "cannot get enable-gpio %d\n", ret);
>   	}
>   
>   	jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> -	if (IS_ERR(jdi->reset_gpio)) {
> -		ret = PTR_ERR(jdi->reset_gpio);
> -		dev_err(dev, "cannot get reset-gpios %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(jdi->reset_gpio))
> +		return dev_err_probe(dev, PTR_ERR(jdi->reset_gpio),
> +				     "cannot get reset-gpios %d\n", ret);
>   
>   	jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
> -	if (IS_ERR(jdi->dcdc_en_gpio)) {
> -		ret = PTR_ERR(jdi->dcdc_en_gpio);
> -		dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(jdi->dcdc_en_gpio))
> +		return dev_err_probe(dev, PTR_ERR(jdi->dcdc_en_gpio),
> +				     "cannot get dcdc-en-gpio %d\n", ret);
>   
>   	jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
> -	if (IS_ERR(jdi->backlight)) {
> -		ret = PTR_ERR(jdi->backlight);
> -		dev_err(dev, "failed to register backlight %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(jdi->backlight))
> +		return dev_err_probe(dev, PTR_ERR(jdi->backlight),
> +				     "failed to register backlight %d\n", ret);
>   
>   	drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
>   		       DRM_MODE_CONNECTOR_DSI);

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Neil Armstrong Aug. 14, 2023, 12:46 p.m. UTC | #2
Hi,

On Sat, 12 Aug 2023 20:52:39 +0200, David Heidelberg wrote:
> Use the dev_err_probe() helper to simplify error handling during probe.
> This also handle scenario, when EDEFER is returned and useless error is printed.
> 
> Fixes error:
> panel-jdi-lt070me05000 4700000.dsi.0: cannot get enable-gpio -517
> 
> 
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[1/1] drm/panel: JDI LT070ME05000 simplify with dev_err_probe()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=f5d8f9c0d8b4bc8ad7e7b23a9f4d116e99202dd3
Neil Armstrong Aug. 14, 2023, 12:50 p.m. UTC | #3
Hi,

On Sat, 12 Aug 2023 20:52:39 +0200, David Heidelberg wrote:
> Use the dev_err_probe() helper to simplify error handling during probe.
> This also handle scenario, when EDEFER is returned and useless error is printed.
> 
> Fixes error:
> panel-jdi-lt070me05000 4700000.dsi.0: cannot get enable-gpio -517
> 
> 
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-fixes)

[1/1] drm/panel: JDI LT070ME05000 simplify with dev_err_probe()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ae6546835efaa7195aaaa10e5ff4e695cd82a816
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index e94c98f00391..f9a69f347068 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -400,38 +400,30 @@  static int jdi_panel_add(struct jdi_panel *jdi)
 
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(jdi->supplies),
 				      jdi->supplies);
-	if (ret < 0) {
-		dev_err(dev, "failed to init regulator, ret=%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret,
+				     "failed to init regulator, ret=%d\n", ret);
 
 	jdi->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
 	if (IS_ERR(jdi->enable_gpio)) {
-		ret = PTR_ERR(jdi->enable_gpio);
-		dev_err(dev, "cannot get enable-gpio %d\n", ret);
-		return ret;
+		return dev_err_probe(dev, PTR_ERR(jdi->enable_gpio),
+				     "cannot get enable-gpio %d\n", ret);
 	}
 
 	jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
-	if (IS_ERR(jdi->reset_gpio)) {
-		ret = PTR_ERR(jdi->reset_gpio);
-		dev_err(dev, "cannot get reset-gpios %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(jdi->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(jdi->reset_gpio),
+				     "cannot get reset-gpios %d\n", ret);
 
 	jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
-	if (IS_ERR(jdi->dcdc_en_gpio)) {
-		ret = PTR_ERR(jdi->dcdc_en_gpio);
-		dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(jdi->dcdc_en_gpio))
+		return dev_err_probe(dev, PTR_ERR(jdi->dcdc_en_gpio),
+				     "cannot get dcdc-en-gpio %d\n", ret);
 
 	jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
-	if (IS_ERR(jdi->backlight)) {
-		ret = PTR_ERR(jdi->backlight);
-		dev_err(dev, "failed to register backlight %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(jdi->backlight))
+		return dev_err_probe(dev, PTR_ERR(jdi->backlight),
+				     "failed to register backlight %d\n", ret);
 
 	drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
 		       DRM_MODE_CONNECTOR_DSI);