diff mbox series

[v2,6/9] drm/i915/display: remove the display platform enum as unnecessary

Message ID 38e923b9fe76664b83c258fe7a806a8daa6ecc48.1724092799.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 Aug. 19, 2024, 6:44 p.m. UTC
The display platform enums are not really needed for
anything. Remove.

Without the enum, PLATFORM_UNINITIALIZED is also no longer needed for
keeping the first enum 0.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_device.c | 12 +++---------
 drivers/gpu/drm/i915/display/intel_display_device.h | 12 ------------
 2 files changed, 3 insertions(+), 21 deletions(-)

Comments

Rodrigo Vivi Aug. 28, 2024, 8:49 p.m. UTC | #1
On Mon, Aug 19, 2024 at 09:44:33PM +0300, Jani Nikula wrote:
> The display platform enums are not really needed for
> anything. Remove.
> 
> Without the enum, PLATFORM_UNINITIALIZED is also no longer needed for
> keeping the first enum 0.

oh great! no need to rename that then! :)


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


> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_device.c | 12 +++---------
>  drivers/gpu/drm/i915/display/intel_display_device.h | 12 ------------
>  2 files changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
> index 3d3b4ed7940e..90609b561630 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -22,26 +22,22 @@ __diag_ignore_all("-Woverride-init", "Allow field initialization overrides for d
>  
>  struct subplatform_desc {
>  	struct intel_display_platforms platforms;
> -	enum intel_display_platform subplatform;
>  	const char *name;
>  	const u16 *pciidlist;
>  };
>  
>  #define SUBPLATFORM(_platform, _subplatform)				\
> -	.subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform),	\
>  	.name = #_subplatform,						\
>  	.platforms._platform##_##_subplatform = 1
>  
>  struct platform_desc {
>  	struct intel_display_platforms platforms;
> -	enum intel_display_platform platform;
>  	const char *name;
>  	const struct subplatform_desc *subplatforms;
>  	const struct intel_display_device_info *info; /* NULL for GMD ID */
>  };
>  
>  #define PLATFORM(_platform)			 \
> -	.platform = (INTEL_DISPLAY_##_platform), \
>  	.name = #_platform,			 \
>  	.platforms._platform = 1
>  
> @@ -1261,7 +1257,7 @@ find_subplatform_desc(struct pci_dev *pdev, const struct platform_desc *desc)
>  	const struct subplatform_desc *sp;
>  	const u16 *id;
>  
> -	for (sp = desc->subplatforms; sp && sp->subplatform; sp++)
> +	for (sp = desc->subplatforms; sp && sp->pciidlist; sp++)
>  		for (id = sp->pciidlist; *id; id++)
>  			if (*id == pdev->device)
>  				return sp;
> @@ -1326,16 +1322,14 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  	       &DISPLAY_INFO(i915)->__runtime_defaults,
>  	       sizeof(*DISPLAY_RUNTIME_INFO(i915)));
>  
> -	drm_WARN_ON(&i915->drm, !desc->platform || !desc->name ||
> +	drm_WARN_ON(&i915->drm, !desc->name ||
>  		    display_platforms_weight(&desc->platforms) != 1);
> -	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
>  	display->is = desc->platforms;
>  
>  	subdesc = find_subplatform_desc(pdev, desc);
>  	if (subdesc) {
> -		drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name ||
> +		drm_WARN_ON(&i915->drm, !subdesc->name ||
>  			    display_platforms_weight(&subdesc->platforms) != 1);
> -		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
>  		display_platforms_or(&display->is, &subdesc->platforms);
>  
>  		/* Ensure platform and subplatform are distinct */
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
> index 6f8814d1fabd..6d1f3de46836 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
> @@ -17,7 +17,6 @@ struct drm_printer;
>  
>  /* Keep in gen based order, and chronological order within a gen */
>  #define INTEL_DISPLAY_PLATFORMS(func) \
> -	func(PLATFORM_UNINITIALIZED) \
>  	/* Display ver 2 */ \
>  	func(I830) \
>  	func(I845G) \
> @@ -94,14 +93,6 @@ struct drm_printer;
>  	func(DG2_G11) \
>  	func(DG2_G12)
>  
> -#define __ENUM(x) INTEL_DISPLAY_ ## x,
> -
> -enum intel_display_platform {
> -	INTEL_DISPLAY_PLATFORMS(__ENUM)
> -};
> -
> -#undef __ENUM
> -
>  #define __MEMBER(name) unsigned long name:1;
>  #define __COUNT(x) 1 +
>  
> @@ -218,9 +209,6 @@ struct intel_display_platforms {
>  	(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
>  
>  struct intel_display_runtime_info {
> -	enum intel_display_platform platform;
> -	enum intel_display_platform subplatform;
> -
>  	struct intel_display_ip_ver {
>  		u16 ver;
>  		u16 rel;
> -- 
> 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 3d3b4ed7940e..90609b561630 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -22,26 +22,22 @@  __diag_ignore_all("-Woverride-init", "Allow field initialization overrides for d
 
 struct subplatform_desc {
 	struct intel_display_platforms platforms;
-	enum intel_display_platform subplatform;
 	const char *name;
 	const u16 *pciidlist;
 };
 
 #define SUBPLATFORM(_platform, _subplatform)				\
-	.subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform),	\
 	.name = #_subplatform,						\
 	.platforms._platform##_##_subplatform = 1
 
 struct platform_desc {
 	struct intel_display_platforms platforms;
-	enum intel_display_platform platform;
 	const char *name;
 	const struct subplatform_desc *subplatforms;
 	const struct intel_display_device_info *info; /* NULL for GMD ID */
 };
 
 #define PLATFORM(_platform)			 \
-	.platform = (INTEL_DISPLAY_##_platform), \
 	.name = #_platform,			 \
 	.platforms._platform = 1
 
@@ -1261,7 +1257,7 @@  find_subplatform_desc(struct pci_dev *pdev, const struct platform_desc *desc)
 	const struct subplatform_desc *sp;
 	const u16 *id;
 
-	for (sp = desc->subplatforms; sp && sp->subplatform; sp++)
+	for (sp = desc->subplatforms; sp && sp->pciidlist; sp++)
 		for (id = sp->pciidlist; *id; id++)
 			if (*id == pdev->device)
 				return sp;
@@ -1326,16 +1322,14 @@  void intel_display_device_probe(struct drm_i915_private *i915)
 	       &DISPLAY_INFO(i915)->__runtime_defaults,
 	       sizeof(*DISPLAY_RUNTIME_INFO(i915)));
 
-	drm_WARN_ON(&i915->drm, !desc->platform || !desc->name ||
+	drm_WARN_ON(&i915->drm, !desc->name ||
 		    display_platforms_weight(&desc->platforms) != 1);
-	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
 	display->is = desc->platforms;
 
 	subdesc = find_subplatform_desc(pdev, desc);
 	if (subdesc) {
-		drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name ||
+		drm_WARN_ON(&i915->drm, !subdesc->name ||
 			    display_platforms_weight(&subdesc->platforms) != 1);
-		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
 		display_platforms_or(&display->is, &subdesc->platforms);
 
 		/* Ensure platform and subplatform are distinct */
diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
index 6f8814d1fabd..6d1f3de46836 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.h
+++ b/drivers/gpu/drm/i915/display/intel_display_device.h
@@ -17,7 +17,6 @@  struct drm_printer;
 
 /* Keep in gen based order, and chronological order within a gen */
 #define INTEL_DISPLAY_PLATFORMS(func) \
-	func(PLATFORM_UNINITIALIZED) \
 	/* Display ver 2 */ \
 	func(I830) \
 	func(I845G) \
@@ -94,14 +93,6 @@  struct drm_printer;
 	func(DG2_G11) \
 	func(DG2_G12)
 
-#define __ENUM(x) INTEL_DISPLAY_ ## x,
-
-enum intel_display_platform {
-	INTEL_DISPLAY_PLATFORMS(__ENUM)
-};
-
-#undef __ENUM
-
 #define __MEMBER(name) unsigned long name:1;
 #define __COUNT(x) 1 +
 
@@ -218,9 +209,6 @@  struct intel_display_platforms {
 	(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
 
 struct intel_display_runtime_info {
-	enum intel_display_platform platform;
-	enum intel_display_platform subplatform;
-
 	struct intel_display_ip_ver {
 		u16 ver;
 		u16 rel;