[Intel-gfx] [RFC 05/28] drm/i915: Make GEN2 support optional

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 14 11:50:05 UTC 2021


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

By adding a hidden Kconfig option selected by all Gen2 platforms, we can
eliminate more code when none of those is selected.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/Kconfig.platforms | 7 +++++++
 drivers/gpu/drm/i915/i915_drv.h        | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/Kconfig.platforms b/drivers/gpu/drm/i915/Kconfig.platforms
index 46b78425e6da..23a44c8eb07b 100644
--- a/drivers/gpu/drm/i915/Kconfig.platforms
+++ b/drivers/gpu/drm/i915/Kconfig.platforms
@@ -1,7 +1,11 @@
+config DRM_I915_GEN2
+	bool
+
 config DRM_I915_PLATFORM_INTEL_I830
 	bool "Intel i830 platform support"
 	default y
 	depends on DRM_I915
+	select DRM_I915_GEN2
 	help
 	  Include support for Intel i830 platform.
 
@@ -9,6 +13,7 @@ config DRM_I915_PLATFORM_INTEL_I845G
 	bool "Intel i845G platform support"
 	default y
 	depends on DRM_I915
+	select DRM_I915_GEN2
 	help
 	  Include support for Intel i845G platform.
 
@@ -16,6 +21,7 @@ config DRM_I915_PLATFORM_INTEL_I85X
 	bool "Intel i85X platform support"
 	default y
 	depends on DRM_I915
+	select DRM_I915_GEN2
 	help
 	  Include support for Intel i85X platforms.
 
@@ -23,5 +29,6 @@ config DRM_I915_PLATFORM_INTEL_I865G
 	bool "Intel i865G platform support"
 	default y
 	depends on DRM_I915
+	select DRM_I915_GEN2
 	help
 	  Include support for Intel i865G platform.
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4a350a6b1800..f718655294ea 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2714,7 +2714,9 @@ intel_info(const struct drm_i915_private *dev_priv)
  * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
  * chips, etc.).
  */
-#define IS_GEN2(dev_priv)	(!!((dev_priv)->info.gen_mask & BIT(1)))
+#define IS_GEN2(dev_priv) \
+	(IS_ENABLED(CONFIG_DRM_I915_GEN2) && \
+	 ((dev_priv)->info.gen_mask & BIT(1)))
 #define IS_GEN3(dev_priv)	(!!((dev_priv)->info.gen_mask & BIT(2)))
 #define IS_GEN4(dev_priv)	(!!((dev_priv)->info.gen_mask & BIT(3)))
 #define IS_GEN5(dev_priv)	(!!((dev_priv)->info.gen_mask & BIT(4)))
-- 
2.27.0



More information about the Intel-gfx mailing list