diff mbox series

[4/6] drm/i915/display: add "display is" structure with platform members

Message ID 80e564e550bc0972c9e0199f1a361a99545ab81b.1718719962.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: platform identification with display->is.<PLATFORM> | expand

Commit Message

Jani Nikula June 18, 2024, 2:22 p.m. UTC
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@intel.com>
---
 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(-)

Comments

Rodrigo Vivi June 19, 2024, 6:30 p.m. UTC | #1
On Tue, Jun 18, 2024 at 05:22:54PM +0300, 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@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  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_PLATFORMS(MEMBER);
> +};
> +
> +#undef MEMBER
> +
>  #define DEV_INFO_DISPLAY_FOR_EACH_FLAG(func) \
>  	/* Keep in alphabetical order */ \
>  	func(cursor_needs_physical); \
> -- 
> 2.39.2
>
Lucas De Marchi June 27, 2024, 5:04 p.m. UTC | #2
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@intel.com>
>---
> 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
>
Jani Nikula June 27, 2024, 6:48 p.m. UTC | #3
On Thu, 27 Jun 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> 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@intel.com>
>>---
>> 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"?

Yeah, naming is hard.

I suppose I could rename it after the last patch which removes enum
intel_display_platform.

BR,
Jani.

>
> 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
>>
diff mbox series

Patch

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_PLATFORMS(MEMBER);
+};
+
+#undef MEMBER
+
 #define DEV_INFO_DISPLAY_FOR_EACH_FLAG(func) \
 	/* Keep in alphabetical order */ \
 	func(cursor_needs_physical); \