drm/i915: Use INTEL_GEN everywhere
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 9 Feb 2018 21:58:46 +0000 (21:58 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 9 Feb 2018 22:29:02 +0000 (22:29 +0000)
Coccinelle patch:

 @@
 identifier p;
 @@
 -INTEL_INFO(p)->gen
 +INTEL_GEN(p)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180208130606.15556-12-tvrtko.ursulin@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180209215847.6660-1-chris@chris-wilson.co.uk
18 files changed:
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_fence_reg.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_stolen.c
drivers/gpu/drm/i915/intel_audio.c
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_cdclk.c
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_mocs.c
drivers/gpu/drm/i915/intel_panel.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_psr.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_uncore.c

index 5040f41e7792b9d8665e79ea38fa9faeb018f01e..a3a02acfc3456e6e3c577b295fa0a9ba73081615 100644 (file)
@@ -2801,7 +2801,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define HAS_FW_BLC(dev_priv)   (INTEL_GEN(dev_priv) > 2)
 #define HAS_FBC(dev_priv)      ((dev_priv)->info.has_fbc)
-#define HAS_CUR_FBC(dev_priv)  (!HAS_GMCH_DISPLAY(dev_priv) && INTEL_INFO(dev_priv)->gen >= 7)
+#define HAS_CUR_FBC(dev_priv)  (!HAS_GMCH_DISPLAY(dev_priv) && INTEL_GEN(dev_priv) >= 7)
 
 #define HAS_IPS(dev_priv)      (IS_HSW_ULT(dev_priv) || IS_BROADWELL(dev_priv))
 
index 349f127330c8e397e4b8174c9a8f92af8cac0c6a..fc68b35854df946e1e6c41616e513b229bc614c3 100644 (file)
@@ -5424,10 +5424,10 @@ i915_gem_load_init_fences(struct drm_i915_private *dev_priv)
 {
        int i;
 
-       if (INTEL_INFO(dev_priv)->gen >= 7 && !IS_VALLEYVIEW(dev_priv) &&
+       if (INTEL_GEN(dev_priv) >= 7 && !IS_VALLEYVIEW(dev_priv) &&
            !IS_CHERRYVIEW(dev_priv))
                dev_priv->num_fence_regs = 32;
-       else if (INTEL_INFO(dev_priv)->gen >= 4 ||
+       else if (INTEL_GEN(dev_priv) >= 4 ||
                 IS_I945G(dev_priv) || IS_I945GM(dev_priv) ||
                 IS_G33(dev_priv) || IS_PINEVIEW(dev_priv))
                dev_priv->num_fence_regs = 16;
index b8338d75c6f3faca71003de6b12ab25eba983562..d548ac05ccd7a45994f38960dd121e79b4d6ecf9 100644 (file)
@@ -64,7 +64,7 @@ static void i965_write_fence_reg(struct drm_i915_fence_reg *fence,
        int fence_pitch_shift;
        u64 val;
 
-       if (INTEL_INFO(fence->i915)->gen >= 6) {
+       if (INTEL_GEN(fence->i915) >= 6) {
                fence_reg_lo = FENCE_REG_GEN6_LO(fence->id);
                fence_reg_hi = FENCE_REG_GEN6_HI(fence->id);
                fence_pitch_shift = GEN6_FENCE_PITCH_SHIFT;
index 955ce7bee448384709d99a7eece4d7560d9e59fe..0c0f1affddad8b5a1fbe327f02266f604601922a 100644 (file)
@@ -2109,7 +2109,7 @@ static int __hw_ppgtt_init(struct i915_hw_ppgtt *ppgtt,
        ppgtt->base.i915 = dev_priv;
        ppgtt->base.dma = &dev_priv->drm.pdev->dev;
 
-       if (INTEL_INFO(dev_priv)->gen < 8)
+       if (INTEL_GEN(dev_priv) < 8)
                return gen6_ppgtt_init(ppgtt);
        else
                return gen8_ppgtt_init(ppgtt);
index d3f222fa6356d53d70c0bb37ea46e0a56c0c03b3..f18da9e2be8e03b2c70f19e89ad67fdfe3127f40 100644 (file)
@@ -356,7 +356,7 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
        reserved_base = 0;
        reserved_size = 0;
 
-       switch (INTEL_INFO(dev_priv)->gen) {
+       switch (INTEL_GEN(dev_priv)) {
        case 2:
        case 3:
                break;
index 522d54fecb53489193eb2b72dbf9fdd41009ac67..ff455c724775d33cf62c8e3f1849f92fe8ada665 100644 (file)
@@ -704,7 +704,7 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv)
        } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
                dev_priv->display.audio_codec_enable = ilk_audio_codec_enable;
                dev_priv->display.audio_codec_disable = ilk_audio_codec_disable;
-       } else if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8) {
+       } else if (IS_HASWELL(dev_priv) || INTEL_GEN(dev_priv) >= 8) {
                dev_priv->display.audio_codec_enable = hsw_audio_codec_enable;
                dev_priv->display.audio_codec_disable = hsw_audio_codec_disable;
        } else if (HAS_PCH_SPLIT(dev_priv)) {
index 4e74aa2f16bc0d96d36dddbe76804335a3875d91..aa4df654877197f08eabe7dfd2102932b79970e0 100644 (file)
@@ -391,7 +391,7 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
 static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,
                                    bool alternate)
 {
-       switch (INTEL_INFO(dev_priv)->gen) {
+       switch (INTEL_GEN(dev_priv)) {
        case 2:
                return alternate ? 66667 : 48000;
        case 3:
index ee788d5be5e36b22bf4af1c9787410315c0fb94f..aab6d1538fffcdbd84ded00c092549eb121e1651 100644 (file)
@@ -2233,7 +2233,7 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
                return max_cdclk_freq;
        else if (IS_CHERRYVIEW(dev_priv))
                return max_cdclk_freq*95/100;
-       else if (INTEL_INFO(dev_priv)->gen < 4)
+       else if (INTEL_GEN(dev_priv) < 4)
                return 2*max_cdclk_freq*90/100;
        else
                return max_cdclk_freq*90/100;
index d9b52fe82932c4bfdc94f9a77249fd26f0214813..db92a26912061ae5ee19525a87d972b836aefa7f 100644 (file)
@@ -2123,7 +2123,7 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
 
                I915_WRITE(DPLL_CTRL2, val);
 
-       } else if (INTEL_INFO(dev_priv)->gen < 9) {
+       } else if (INTEL_GEN(dev_priv) < 9) {
                I915_WRITE(PORT_CLK_SEL(port), hsw_pll_to_ddi_pll_sel(pll));
        }
 
index d128277978d7c9ae27fb6b0f8dbdf6b4968be56f..94d03e2cd49867fa8e2ce6447dbabf21929fe41f 100644 (file)
@@ -2029,12 +2029,12 @@ static unsigned int intel_cursor_alignment(const struct drm_i915_private *dev_pr
 
 static unsigned int intel_linear_alignment(const struct drm_i915_private *dev_priv)
 {
-       if (INTEL_INFO(dev_priv)->gen >= 9)
+       if (INTEL_GEN(dev_priv) >= 9)
                return 256 * 1024;
        else if (IS_I965G(dev_priv) || IS_I965GM(dev_priv) ||
                 IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
                return 128 * 1024;
-       else if (INTEL_INFO(dev_priv)->gen >= 4)
+       else if (INTEL_GEN(dev_priv) >= 4)
                return 4 * 1024;
        else
                return 0;
@@ -6307,7 +6307,7 @@ static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
        const struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 
        /* GDG double wide on either pipe, otherwise pipe A only */
-       return INTEL_INFO(dev_priv)->gen < 4 &&
+       return INTEL_GEN(dev_priv) < 4 &&
                (crtc->pipe == PIPE_A || IS_I915G(dev_priv));
 }
 
@@ -8185,7 +8185,7 @@ static void haswell_set_pipemisc(struct drm_crtc *crtc)
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        struct intel_crtc_state *config = intel_crtc->config;
 
-       if (IS_BROADWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 9) {
+       if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9) {
                u32 val = 0;
 
                switch (intel_crtc->config->pipe_bpp) {
@@ -13928,7 +13928,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
         * gen2/3 display engine uses the fence if present,
         * so the tiling mode must match the fb modifier exactly.
         */
-       if (INTEL_INFO(dev_priv)->gen < 4 &&
+       if (INTEL_GEN(dev_priv) < 4 &&
            tiling != intel_fb_modifier_to_tiling(mode_cmd->modifier[0])) {
                DRM_DEBUG_KMS("tiling_mode must match fb modifier exactly on gen2/3\n");
                goto err;
@@ -14116,7 +14116,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
 {
        intel_init_cdclk_hooks(dev_priv);
 
-       if (INTEL_INFO(dev_priv)->gen >= 9) {
+       if (INTEL_GEN(dev_priv) >= 9) {
                dev_priv->display.get_pipe_config = haswell_get_pipe_config;
                dev_priv->display.get_initial_plane_config =
                        skylake_get_initial_plane_config;
index 8503d182921b4c4d29a097990436a767bc7ff3ba..a2eeede525e051992efa80dfccb0559c8e3ed116 100644 (file)
@@ -1443,7 +1443,7 @@ static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
 static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
                                    enum port port)
 {
-       if (INTEL_INFO(dev_priv)->gen >= 9)
+       if (INTEL_GEN(dev_priv) >= 9)
                return skl_aux_ctl_reg(dev_priv, port);
        else if (HAS_PCH_SPLIT(dev_priv))
                return ilk_aux_ctl_reg(dev_priv, port);
@@ -1454,7 +1454,7 @@ static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
 static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
                                     enum port port, int index)
 {
-       if (INTEL_INFO(dev_priv)->gen >= 9)
+       if (INTEL_GEN(dev_priv) >= 9)
                return skl_aux_data_reg(dev_priv, port, index);
        else if (HAS_PCH_SPLIT(dev_priv))
                return ilk_aux_data_reg(dev_priv, port, index);
index ef80499113ee374e64f696228bc9d974eceb2957..4677ac0b10d704ec34a67e1b899642373502a753 100644 (file)
@@ -189,7 +189,7 @@ static void intel_lvds_pps_get_hw_state(struct drm_i915_private *dev_priv,
        /* Convert from 100ms to 100us units */
        pps->t4 = val * 1000;
 
-       if (INTEL_INFO(dev_priv)->gen <= 4 &&
+       if (INTEL_GEN(dev_priv) <= 4 &&
            pps->t1_t2 == 0 && pps->t5 == 0 && pps->t3 == 0 && pps->tx == 0) {
                DRM_DEBUG_KMS("Panel power timings uninitialized, "
                              "setting defaults\n");
index f4c46b0b8f0aeb6d42ecb31031053bfd5182485f..abb7a8c1e340c036c5c29338c0bb5c526de1ebca 100644 (file)
@@ -187,7 +187,7 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
                table->table = broxton_mocs_table;
                result = true;
        } else {
-               WARN_ONCE(INTEL_INFO(dev_priv)->gen >= 9,
+               WARN_ONCE(INTEL_GEN(dev_priv) >= 9,
                          "Platform that should have a MOCS table does not.\n");
        }
 
index e702a6487aa9af532d685e7b18ea4a513935d30d..78a53c8b17898cb8608662b3343a15c082e64b84 100644 (file)
@@ -497,7 +497,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)
        u32 val;
 
        val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
-       if (INTEL_INFO(dev_priv)->gen < 4)
+       if (INTEL_GEN(dev_priv) < 4)
                val >>= 1;
 
        if (panel->backlight.combination_mode) {
index b2f5e3b9ada8e253ed8d18f434d4f17fad1c3364..6f98d144924e1b93fd861d27e88c8e0efbd9f2b1 100644 (file)
@@ -6943,7 +6943,7 @@ static void gen6_update_ring_freq(struct drm_i915_private *dev_priv)
                         * No floor required for ring frequency on SKL.
                         */
                        ring_freq = gpu_freq;
-               } else if (INTEL_INFO(dev_priv)->gen >= 8) {
+               } else if (INTEL_GEN(dev_priv) >= 8) {
                        /* max(2 * GT, DDR). NB: GT is 50MHz units */
                        ring_freq = max(min_ring_freq, gpu_freq);
                } else if (IS_HASWELL(dev_priv)) {
@@ -7554,7 +7554,7 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
 {
        unsigned long val;
 
-       if (INTEL_INFO(dev_priv)->gen != 5)
+       if (INTEL_GEN(dev_priv) != 5)
                return 0;
 
        spin_lock_irq(&mchdev_lock);
@@ -7638,7 +7638,7 @@ static void __i915_update_gfx_val(struct drm_i915_private *dev_priv)
 
 void i915_update_gfx_val(struct drm_i915_private *dev_priv)
 {
-       if (INTEL_INFO(dev_priv)->gen != 5)
+       if (INTEL_GEN(dev_priv) != 5)
                return;
 
        spin_lock_irq(&mchdev_lock);
@@ -7689,7 +7689,7 @@ unsigned long i915_gfx_val(struct drm_i915_private *dev_priv)
 {
        unsigned long val;
 
-       if (INTEL_INFO(dev_priv)->gen != 5)
+       if (INTEL_GEN(dev_priv) != 5)
                return 0;
 
        spin_lock_irq(&mchdev_lock);
index e9feffdea899cf869f192263695f02384e23daa6..2ef374f936b988ecf0f64e730d82e7fa119d31e9 100644 (file)
@@ -126,7 +126,7 @@ static void vlv_psr_enable_sink(struct intel_dp *intel_dp)
 static i915_reg_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
                                       enum port port)
 {
-       if (INTEL_INFO(dev_priv)->gen >= 9)
+       if (INTEL_GEN(dev_priv) >= 9)
                return DP_AUX_CH_CTL(port);
        else
                return EDP_PSR_AUX_CTL;
@@ -135,7 +135,7 @@ static i915_reg_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
 static i915_reg_t psr_aux_data_reg(struct drm_i915_private *dev_priv,
                                        enum port port, int index)
 {
-       if (INTEL_INFO(dev_priv)->gen >= 9)
+       if (INTEL_GEN(dev_priv) >= 9)
                return DP_AUX_CH_DATA(port, index);
        else
                return EDP_PSR_AUX_DATA(index);
index c8f95456e4302d0f80d460a98cd17569c2bd73d0..5718f37160c593fede8eabe8ebe8cf1a63ef4abc 100644 (file)
@@ -655,7 +655,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
        if (IS_GEN(dev_priv, 6, 7))
                I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING));
 
-       if (INTEL_INFO(dev_priv)->gen >= 6)
+       if (INTEL_GEN(dev_priv) >= 6)
                I915_WRITE_IMR(engine, ~engine->irq_keep_mask);
 
        return init_workarounds_ring(engine);
index c23af35c081ef7364d80c2299de14b26f2d3fdd3..2cfac0b60500bd64ac76534f13ec15ad9f821c00 100644 (file)
@@ -1874,9 +1874,9 @@ static reset_func intel_get_gpu_reset(struct drm_i915_private *dev_priv)
        if (!i915_modparams.reset)
                return NULL;
 
-       if (INTEL_INFO(dev_priv)->gen >= 8)
+       if (INTEL_GEN(dev_priv) >= 8)
                return gen8_reset_engines;
-       else if (INTEL_INFO(dev_priv)->gen >= 6)
+       else if (INTEL_GEN(dev_priv) >= 6)
                return gen6_reset_engines;
        else if (IS_GEN5(dev_priv))
                return ironlake_do_reset;
@@ -1884,7 +1884,7 @@ static reset_func intel_get_gpu_reset(struct drm_i915_private *dev_priv)
                return g4x_do_reset;
        else if (IS_G33(dev_priv) || IS_PINEVIEW(dev_priv))
                return g33_do_reset;
-       else if (INTEL_INFO(dev_priv)->gen >= 3)
+       else if (INTEL_GEN(dev_priv) >= 3)
                return i915_do_reset;
        else
                return NULL;