drm/i915: Add IS_PLATFORM macro
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Wed, 20 Sep 2017 09:26:59 +0000 (10:26 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 26 Sep 2017 13:52:07 +0000 (14:52 +0100)
This will allow some code re-organization in a following patch.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170920092701.17963-2-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_drv.h

index 44f5569ed9951525f1bb81d015eda52c5032e829..b5d65d07432d0ed410ace2340c63869df6cc9eac 100644 (file)
@@ -2907,37 +2907,39 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define IS_REVID(p, since, until) \
        (INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
 
-#define IS_I830(dev_priv)      ((dev_priv)->info.platform == INTEL_I830)
-#define IS_I845G(dev_priv)     ((dev_priv)->info.platform == INTEL_I845G)
-#define IS_I85X(dev_priv)      ((dev_priv)->info.platform == INTEL_I85X)
-#define IS_I865G(dev_priv)     ((dev_priv)->info.platform == INTEL_I865G)
-#define IS_I915G(dev_priv)     ((dev_priv)->info.platform == INTEL_I915G)
-#define IS_I915GM(dev_priv)    ((dev_priv)->info.platform == INTEL_I915GM)
-#define IS_I945G(dev_priv)     ((dev_priv)->info.platform == INTEL_I945G)
-#define IS_I945GM(dev_priv)    ((dev_priv)->info.platform == INTEL_I945GM)
-#define IS_I965G(dev_priv)     ((dev_priv)->info.platform == INTEL_I965G)
-#define IS_I965GM(dev_priv)    ((dev_priv)->info.platform == INTEL_I965GM)
-#define IS_G45(dev_priv)       ((dev_priv)->info.platform == INTEL_G45)
-#define IS_GM45(dev_priv)      ((dev_priv)->info.platform == INTEL_GM45)
+#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform == (p))
+
+#define IS_I830(dev_priv)      IS_PLATFORM(dev_priv, INTEL_I830)
+#define IS_I845G(dev_priv)     IS_PLATFORM(dev_priv, INTEL_I845G)
+#define IS_I85X(dev_priv)      IS_PLATFORM(dev_priv, INTEL_I85X)
+#define IS_I865G(dev_priv)     IS_PLATFORM(dev_priv, INTEL_I865G)
+#define IS_I915G(dev_priv)     IS_PLATFORM(dev_priv, INTEL_I915G)
+#define IS_I915GM(dev_priv)    IS_PLATFORM(dev_priv, INTEL_I915GM)
+#define IS_I945G(dev_priv)     IS_PLATFORM(dev_priv, INTEL_I945G)
+#define IS_I945GM(dev_priv)    IS_PLATFORM(dev_priv, INTEL_I945GM)
+#define IS_I965G(dev_priv)     IS_PLATFORM(dev_priv, INTEL_I965G)
+#define IS_I965GM(dev_priv)    IS_PLATFORM(dev_priv, INTEL_I965GM)
+#define IS_G45(dev_priv)       IS_PLATFORM(dev_priv, INTEL_G45)
+#define IS_GM45(dev_priv)      IS_PLATFORM(dev_priv, INTEL_GM45)
 #define IS_G4X(dev_priv)       (IS_G45(dev_priv) || IS_GM45(dev_priv))
 #define IS_PINEVIEW_G(dev_priv)        (INTEL_DEVID(dev_priv) == 0xa001)
 #define IS_PINEVIEW_M(dev_priv)        (INTEL_DEVID(dev_priv) == 0xa011)
-#define IS_PINEVIEW(dev_priv)  ((dev_priv)->info.platform == INTEL_PINEVIEW)
-#define IS_G33(dev_priv)       ((dev_priv)->info.platform == INTEL_G33)
+#define IS_PINEVIEW(dev_priv)  IS_PLATFORM(dev_priv, INTEL_PINEVIEW)
+#define IS_G33(dev_priv)       IS_PLATFORM(dev_priv, INTEL_G33)
 #define IS_IRONLAKE_M(dev_priv)        (INTEL_DEVID(dev_priv) == 0x0046)
-#define IS_IVYBRIDGE(dev_priv) ((dev_priv)->info.platform == INTEL_IVYBRIDGE)
+#define IS_IVYBRIDGE(dev_priv) IS_PLATFORM(dev_priv, INTEL_IVYBRIDGE)
 #define IS_IVB_GT1(dev_priv)   (IS_IVYBRIDGE(dev_priv) && \
                                 (dev_priv)->info.gt == 1)
-#define IS_VALLEYVIEW(dev_priv)        ((dev_priv)->info.platform == INTEL_VALLEYVIEW)
-#define IS_CHERRYVIEW(dev_priv)        ((dev_priv)->info.platform == INTEL_CHERRYVIEW)
-#define IS_HASWELL(dev_priv)   ((dev_priv)->info.platform == INTEL_HASWELL)
-#define IS_BROADWELL(dev_priv) ((dev_priv)->info.platform == INTEL_BROADWELL)
-#define IS_SKYLAKE(dev_priv)   ((dev_priv)->info.platform == INTEL_SKYLAKE)
-#define IS_BROXTON(dev_priv)   ((dev_priv)->info.platform == INTEL_BROXTON)
-#define IS_KABYLAKE(dev_priv)  ((dev_priv)->info.platform == INTEL_KABYLAKE)
-#define IS_GEMINILAKE(dev_priv)        ((dev_priv)->info.platform == INTEL_GEMINILAKE)
-#define IS_COFFEELAKE(dev_priv)        ((dev_priv)->info.platform == INTEL_COFFEELAKE)
-#define IS_CANNONLAKE(dev_priv)        ((dev_priv)->info.platform == INTEL_CANNONLAKE)
+#define IS_VALLEYVIEW(dev_priv)        IS_PLATFORM(dev_priv, INTEL_VALLEYVIEW)
+#define IS_CHERRYVIEW(dev_priv)        IS_PLATFORM(dev_priv, INTEL_CHERRYVIEW)
+#define IS_HASWELL(dev_priv)   IS_PLATFORM(dev_priv, INTEL_HASWELL)
+#define IS_BROADWELL(dev_priv) IS_PLATFORM(dev_priv, INTEL_BROADWELL)
+#define IS_SKYLAKE(dev_priv)   IS_PLATFORM(dev_priv, INTEL_SKYLAKE)
+#define IS_BROXTON(dev_priv)   IS_PLATFORM(dev_priv, INTEL_BROXTON)
+#define IS_KABYLAKE(dev_priv)  IS_PLATFORM(dev_priv, INTEL_KABYLAKE)
+#define IS_GEMINILAKE(dev_priv)        IS_PLATFORM(dev_priv, INTEL_GEMINILAKE)
+#define IS_COFFEELAKE(dev_priv)        IS_PLATFORM(dev_priv, INTEL_COFFEELAKE)
+#define IS_CANNONLAKE(dev_priv)        IS_PLATFORM(dev_priv, INTEL_CANNONLAKE)
 #define IS_MOBILE(dev_priv)    ((dev_priv)->info.is_mobile)
 #define IS_HSW_EARLY_SDV(dev_priv) (IS_HASWELL(dev_priv) && \
                                    (INTEL_DEVID(dev_priv) & 0xFF00) == 0x0C00)