[Intel-gfx] [PATCH v2 3/4] drm/i915: Introduce for_each_shared_dpll()

Jani Nikula jani.nikula at linux.intel.com
Tue Oct 4 09:36:52 UTC 2022


On Mon, 26 Sep 2022, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> index b8dce4e9ac54..d419f4f98d28 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> @@ -36,6 +36,10 @@
>  	(void) (&__a == &__b);			\
>  	__a > __b ? (__a - __b) : (__b - __a); })
>  
> +#define for_each_shared_dpll(__i915, __pll, __i) \
> +	for ((__i) = 0; (__i) < (__i915)->display.dpll.num_shared_dpll && \
> +		     ((__pll) = &(__i915)->display.dpll.shared_dplls[(__i)]); (__i)++)
> +

A follow-up could drop dpll.num_shared_dpll altogether, and use
ARRAY_SIZE() to loop. This anyway stops at first NULL value.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list