[3/7] drm/i915: s/mode/adjusted_mode/ in functions that really get passed the adjusted_mode
diff mbox

Message ID 1441708851-24646-4-git-send-email-ville.syrjala@linux.intel.com
State New
Headers show

Commit Message

Ville Syrjala Sept. 8, 2015, 10:40 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename the function argument to 'adjusted_mode' whenever the function
only ever gets passed the adjusted_mode.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h     |  2 +-
 drivers/gpu/drm/i915/intel_audio.c  | 17 +++++++++--------
 drivers/gpu/drm/i915/intel_dsi.c    | 16 ++++++++--------
 drivers/gpu/drm/i915/intel_panel.c  | 36 ++++++++++++++++++------------------
 drivers/gpu/drm/i915/intel_sdvo.c   |  6 +++---
 drivers/gpu/drm/i915/intel_sprite.c |  8 +++++---
 6 files changed, 44 insertions(+), 41 deletions(-)

Comments

Kahola, Mika Sept. 23, 2015, 11:12 a.m. UTC | #1
On Tue, 2015-09-08 at 13:40 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rename the function argument to 'adjusted_mode' whenever the function
> only ever gets passed the adjusted_mode.
> 
What was the reason why we need to rename the function argument?

-Mika-

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h     |  2 +-
>  drivers/gpu/drm/i915/intel_audio.c  | 17 +++++++++--------
>  drivers/gpu/drm/i915/intel_dsi.c    | 16 ++++++++--------
>  drivers/gpu/drm/i915/intel_panel.c  | 36 ++++++++++++++++++------------------
>  drivers/gpu/drm/i915/intel_sdvo.c   |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c |  8 +++++---
>  6 files changed, 44 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 503dff5..4f4b504 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -646,7 +646,7 @@ struct drm_i915_display_funcs {
>  	void (*crtc_disable)(struct drm_crtc *crtc);
>  	void (*audio_codec_enable)(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode);
> +				   const struct drm_display_mode *adjusted_mode);
>  	void (*audio_codec_disable)(struct intel_encoder *encoder);
>  	void (*fdi_link_train)(struct drm_crtc *crtc);
>  	void (*init_clock_gating)(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index cf4f5d1..ca90ba3 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -69,17 +69,18 @@ static const struct {
>  };
>  
>  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
> -static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
> +static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
>  {
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
> -		if (mode->clock == hdmi_audio_clock[i].clock)
> +		if (adjusted_mode->clock == hdmi_audio_clock[i].clock)
>  			break;
>  	}
>  
>  	if (i == ARRAY_SIZE(hdmi_audio_clock)) {
> -		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock);
> +		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n",
> +			      adjusted_mode->clock);
>  		i = 1;
>  	}
>  
> @@ -138,7 +139,7 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void g4x_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	uint8_t *eld = connector->eld;
> @@ -203,7 +204,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void hsw_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> @@ -251,7 +252,7 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
>  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
> -		tmp |= audio_config_hdmi_pixel_clock(mode);
> +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>  }
>  
> @@ -304,7 +305,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void ilk_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> @@ -381,7 +382,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
>  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
> -		tmp |= audio_config_hdmi_pixel_clock(mode);
> +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>  	I915_WRITE(aud_config, tmp);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 0c26ba5..55af0c5 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -698,7 +698,7 @@ static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
>  }
>  
>  static void set_dsi_timings(struct drm_encoder *encoder,
> -			    const struct drm_display_mode *mode)
> +			    const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_device *dev = encoder->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -710,10 +710,10 @@ static void set_dsi_timings(struct drm_encoder *encoder,
>  
>  	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
>  
> -	hactive = mode->hdisplay;
> -	hfp = mode->hsync_start - mode->hdisplay;
> -	hsync = mode->hsync_end - mode->hsync_start;
> -	hbp = mode->htotal - mode->hsync_end;
> +	hactive = adjusted_mode->hdisplay;
> +	hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay;
> +	hsync = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
> +	hbp = adjusted_mode->htotal - adjusted_mode->hsync_end;
>  
>  	if (intel_dsi->dual_link) {
>  		hactive /= 2;
> @@ -724,9 +724,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
>  		hbp /= 2;
>  	}
>  
> -	vfp = mode->vsync_start - mode->vdisplay;
> -	vsync = mode->vsync_end - mode->vsync_start;
> -	vbp = mode->vtotal - mode->vsync_end;
> +	vfp = adjusted_mode->vsync_start - adjusted_mode->vdisplay;
> +	vsync = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
> +	vbp = adjusted_mode->vtotal - adjusted_mode->vsync_end;
>  
>  	/* horizontal values are in terms of high speed byte clock */
>  	hactive = txbyteclkhs(hactive, bpp, lane_count,
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 2034438a..d071bed 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -172,46 +172,46 @@ done:
>  }
>  
>  static void
> -centre_horizontally(struct drm_display_mode *mode,
> +centre_horizontally(struct drm_display_mode *adjusted_mode,
>  		    int width)
>  {
>  	u32 border, sync_pos, blank_width, sync_width;
>  
>  	/* keep the hsync and hblank widths constant */
> -	sync_width = mode->crtc_hsync_end - mode->crtc_hsync_start;
> -	blank_width = mode->crtc_hblank_end - mode->crtc_hblank_start;
> +	sync_width = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start;
> +	blank_width = adjusted_mode->crtc_hblank_end - adjusted_mode->crtc_hblank_start;
>  	sync_pos = (blank_width - sync_width + 1) / 2;
>  
> -	border = (mode->hdisplay - width + 1) / 2;
> +	border = (adjusted_mode->hdisplay - width + 1) / 2;
>  	border += border & 1; /* make the border even */
>  
> -	mode->crtc_hdisplay = width;
> -	mode->crtc_hblank_start = width + border;
> -	mode->crtc_hblank_end = mode->crtc_hblank_start + blank_width;
> +	adjusted_mode->crtc_hdisplay = width;
> +	adjusted_mode->crtc_hblank_start = width + border;
> +	adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_start + blank_width;
>  
> -	mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
> -	mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
> +	adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hblank_start + sync_pos;
> +	adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + sync_width;
>  }
>  
>  static void
> -centre_vertically(struct drm_display_mode *mode,
> +centre_vertically(struct drm_display_mode *adjusted_mode,
>  		  int height)
>  {
>  	u32 border, sync_pos, blank_width, sync_width;
>  
>  	/* keep the vsync and vblank widths constant */
> -	sync_width = mode->crtc_vsync_end - mode->crtc_vsync_start;
> -	blank_width = mode->crtc_vblank_end - mode->crtc_vblank_start;
> +	sync_width = adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start;
> +	blank_width = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start;
>  	sync_pos = (blank_width - sync_width + 1) / 2;
>  
> -	border = (mode->vdisplay - height + 1) / 2;
> +	border = (adjusted_mode->vdisplay - height + 1) / 2;
>  
> -	mode->crtc_vdisplay = height;
> -	mode->crtc_vblank_start = height + border;
> -	mode->crtc_vblank_end = mode->crtc_vblank_start + blank_width;
> +	adjusted_mode->crtc_vdisplay = height;
> +	adjusted_mode->crtc_vblank_start = height + border;
> +	adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vblank_start + blank_width;
>  
> -	mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
> -	mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
> +	adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vblank_start + sync_pos;
> +	adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + sync_width;
>  }
>  
>  static inline u32 panel_fitter_scaling(u32 source, u32 target)
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 3a70c2f..81e9325 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -603,11 +603,11 @@ log_fail:
>  	return false;
>  }
>  
> -static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
> +static int intel_sdvo_get_pixel_multiplier(const struct drm_display_mode *adjusted_mode)
>  {
> -	if (mode->clock >= 100000)
> +	if (adjusted_mode->clock >= 100000)
>  		return 1;
> -	else if (mode->clock >= 50000)
> +	else if (adjusted_mode->clock >= 50000)
>  		return 2;
>  	else
>  		return 4;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index a5e599b..239afa8 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -53,13 +53,15 @@ format_is_yuv(uint32_t format)
>  	}
>  }
>  
> -static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs)
> +static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> +			      int usecs)
>  {
>  	/* paranoia */
> -	if (!mode->crtc_htotal)
> +	if (!adjusted_mode->crtc_htotal)
>  		return 1;
>  
> -	return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal);
> +	return DIV_ROUND_UP(usecs * adjusted_mode->crtc_clock,
> +			    1000 * adjusted_mode->crtc_htotal);
>  }
>  
>  /**
Ville Syrjala Sept. 23, 2015, 12:30 p.m. UTC | #2
On Wed, Sep 23, 2015 at 02:12:18PM +0300, Mika Kahola wrote:
> On Tue, 2015-09-08 at 13:40 +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Rename the function argument to 'adjusted_mode' whenever the function
> > only ever gets passed the adjusted_mode.
> > 
> What was the reason why we need to rename the function argument?

Two things; First one being clarity. When you see 'mode' you can't be
sure what it is, 'adjusted_mode' OTOH is pretty clear. The second reason
was that I could then use sed to replace all the adjusted_mode->foo
with adjusted_mode->crtc_foo (which resulted in the next patch).

> 
> -Mika-
> 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h     |  2 +-
> >  drivers/gpu/drm/i915/intel_audio.c  | 17 +++++++++--------
> >  drivers/gpu/drm/i915/intel_dsi.c    | 16 ++++++++--------
> >  drivers/gpu/drm/i915/intel_panel.c  | 36 ++++++++++++++++++------------------
> >  drivers/gpu/drm/i915/intel_sdvo.c   |  6 +++---
> >  drivers/gpu/drm/i915/intel_sprite.c |  8 +++++---
> >  6 files changed, 44 insertions(+), 41 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 503dff5..4f4b504 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -646,7 +646,7 @@ struct drm_i915_display_funcs {
> >  	void (*crtc_disable)(struct drm_crtc *crtc);
> >  	void (*audio_codec_enable)(struct drm_connector *connector,
> >  				   struct intel_encoder *encoder,
> > -				   struct drm_display_mode *mode);
> > +				   const struct drm_display_mode *adjusted_mode);
> >  	void (*audio_codec_disable)(struct intel_encoder *encoder);
> >  	void (*fdi_link_train)(struct drm_crtc *crtc);
> >  	void (*init_clock_gating)(struct drm_device *dev);
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> > index cf4f5d1..ca90ba3 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -69,17 +69,18 @@ static const struct {
> >  };
> >  
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
> > -static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
> > +static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
> >  {
> >  	int i;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
> > -		if (mode->clock == hdmi_audio_clock[i].clock)
> > +		if (adjusted_mode->clock == hdmi_audio_clock[i].clock)
> >  			break;
> >  	}
> >  
> >  	if (i == ARRAY_SIZE(hdmi_audio_clock)) {
> > -		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock);
> > +		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n",
> > +			      adjusted_mode->clock);
> >  		i = 1;
> >  	}
> >  
> > @@ -138,7 +139,7 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)
> >  
> >  static void g4x_audio_codec_enable(struct drm_connector *connector,
> >  				   struct intel_encoder *encoder,
> > -				   struct drm_display_mode *mode)
> > +				   const struct drm_display_mode *adjusted_mode)
> >  {
> >  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
> >  	uint8_t *eld = connector->eld;
> > @@ -203,7 +204,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> >  
> >  static void hsw_audio_codec_enable(struct drm_connector *connector,
> >  				   struct intel_encoder *encoder,
> > -				   struct drm_display_mode *mode)
> > +				   const struct drm_display_mode *adjusted_mode)
> >  {
> >  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> > @@ -251,7 +252,7 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
> >  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	else
> > -		tmp |= audio_config_hdmi_pixel_clock(mode);
> > +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >  }
> >  
> > @@ -304,7 +305,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder)
> >  
> >  static void ilk_audio_codec_enable(struct drm_connector *connector,
> >  				   struct intel_encoder *encoder,
> > -				   struct drm_display_mode *mode)
> > +				   const struct drm_display_mode *adjusted_mode)
> >  {
> >  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> > @@ -381,7 +382,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
> >  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	else
> > -		tmp |= audio_config_hdmi_pixel_clock(mode);
> > +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >  	I915_WRITE(aud_config, tmp);
> >  }
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> > index 0c26ba5..55af0c5 100644
> > --- a/drivers/gpu/drm/i915/intel_dsi.c
> > +++ b/drivers/gpu/drm/i915/intel_dsi.c
> > @@ -698,7 +698,7 @@ static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
> >  }
> >  
> >  static void set_dsi_timings(struct drm_encoder *encoder,
> > -			    const struct drm_display_mode *mode)
> > +			    const struct drm_display_mode *adjusted_mode)
> >  {
> >  	struct drm_device *dev = encoder->dev;
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> > @@ -710,10 +710,10 @@ static void set_dsi_timings(struct drm_encoder *encoder,
> >  
> >  	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
> >  
> > -	hactive = mode->hdisplay;
> > -	hfp = mode->hsync_start - mode->hdisplay;
> > -	hsync = mode->hsync_end - mode->hsync_start;
> > -	hbp = mode->htotal - mode->hsync_end;
> > +	hactive = adjusted_mode->hdisplay;
> > +	hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay;
> > +	hsync = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
> > +	hbp = adjusted_mode->htotal - adjusted_mode->hsync_end;
> >  
> >  	if (intel_dsi->dual_link) {
> >  		hactive /= 2;
> > @@ -724,9 +724,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
> >  		hbp /= 2;
> >  	}
> >  
> > -	vfp = mode->vsync_start - mode->vdisplay;
> > -	vsync = mode->vsync_end - mode->vsync_start;
> > -	vbp = mode->vtotal - mode->vsync_end;
> > +	vfp = adjusted_mode->vsync_start - adjusted_mode->vdisplay;
> > +	vsync = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
> > +	vbp = adjusted_mode->vtotal - adjusted_mode->vsync_end;
> >  
> >  	/* horizontal values are in terms of high speed byte clock */
> >  	hactive = txbyteclkhs(hactive, bpp, lane_count,
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index 2034438a..d071bed 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -172,46 +172,46 @@ done:
> >  }
> >  
> >  static void
> > -centre_horizontally(struct drm_display_mode *mode,
> > +centre_horizontally(struct drm_display_mode *adjusted_mode,
> >  		    int width)
> >  {
> >  	u32 border, sync_pos, blank_width, sync_width;
> >  
> >  	/* keep the hsync and hblank widths constant */
> > -	sync_width = mode->crtc_hsync_end - mode->crtc_hsync_start;
> > -	blank_width = mode->crtc_hblank_end - mode->crtc_hblank_start;
> > +	sync_width = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start;
> > +	blank_width = adjusted_mode->crtc_hblank_end - adjusted_mode->crtc_hblank_start;
> >  	sync_pos = (blank_width - sync_width + 1) / 2;
> >  
> > -	border = (mode->hdisplay - width + 1) / 2;
> > +	border = (adjusted_mode->hdisplay - width + 1) / 2;
> >  	border += border & 1; /* make the border even */
> >  
> > -	mode->crtc_hdisplay = width;
> > -	mode->crtc_hblank_start = width + border;
> > -	mode->crtc_hblank_end = mode->crtc_hblank_start + blank_width;
> > +	adjusted_mode->crtc_hdisplay = width;
> > +	adjusted_mode->crtc_hblank_start = width + border;
> > +	adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_start + blank_width;
> >  
> > -	mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
> > -	mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
> > +	adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hblank_start + sync_pos;
> > +	adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + sync_width;
> >  }
> >  
> >  static void
> > -centre_vertically(struct drm_display_mode *mode,
> > +centre_vertically(struct drm_display_mode *adjusted_mode,
> >  		  int height)
> >  {
> >  	u32 border, sync_pos, blank_width, sync_width;
> >  
> >  	/* keep the vsync and vblank widths constant */
> > -	sync_width = mode->crtc_vsync_end - mode->crtc_vsync_start;
> > -	blank_width = mode->crtc_vblank_end - mode->crtc_vblank_start;
> > +	sync_width = adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start;
> > +	blank_width = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start;
> >  	sync_pos = (blank_width - sync_width + 1) / 2;
> >  
> > -	border = (mode->vdisplay - height + 1) / 2;
> > +	border = (adjusted_mode->vdisplay - height + 1) / 2;
> >  
> > -	mode->crtc_vdisplay = height;
> > -	mode->crtc_vblank_start = height + border;
> > -	mode->crtc_vblank_end = mode->crtc_vblank_start + blank_width;
> > +	adjusted_mode->crtc_vdisplay = height;
> > +	adjusted_mode->crtc_vblank_start = height + border;
> > +	adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vblank_start + blank_width;
> >  
> > -	mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
> > -	mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
> > +	adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vblank_start + sync_pos;
> > +	adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + sync_width;
> >  }
> >  
> >  static inline u32 panel_fitter_scaling(u32 source, u32 target)
> > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> > index 3a70c2f..81e9325 100644
> > --- a/drivers/gpu/drm/i915/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> > @@ -603,11 +603,11 @@ log_fail:
> >  	return false;
> >  }
> >  
> > -static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
> > +static int intel_sdvo_get_pixel_multiplier(const struct drm_display_mode *adjusted_mode)
> >  {
> > -	if (mode->clock >= 100000)
> > +	if (adjusted_mode->clock >= 100000)
> >  		return 1;
> > -	else if (mode->clock >= 50000)
> > +	else if (adjusted_mode->clock >= 50000)
> >  		return 2;
> >  	else
> >  		return 4;
> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> > index a5e599b..239afa8 100644
> > --- a/drivers/gpu/drm/i915/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/intel_sprite.c
> > @@ -53,13 +53,15 @@ format_is_yuv(uint32_t format)
> >  	}
> >  }
> >  
> > -static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs)
> > +static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> > +			      int usecs)
> >  {
> >  	/* paranoia */
> > -	if (!mode->crtc_htotal)
> > +	if (!adjusted_mode->crtc_htotal)
> >  		return 1;
> >  
> > -	return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal);
> > +	return DIV_ROUND_UP(usecs * adjusted_mode->crtc_clock,
> > +			    1000 * adjusted_mode->crtc_htotal);
> >  }
> >  
> >  /**
>
Kahola, Mika Sept. 24, 2015, 8:06 a.m. UTC | #3
On Tue, 2015-09-08 at 13:40 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rename the function argument to 'adjusted_mode' whenever the function
> only ever gets passed the adjusted_mode.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h     |  2 +-
>  drivers/gpu/drm/i915/intel_audio.c  | 17 +++++++++--------
>  drivers/gpu/drm/i915/intel_dsi.c    | 16 ++++++++--------
>  drivers/gpu/drm/i915/intel_panel.c  | 36 ++++++++++++++++++------------------
>  drivers/gpu/drm/i915/intel_sdvo.c   |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c |  8 +++++---
>  6 files changed, 44 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 503dff5..4f4b504 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -646,7 +646,7 @@ struct drm_i915_display_funcs {
>  	void (*crtc_disable)(struct drm_crtc *crtc);
>  	void (*audio_codec_enable)(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode);
> +				   const struct drm_display_mode *adjusted_mode);
>  	void (*audio_codec_disable)(struct intel_encoder *encoder);
>  	void (*fdi_link_train)(struct drm_crtc *crtc);
>  	void (*init_clock_gating)(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index cf4f5d1..ca90ba3 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -69,17 +69,18 @@ static const struct {
>  };
>  
>  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
> -static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
> +static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
>  {
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
> -		if (mode->clock == hdmi_audio_clock[i].clock)
> +		if (adjusted_mode->clock == hdmi_audio_clock[i].clock)
>  			break;
>  	}
>  
>  	if (i == ARRAY_SIZE(hdmi_audio_clock)) {
> -		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock);
> +		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n",
> +			      adjusted_mode->clock);
>  		i = 1;
>  	}
>  
> @@ -138,7 +139,7 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void g4x_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	uint8_t *eld = connector->eld;
> @@ -203,7 +204,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void hsw_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> @@ -251,7 +252,7 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
>  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
> -		tmp |= audio_config_hdmi_pixel_clock(mode);
> +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>  }
>  
> @@ -304,7 +305,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder)
>  
>  static void ilk_audio_codec_enable(struct drm_connector *connector,
>  				   struct intel_encoder *encoder,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *dev_priv = connector->dev->dev_private;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> @@ -381,7 +382,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
>  	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
> -		tmp |= audio_config_hdmi_pixel_clock(mode);
> +		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>  	I915_WRITE(aud_config, tmp);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 0c26ba5..55af0c5 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -698,7 +698,7 @@ static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
>  }
>  
>  static void set_dsi_timings(struct drm_encoder *encoder,
> -			    const struct drm_display_mode *mode)
> +			    const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_device *dev = encoder->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -710,10 +710,10 @@ static void set_dsi_timings(struct drm_encoder *encoder,
>  
>  	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
>  
> -	hactive = mode->hdisplay;
> -	hfp = mode->hsync_start - mode->hdisplay;
> -	hsync = mode->hsync_end - mode->hsync_start;
> -	hbp = mode->htotal - mode->hsync_end;
> +	hactive = adjusted_mode->hdisplay;
> +	hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay;
> +	hsync = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
> +	hbp = adjusted_mode->htotal - adjusted_mode->hsync_end;
>  
>  	if (intel_dsi->dual_link) {
>  		hactive /= 2;
> @@ -724,9 +724,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
>  		hbp /= 2;
>  	}
>  
> -	vfp = mode->vsync_start - mode->vdisplay;
> -	vsync = mode->vsync_end - mode->vsync_start;
> -	vbp = mode->vtotal - mode->vsync_end;
> +	vfp = adjusted_mode->vsync_start - adjusted_mode->vdisplay;
> +	vsync = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
> +	vbp = adjusted_mode->vtotal - adjusted_mode->vsync_end;
>  
>  	/* horizontal values are in terms of high speed byte clock */
>  	hactive = txbyteclkhs(hactive, bpp, lane_count,
The intel_dsi.c has propably changed since the patch has been submitted
for review as the lines in 'drivers/gpu/drm/i915/intel_dsi.c:748',
'drivers/gpu/drm/i915/intel_dsi.c:750',
and 'drivers/gpu/drm/i915/intel_dsi.c:752' need some tlc as variable
'mode' needs to be renamed as 'adjusted_mode'

> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 2034438a..d071bed 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -172,46 +172,46 @@ done:
>  }
>  
>  static void
> -centre_horizontally(struct drm_display_mode *mode,
> +centre_horizontally(struct drm_display_mode *adjusted_mode,
>  		    int width)
>  {
>  	u32 border, sync_pos, blank_width, sync_width;
>  
>  	/* keep the hsync and hblank widths constant */
> -	sync_width = mode->crtc_hsync_end - mode->crtc_hsync_start;
> -	blank_width = mode->crtc_hblank_end - mode->crtc_hblank_start;
> +	sync_width = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start;
> +	blank_width = adjusted_mode->crtc_hblank_end - adjusted_mode->crtc_hblank_start;
>  	sync_pos = (blank_width - sync_width + 1) / 2;
>  
> -	border = (mode->hdisplay - width + 1) / 2;
> +	border = (adjusted_mode->hdisplay - width + 1) / 2;
>  	border += border & 1; /* make the border even */
>  
> -	mode->crtc_hdisplay = width;
> -	mode->crtc_hblank_start = width + border;
> -	mode->crtc_hblank_end = mode->crtc_hblank_start + blank_width;
> +	adjusted_mode->crtc_hdisplay = width;
> +	adjusted_mode->crtc_hblank_start = width + border;
> +	adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_start + blank_width;
>  
> -	mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
> -	mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
> +	adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hblank_start + sync_pos;
> +	adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + sync_width;
>  }
>  
>  static void
> -centre_vertically(struct drm_display_mode *mode,
> +centre_vertically(struct drm_display_mode *adjusted_mode,
>  		  int height)
>  {
>  	u32 border, sync_pos, blank_width, sync_width;
>  
>  	/* keep the vsync and vblank widths constant */
> -	sync_width = mode->crtc_vsync_end - mode->crtc_vsync_start;
> -	blank_width = mode->crtc_vblank_end - mode->crtc_vblank_start;
> +	sync_width = adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start;
> +	blank_width = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start;
>  	sync_pos = (blank_width - sync_width + 1) / 2;
>  
> -	border = (mode->vdisplay - height + 1) / 2;
> +	border = (adjusted_mode->vdisplay - height + 1) / 2;
>  
> -	mode->crtc_vdisplay = height;
> -	mode->crtc_vblank_start = height + border;
> -	mode->crtc_vblank_end = mode->crtc_vblank_start + blank_width;
> +	adjusted_mode->crtc_vdisplay = height;
> +	adjusted_mode->crtc_vblank_start = height + border;
> +	adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vblank_start + blank_width;
>  
> -	mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
> -	mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
> +	adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vblank_start + sync_pos;
> +	adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + sync_width;
>  }
>  
>  static inline u32 panel_fitter_scaling(u32 source, u32 target)
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 3a70c2f..81e9325 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -603,11 +603,11 @@ log_fail:
>  	return false;
>  }
>  
> -static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
> +static int intel_sdvo_get_pixel_multiplier(const struct drm_display_mode *adjusted_mode)
>  {
> -	if (mode->clock >= 100000)
> +	if (adjusted_mode->clock >= 100000)
>  		return 1;
> -	else if (mode->clock >= 50000)
> +	else if (adjusted_mode->clock >= 50000)
>  		return 2;
>  	else
>  		return 4;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index a5e599b..239afa8 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -53,13 +53,15 @@ format_is_yuv(uint32_t format)
>  	}
>  }
>  
> -static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs)
> +static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> +			      int usecs)
>  {
>  	/* paranoia */
> -	if (!mode->crtc_htotal)
> +	if (!adjusted_mode->crtc_htotal)
>  		return 1;
>  
> -	return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal);
> +	return DIV_ROUND_UP(usecs * adjusted_mode->crtc_clock,
> +			    1000 * adjusted_mode->crtc_htotal);
>  }
>  
>  /**

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 503dff5..4f4b504 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -646,7 +646,7 @@  struct drm_i915_display_funcs {
 	void (*crtc_disable)(struct drm_crtc *crtc);
 	void (*audio_codec_enable)(struct drm_connector *connector,
 				   struct intel_encoder *encoder,
-				   struct drm_display_mode *mode);
+				   const struct drm_display_mode *adjusted_mode);
 	void (*audio_codec_disable)(struct intel_encoder *encoder);
 	void (*fdi_link_train)(struct drm_crtc *crtc);
 	void (*init_clock_gating)(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index cf4f5d1..ca90ba3 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -69,17 +69,18 @@  static const struct {
 };
 
 /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
-static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
+static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
 {
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
-		if (mode->clock == hdmi_audio_clock[i].clock)
+		if (adjusted_mode->clock == hdmi_audio_clock[i].clock)
 			break;
 	}
 
 	if (i == ARRAY_SIZE(hdmi_audio_clock)) {
-		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock);
+		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n",
+			      adjusted_mode->clock);
 		i = 1;
 	}
 
@@ -138,7 +139,7 @@  static void g4x_audio_codec_disable(struct intel_encoder *encoder)
 
 static void g4x_audio_codec_enable(struct drm_connector *connector,
 				   struct intel_encoder *encoder,
-				   struct drm_display_mode *mode)
+				   const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -203,7 +204,7 @@  static void hsw_audio_codec_disable(struct intel_encoder *encoder)
 
 static void hsw_audio_codec_enable(struct drm_connector *connector,
 				   struct intel_encoder *encoder,
-				   struct drm_display_mode *mode)
+				   const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
@@ -251,7 +252,7 @@  static void hsw_audio_codec_enable(struct drm_connector *connector,
 	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
 		tmp |= AUD_CONFIG_N_VALUE_INDEX;
 	else
-		tmp |= audio_config_hdmi_pixel_clock(mode);
+		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
 	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
 }
 
@@ -304,7 +305,7 @@  static void ilk_audio_codec_disable(struct intel_encoder *encoder)
 
 static void ilk_audio_codec_enable(struct drm_connector *connector,
 				   struct intel_encoder *encoder,
-				   struct drm_display_mode *mode)
+				   const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
@@ -381,7 +382,7 @@  static void ilk_audio_codec_enable(struct drm_connector *connector,
 	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
 		tmp |= AUD_CONFIG_N_VALUE_INDEX;
 	else
-		tmp |= audio_config_hdmi_pixel_clock(mode);
+		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
 	I915_WRITE(aud_config, tmp);
 }
 
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 0c26ba5..55af0c5 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -698,7 +698,7 @@  static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
 }
 
 static void set_dsi_timings(struct drm_encoder *encoder,
-			    const struct drm_display_mode *mode)
+			    const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -710,10 +710,10 @@  static void set_dsi_timings(struct drm_encoder *encoder,
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
 
-	hactive = mode->hdisplay;
-	hfp = mode->hsync_start - mode->hdisplay;
-	hsync = mode->hsync_end - mode->hsync_start;
-	hbp = mode->htotal - mode->hsync_end;
+	hactive = adjusted_mode->hdisplay;
+	hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay;
+	hsync = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
+	hbp = adjusted_mode->htotal - adjusted_mode->hsync_end;
 
 	if (intel_dsi->dual_link) {
 		hactive /= 2;
@@ -724,9 +724,9 @@  static void set_dsi_timings(struct drm_encoder *encoder,
 		hbp /= 2;
 	}
 
-	vfp = mode->vsync_start - mode->vdisplay;
-	vsync = mode->vsync_end - mode->vsync_start;
-	vbp = mode->vtotal - mode->vsync_end;
+	vfp = adjusted_mode->vsync_start - adjusted_mode->vdisplay;
+	vsync = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
+	vbp = adjusted_mode->vtotal - adjusted_mode->vsync_end;
 
 	/* horizontal values are in terms of high speed byte clock */
 	hactive = txbyteclkhs(hactive, bpp, lane_count,
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 2034438a..d071bed 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -172,46 +172,46 @@  done:
 }
 
 static void
-centre_horizontally(struct drm_display_mode *mode,
+centre_horizontally(struct drm_display_mode *adjusted_mode,
 		    int width)
 {
 	u32 border, sync_pos, blank_width, sync_width;
 
 	/* keep the hsync and hblank widths constant */
-	sync_width = mode->crtc_hsync_end - mode->crtc_hsync_start;
-	blank_width = mode->crtc_hblank_end - mode->crtc_hblank_start;
+	sync_width = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start;
+	blank_width = adjusted_mode->crtc_hblank_end - adjusted_mode->crtc_hblank_start;
 	sync_pos = (blank_width - sync_width + 1) / 2;
 
-	border = (mode->hdisplay - width + 1) / 2;
+	border = (adjusted_mode->hdisplay - width + 1) / 2;
 	border += border & 1; /* make the border even */
 
-	mode->crtc_hdisplay = width;
-	mode->crtc_hblank_start = width + border;
-	mode->crtc_hblank_end = mode->crtc_hblank_start + blank_width;
+	adjusted_mode->crtc_hdisplay = width;
+	adjusted_mode->crtc_hblank_start = width + border;
+	adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_start + blank_width;
 
-	mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
-	mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
+	adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hblank_start + sync_pos;
+	adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + sync_width;
 }
 
 static void
-centre_vertically(struct drm_display_mode *mode,
+centre_vertically(struct drm_display_mode *adjusted_mode,
 		  int height)
 {
 	u32 border, sync_pos, blank_width, sync_width;
 
 	/* keep the vsync and vblank widths constant */
-	sync_width = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	blank_width = mode->crtc_vblank_end - mode->crtc_vblank_start;
+	sync_width = adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start;
+	blank_width = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start;
 	sync_pos = (blank_width - sync_width + 1) / 2;
 
-	border = (mode->vdisplay - height + 1) / 2;
+	border = (adjusted_mode->vdisplay - height + 1) / 2;
 
-	mode->crtc_vdisplay = height;
-	mode->crtc_vblank_start = height + border;
-	mode->crtc_vblank_end = mode->crtc_vblank_start + blank_width;
+	adjusted_mode->crtc_vdisplay = height;
+	adjusted_mode->crtc_vblank_start = height + border;
+	adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vblank_start + blank_width;
 
-	mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
-	mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
+	adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vblank_start + sync_pos;
+	adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + sync_width;
 }
 
 static inline u32 panel_fitter_scaling(u32 source, u32 target)
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 3a70c2f..81e9325 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -603,11 +603,11 @@  log_fail:
 	return false;
 }
 
-static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
+static int intel_sdvo_get_pixel_multiplier(const struct drm_display_mode *adjusted_mode)
 {
-	if (mode->clock >= 100000)
+	if (adjusted_mode->clock >= 100000)
 		return 1;
-	else if (mode->clock >= 50000)
+	else if (adjusted_mode->clock >= 50000)
 		return 2;
 	else
 		return 4;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index a5e599b..239afa8 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -53,13 +53,15 @@  format_is_yuv(uint32_t format)
 	}
 }
 
-static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs)
+static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
+			      int usecs)
 {
 	/* paranoia */
-	if (!mode->crtc_htotal)
+	if (!adjusted_mode->crtc_htotal)
 		return 1;
 
-	return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal);
+	return DIV_ROUND_UP(usecs * adjusted_mode->crtc_clock,
+			    1000 * adjusted_mode->crtc_htotal);
 }
 
 /**