[Intel-gfx] [PATCH i-g-t v2 8/9] lib/igt_kms: Add more braces around macros

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Fri Jan 12 10:21:15 UTC 2018


The next patch wants to call for_each_pipe_with_valid_output
with *pipe and *output, this fails miserably without these braces.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 lib/igt_kms.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1cf9422c0d12..85e9564adf34 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -430,8 +430,8 @@ static inline bool igt_output_is_connected(igt_output_t *output)
  */
 #define for_each_connected_output(display, output)		\
 	for (int i__ = 0;  assert(igt_can_fail()), i__ < (display)->n_outputs; i__++)	\
-		for_each_if (((output = &(display)->outputs[i__]), \
-			      igt_output_is_connected(output)))
+		for_each_if ((((output) = &(display)->outputs[i__]), \
+			      igt_output_is_connected((output))))
 
 /**
  * for_each_pipe:
@@ -469,11 +469,11 @@ static inline bool igt_output_is_connected(igt_output_t *output)
  * will try every combination of @pipe and @output.
  */
 #define for_each_pipe_with_valid_output(display, pipe, output) \
-	for (int con__ = pipe = 0; \
-	     assert(igt_can_fail()), pipe < igt_display_get_n_pipes((display)) && con__ < (display)->n_outputs; \
+	for (int con__ = (pipe) = 0; \
+	     assert(igt_can_fail()), (pipe) < igt_display_get_n_pipes((display)) && con__ < (display)->n_outputs; \
 	     con__ = (con__ + 1 < (display)->n_outputs) ? con__ + 1 : (pipe = pipe + 1, 0)) \
-		for_each_if (((output = &(display)->outputs[con__]), \
-			     igt_pipe_connector_valid(pipe, output)))
+		for_each_if ((((output) = &(display)->outputs[con__]), \
+			     igt_pipe_connector_valid((pipe), (output))))
 
 /**
  * for_each_valid_output_on_pipe:
@@ -486,8 +486,8 @@ static inline bool igt_output_is_connected(igt_output_t *output)
  * happens.
  */
 #define for_each_valid_output_on_pipe(display, pipe, output) \
-	for_each_connected_output(display, output) \
-		for_each_if (igt_pipe_connector_valid(pipe, output))
+	for_each_connected_output((display), (output)) \
+		for_each_if (igt_pipe_connector_valid((pipe), (output)))
 
 #define for_each_plane_on_pipe(display, pipe, plane)			\
 	for (int j__ = 0; assert(igt_can_fail()), (plane) = &(display)->pipes[(pipe)].planes[j__], \
-- 
2.15.1



More information about the Intel-gfx mailing list