Den 30.06.2021 21.46, skrev Noralf Trønnes:
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@tronnes.org Suggested-by: Douglas Anderson dianders@chromium.org Signed-off-by: Linus Walleij linus.walleij@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.
I think the error reporting needs to ratelimited if added to mipi_dbi_command() because worst case a blinking fbcon cursor will trigger 10 errors a second for the framebuffer drivers.
Noralf.