All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panel: k101-im2ba02: Make use of the helper function dev_err_probe()
@ 2021-09-16 10:42 Cai Huoqing
  2021-09-16 11:18   ` Icenowy Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Cai Huoqing @ 2021-09-16 10:42 UTC (permalink / raw)
  To: caihuoqing
  Cc: Icenowy Zheng, Thierry Reding, Sam Ravnborg, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
index 2a602aee61c3..cb0bb3076099 100644
--- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
+++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
@@ -456,16 +456,13 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
 
 	ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx->supplies),
 				      ctx->supplies);
-	if (ret < 0) {
-		dev_err(&dsi->dev, "Couldn't get regulators\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&dsi->dev, ret, "Couldn't get regulators\n");
 
 	ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(ctx->reset)) {
-		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
-		return PTR_ERR(ctx->reset);
-	}
+	if (IS_ERR(ctx->reset))
+		return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
+				     "Couldn't get our reset GPIO\n");
 
 	drm_panel_init(&ctx->panel, &dsi->dev, &k101_im2ba02_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panel: k101-im2ba02: Make use of the helper function dev_err_probe()
  2021-09-16 10:42 [PATCH] drm/panel: k101-im2ba02: Make use of the helper function dev_err_probe() Cai Huoqing
@ 2021-09-16 11:18   ` Icenowy Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Icenowy Zheng @ 2021-09-16 11:18 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

在 2021-09-16星期四的 18:42 +0800,Cai Huoqing写道:
> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> And using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

Looks good to me, and thanks for pointing out this helper.

Acked-by: Icenowy Zheng <icenowy@aosc.io>

> ---
>  drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> index 2a602aee61c3..cb0bb3076099 100644
> --- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> +++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> @@ -456,16 +456,13 @@ static int k101_im2ba02_dsi_probe(struct
> mipi_dsi_device *dsi)
>  
>         ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx-
> >supplies),
>                                       ctx->supplies);
> -       if (ret < 0) {
> -               dev_err(&dsi->dev, "Couldn't get regulators\n");
> -               return ret;
> -       }
> +       if (ret < 0)
> +               return dev_err_probe(&dsi->dev, ret, "Couldn't get
> regulators\n");
>  
>         ctx->reset = devm_gpiod_get(&dsi->dev, "reset",
> GPIOD_OUT_LOW);
> -       if (IS_ERR(ctx->reset)) {
> -               dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
> -               return PTR_ERR(ctx->reset);
> -       }
> +       if (IS_ERR(ctx->reset))
> +               return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
> +                                    "Couldn't get our reset
> GPIO\n");
>  
>         drm_panel_init(&ctx->panel, &dsi->dev, &k101_im2ba02_funcs,
>                        DRM_MODE_CONNECTOR_DSI);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panel: k101-im2ba02: Make use of the helper function dev_err_probe()
@ 2021-09-16 11:18   ` Icenowy Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Icenowy Zheng @ 2021-09-16 11:18 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

在 2021-09-16星期四的 18:42 +0800,Cai Huoqing写道:
> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> And using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

Looks good to me, and thanks for pointing out this helper.

Acked-by: Icenowy Zheng <icenowy@aosc.io>

> ---
>  drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> index 2a602aee61c3..cb0bb3076099 100644
> --- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> +++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> @@ -456,16 +456,13 @@ static int k101_im2ba02_dsi_probe(struct
> mipi_dsi_device *dsi)
>  
>         ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx-
> >supplies),
>                                       ctx->supplies);
> -       if (ret < 0) {
> -               dev_err(&dsi->dev, "Couldn't get regulators\n");
> -               return ret;
> -       }
> +       if (ret < 0)
> +               return dev_err_probe(&dsi->dev, ret, "Couldn't get
> regulators\n");
>  
>         ctx->reset = devm_gpiod_get(&dsi->dev, "reset",
> GPIOD_OUT_LOW);
> -       if (IS_ERR(ctx->reset)) {
> -               dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
> -               return PTR_ERR(ctx->reset);
> -       }
> +       if (IS_ERR(ctx->reset))
> +               return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
> +                                    "Couldn't get our reset
> GPIO\n");
>  
>         drm_panel_init(&ctx->panel, &dsi->dev, &k101_im2ba02_funcs,
>                        DRM_MODE_CONNECTOR_DSI);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-16 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 10:42 [PATCH] drm/panel: k101-im2ba02: Make use of the helper function dev_err_probe() Cai Huoqing
2021-09-16 11:18 ` Icenowy Zheng
2021-09-16 11:18   ` Icenowy Zheng

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.