[PATCH v3 03/15] drm/i915/display: use a macro to define platform enumerations

Michal Wajdeczko michal.wajdeczko at intel.com
Tue Oct 8 09:42:28 UTC 2024



On 08.10.2024 11:30, Jani Nikula wrote:
> On Mon, 07 Oct 2024, Michal Wajdeczko <michal.wajdeczko at intel.com> wrote:
>> On 30.09.2024 14:31, Jani Nikula wrote:
>>> We'll be needing a macro based list of platforms for more things in the
>>> future. Start by defining the platform enumerations with it.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>>> ---
>>>  .../drm/i915/display/intel_display_device.h   | 115 ++++++++++--------
>>>  1 file changed, 61 insertions(+), 54 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
>>> index 5306bbd13e59..1cc1a2de9e6a 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
>>> @@ -15,63 +15,70 @@ struct drm_i915_private;
>>>  struct drm_printer;
>>>  
>>>  /* Keep in gen based order, and chronological order within a gen */
>>> +#define INTEL_DISPLAY_PLATFORMS(func) \
>>> +	func(PLATFORM_UNINITIALIZED) \
>>
>> maybe this one should be defined in the old-fashion way so the
>> INTEL_DISPLAY_PLATFORMS macro will contain only valid IDs?
> 
> I don't understand.
> 

I mean something like this:

enum intel_display_platform {
	INTEL_DISPLAY_PLATFORM_UNINITIALIZED = 0,
	INTEL_DISPLAY_PLATFORMS(__ENUM)
};

with that INTEL_DISPLAY_PLATFORMS macro could be used in some other
cases (maybe tests) without worrying about that uninitialized case.


More information about the Intel-gfx mailing list