drm/i915: prefer INTEL_GEN(dev_priv) to INTEL_INFO(dev)->gen
Subsystems (2)
PATCH 1/1 drm/i915: prefer INTEL_GEN(dev_priv) to INTEL_INFO(dev)->gen
More Coccinellery ...
Wherever we find "INTEL_INFO(dev)->gen", and have a suitable "dev_priv" in scope, replace it with "INTEL_GEN(dev_priv)", which is the preferred wasy to access this device property.
This patch covers all the files that contained only relatively few instances, and where no manual fixup was required. A few more complex instances may be updated in a later patch.
@dev_priv_param@
function FUNC;
idexpression struct drm_device *DEV;
identifier DEV_PRIV;
@@FUNC(..., struct drm_i915_private *DEV_PRIV, ...)
{
<...
- INTEL_INFO(DEV)->gen
+ INTEL_GEN(DEV_PRIV)
...>
}@dev_priv_local@
idexpression struct drm_device *DEV;
identifier DEV_PRIV;
expression E;
@@
{
...
(
struct drm_i915_private *DEV_PRIV;
|
struct drm_i915_private *DEV_PRIV = E;
)
<...
- INTEL_INFO(DEV)->gen
+ INTEL_GEN(DEV_PRIV)
...>
}--- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 +++--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 14 +++++++------- drivers/gpu/drm/i915/i915_irq.c | 12 ++++++------ drivers/gpu/drm/i915/intel_color.c | 2 +- drivers/gpu/drm/i915/intel_crt.c | 6 +++--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++------- drivers/gpu/drm/i915/intel_dpll_mgr.c | 2 +- drivers/gpu/drm/i915/intel_lvds.c | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 18 +++++++++--------- drivers/gpu/drm/i915/intel_psr.c | 4 ++-- drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++---- drivers/gpu/drm/i915/intel_tv.c | 2 +- 15 files changed, 52 insertions(+), 52 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -4343,7 +4343,7 @@ void i915_gem_init_swizzling(struct drm_device *dev) {struct drm_i915_private *dev_priv =to_i915 (dev); -if (INTEL_INFO (dev)->gen <5 || +if (INTEL_GEN (dev_priv) <5 || dev_priv->mm.bit_6_swizzle_x ==I915_BIT_6_SWIZZLE_NONE )return ;
@@ -4413,7 +4413,7 @@ static void init_unused_rings(struct drm_device *dev)u32 temp =I915_READ (GEN7_MSG_CTL ); temp &= ~(WAIT_FOR_PCH_FLR_ACK |WAIT_FOR_PCH_RESET_ACK );I915_WRITE (GEN7_MSG_CTL , temp); - }else if (INTEL_INFO (dev)->gen >=7 ) { + }else if (INTEL_GEN (dev_priv) >=7 ) {u32 temp =I915_READ (HSW_NDE_RSTWRN_OPT ); temp &= ~RESET_PCH_HANDSHAKE_ENABLE ;I915_WRITE (HSW_NDE_RSTWRN_OPT , temp);
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3 -3
@@ -1460,19 +1460,19 @@ static void eb_export_fence(struct drm_i915_gem_object *obj, }if (instp_mode != dev_priv->relative_constants_mode) { -if (INTEL_INFO (dev_priv)->gen <4 ) { +if (INTEL_GEN (dev_priv) <4 ) {DRM_DEBUG ("no rel constants on pre-gen4\n" );return -EINVAL ; } -if (INTEL_INFO (dev_priv)->gen >5 && +if (INTEL_GEN (dev_priv) >5 && instp_mode ==I915_EXEC_CONSTANTS_REL_SURFACE ) {DRM_DEBUG ("rel surface constants mode invalid on gen5+\n" );return -EINVAL ; }/* The HW changed the meaning on this bit on gen6 */ -if (INTEL_INFO (dev_priv)->gen >=6 ) +if (INTEL_GEN (dev_priv) >=6 ) instp_mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE ; }break ;
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
@@ -2281,7 +2281,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)/* Don't bother messing with faults pre GEN6 as we have little * documentation supporting that it's a good idea. */ -if (INTEL_INFO (dev)->gen <6 ) +if (INTEL_GEN (dev_priv) <6 )return ;i915_check_and_clear_faults (dev_priv);
@@ -3260,7 +3260,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)WARN_ON (i915_gem_object_set_to_gtt_domain (obj, false)); } -if (INTEL_INFO (dev)->gen >=8 ) { +if (INTEL_GEN (dev_priv) >=8 ) {if (IS_CHERRYVIEW (dev) ||IS_BROXTON (dev))chv_setup_private_ppat (dev_priv);else
drivers/gpu/drm/i915/i915_gpu_error.c +7 -7
@@ -387,7 +387,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m,"EIR: 0x%08x\n" , error->eir);err_printf (m,"IER: 0x%08x\n" , error->ier); -if (INTEL_INFO (dev)->gen >=8 ) { +if (INTEL_GEN (dev_priv) >=8 ) {for (i =0 ; i <4 ; i++)err_printf (m,"GTIER gt %d: 0x%08x\n" , i, error->gtier[i]);
@@ -406,10 +406,10 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m," INSTDONE_%d: 0x%08x\n" , i, error->extra_instdone[i]); -if (INTEL_INFO (dev)->gen >=6 ) { +if (INTEL_GEN (dev_priv) >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error); -if (INTEL_INFO (dev)->gen >=8 ) +if (INTEL_GEN (dev_priv) >=8 )err_printf (m,"FAULT_TLB_DATA: 0x%08x 0x%08x\n" , error->fault_data1, error->fault_data0);
@@ -1327,7 +1327,7 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv,if (IS_GEN7 (dev)) error->err_int =I915_READ (GEN7_ERR_INT ); -if (INTEL_INFO (dev)->gen >=8 ) { +if (INTEL_GEN (dev_priv) >=8 ) { error->fault_data0 =I915_READ (GEN8_FAULT_TLB_DATA0 ); error->fault_data1 =I915_READ (GEN8_FAULT_TLB_DATA1 ); }
@@ -1339,10 +1339,10 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv, }/* 2: Registers which belong to multiple generations */ -if (INTEL_INFO (dev)->gen >=7 ) +if (INTEL_GEN (dev_priv) >=7 ) error->forcewake =I915_READ_FW (FORCEWAKE_MT ); -if (INTEL_INFO (dev)->gen >=6 ) { +if (INTEL_GEN (dev_priv) >=6 ) { error->derrmr =I915_READ (DERRMR ); error->error =I915_READ (ERROR_GEN6 ); error->done_reg =I915_READ (DONE_REG );
@@ -1358,7 +1358,7 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv,if (HAS_HW_CONTEXTS (dev)) error->ccid =I915_READ (CCID ); -if (INTEL_INFO (dev)->gen >=8 ) { +if (INTEL_GEN (dev_priv) >=8 ) { error->ier =I915_READ (GEN8_DE_MISC_IER );for (i =0 ; i <4 ; i++) error->gtier[i] =I915_READ (GEN8_GT_IER (i));
drivers/gpu/drm/i915/i915_irq.c +6 -6
@@ -2698,7 +2698,7 @@ static int i915_enable_vblank(struct drm_device *dev, unsigned int pipe)unsigned long irqflags;spin_lock_irqsave (&dev_priv->irq_lock, irqflags); -if (INTEL_INFO (dev)->gen >=4 ) +if (INTEL_GEN (dev_priv) >=4 )i915_enable_pipestat (dev_priv, pipe,PIPE_START_VBLANK_INTERRUPT_STATUS );else
@@ -2713,7 +2713,7 @@ static int ironlake_enable_vblank(struct drm_device *dev, unsigned int pipe) {struct drm_i915_private *dev_priv =to_i915 (dev);unsigned long irqflags; -uint32_t bit = (INTEL_INFO (dev)->gen >=7 ) ?DE_PIPE_VBLANK_IVB (pipe) : +uint32_t bit = (INTEL_GEN (dev_priv) >=7 ) ?DE_PIPE_VBLANK_IVB (pipe) :DE_PIPE_VBLANK (pipe);spin_lock_irqsave (&dev_priv->irq_lock, irqflags);
@@ -2767,7 +2767,7 @@ static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe) {struct drm_i915_private *dev_priv =to_i915 (dev);unsigned long irqflags; -uint32_t bit = (INTEL_INFO (dev)->gen >=7 ) ?DE_PIPE_VBLANK_IVB (pipe) : +uint32_t bit = (INTEL_GEN (dev_priv) >=7 ) ?DE_PIPE_VBLANK_IVB (pipe) :DE_PIPE_VBLANK (pipe);spin_lock_irqsave (&dev_priv->irq_lock, irqflags);
@@ -3230,7 +3230,7 @@ static void gen5_gt_irq_reset(struct drm_device *dev)struct drm_i915_private *dev_priv =to_i915 (dev);GEN5_IRQ_RESET (GT ); -if (INTEL_INFO (dev)->gen >=6 ) +if (INTEL_GEN (dev_priv) >=6 )GEN5_IRQ_RESET (GEN6_PM ); }
@@ -3566,7 +3566,7 @@ static void gen5_gt_irq_postinstall(struct drm_device *dev)GEN5_IRQ_INIT (GT , dev_priv->gt_irq_mask, gt_irqs); -if (INTEL_INFO (dev)->gen >=6 ) { +if (INTEL_GEN (dev_priv) >=6 ) {/* * RPS interrupts will get enabled/disabled on demand when RPS * itself is enabled/disabled.
@@ -3584,7 +3584,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)struct drm_i915_private *dev_priv =to_i915 (dev);u32 display_mask, extra_mask; -if (INTEL_INFO (dev)->gen >=7 ) { +if (INTEL_GEN (dev_priv) >=7 ) { display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB | DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB | DE_PLANEB_FLIP_DONE_IVB |
drivers/gpu/drm/i915/intel_color.c +1 -1
@@ -180,7 +180,7 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state)I915_WRITE (PIPE_CSC_PREOFF_ME (pipe),0 );I915_WRITE (PIPE_CSC_PREOFF_LO (pipe),0 ); -if (INTEL_INFO (dev)->gen >6 ) { +if (INTEL_GEN (dev_priv) >6 ) {uint16_t postoff =0 ;if (intel_crtc_state->limited_color_range)
drivers/gpu/drm/i915/intel_crt.c +3 -3
@@ -154,7 +154,7 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder,const struct drm_display_mode *adjusted_mode = &crtc_state->base.adjusted_mode;u32 adpa; -if (INTEL_INFO (dev)->gen >=5 ) +if (INTEL_GEN (dev_priv) >=5 ) adpa =ADPA_HOTPLUG_BITS ;else adpa =0 ;
@@ -700,7 +700,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)if (intel_get_load_detect_pipe (connector,NULL , &tmp, &ctx)) {if (intel_crt_detect_ddc (connector)) status = connector_status_connected; -else if (INTEL_INFO (dev)->gen <4 ) +else if (INTEL_GEN (dev_priv) <4 ) status =intel_crt_load_detect (crt,to_intel_crtc (connector->state->crtc)->pipe);else if (i915.load_detect_test)
@@ -766,7 +766,7 @@ void intel_crt_reset(struct drm_encoder *encoder)struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crt *crt =intel_encoder_to_crt (to_intel_encoder (encoder)); -if (INTEL_INFO (dev)->gen >=5 ) { +if (INTEL_GEN (dev_priv) >=5 ) {u32 adpa; adpa =I915_READ (crt->adpa_reg);
drivers/gpu/drm/i915/intel_ddi.c +2 -2
@@ -1745,7 +1745,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,if (IS_SKYLAKE (dev) ||IS_KABYLAKE (dev))I915_WRITE (DPLL_CTRL2 , (I915_READ (DPLL_CTRL2 ) |DPLL_CTRL2_DDI_CLK_OFF (port))); -else if (INTEL_INFO (dev)->gen <9 ) +else if (INTEL_GEN (dev_priv) <9 )I915_WRITE (PORT_CLK_SEL (port),PORT_CLK_SEL_NONE );if (type ==INTEL_OUTPUT_HDMI ) {
@@ -1814,7 +1814,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder, }else if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder); -if (port ==PORT_A &&INTEL_INFO (dev)->gen <9 ) +if (port ==PORT_A &&INTEL_GEN (dev_priv) <9 )intel_dp_stop_link_train (intel_dp);intel_edp_backlight_on (intel_dp);
drivers/gpu/drm/i915/intel_dp.c +7 -7
@@ -1502,7 +1502,7 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,intel_fixed_panel_mode (intel_connector->panel.fixed_mode, adjusted_mode); -if (INTEL_INFO (dev)->gen >=9 ) { +if (INTEL_GEN (dev_priv) >=9 ) {int ret; ret =skl_update_scaler_crtc (pipe_config);if (ret)
@@ -2908,7 +2908,7 @@ static void chv_dp_post_pll_disable(struct intel_encoder *encoder,if (IS_BROXTON (dev))return DP_TRAIN_VOLTAGE_SWING_LEVEL_3 ; -else if (INTEL_INFO (dev)->gen >=9 ) { +else if (INTEL_GEN (dev_priv) >=9 ) {if (dev_priv->vbt.edp.low_vswing && port ==PORT_A )return DP_TRAIN_VOLTAGE_SWING_LEVEL_3 ;return DP_TRAIN_VOLTAGE_SWING_LEVEL_2 ;
@@ -4801,7 +4801,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)* eDP not supported on g4x. so bail out early just * for a bit extra safety in case the VBT is bonkers. */ -if (INTEL_INFO (dev)->gen <5 ) +if (INTEL_GEN (dev_priv) <5 )return false;if (port ==PORT_A )
@@ -5401,7 +5401,7 @@ void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,INIT_DELAYED_WORK (&dev_priv->drrs.work, intel_edp_drrs_downclock_work);mutex_init (&dev_priv->drrs.mutex); -if (INTEL_INFO (dev)->gen <=6 ) { +if (INTEL_GEN (dev_priv) <=6 ) {DRM_DEBUG_KMS ("DRRS supported for Gen7 and above\n" );return NULL ; }
@@ -5575,7 +5575,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, intel_dp->pps_pipe =INVALID_PIPE ;/* intel_dp vfuncs */ -if (INTEL_INFO (dev)->gen >=9 ) +if (INTEL_GEN (dev_priv) >=9 ) intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider;else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider;
@@ -5584,7 +5584,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,else intel_dp->get_aux_clock_divider = g4x_get_aux_clock_divider; -if (INTEL_INFO (dev)->gen >=9 ) +if (INTEL_GEN (dev_priv) >=9 ) intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl;else intel_dp->get_aux_send_ctl = g4x_get_aux_send_ctl;
@@ -5734,7 +5734,7 @@ bool intel_dp_init(struct drm_device *dev, }else { intel_encoder->pre_enable = g4x_pre_enable_dp; intel_encoder->enable = g4x_enable_dp; -if (INTEL_INFO (dev)->gen >=5 ) +if (INTEL_GEN (dev_priv) >=5 ) intel_encoder->post_disable = ilk_post_disable_dp; }
drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -1
@@ -156,7 +156,7 @@ void intel_disable_shared_dpll(struct intel_crtc *crtc)unsigned crtc_mask =1 <<drm_crtc_index (&crtc->base);/* PCH only available on ILK+ */ -if (INTEL_INFO (dev)->gen <5 ) +if (INTEL_GEN (dev_priv) <5 )return ;if (pll ==NULL )
drivers/gpu/drm/i915/intel_lvds.c +2 -2
@@ -139,12 +139,12 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, pipe_config->base.adjusted_mode.flags |= flags; -if (INTEL_INFO (dev)->gen <5 ) +if (INTEL_GEN (dev_priv) <5 ) pipe_config->gmch_pfit.lvds_border_bits = tmp &LVDS_BORDER_ENABLE ;/* gen2/3 store dither state in pfit control, needs to match */ -if (INTEL_INFO (dev)->gen <4 ) { +if (INTEL_GEN (dev_priv) <4 ) { tmp =I915_READ (PFIT_CONTROL ); pipe_config->gmch_pfit.control |= tmp &PANEL_8TO6_DITHER_ENABLE ;
drivers/gpu/drm/i915/intel_pm.c +9 -9
@@ -2163,14 +2163,14 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8]) wm[2 ] = (sskpd >>12 ) &0xFF ; wm[3 ] = (sskpd >>20 ) &0x1FF ; wm[4 ] = (sskpd >>32 ) &0x1FF ; - }else if (INTEL_INFO (dev)->gen >=6 ) { + }else if (INTEL_GEN (dev_priv) >=6 ) {uint32_t sskpd =I915_READ (MCH_SSKPD ); wm[0 ] = (sskpd >>SSKPD_WM0_SHIFT ) &SSKPD_WM_MASK ; wm[1 ] = (sskpd >>SSKPD_WM1_SHIFT ) &SSKPD_WM_MASK ; wm[2 ] = (sskpd >>SSKPD_WM2_SHIFT ) &SSKPD_WM_MASK ; wm[3 ] = (sskpd >>SSKPD_WM3_SHIFT ) &SSKPD_WM_MASK ; - }else if (INTEL_INFO (dev)->gen >=5 ) { + }else if (INTEL_GEN (dev_priv) >=5 ) {uint32_t mltr =I915_READ (MLTR_ILK );/* ILK primary LP0 latency is 700 ns */
@@ -2375,7 +2375,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate) usable_level = max_level;/* ILK/SNB: LP2+ watermarks only w/o sprites */ -if (INTEL_INFO (dev)->gen <=6 && pipe_wm->sprites_enabled) +if (INTEL_GEN (dev_priv) <=6 && pipe_wm->sprites_enabled) usable_level =1 ;/* ILK/SNB/IVB: LP1+ watermarks only w/o scaling */
@@ -2518,12 +2518,12 @@ static void ilk_wm_merge(struct drm_device *dev,int last_enabled_level = max_level;/* ILK/SNB/IVB: LP1+ watermarks only w/ single pipe */ -if ((INTEL_INFO (dev)->gen <=6 ||IS_IVYBRIDGE (dev)) && +if ((INTEL_GEN (dev_priv) <=6 ||IS_IVYBRIDGE (dev)) && config->num_pipes_active >1 ) last_enabled_level =0 ;/* ILK: FBC WM must be disabled always */ - merged->fbc_wm_enabled =INTEL_INFO (dev)->gen >=6 ; + merged->fbc_wm_enabled =INTEL_GEN (dev_priv) >=6 ;/* merge each WM1+ level */ for (level =1 ; level <= max_level; level++) {
@@ -2829,7 +2829,7 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv, previous->wm_lp_spr[0] != results->wm_lp_spr[0])I915_WRITE (WM1S_LP_ILK , results->wm_lp_spr[0 ]); -if (INTEL_INFO (dev)->gen >=7 ) { +if (INTEL_GEN (dev_priv) >=7 ) {if (dirty &WM_DIRTY_LP (2 ) && previous->wm_lp_spr[1 ] != results->wm_lp_spr[1 ])I915_WRITE (WM2S_LP_IVB , results->wm_lp_spr[1 ]);if (dirty &WM_DIRTY_LP (3 ) && previous->wm_lp_spr[2 ] != results->wm_lp_spr[2 ])
@@ -4175,7 +4175,7 @@ static void ilk_program_watermarks(struct drm_i915_private *dev_priv)ilk_wm_merge (dev, &config, &max, &lp_wm_1_2);/* 5/6 split only in single pipe config on IVB+ */ -if (INTEL_INFO (dev)->gen >=7 && +if (INTEL_GEN (dev_priv) >=7 && config.num_pipes_active ==1 && config.sprites_enabled) {ilk_compute_wm_maximums (dev,1 , &config,INTEL_DDB_PART_5_6 , &max);ilk_wm_merge (dev, &config, &max, &lp_wm_5_6);
@@ -4554,7 +4554,7 @@ void ilk_wm_get_hw_state(struct drm_device *dev) hw->wm_lp[2 ] =I915_READ (WM3_LP_ILK ); hw->wm_lp_spr[0 ] =I915_READ (WM1S_LP_ILK ); -if (INTEL_INFO (dev)->gen >=7 ) { +if (INTEL_GEN (dev_priv) >=7 ) { hw->wm_lp_spr[1 ] =I915_READ (WM2S_LP_IVB ); hw->wm_lp_spr[2 ] =I915_READ (WM3S_LP_IVB ); }
@@ -7678,7 +7678,7 @@ void intel_init_pm(struct drm_device *dev)i915_ironlake_get_mem_freq (dev);/* For FIFO watermark updates */ -if (INTEL_INFO (dev)->gen >=9 ) { +if (INTEL_GEN (dev_priv) >=9 ) {skl_setup_wm_latency (dev); dev_priv->display.update_wm = skl_update_wm; dev_priv->display.compute_global_watermarks = skl_compute_wm;
drivers/gpu/drm/i915/intel_psr.c +2 -2
@@ -472,7 +472,7 @@ void intel_psr_enable(struct intel_dp *intel_dp)/* Enable PSR on the panel */ hsw_psr_enable_sink (intel_dp); -if (INTEL_INFO (dev)->gen >=9 ) +if (INTEL_GEN (dev_priv) >=9 )intel_psr_activate (intel_dp); }else {vlv_psr_setup_vsc (intel_dp);
@@ -498,7 +498,7 @@ void intel_psr_enable(struct intel_dp *intel_dp)* - On HSW/BDW we get a recoverable frozen screen until next * exit-activate sequence. */ -if (INTEL_INFO (dev)->gen <9 ) +if (INTEL_GEN (dev_priv) <9 )schedule_delayed_work (&dev_priv->psr.work,msecs_to_jiffies (intel_dp->panel_power_cycle_delay *5 ));
drivers/gpu/drm/i915/intel_sdvo.c +4 -4
@@ -1269,13 +1269,13 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,return ;/* Set the SDVO control regs. */ -if (INTEL_INFO (dev)->gen >=4 ) { +if (INTEL_GEN (dev_priv) >=4 ) {/* The real mode polarity is set by the SDVO commands, using * struct intel_sdvo_dtd. */ sdvox =SDVO_VSYNC_ACTIVE_HIGH |SDVO_HSYNC_ACTIVE_HIGH ;if (!HAS_PCH_SPLIT (dev) && crtc_state->limited_color_range) sdvox |=HDMI_COLOR_RANGE_16_235 ; -if (INTEL_INFO (dev)->gen <5 ) +if (INTEL_GEN (dev_priv) <5 ) sdvox |=SDVO_BORDER_ENABLE ; }else { sdvox =I915_READ (intel_sdvo->sdvo_reg);
@@ -1294,7 +1294,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,if (intel_sdvo->has_hdmi_audio) sdvox |=SDVO_AUDIO_ENABLE ; -if (INTEL_INFO (dev)->gen >=4 ) { +if (INTEL_GEN (dev_priv) >=4 ) {/* done in crtc_mode_set as the dpll_md reg must be written early */ }else if (IS_I945G (dev) ||IS_I945GM (dev) ||IS_G33 (dev)) {/* done in crtc_mode_set as it lives inside the dpll register */
@@ -1304,7 +1304,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder, }if (input_dtd.part2.sdvo_flags &SDVO_NEED_TO_STALL && -INTEL_INFO (dev)->gen <5 ) +INTEL_GEN (dev_priv) <5 ) sdvox |=SDVO_STALL_SELECT ;intel_sdvo_write_sdvox (intel_sdvo, sdvox); }
drivers/gpu/drm/i915/intel_tv.c +1 -1
@@ -1106,7 +1106,7 @@ static void intel_tv_pre_enable(struct intel_encoder *encoder,set_color_conversion (dev_priv, color_conversion); -if (INTEL_INFO (dev)->gen >=4 ) +if (INTEL_GEN (dev_priv) >=4 )I915_WRITE (TV_CLR_KNOBS ,0x00404000 );else I915_WRITE (TV_CLR_KNOBS ,0x00606000 );
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Dave Gordon
More Coccinellery ...
Wherever we find "INTEL_INFO(dev)->gen", and have a suitable "
dev_priv" in scope, replace it with "INTEL_GEN(dev_priv)", which is the preferred wasy to access this device property.
Quoted 7 lines
This patch covers all the files that contained only relatively few instances, and where no manual fixup was required. A few more complex instances may be updated in a later patch.
@dev_priv_param@
function FUNC;
idexpression structdrm_device*DEV;
Oh. That's how you catch those.
Quoted 26 lines
identifier
DEV_PRIV;
@@FUNC(..., struct drm_i915_private *DEV_PRIV, ...){ <...(quoted diff) +1
-1- INTEL_INFO(DEV)->gen + INTEL_GEN(DEV_PRIV) ...>}
@dev_priv_local@
idexpression structdrm_device*DEV;
identifierDEV_PRIV;
expression E;
@@{ ... ( struct drm_i915_private *DEV_PRIV; | struct drm_i915_private *DEV_PRIV = E; ) <...(quoted diff) +1
-1- INTEL_INFO(DEV)->gen + INTEL_GEN(DEV_PRIV) ...>
Quoted 1 line
}
Looks good, will have to wait until just after another merge point so that we can apply to dinq (as well as applies to nightly).
Nothing appeared out-of-place running this against intel_display.c, just a residual unused struct drm_dev.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 45 lines · Chris Wilson
Quoted 6 lines · Dave Gordon
More Coccinellery ...
Wherever we find "INTEL_INFO(dev)->gen", and have a suitable "
dev_priv" in scope, replace it with "INTEL_GEN(dev_priv)", which is the preferred wasy to access this device property.Quoted 7 lines
This patch covers all the files that contained only relatively few instances, and where no manual fixup was required. A few more complex instances may be updated in a later patch.
@dev_priv_param@
function FUNC;
idexpression structdrm_device*DEV;Oh. That's how you catch those.
Quoted 26 lines
identifier
DEV_PRIV;
@@FUNC(..., struct drm_i915_private *DEV_PRIV, ...){ <...(quoted diff) +1
-1- INTEL_INFO(DEV)->gen + INTEL_GEN(DEV_PRIV) ...>}
@dev_priv_local@
idexpression structdrm_device*DEV;
identifierDEV_PRIV;
expression E;
@@{ ... ( struct drm_i915_private *DEV_PRIV; | struct drm_i915_private *DEV_PRIV = E; ) <...(quoted diff) +1
-1- INTEL_INFO(DEV)->gen + INTEL_GEN(DEV_PRIV) ...>Quoted 1 line
}
Quoted 8 lines
Looks good, will have to wait until just after another merge point so that we can apply to dinq (as well as applies to nightly).
Nothing appeared out-of-place running this against
intel_display.c, just a residual unused structdrm_dev.Reviewed-by Chris Wilson <[email protected]>-Chris
Thanks, the other things I was thinking of fixing in the remaining files were generally things like
if (INTEL_INFO(dev)->gen < 5 || IS_G33(dev))
where the Cocci script spotted the first half but left a reference to 'dev' in the IS_X() call, which might be worth changing at the same time in these specific cases. Of course I've got a Coccinelle script to convert all the IS_X() macros too but that does produce rather too much churn for one patch!
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 4 lines · Dave Gordon
Thanks, the other things I was thinking of fixing in the remaining files were generally things like
if (INTEL_INFO(dev)->gen < 5 || IS_G33(dev))
Is that a real or a made up example? IS_G33() would be redundant. But I'd like to see the semantic patch to fix that! ;)
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Jani Nikula
Quoted 4 lines · Dave Gordon
Thanks, the other things I was thinking of fixing in the remaining files were generally things like
if (INTEL_INFO(dev)->gen < 5 || IS_G33(dev))Is that a real or a made up example?
IS_G33()would be redundant. But I'd like to see the semantic patch to fix that! ;)BR,
Jani.
That particular one was made up. The full series is now on the list in three patches. Part 1 is this one and already has Chris' R-b, part 2 is all the nontrivial ones such as the above and part 3 is intel_display.c all on its own 'cos it's the biggest file and the biggest user of this construct. Both of the latter have various boolean combinations of INTEL_GEN() with IS_X() or HAS_X() so it might be worth checking them for redundancies.
If you make up a table of redundant comparisons I'm sure it can be turned into a Cocci script :)
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 13 lines · Dave Gordon
Quoted 11 lines · Jani Nikula
Quoted 4 lines · Dave Gordon
Thanks, the other things I was thinking of fixing in the remaining files were generally things like
if (INTEL_INFO(dev)->gen < 5 || IS_G33(dev))Is that a real or a made up example?
IS_G33()would be redundant. But I'd like to see the semantic patch to fix that! ;)BR,
Jani.
Quoted 7 lines
That particular one was made up. The full series is now on the list in three patches. Part 1 is this one and already has Chris' R-b, part 2 is all the nontrivial ones such as the above and part 3 is
intel_display.call on its own 'cos it's the biggest file and the biggest user of this construct. Both of the latter have various boolean combinations ofINTEL_GEN()withIS_X()orHAS_X()so it might be worth checking them for redundancies.
I should have pointed out that the full series is not part of this thread, it's a separate patchset beginning with
[PATCH 0/3] drm/i915: use INTEL_GEN(dev_priv) wherever possible
https://lists.freedesktop.org/archives/intel-gfx/2016-September/106338.html
.Dave.
Quoted 8 lines
If you make up a table of redundant comparisons I'm sure it can be turned into a Cocci script :)
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx