drm/panel : himax-hx83102: fix incorrect argument to mipi_dsi_msleep
Subsystems (3)
PATCH v2 1/1 drm/panel : himax-hx83102: fix incorrect argument to mipi_dsi_msleep
mipi_dsi_msleep expects struct mipi_dsi_multi_context to be passed as a value and not as a reference.
---
Changes in v2:
- Add Fixes tag
v1: https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/panel/panel-himax-hx83102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-himax-hx83102.c +1 -1
@@ -479,7 +479,7 @@ static int hx83102_disable(struct drm_panel *panel)mipi_dsi_dcs_set_display_off_multi (&dsi_ctx);mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx); -mipi_dsi_msleep (&dsi_ctx,150 ); +mipi_dsi_msleep (dsi_ctx,150 );return dsi_ctx.accum_err; }
Signature · 1 line
2.45.2
Quoted 6 lines · Tejas Vipin
mipi_dsi_msleepexpects structmipi_dsi_multi_contextto be passed as a value and not as a reference.Fixes a2ab7cb169da ("drm/panel: himax-hx83102: use wrapped MIPI DCS functions")Signed-off-by Tejas Vipin <[email protected]>
Hi Tejas,
(for future reference, you don't need an extra newline between the Fixes and Signed-off-by tags)
LGTM,
Thanks,
Jessica Zhang
Quoted 27 lines
---
Changes in v2:
- Add Fixes tagv1: https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/panel/panel-himax-hx83102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/panel/panel-himax-hx83102.c +1
-1@@ -479,7 +479,7 @@ static int hx83102_disable(struct drm_panel *panel)mipi_dsi_dcs_set_display_off_multi (&dsi_ctx);mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx); -mipi_dsi_msleep (&dsi_ctx,150 ); +mipi_dsi_msleep (dsi_ctx,150 );return dsi_ctx.accum_err; }Signature · 1 line
2.45.2
Hi,
Quoted 7 lines · Tejas Vipin
mipi_dsi_msleepexpects structmipi_dsi_multi_contextto be passed as a value and not as a reference.Fixes a2ab7cb169da ("drm/panel: himax-hx83102: use wrapped MIPI DCS functions")Signed-off-by Tejas Vipin <[email protected]>
Should be no blank line between "Fixes" and "Signed-off-by"
Quoted 10 lines
---
Changes in v2:
- Add Fixes tagv1: https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/panel/panel-himax-hx83102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I notice you didn't CC me, even though I authored the broken commit. Presumably get_maintainer should have suggested you CC me?
drivers/gpu/drm/panel/panel-himax-hx83102.c static int hx83102_disable(struct drm_panel *panel) · line 482
Quoted 10 lines
drivers/gpu/drm/panel/panel-himax-hx83102.c +1
-1@@ -479,7 +479,7 @@ static int hx83102_disable(struct drm_panel *panel)mipi_dsi_dcs_set_display_off_multi (&dsi_ctx);mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx); -mipi_dsi_msleep (&dsi_ctx,150 ); +mipi_dsi_msleep (dsi_ctx,150 );
So while your fix is correct, it's not really enough. I swore that I compile tested my change and, sure enough, the bad code compile tests fine. This is because the macro mipi_dsi_msleep() fell into a macro trap. :( Specifically, we have:
#define mipi_dsi_msleep(ctx, delay) \
do { \
if (!ctx.accum_err) \
msleep(delay); \
} while (0)Let's look at "if (!ctx.accum_err)". Before your patch, that translated to:
if (!&dsi_ctx.accum_err)
...adding extra parentheses for order of operations, that is:
if (!&(dsi_ctx.accum_err))
...in other words it's testing whether the address of the "accum_err" is NULL. That's not a syntax error, but _really_ not what was meant.
We really need to fix the macro trap by changing it like this:
- if (!ctx.accum_err) \ + if (!(ctx).accum_err) \
When you do that, though, you find that half the users of the macro were using it wrong since every other "_multi_" function passes the address. IMO while fixing the macro trap we should just change this to pass the address and then fix up all the callers.
This is a serious enough problem (thanks for noticing it) that I'm happy to send out patches, but also I'm fine if you want to tackle it. If I don't see anything from you in a day or two I'll send out patches.
Thanks!
-Doug