From: Tvrtko Ursulin <tvrtko.ursu...@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.ursu...@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 f52e4a4aac9c..f92bd631caba 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.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to