All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/panel: Use dev_err_probe() to simplify code
@ 2022-09-29  1:55 Yuan Can
  2022-09-29  1:55 ` [PATCH v2 1/2] drm/panel: panel-edp: " Yuan Can
  2022-09-29  1:55 ` [PATCH v2 2/2] drm/panel: simple: " Yuan Can
  0 siblings, 2 replies; 6+ messages in thread
From: Yuan Can @ 2022-09-29  1:55 UTC (permalink / raw)
  To: dianders, thierry.reding, sam, airlied, daniel, dri-devel; +Cc: yuancan

This series contains two patchs simplify the error handling in probe
function by switching from dev_err() to dev_err_probe().
---
changes in v2:
- simplify the same case in panel_edp_probe
- add Reviewed-by from Douglas Anderson

Yuan Can (2):
  drm/panel: panel-edp: Use dev_err_probe() to simplify code
  drm/panel: simple: Use dev_err_probe() to simplify code

 drivers/gpu/drm/panel/panel-edp.c    | 22 ++++++----------------
 drivers/gpu/drm/panel/panel-simple.c |  9 +++------
 2 files changed, 9 insertions(+), 22 deletions(-)

-- 
2.17.1


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

* [PATCH v2 1/2] drm/panel: panel-edp: Use dev_err_probe() to simplify code
  2022-09-29  1:55 [PATCH v2 0/2] drm/panel: Use dev_err_probe() to simplify code Yuan Can
@ 2022-09-29  1:55 ` Yuan Can
  2022-09-29 21:06   ` Doug Anderson
  2022-09-29  1:55 ` [PATCH v2 2/2] drm/panel: simple: " Yuan Can
  1 sibling, 1 reply; 6+ messages in thread
From: Yuan Can @ 2022-09-29  1:55 UTC (permalink / raw)
  To: dianders, thierry.reding, sam, airlied, daniel, dri-devel; +Cc: yuancan

In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs.

Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-edp.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index 7b90016b8408..e323a6331143 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -403,17 +403,10 @@ static int panel_edp_unprepare(struct drm_panel *panel)
 
 static int panel_edp_get_hpd_gpio(struct device *dev, struct panel_edp *p)
 {
-	int err;
-
 	p->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN);
-	if (IS_ERR(p->hpd_gpio)) {
-		err = PTR_ERR(p->hpd_gpio);
-
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "failed to get 'hpd' GPIO: %d\n", err);
-
-		return err;
-	}
+	if (IS_ERR(p->hpd_gpio))
+		return dev_err_probe(dev, PTR_ERR(p->hpd_gpio),
+				     "failed to get 'hpd' GPIO\n");
 
 	return 0;
 }
@@ -832,12 +825,9 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
 
 	panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
 						     GPIOD_OUT_LOW);
-	if (IS_ERR(panel->enable_gpio)) {
-		err = PTR_ERR(panel->enable_gpio);
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "failed to request GPIO: %d\n", err);
-		return err;
-	}
+	if (IS_ERR(panel->enable_gpio))
+		return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
+				     "failed to request GPIO\n");
 
 	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
-- 
2.17.1


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

* [PATCH v2 2/2] drm/panel: simple: Use dev_err_probe() to simplify code
  2022-09-29  1:55 [PATCH v2 0/2] drm/panel: Use dev_err_probe() to simplify code Yuan Can
  2022-09-29  1:55 ` [PATCH v2 1/2] drm/panel: panel-edp: " Yuan Can
@ 2022-09-29  1:55 ` Yuan Can
  2022-09-29 21:08   ` Doug Anderson
  1 sibling, 1 reply; 6+ messages in thread
From: Yuan Can @ 2022-09-29  1:55 UTC (permalink / raw)
  To: dianders, thierry.reding, sam, airlied, daniel, dri-devel; +Cc: yuancan

In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs.

Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-simple.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 0cb3be26e2e6..1607824dc2b3 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -575,12 +575,9 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 
 	panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
 						     GPIOD_OUT_LOW);
-	if (IS_ERR(panel->enable_gpio)) {
-		err = PTR_ERR(panel->enable_gpio);
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "failed to request GPIO: %d\n", err);
-		return err;
-	}
+	if (IS_ERR(panel->enable_gpio))
+		return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
+				     "failed to request GPIO\n");
 
 	err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
 	if (err) {
-- 
2.17.1


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

* Re: [PATCH v2 1/2] drm/panel: panel-edp: Use dev_err_probe() to simplify code
  2022-09-29  1:55 ` [PATCH v2 1/2] drm/panel: panel-edp: " Yuan Can
@ 2022-09-29 21:06   ` Doug Anderson
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2022-09-29 21:06 UTC (permalink / raw)
  To: Yuan Can; +Cc: Thierry Reding, Sam Ravnborg, dri-devel

Hi,

On Wed, Sep 28, 2022 at 6:56 PM Yuan Can <yuancan@huawei.com> wrote:
>
> In the probe path, dev_err() can be replaced with dev_err_probe()
> which will check if error code is -EPROBE_DEFER and prints the
> error name. It also sets the defer probe reason which can be
> checked later through debugfs.
>
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> ---
>  drivers/gpu/drm/panel/panel-edp.c | 22 ++++++----------------
>  1 file changed, 6 insertions(+), 16 deletions(-)

Pushed to drm-misc-next:

b28d204a7c19 drm/panel: panel-edp: Use dev_err_probe() to simplify code

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

* Re: [PATCH v2 2/2] drm/panel: simple: Use dev_err_probe() to simplify code
  2022-09-29  1:55 ` [PATCH v2 2/2] drm/panel: simple: " Yuan Can
@ 2022-09-29 21:08   ` Doug Anderson
  2022-09-30  1:10     ` Yuan Can
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Anderson @ 2022-09-29 21:08 UTC (permalink / raw)
  To: Yuan Can; +Cc: Thierry Reding, Sam Ravnborg, dri-devel

Hi,

On Wed, Sep 28, 2022 at 6:57 PM Yuan Can <yuancan@huawei.com> wrote:
>
> In the probe path, dev_err() can be replaced with dev_err_probe()
> which will check if error code is -EPROBE_DEFER and prints the
> error name. It also sets the defer probe reason which can be
> checked later through debugfs.
>
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Pushed to drm-misc-next:

c9b48b91e2fb drm/panel: simple: Use dev_err_probe() to simplify code

For the other patches in your original series, I'll assume folks
paying more attention to those panel drivers will commit them. If they
totally stall for a while, though, then yell and I can try taking a
look at them. :-)

-Doug

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

* Re: [PATCH v2 2/2] drm/panel: simple: Use dev_err_probe() to simplify code
  2022-09-29 21:08   ` Doug Anderson
@ 2022-09-30  1:10     ` Yuan Can
  0 siblings, 0 replies; 6+ messages in thread
From: Yuan Can @ 2022-09-30  1:10 UTC (permalink / raw)
  To: Doug Anderson; +Cc: Thierry Reding, Sam Ravnborg, dri-devel


在 2022/9/30 5:08, Doug Anderson 写道:
> Hi,
>
> On Wed, Sep 28, 2022 at 6:57 PM Yuan Can <yuancan@huawei.com> wrote:
>> In the probe path, dev_err() can be replaced with dev_err_probe()
>> which will check if error code is -EPROBE_DEFER and prints the
>> error name. It also sets the defer probe reason which can be
>> checked later through debugfs.
>>
>> Signed-off-by: Yuan Can <yuancan@huawei.com>
>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>> ---
>>   drivers/gpu/drm/panel/panel-simple.c | 9 +++------
>>   1 file changed, 3 insertions(+), 6 deletions(-)
> Pushed to drm-misc-next:
>
> c9b48b91e2fb drm/panel: simple: Use dev_err_probe() to simplify code
>
> For the other patches in your original series, I'll assume folks
> paying more attention to those panel drivers will commit them. If they
> totally stall for a while, though, then yell and I can try taking a
> look at them. :-)
That's great, Thanks!😁

-- 
Best regards,
Yuan Can


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

end of thread, other threads:[~2022-09-30  1:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  1:55 [PATCH v2 0/2] drm/panel: Use dev_err_probe() to simplify code Yuan Can
2022-09-29  1:55 ` [PATCH v2 1/2] drm/panel: panel-edp: " Yuan Can
2022-09-29 21:06   ` Doug Anderson
2022-09-29  1:55 ` [PATCH v2 2/2] drm/panel: simple: " Yuan Can
2022-09-29 21:08   ` Doug Anderson
2022-09-30  1:10     ` Yuan Can

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.