drm/panel: Use dev_err_probe() to simplify code
v2 cover drm/panel: Use dev_err_probe() to simplify code
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(-)
Signature · 1 line
2.17.1
PATCH v2 1/2 drm/panel: panel-edp: Use dev_err_probe() to simplify code
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.
--- drivers/gpu/drm/panel/panel-edp.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +6 -16
@@ -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) {
Signature · 1 line
2.17.1
Re: [PATCH v2 1/2] drm/panel: panel-edp: Use dev_err_probe() to simplify code
Hi,
Quoted 11 lines · Yuan Can
In the probe path,
dev_err()can be replaced withdev_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 <[email protected]>Reviewed-by Douglas Anderson <[email protected]>--- 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
PATCH v2 2/2 drm/panel: simple: Use dev_err_probe() to simplify code
In reply to Yuan CanIn 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.
--- drivers/gpu/drm/panel/panel-simple.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +3 -6
@@ -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) {
Signature · 1 line
2.17.1
Re: [PATCH v2 2/2] drm/panel: simple: Use dev_err_probe() to simplify code
Hi,
Quoted 11 lines · Yuan Can
In the probe path,
dev_err()can be replaced withdev_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 <[email protected]>Reviewed-by Douglas Anderson <[email protected]>--- 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
Re: [PATCH v2 2/2] drm/panel: simple: Use dev_err_probe() to simplify code
Quoted 13 lines · Doug Anderson
Hi,
Quoted 10 lines · Yuan Can
In the probe path,
dev_err()can be replaced withdev_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 <[email protected]>Reviewed-by Douglas Anderson <[email protected]>--- drivers/gpu/drm/panel/panel-simple.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Quoted 8 lines
Pushed to drm-misc-next:
c9b48b91e2fbdrm/panel: simple: Usedev_err_probe()to simplify codeFor 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!😁
Signature · 2 lines
Best regards, Yuan Can