diff mbox series

[v4,08/15] drm/i915/display: remove the display platform enum as unnecessary

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

Commit Message

Jani Nikula Oct. 21, 2024, 1:54 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 Oct. 22, 2024, 5:49 p.m. UTC | #1
On Mon, Oct 21, 2024 at 04:54:09PM +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.
> 
> 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 c124df204166..e9d56f8aa3ab 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -32,7 +32,6 @@ struct stepping_desc {
>  
>  struct subplatform_desc {
>  	struct intel_display_platforms platforms;
> -	enum intel_display_platform subplatform;
>  	const char *name;
>  	const u16 *pciidlist;
>  	struct stepping_desc step_info;
> @@ -40,12 +39,10 @@ struct subplatform_desc {
>  
>  #define SUBPLATFORM(_platform, _subplatform)				\
>  	.platforms._platform##_##_subplatform = 1,			\
> -	.subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform),	\
>  	.name = #_subplatform
>  
>  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 */
> @@ -54,7 +51,6 @@ struct platform_desc {
>  
>  #define PLATFORM(_platform)			 \
>  	.platforms._platform = 1,		 \
> -	.platform = (INTEL_DISPLAY_##_platform), \
>  	.name = #_platform
>  
>  #define ID(id) (id)
> @@ -1466,7 +1462,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++)

I honestly got confused on this... should it be a separate patch?

>  		for (id = sp->pciidlist; *id; id++)
>  			if (*id == pdev->device)
>  				return sp;
> @@ -1583,17 +1579,15 @@ 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));
> -	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
>  
>  	display->platform = 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));
> -		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
>  
>  		display_platforms_or(&display->platform, &subdesc->platforms);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
> index fac361a4921b..b240c28db2cb 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
> @@ -21,7 +21,6 @@ struct drm_printer;
>   * platform.
>   */
>  #define INTEL_DISPLAY_PLATFORMS(func) \
> -	func(PLATFORM_UNINITIALIZED) \
>  	/* Display ver 2 */ \
>  	func(i830) \
>  	func(i845g) \
> @@ -99,14 +98,6 @@ struct drm_printer;
>  	/* Display ver 30 (based on GMD ID) */ \
>  	func(pantherlake)
>  
> -#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 +
>  
> @@ -234,9 +225,6 @@ struct intel_display_platforms {
>  	 INTEL_DISPLAY_STEP(__i915) >= (since) && INTEL_DISPLAY_STEP(__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.5
>
Jani Nikula Oct. 23, 2024, 1:09 p.m. UTC | #2
On Tue, 22 Oct 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Mon, Oct 21, 2024 at 04:54:09PM +0300, Jani Nikula wrote:
>> @@ -1466,7 +1462,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++)
>
> I honestly got confused on this... should it be a separate patch?

Well, I'm removing ->subplatform so obviously I have to check for the
end condition using something else. I can make it a separate patch if
you want.

BR,
Jani.
Rodrigo Vivi Oct. 23, 2024, 2:40 p.m. UTC | #3
On Wed, Oct 23, 2024 at 04:09:03PM +0300, Jani Nikula wrote:
> On Tue, 22 Oct 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > On Mon, Oct 21, 2024 at 04:54:09PM +0300, Jani Nikula wrote:
> >> @@ -1466,7 +1462,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++)
> >
> > I honestly got confused on this... should it be a separate patch?
> 
> Well, I'm removing ->subplatform so obviously I have to check for the
> end condition using something else. I can make it a separate patch if
> you want.

oh, okay... I was in doubt if pciidlist was the right check to ensure
same condition. But taking a deeper look on it here again it indeed sounds
the case.

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

> 
> BR,
> Jani.
> 
> 
> -- 
> Jani Nikula, Intel
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 c124df204166..e9d56f8aa3ab 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -32,7 +32,6 @@  struct stepping_desc {
 
 struct subplatform_desc {
 	struct intel_display_platforms platforms;
-	enum intel_display_platform subplatform;
 	const char *name;
 	const u16 *pciidlist;
 	struct stepping_desc step_info;
@@ -40,12 +39,10 @@  struct subplatform_desc {
 
 #define SUBPLATFORM(_platform, _subplatform)				\
 	.platforms._platform##_##_subplatform = 1,			\
-	.subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform),	\
 	.name = #_subplatform
 
 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 */
@@ -54,7 +51,6 @@  struct platform_desc {
 
 #define PLATFORM(_platform)			 \
 	.platforms._platform = 1,		 \
-	.platform = (INTEL_DISPLAY_##_platform), \
 	.name = #_platform
 
 #define ID(id) (id)
@@ -1466,7 +1462,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;
@@ -1583,17 +1579,15 @@  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));
-	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
 
 	display->platform = 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));
-		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
 
 		display_platforms_or(&display->platform, &subdesc->platforms);
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
index fac361a4921b..b240c28db2cb 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.h
+++ b/drivers/gpu/drm/i915/display/intel_display_device.h
@@ -21,7 +21,6 @@  struct drm_printer;
  * platform.
  */
 #define INTEL_DISPLAY_PLATFORMS(func) \
-	func(PLATFORM_UNINITIALIZED) \
 	/* Display ver 2 */ \
 	func(i830) \
 	func(i845g) \
@@ -99,14 +98,6 @@  struct drm_printer;
 	/* Display ver 30 (based on GMD ID) */ \
 	func(pantherlake)
 
-#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 +
 
@@ -234,9 +225,6 @@  struct intel_display_platforms {
 	 INTEL_DISPLAY_STEP(__i915) >= (since) && INTEL_DISPLAY_STEP(__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;