Re: [PATCH i-g-t 8/8] lib/kms: Turn igt_pipe_connector_valid() into a function

Jani Nikula
2026-01-13T14:41:20Z

On Tue, 13 Jan 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> There is no need for igt_pipe_connector_valid() to be a macro,
> just make it a function. This gets us type safety, and will
> help us do more changes later using coccinelle.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> lib/igt_kms.h | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index e1044101707c..a271c94a97fd 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -669,9 +669,11 @@ static inline bool igt_output_is_connected(igt_output_t *output)
> *
> * Checks whether the given pipe and output can be used together.
> */
> -#define igt_pipe_connector_valid(pipe, output) \
> - (igt_output_is_connected((output)) && \
> - (output->config.valid_crtc_idx_mask & (1 << (pipe))))
> +static inline bool igt_pipe_connector_valid(enum pipe pipe, igt_output_t *output)
> +{
> + return igt_output_is_connected(output) &&
> + output->config.valid_crtc_idx_mask & (1 << (pipe));

Here, too, using pipe for crtc idx mask is wrong both before and after
the patch. But I'm sure this will help the eventual changes fixing that.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> +}
>
> #define for_each_if(condition) if (!(condition)) {} else

--
Jani Nikula, Intel