[Intel-gfx] [PATCH i-g-t v2 8/9] lib/igt_kms: Add more braces around macros
Mika Kahola
mika.kahola at intel.com
Mon Jan 15 12:01:42 UTC 2018
On Fri, 2018-01-12 at 11:21 +0100, Maarten Lankhorst wrote:
> The next patch wants to call for_each_pipe_with_valid_output
> with *pipe and *output, this fails miserably without these braces.
>
Reviewed-by: Mika Kahola <mika.kahola at intel.com>
> 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__], \
--
Mika Kahola - Intel OTC
More information about the Intel-gfx
mailing list