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 <[email protected]>
> Suggested-by: Douglas Anderson <[email protected]>
> Signed-off-by: Linus Walleij <[email protected]>
> ---
>  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.

Reply via email to