drm/panel: Use dev_err_probe() to simplify code
Subsystems (6)
cover drm/panel: Use dev_err_probe() to simplify code
This series simplify the error handling in probe function by switching from dev_err() to dev_err_probe().
Yuan Can (10):
drm/panel: himax8279d: Use dev_err_probe() to simplify code drm/panel: panel-edp: Use dev_err_probe() to simplify code drm/panel: elida-kd35t133: Use dev_err_probe() to simplify code drm/panel: leadtek-ltk050h3146w: Use dev_err_probe() to simplify code drm/panel: leadtek-ltk500hd1829: Use dev_err_probe() to simplify code drm/panel: lvds: Use dev_err_probe() to simplify code drm/panel: otm8009a: Use dev_err_probe() to simplify code drm/panel: rm68200: Use dev_err_probe() to simplify code drm/panel: s6d16d0: Use dev_err_probe() to simplify code drm/panel: simple: Use dev_err_probe() to simplify code
drivers/gpu/drm/panel/panel-boe-himax8279d.c | 27 +++++++------------ drivers/gpu/drm/panel/panel-edp.c | 13 +++------ drivers/gpu/drm/panel/panel-elida-kd35t133.c | 18 +++++-------- .../drm/panel/panel-leadtek-ltk050h3146w.c | 18 +++++-------- .../drm/panel/panel-leadtek-ltk500hd1829.c | 18 +++++-------- drivers/gpu/drm/panel/panel-lvds.c | 9 +++---- .../gpu/drm/panel/panel-orisetech-otm8009a.c | 9 +++---- drivers/gpu/drm/panel/panel-raydium-rm68200.c | 9 +++---- drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 9 +++---- drivers/gpu/drm/panel/panel-simple.c | 9 +++---- 10 files changed, 45 insertions(+), 94 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/10 drm/panel: himax8279d: 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-boe-himax8279d.c | 27 +++++++------------- 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/gpu/drm/panel/panel-boe-himax8279d.c +9 -18
@@ -854,28 +854,19 @@ static int panel_add(struct panel_info *pinfo)int ret; pinfo->pp18_gpio =devm_gpiod_get (dev,"pp18" ,GPIOD_OUT_HIGH ); -if (IS_ERR (pinfo->pp18_gpio)) { - ret =PTR_ERR (pinfo->pp18_gpio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pp18 gpio: %d\n" , ret); -return ret; - } +if (IS_ERR (pinfo->pp18_gpio)) +return dev_err_probe (dev,PTR_ERR (pinfo->pp18_gpio), +"failed to get pp18 gpio\n" ); pinfo->pp33_gpio =devm_gpiod_get (dev,"pp33" ,GPIOD_OUT_HIGH ); -if (IS_ERR (pinfo->pp33_gpio)) { - ret =PTR_ERR (pinfo->pp33_gpio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pp33 gpio: %d\n" , ret); -return ret; - } +if (IS_ERR (pinfo->pp33_gpio)) +return dev_err_probe (dev,PTR_ERR (pinfo->pp33_gpio), +"failed to get pp33 gpio\n" ); pinfo->enable_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_HIGH ); -if (IS_ERR (pinfo->enable_gpio)) { - ret =PTR_ERR (pinfo->enable_gpio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get enable gpio: %d\n" , ret); -return ret; - } +if (IS_ERR (pinfo->enable_gpio)) +return dev_err_probe (dev,PTR_ERR (pinfo->enable_gpio), +"failed to get enable gpio\n" );drm_panel_init (&pinfo->base, dev, &panel_funcs,DRM_MODE_CONNECTOR_DSI );
Signature · 1 line
2.17.1
PATCH 2/10 drm/panel: panel-edp: 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-edp.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +3 -10
@@ -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 ; }
Signature · 1 line
2.17.1
Doug Anderson
reviewerRe: [PATCH 02/10] drm/panel: panel-edp: Use dev_err_probe() to simplify code
Hi,
Quoted 23 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]>--- drivers/gpu/drm/panel/panel-edp.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)drivers/gpu/drm/panel/panel-edp.c +0
-3@@ -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)) {
drivers/gpu/drm/panel/panel-edp.c static int panel_edp_unprepare(struct drm_panel *panel) · line 409
Quoted 10 lines
drivers/gpu/drm/panel/panel-edp.c +3
-7- 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" );
This is a fine improvement but I'm a bit curious why you only fixed one of the two cases? You could do the same thing for the "enable" GPIO in panel_edp_probe().
-Doug
PATCH 3/10 drm/panel: elida-kd35t133: 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-elida-kd35t133.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +6 -12
@@ -257,20 +257,14 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi) } ctx->vdd =devm_regulator_get (dev,"vdd" ); -if (IS_ERR (ctx->vdd)) { - ret =PTR_ERR (ctx->vdd); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request vdd regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->vdd)) +return dev_err_probe (dev,PTR_ERR (ctx->vdd), +"Failed to request vdd regulator\n" ); ctx->iovcc =devm_regulator_get (dev,"iovcc" ); -if (IS_ERR (ctx->iovcc)) { - ret =PTR_ERR (ctx->iovcc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request iovcc regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->iovcc)) +return dev_err_probe (dev,PTR_ERR (ctx->iovcc), +"Failed to request iovcc regulator\n" ); ret =of_drm_get_panel_orientation (dev->of_node, &ctx->orientation);if (ret <0 ) {
Signature · 1 line
2.17.1
PATCH 4/10 drm/panel: leadtek-ltk050h3146w: 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.
--- .../gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +6 -12
@@ -571,20 +571,14 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi) } ctx->vci =devm_regulator_get (dev,"vci" ); -if (IS_ERR (ctx->vci)) { - ret =PTR_ERR (ctx->vci); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request vci regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->vci)) +return dev_err_probe (dev,PTR_ERR (ctx->vci), +"Failed to request vci regulator\n" ); ctx->iovcc =devm_regulator_get (dev,"iovcc" ); -if (IS_ERR (ctx->iovcc)) { - ret =PTR_ERR (ctx->iovcc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request iovcc regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->iovcc)) +return dev_err_probe (dev,PTR_ERR (ctx->iovcc), +"Failed to request iovcc regulator\n" );mipi_dsi_set_drvdata (dsi, ctx);
Signature · 1 line
2.17.1
PATCH 5/10 drm/panel: leadtek-ltk500hd1829: 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.
--- .../gpu/drm/panel/panel-leadtek-ltk500hd1829.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c +6 -12
@@ -420,20 +420,14 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi) } ctx->vcc =devm_regulator_get (dev,"vcc" ); -if (IS_ERR (ctx->vcc)) { - ret =PTR_ERR (ctx->vcc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request vcc regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->vcc)) +return dev_err_probe (dev,PTR_ERR (ctx->vcc), +"Failed to request vcc regulator\n" ); ctx->iovcc =devm_regulator_get (dev,"iovcc" ); -if (IS_ERR (ctx->iovcc)) { - ret =PTR_ERR (ctx->iovcc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request iovcc regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->iovcc)) +return dev_err_probe (dev,PTR_ERR (ctx->iovcc), +"Failed to request iovcc regulator\n" );mipi_dsi_set_drvdata (dsi, ctx);
Signature · 1 line
2.17.1
PATCH 6/10 drm/panel: lvds: 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-lvds.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-lvds.c +3 -6
@@ -178,12 +178,9 @@ static int panel_lvds_probe(struct platform_device *pdev)if (IS_ERR (lvds->supply)) { ret =PTR_ERR (lvds->supply); -if (ret != -ENODEV ) { -if (ret != -EPROBE_DEFER ) -dev_err (lvds->dev,"failed to request regulator: %d\n" , - ret); -return ret; - } +if (ret != -ENODEV ) +return dev_err_probe (lvds->dev, ret, +"failed to request regulator\n" ); lvds->supply =NULL ; }
Signature · 1 line
2.17.1
PATCH 7/10 drm/panel: otm8009a: 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-orisetech-otm8009a.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +3 -6
@@ -451,12 +451,9 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi) } ctx->supply =devm_regulator_get (dev,"power" ); -if (IS_ERR (ctx->supply)) { - ret =PTR_ERR (ctx->supply); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to request regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->supply)) +return dev_err_probe (dev,PTR_ERR (ctx->supply), +"failed to request regulator\n" );mipi_dsi_set_drvdata (dsi, ctx);
Signature · 1 line
2.17.1
PATCH 8/10 drm/panel: rm68200: 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-raydium-rm68200.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-raydium-rm68200.c +3 -6
@@ -377,12 +377,9 @@ static int rm68200_probe(struct mipi_dsi_device *dsi) } ctx->supply =devm_regulator_get (dev,"power" ); -if (IS_ERR (ctx->supply)) { - ret =PTR_ERR (ctx->supply); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"cannot get regulator: %d\n" , ret); -return ret; - } +if (IS_ERR (ctx->supply)) +return dev_err_probe (dev,PTR_ERR (ctx->supply), +"cannot get regulator\n" );mipi_dsi_set_drvdata (dsi, ctx);
Signature · 1 line
2.17.1
PATCH 9/10 drm/panel: s6d16d0: 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-samsung-s6d16d0.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-samsung-s6d16d0.c +3 -6
@@ -193,12 +193,9 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)/* This asserts RESET by default */ s6->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (s6->reset_gpio)) { - ret =PTR_ERR (s6->reset_gpio); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to request GPIO (%d)\n" , ret); -return ret; - } +if (IS_ERR (s6->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (s6->reset_gpio), +"failed to request GPIO\n" );drm_panel_init (&s6->panel, dev, &s6d16d0_drm_funcs,DRM_MODE_CONNECTOR_DSI );
Signature · 1 line
2.17.1
PATCH 10/10 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 10/10] drm/panel: simple: Use dev_err_probe() to simplify code
Hi,
Quoted 18 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]>--- drivers/gpu/drm/panel/panel-simple.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/gpu/drm/panel/panel-simple.c +0
-0@@ -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",
drivers/gpu/drm/panel/panel-simple.c static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) · line 580
Quoted 10 lines
drivers/gpu/drm/panel/panel-simple.c +3
-6GPIOD_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" );
I'd be happy to land this patch and the panel-edp one into drm-misc just because I've touched those panel drivers in the past. I'd tend to leave the other panel drivers to others unless you really get stuck.
For now I'll sit tight because I think you can make a 2nd fix to the panel-edp one and put them into the same patch.
-Doug
Re: [PATCH 10/10] drm/panel: simple: Use dev_err_probe() to simplify code
Quoted 32 lines · Doug Anderson
Hi,
Quoted 17 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]>--- drivers/gpu/drm/panel/panel-simple.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/gpu/drm/panel/panel-simple.c +0
-0@@ -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",drivers/gpu/drm/panel/panel-simple.c static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) · line 580
Quoted 10 lines
drivers/gpu/drm/panel/panel-simple.c +3
-6GPIOD_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" );Reviewed-by Douglas Anderson <[email protected]>
Quoted 6 lines
I'd be happy to land this patch and the panel-edp one into drm-misc just because I've touched those panel drivers in the past. I'd tend to leave the other panel drivers to others unless you really get stuck.
For now I'll sit tight because I think you can make a 2nd fix to the panel-edp one and put them into the same patch.
Thanks for the notice, I will fix the case in panel_edp_probe in the v2 patch and
send it ASAP.
Signature · 2 lines
Best regards, Yuan Can