drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
Subsystems (2)
PATCH 1/1 drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
From: Ville Syrjälä <[email protected]>
Make the PIPE_CONF_CHECK macros a bit more robust by wrapping them in do {} while(0). Avoids funky sirprises when you try put an 'else' after a PIPE_CONF_CHECK invocation...
--- drivers/gpu/drm/i915/intel_display.c | 45 +++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_display.c +27 -18
@@ -11087,39 +11087,42 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, (current_config->base.mode.private_flags &I915_MODE_FLAG_INHERITED ) && !(pipe_config->base.mode.private_flags &I915_MODE_FLAG_INHERITED ); -#define PIPE_CONF_CHECK_X (name) \ +#define PIPE_CONF_CHECK_X (name) do { \ if (current_config->name != pipe_config->name) { \ pipe_config_err(adjust, __stringify(name), \ "(expected 0x%08x, found 0x%08x)\n", \ current_config->name, \ pipe_config->name); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_I (name) \ +#define PIPE_CONF_CHECK_I (name) do { \ if (current_config->name != pipe_config->name) { \ pipe_config_err(adjust, __stringify(name), \ "(expected %i, found %i)\n", \ current_config->name, \ pipe_config->name); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_BOOL (name) \ +#define PIPE_CONF_CHECK_BOOL (name) do { \ if (current_config->name != pipe_config->name) { \ pipe_config_err(adjust, __stringify(name), \ "(expected %s, found %s)\n", \ yesno(current_config->name), \ yesno(pipe_config->name)); \ ret = false; \ - } + } \ +} while (0)/* * Checks state where we only read out the enabling, but not the entire * state itself (like full infoframes or ELD for audio). These states * require a full modeset on bootup to fix up. */ -#define PIPE_CONF_CHECK_BOOL_INCOMPLETE (name) \ +#define PIPE_CONF_CHECK_BOOL_INCOMPLETE (name) do { \ if (!fixup_inherited || (!current_config->name && !pipe_config->name)) { \ PIPE_CONF_CHECK_BOOL(name); \ } else { \
@@ -11128,18 +11131,20 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,yesno (current_config->name), \ yesno(pipe_config->name)); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_P (name) \ +#define PIPE_CONF_CHECK_P (name) do { \ if (current_config->name != pipe_config->name) { \ pipe_config_err(adjust, __stringify(name), \ "(expected %p, found %p)\n", \ current_config->name, \ pipe_config->name); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_M_N (name) \ +#define PIPE_CONF_CHECK_M_N (name) do { \ if (!intel_compare_link_m_n(¤t_config->name, \ &pipe_config->name,\ adjust)) { \
@@ -11157,14 +11162,15 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, pipe_config->name.link_m, \ pipe_config->name.link_n); \ ret = false; \ - } + } \ +}while (0 )/* This is required for BDW+ where there is only one set of registers for * switching between high and low RR. * This macro can be used whenever a comparison has to be made between one * hw state and multiple sw state variables. */ -#define PIPE_CONF_CHECK_M_N_ALT (name, alt_name) \ +#define PIPE_CONF_CHECK_M_N_ALT (name, alt_name) do { \ if (!intel_compare_link_m_n(¤t_config->name, \ &pipe_config->name, adjust) && \ !intel_compare_link_m_n(¤t_config->alt_name, \
@@ -11189,9 +11195,10 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, pipe_config->name.link_m, \ pipe_config->name.link_n); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_FLAGS (name, mask) \ +#define PIPE_CONF_CHECK_FLAGS (name, mask) do { \ if ((current_config->name ^ pipe_config->name) & (mask)) { \ pipe_config_err(adjust, __stringify(name), \ "(%x) (expected %i, found %i)\n", \
@@ -11199,16 +11206,18 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, current_config->name & (mask), \ pipe_config->name & (mask)); \ ret = false; \ - } + } \ +} while (0) -#define PIPE_CONF_CHECK_CLOCK_FUZZY (name) \ +#define PIPE_CONF_CHECK_CLOCK_FUZZY (name) do { \ if (!intel_fuzzy_clock_check(current_config->name, pipe_config->name)) { \ pipe_config_err(adjust, __stringify(name), \ "(expected %i, found %i)\n", \ current_config->name, \ pipe_config->name); \ ret = false; \ - } + } \ +} while (0)#define PIPE_CONF_QUIRK (quirk) \ ((current_config->quirks | pipe_config->quirks) & (quirk))
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
== Series Details ==
== Series Details ==
Series: drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
URL : https://patchwork.freedesktop.org/series/40118/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
f40fddd1cd8c drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
-:24: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects?
#24: FILE: drivers/gpu/drm/i915/intel_display.c:11090:
+#define PIPE_CONF_CHECK_X(name) do { \
if (current_config->name != pipe_config->name) { \
pipe_config_err(adjust, __stringify(name), \
"(expected 0x%08x, found 0x%08x)\n", \
current_config->name, \
pipe_config->name); \
ret = false; \
+ } \
+} while (0)-:36: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #36: FILE: drivers/gpu/drm/i915/intel_display.c:11100:
+#define PIPE_CONF_CHECK_I(name) do { \
if (current_config->name != pipe_config->name) { \
pipe_config_err(adjust, __stringify(name), \
"(expected %i, found %i)\n", \
current_config->name, \
pipe_config->name); \
ret = false; \
+ } \
+} while (0)
-:48: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #48: FILE: drivers/gpu/drm/i915/intel_display.c:11110:
+#define PIPE_CONF_CHECK_BOOL(name) do { \
if (current_config->name != pipe_config->name) { \
pipe_config_err(adjust, __stringify(name), \
"(expected %s, found %s)\n", \
yesno(current_config->name), \
yesno(pipe_config->name)); \
ret = false; \
+ } \
+} while (0)
-:65: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #65: FILE: drivers/gpu/drm/i915/intel_display.c:11125:
+#define PIPE_CONF_CHECK_BOOL_INCOMPLETE(name) do { \
if (!fixup_inherited || (!current_config->name && !pipe_config->name)) { \
PIPE_CONF_CHECK_BOOL(name); \
} else { \
-:78: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #78: FILE: drivers/gpu/drm/i915/intel_display.c:11137:
+#define PIPE_CONF_CHECK_P(name) do { \
if (current_config->name != pipe_config->name) { \
pipe_config_err(adjust, __stringify(name), \
"(expected %p, found %p)\n", \
current_config->name, \
pipe_config->name); \
ret = false; \
+ } \
+} while (0)
-:90: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #90: FILE: drivers/gpu/drm/i915/intel_display.c:11147:
+#define PIPE_CONF_CHECK_M_N(name) do { \
if (!intel_compare_link_m_n(¤t_config->name, \
&pipe_config->name,\
adjust)) { \
-:108: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #108: FILE: drivers/gpu/drm/i915/intel_display.c:11173:
+#define PIPE_CONF_CHECK_M_N_ALT(name, alt_name) do { \
if (!intel_compare_link_m_n(¤t_config->name, \
&pipe_config->name, adjust) && \
!intel_compare_link_m_n(¤t_config->alt_name, \
-:121: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #121: FILE: drivers/gpu/drm/i915/intel_display.c:11201:
+#define PIPE_CONF_CHECK_FLAGS(name, mask) do { \
if ((current_config->name ^ pipe_config->name) & (mask)) { \
pipe_config_err(adjust, __stringify(name), \
"(%x) (expected %i, found %i)\n", \
-:134: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects? #134: FILE: drivers/gpu/drm/i915/intel_display.c:11212:
+#define PIPE_CONF_CHECK_CLOCK_FUZZY(name) do { \
if (!intel_fuzzy_clock_check(current_config->name, pipe_config->name)) { \
pipe_config_err(adjust, __stringify(name), \
"(expected %i, found %i)\n", \
current_config->name, \
pipe_config->name); \
ret = false; \
+ } \
+} while (0)
total: 0 errors, 0 warnings, 9 checks, 123 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
URL : https://patchwork.freedesktop.org/series/40118/
State : success
== Summary ==
Series 40118v1 drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
https://patchwork.freedesktop.org/api/1.0/series/40118/revisions/1/mbox/
---- Known issues:
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:438s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:439s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:387s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:538s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:300s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:517s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:523s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:503s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:411s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:582s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:512s fi-cnl-drrs total:285 pass:254 dwarn:3 dfail:0 fail:0 skip:28 time:532s fi-cnl-y3 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:592s fi-elk-e7500 total:285 pass:225 dwarn:1 dfail:0 fail:0 skip:59 time:428s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:317s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:540s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:403s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:422s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:469s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:428s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:472s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:478s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:513s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:661s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:446s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:533s fi-skl-6700hq total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:541s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:503s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:500s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:429s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:443s fi-snb-2520m total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:585s fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:402s
66a3be2efe097a5aa8617214ac99fef81d623fe7 drm-tip: 2018y-03m-16d-16h-32m-51s UTC integration manifest f40fddd1cd8c drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8379/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Protect PIPE_CONF_CHECK macros with do {} while(0)
URL : https://patchwork.freedesktop.org/series/40118/
State : warning
== Summary ==
---- Possible new issues:
Test kms_cursor_crc:
Subgroup cursor-128x128-suspend:
skip -> PASS (shard-snb)
Test pm_rc6_residency:
Subgroup rc6-accuracy:
pass -> SKIP (shard-snb)---- Known issues:
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
pass -> DMESG-WARN (shard-snb) fdo#103375
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-pri-indfb-draw-render:
pass -> FAIL (shard-apl) fdo#101623
Test kms_rotation_crc:
Subgroup sprite-rotation-90-pos-100-0:
pass -> FAIL (shard-apl) fdo#105185
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047
Test perf:
Subgroup blocking:
fail -> PASS (shard-hsw) fdo#102252fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-apl total:3442 pass:1812 dwarn:1 dfail:0 fail:9 skip:1619 time:13107s shard-hsw total:3442 pass:1768 dwarn:1 dfail:0 fail:1 skip:1671 time:11973s shard-snb total:3442 pass:1357 dwarn:2 dfail:0 fail:2 skip:2081 time:7295s
Blacklisted hosts:
shard-kbl total:3442 pass:1938 dwarn:1 dfail:1 fail:9 skip:1493 time:9874s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8379/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx