diff mbox series

[v2,2/2] drm/panel: simple: Use dev_err_probe() to simplify code

Message ID 20220929015503.17301-3-yuancan@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/panel: Use dev_err_probe() to simplify code | expand

Commit Message

Yuan Can Sept. 29, 2022, 1:55 a.m. UTC
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(-)

Comments

Doug Anderson Sept. 29, 2022, 9:08 p.m. UTC | #1
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
Yuan Can Sept. 30, 2022, 1:10 a.m. UTC | #2
在 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!
diff mbox series

Patch

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) {