drm/panel: ltk050h3146w: error-path debug message improvements
Subsystems (3)
cover drm/panel: ltk050h3146w: error-path debug message improvements
This hides an error message if EPROBE_DEFER was returned when trying to get the reset GPIO.
This also makes use of dev_err_probe in lieu of hand-crafted logic inside the driver.
Thanks,
Quentin
---
Quentin Schulz (2):
drm/panel: ltk050h3146w: only print message when GPIO getting is not EPROBE_DEFER drm/panel: ltk050h3146w: use dev_err_probe wherever possible
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 23 +++++++--------------- 1 file changed, 7 insertions(+), 16 deletions(-)
---
base-commit: ac865f00af293d081356bec56eea90815094a60e
change-id: 20240104-ltk-dev_err_probe-3c93c1b09242
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH 1/2 drm/panel: ltk050h3146w: only print message when GPIO getting is not EPROBE_DEFER
From: Quentin Schulz <[email protected]>
devm_gpiod_get_optional may return EPROBE_DEFER in case the GPIO controller isn't yet probed when the panel driver is being probed.
In that case, a spurious and confusing error message about not being able to get the reset GPIO is printed even though later on the device actually manages to get probed.
Use dev_err_probe instead so that the message is only printed when it truly matters.
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +2 -4
@@ -646,10 +646,8 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)return -EINVAL ; ctx->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ctx->reset_gpio)) { -dev_err (dev,"cannot get reset gpio\n" ); -return PTR_ERR (ctx->reset_gpio); - } +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"cannot get reset gpio\n" ); ctx->vci =devm_regulator_get (dev,"vci" );if (IS_ERR (ctx->vci)) {
Signature · 1 line
2.43.0
Re: [PATCH 1/2] drm/panel: ltk050h3146w: only print message when GPIO getting is not EPROBE_DEFER
Le 04/01/2024 à 13:41, Quentin Schulz a écrit :
Quoted 9 lines
From: Quentin Schulz <[email protected]>
devm_gpiod_get_optionalmay returnEPROBE_DEFERin case the GPIO controller isn't yet probed when the panel driver is being probed.In that case, a spurious and confusing error message about not being able to get the reset GPIO is printed even though later on the device actually manages to get probed.
Quoted 5 lines
Use
dev_err_probeinstead so that the message is only printed when it truly matters.Cc Quentin Schulz <[email protected]>Signed-off-by Quentin Schulz <[email protected]>
Quoted 22 lines
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +2
-4@@ -646,10 +646,8 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)return -EINVAL ; ctx->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ctx->reset_gpio)) { -dev_err (dev,"cannot get reset gpio\n" ); -return PTR_ERR (ctx->reset_gpio); - } +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"cannot get reset gpio\n" ); ctx->vci =devm_regulator_get (dev,"vci" );if (IS_ERR (ctx->vci)) {
PATCH 2/2 drm/panel: ltk050h3146w: use dev_err_probe wherever possible
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This is only a cosmetic change.
This replaces a hand-crafted EPROBE_DEFER handling for deciding to print an error message with dev_err_probe.
A side-effect is that dev_err_probe also adds a debug message when it's not EPROBE_DEFER, but this is seen as an improvement.
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +5 -12
@@ -650,20 +650,13 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"cannot get reset gpio\n" ); 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.43.0
Re: [PATCH 2/2] drm/panel: ltk050h3146w: use dev_err_probe wherever possible
Le 04/01/2024 à 13:41, Quentin Schulz a écrit :
Quoted 4 lines
From: Quentin Schulz <[email protected]>
This is only a cosmetic change.
Quoted 8 lines
This replaces a hand-crafted
EPROBE_DEFERhandling for deciding to print an error message withdev_err_probe.A side-effect is that
dev_err_probealso adds a debug message when it's notEPROBE_DEFER, but this is seen as an improvement.Cc Quentin Schulz <[email protected]>Signed-off-by Quentin Schulz <[email protected]>
Quoted 35 lines
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +5
-12@@ -650,20 +650,13 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"cannot get reset gpio\n" ); 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);
Heiko Stuebner
AppliedQuoted 10 lines · Quentin Schulz
This hides an error message if
EPROBE_DEFERwas returned when trying to get the reset GPIO.This also makes use of
dev_err_probein lieu of hand-crafted logic inside the driver.Thanks,
Quentin[...]
Applied, thanks!
[1/2] drm/panel: ltk050h3146w: only print message when GPIO getting is not EPROBE_DEFER
commit: 65afd91e8d70e10c7f99126d61bf0045ef52d271
[2/2] drm/panel: ltk050h3146w: use dev_err_probe wherever possible
commit: 056a9965e58e47928e8afd4dc017221f9221b3d3Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>