[PATCH] drm/panel: db7430: Improve error reporting

Noralf Trønnes noralf at tronnes.org
Wed Jun 30 19:46:45 UTC 2021



Den 30.06.2021 21.13, skrev Linus Walleij:
> This creates a macro wrapping mipi_dbi_command() such that we get
> some explicit error reporting if something goes wrong.
> 
> Cc: Noralf Trønnes <noralf at tronnes.org>
> Suggested-by: Douglas Anderson <dianders at chromium.org>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  drivers/gpu/drm/panel/panel-samsung-db7430.c | 66 +++++++++++---------
>  1 file changed, 36 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-db7430.c b/drivers/gpu/drm/panel/panel-samsung-db7430.c
> index fe58263bd9cd..c42d43ab6a4f 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-db7430.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-db7430.c
> @@ -90,9 +90,17 @@ static inline struct db7430 *to_db7430(struct drm_panel *panel)
>  	return container_of(panel, struct db7430, panel);
>  }
>  
> +#define db7430_command(db, cmd, seq...) \
> +({ \
> +	struct mipi_dbi *dbi = &db->dbi;	\
> +	int ret;				\
> +	ret = mipi_dbi_command(dbi, cmd, seq);  \
> +	if (ret)							\
> +		dev_err(db->dev, "failure in writing command %#02x\n", cmd); \
> +})
> +

I did a grep and there's only one mipi_dbi_command() caller that checks
the return code: mipi_dbi_poweron_reset_conditional().

Can you add the error reporting to mipi_dbi_command() instead? Instead
of drivers adding their own similar macros.

In that case I think you need to add a plain 'ret' at the end of the
macro for it to return the error code.

Noralf.


More information about the dri-devel mailing list