On Tue, Jun 18, 2024 at 05:22:54PM GMT, Jani Nikula wrote:
Add a structure with a bitfield member for each platform and subplatform, and initialize them in platform and subplatform descs. Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_display_device.c | 8 ++++++-- drivers/gpu/drm/i915/display/intel_display_device.h | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c index 80563af7ac71..0c275d85bd30 100644 --- a/drivers/gpu/drm/i915/display/intel_display_device.c +++ b/drivers/gpu/drm/i915/display/intel_display_device.c @@ -21,6 +21,7 @@ __diag_push(); __diag_ignore_all("-Woverride-init", "Allow field initialization overrides for display info"); struct subplatform_desc { + struct intel_display_is is; enum intel_display_platform subplatform; const char *name; const u16 *pciidlist; @@ -28,9 +29,11 @@ struct subplatform_desc { #define SUBPLATFORM(_platform, _subplatform) \ .subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform), \ - .name = #_subplatform + .name = #_subplatform, \ + .is._platform##_##_subplatform = 1 struct platform_desc { + struct intel_display_is is; enum intel_display_platform platform; const char *name; const struct subplatform_desc *subplatforms; @@ -39,7 +42,8 @@ struct platform_desc { #define PLATFORM(_platform) \ .platform = (INTEL_DISPLAY_##_platform), \ - .name = #_platform + .name = #_platform, \ + .is._platform = 1 #define ID(id) (id) diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h index 50485235ef09..73070c8487ff 100644 --- a/drivers/gpu/drm/i915/display/intel_display_device.h +++ b/drivers/gpu/drm/i915/display/intel_display_device.h @@ -101,6 +101,14 @@ enum intel_display_platform { #undef ENUM +#define MEMBER(name) u32 name:1; + +struct intel_display_is {
intel_display_is??? very odd to name something like this as a verb and that has no indication in the name what actually is about. Why is this not "_platform"? Lucas De Marchi
+ INTEL_DISPLAY_PLATFORMS(MEMBER); +}; + +#undef MEMBER + #define DEV_INFO_DISPLAY_FOR_EACH_FLAG(func) \ /* Keep in alphabetical order */ \ func(cursor_needs_physical); \ -- 2.39.2