diff mbox

[RFC,14/37] drm: connector-helper: Constify mode_set parameters

Message ID 1426739616-10635-14-git-send-email-daniels@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone March 19, 2015, 4:33 a.m. UTC
Enforce the existing rules on when modes can be modified (never modify
the passed-in mode; only modify adjusted_mode in mode_fixup), by
adding const.

This removes the interim mode_set helper functions introduced in tilcdc
and armada during the encoder-slave mode_set constification, as the
encoder and encoder-slave types are now compatible.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 drivers/gpu/drm/armada/armada_slave.c            | 10 +---------
 drivers/gpu/drm/ast/ast_mode.c                   |  4 ++--
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c |  4 ++--
 drivers/gpu/drm/bochs/bochs_kms.c                |  4 ++--
 drivers/gpu/drm/cirrus/cirrus_mode.c             |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.h          |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c          |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c      |  4 ++--
 drivers/gpu/drm/exynos/exynos_hdmi.c             | 19 ++++++++-----------
 drivers/gpu/drm/gma500/cdv_intel_crt.c           |  4 ++--
 drivers/gpu/drm/gma500/cdv_intel_dp.c            |  5 +++--
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c          |  4 ++--
 drivers/gpu/drm/gma500/cdv_intel_lvds.c          |  4 ++--
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c           |  4 ++--
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.h           |  4 ++--
 drivers/gpu/drm/gma500/oaktrail_hdmi.c           |  4 ++--
 drivers/gpu/drm/gma500/oaktrail_lvds.c           |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_lvds.c          |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_sdvo.c          |  4 ++--
 drivers/gpu/drm/i2c/tda998x_drv.c                |  8 ++++----
 drivers/gpu/drm/imx/dw_hdmi-imx.c                |  4 ++--
 drivers/gpu/drm/imx/imx-ldb.c                    |  4 ++--
 drivers/gpu/drm/imx/imx-tve.c                    |  4 ++--
 drivers/gpu/drm/imx/parallel-display.c           |  4 ++--
 drivers/gpu/drm/mgag200/mgag200_mode.c           |  4 ++--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  6 ++----
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  6 ++----
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c      |  6 ++----
 drivers/gpu/drm/nouveau/dispnv04/dac.c           |  4 ++--
 drivers/gpu/drm/nouveau/dispnv04/dfp.c           |  4 ++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c        |  4 ++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c        |  4 ++--
 drivers/gpu/drm/nouveau/nv50_display.c           | 21 +++++++++++++--------
 drivers/gpu/drm/omapdrm/omap_encoder.c           |  4 ++--
 drivers/gpu/drm/qxl/qxl_display.c                |  4 ++--
 drivers/gpu/drm/radeon/atombios_encoders.c       | 10 +++++-----
 drivers/gpu/drm/radeon/radeon_audio.c            | 20 +++++++++++---------
 drivers/gpu/drm/radeon/radeon_audio.h            |  7 ++++---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c  | 20 ++++++++++----------
 drivers/gpu/drm/radeon/radeon_legacy_tv.c        |  4 ++--
 drivers/gpu/drm/radeon/radeon_mode.h             |  4 ++--
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c        |  4 ++--
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c        |  4 ++--
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c      |  4 ++--
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c        |  4 ++--
 drivers/gpu/drm/sti/sti_tvout.c                  |  4 ++--
 drivers/gpu/drm/tegra/dsi.c                      |  4 ++--
 drivers/gpu/drm/tegra/hdmi.c                     |  6 +++---
 drivers/gpu/drm/tegra/rgb.c                      |  4 ++--
 drivers/gpu/drm/tegra/sor.c                      |  6 +++---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c            |  4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_slave.c            |  9 +--------
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c           |  4 ++--
 drivers/gpu/drm/udl/udl_encoder.c                |  4 ++--
 include/drm/drm_crtc_helper.h                    |  4 ++--
 55 files changed, 150 insertions(+), 165 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/armada/armada_slave.c b/drivers/gpu/drm/armada/armada_slave.c
index a58f4f9..00d0fac 100644
--- a/drivers/gpu/drm/armada/armada_slave.c
+++ b/drivers/gpu/drm/armada/armada_slave.c
@@ -42,14 +42,6 @@  static void armada_drm_slave_destroy(struct drm_encoder *enc)
 	kfree(slave);
 }
 
-static void armada_drm_slave_mode_set(struct drm_encoder *encoder,
-				      struct drm_display_mode *mode,
-				      struct drm_display_mode *adjusted_mode)
-{
-	drm_i2c_encoder_mode_set(encoder, mode, adjusted_mode);
-}
-
-
 static const struct drm_encoder_funcs armada_drm_slave_encoder_funcs = {
 	.destroy	= armada_drm_slave_destroy,
 };
@@ -67,7 +59,7 @@  static const struct drm_encoder_helper_funcs drm_slave_encoder_helpers = {
 	.mode_fixup = drm_i2c_encoder_mode_fixup,
 	.prepare = drm_i2c_encoder_prepare,
 	.commit = drm_i2c_encoder_commit,
-	.mode_set = armada_drm_slave_mode_set,
+	.mode_set = drm_i2c_encoder_mode_set,
 	.detect = drm_i2c_encoder_detect,
 };
 
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 8069448..76e7d56 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -743,8 +743,8 @@  static bool ast_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void ast_encoder_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index b6a7ee4..de24d55 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -114,8 +114,8 @@  atmel_hlcdc_panel_encoder_mode_fixup(struct drm_encoder *encoder,
 
 static void
 atmel_hlcdc_rgb_encoder_mode_set(struct drm_encoder *encoder,
-				 struct drm_display_mode *mode,
-				 struct drm_display_mode *adjusted)
+				 const struct drm_display_mode *mode,
+				 const struct drm_display_mode *adjusted)
 {
 	struct atmel_hlcdc_rgb_output *rgb =
 			drm_encoder_to_atmel_hlcdc_rgb_output(encoder);
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index a61a42e..3967559 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -160,8 +160,8 @@  static bool bochs_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void bochs_encoder_mode_set(struct drm_encoder *encoder,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode)
+				   const struct drm_display_mode *mode,
+				   const struct drm_display_mode *adjusted_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 61385f2..b77938d 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -439,8 +439,8 @@  static bool cirrus_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void cirrus_encoder_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 0910c66..dc9cc99 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -137,7 +137,7 @@  struct exynos_drm_display_ops {
 				const struct drm_display_mode *mode,
 				struct drm_display_mode *adjusted_mode);
 	void (*mode_set)(struct exynos_drm_display *display,
-				struct drm_display_mode *mode);
+				const struct drm_display_mode *mode);
 	int (*check_mode)(struct exynos_drm_display *display,
 				const struct drm_display_mode *mode);
 	void (*dpms)(struct exynos_drm_display *display, int mode);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 885317a..e30f875 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1518,7 +1518,7 @@  static int exynos_dsi_create_connector(struct exynos_drm_display *display,
 }
 
 static void exynos_dsi_mode_set(struct exynos_drm_display *display,
-			 struct drm_display_mode *mode)
+			 const struct drm_display_mode *mode)
 {
 	struct exynos_dsi *dsi = display_to_dsi(display);
 	struct videomode *vm = &dsi->vm;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 57de0bd..4dceb34 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -66,8 +66,8 @@  exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
-					 struct drm_display_mode *mode,
-					 struct drm_display_mode *adjusted_mode)
+					 const struct drm_display_mode *mode,
+					 const struct drm_display_mode *adjusted_mode)
 {
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 	struct exynos_drm_display *display = exynos_encoder->display;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index abbe438..504d012 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1762,14 +1762,13 @@  static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value)
 }
 
 static void hdmi_v13_mode_set(struct hdmi_context *hdata,
-			struct drm_display_mode *m)
+			const struct drm_display_mode *m)
 {
 	struct hdmi_v13_core_regs *core = &hdata->mode_conf.conf.v13_conf.core;
 	struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg;
 	unsigned int val;
 
-	hdata->mode_conf.cea_video_id =
-		drm_match_cea_mode((struct drm_display_mode *)m);
+	hdata->mode_conf.cea_video_id = drm_match_cea_mode(m);
 	hdata->mode_conf.pixel_clock = m->clock * 1000;
 	hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio;
 
@@ -1859,14 +1858,13 @@  static void hdmi_v13_mode_set(struct hdmi_context *hdata,
 }
 
 static void hdmi_v14_mode_set(struct hdmi_context *hdata,
-			struct drm_display_mode *m)
+			const struct drm_display_mode *m)
 {
 	struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg;
 	struct hdmi_v14_core_regs *core =
 		&hdata->mode_conf.conf.v14_conf.core;
 
-	hdata->mode_conf.cea_video_id =
-		drm_match_cea_mode((struct drm_display_mode *)m);
+	hdata->mode_conf.cea_video_id = drm_match_cea_mode(m);
 	hdata->mode_conf.pixel_clock = m->clock * 1000;
 	hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio;
 
@@ -1971,10 +1969,9 @@  static void hdmi_v14_mode_set(struct hdmi_context *hdata,
 }
 
 static void hdmi_mode_set(struct exynos_drm_display *display,
-			struct drm_display_mode *mode)
+			const struct drm_display_mode *m)
 {
 	struct hdmi_context *hdata = display_to_hdmi(display);
-	struct drm_display_mode *m = mode;
 
 	DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n",
 		m->hdisplay, m->vdisplay,
@@ -1982,12 +1979,12 @@  static void hdmi_mode_set(struct exynos_drm_display *display,
 		"INTERLACED" : "PROGERESSIVE");
 
 	/* preserve mode information for later use. */
-	drm_mode_copy(&hdata->current_mode, mode);
+	drm_mode_copy(&hdata->current_mode, m);
 
 	if (hdata->type == HDMI_TYPE13)
-		hdmi_v13_mode_set(hdata, mode);
+		hdmi_v13_mode_set(hdata, m);
 	else
-		hdmi_v14_mode_set(hdata, mode);
+		hdmi_v14_mode_set(hdata, m);
 }
 
 static void hdmi_commit(struct exynos_drm_display *display)
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 9152105..fbf5524 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -82,8 +82,8 @@  static int cdv_intel_crt_mode_valid(struct drm_connector *connector,
 }
 
 static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode)
 {
 
 	struct drm_device *dev = encoder->dev;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 506f5d2..a303cb9 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -1036,8 +1036,9 @@  cdv_intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 }
 
 static void
-cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
-		  struct drm_display_mode *adjusted_mode)
+cdv_intel_dp_mode_set(struct drm_encoder *encoder,
+		const struct drm_display_mode *mode,
+		const struct drm_display_mode *adjusted_mode)
 {
 	struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
 	struct drm_crtc *crtc = encoder->crtc;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 19a73c8..96b8ee1 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -60,8 +60,8 @@  struct mid_intel_hdmi_priv {
 };
 
 static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
-			struct drm_display_mode *mode,
-			struct drm_display_mode *adjusted_mode)
+			const struct drm_display_mode *mode,
+			const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index c416fbe..afe6d5d 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -351,8 +351,8 @@  static void cdv_intel_lvds_commit(struct drm_encoder *encoder)
 }
 
 static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_psb_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index d4813e0..ca31291 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -810,8 +810,8 @@  static void mdfld_set_pipe_timing(struct mdfld_dsi_config *dsi_config, int pipe)
 /* End for TC35876X */
 
 void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode)
+				   const struct drm_display_mode *mode,
+				   const struct drm_display_mode *adjusted_mode)
 {
 	struct mdfld_dsi_encoder *dsi_encoder = mdfld_dsi_encoder(encoder);
 	struct mdfld_dsi_dpi_output *dpi_output =
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.h b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.h
index 2b40663..66e62c7 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.h
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.h
@@ -70,8 +70,8 @@  extern bool mdfld_dsi_dpi_mode_fixup(struct drm_encoder *encoder,
 extern void mdfld_dsi_dpi_prepare(struct drm_encoder *encoder);
 extern void mdfld_dsi_dpi_commit(struct drm_encoder *encoder);
 extern void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode);
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode);
 extern void mdfld_dsi_dpi_turn_on(struct mdfld_dsi_dpi_output *output,
 				int pipe);
 extern void mdfld_dsi_dpi_controller_init(struct mdfld_dsi_config *dsi_config,
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index fcdfe78..877b63c 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -585,8 +585,8 @@  static int oaktrail_hdmi_get_modes(struct drm_connector *connector)
 }
 
 static void oaktrail_hdmi_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 83bbc27..7b8fd50 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -89,8 +89,8 @@  static void oaktrail_lvds_dpms(struct drm_encoder *encoder, int mode)
 }
 
 static void oaktrail_lvds_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_psb_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 12fac19..335f2a7 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -467,8 +467,8 @@  static void psb_intel_lvds_commit(struct drm_encoder *encoder)
 }
 
 static void psb_intel_lvds_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_psb_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 73b17eb..2f243b3 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -985,8 +985,8 @@  static bool psb_intel_sdvo_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_crtc *crtc = encoder->crtc;
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index f20754b..cfde036 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -840,8 +840,8 @@  static int tda998x_encoder_mode_valid(struct tda998x_priv *priv,
 
 static void
 tda998x_encoder_mode_set(struct tda998x_priv *priv,
-			 const struct drm_display_mode *mode,
-			 const struct drm_display_mode *adjusted_mode)
+			 const const struct drm_display_mode *mode,
+			 const const struct drm_display_mode *adjusted_mode)
 {
 	uint16_t ref_pix, ref_line, n_pix, n_line;
 	uint16_t hs_pix_s, hs_pix_e;
@@ -1413,8 +1413,8 @@  static void tda998x_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tda998x_encoder2_mode_set(struct drm_encoder *encoder,
-				      struct drm_display_mode *mode,
-				      struct drm_display_mode *adjusted_mode)
+				      const struct drm_display_mode *mode,
+				      const struct drm_display_mode *adjusted_mode)
 {
 	struct tda998x_priv2 *priv = enc_to_tda998x_priv2(encoder);
 
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 543ce72..5a4bdba 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -106,8 +106,8 @@  static bool dw_hdmi_imx_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void dw_hdmi_imx_encoder_mode_set(struct drm_encoder *encoder,
-					 struct drm_display_mode *mode,
-					 struct drm_display_mode *adj_mode)
+					 const struct drm_display_mode *mode,
+					 const struct drm_display_mode *adj_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 2d6dc94..938feff 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -226,8 +226,8 @@  static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder,
-			 struct drm_display_mode *orig_mode,
-			 struct drm_display_mode *mode)
+			 const struct drm_display_mode *orig_mode,
+			 const struct drm_display_mode *mode)
 {
 	struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
 	struct imx_ldb *ldb = imx_ldb_ch->ldb;
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 165a9d6..6a275bb 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -311,8 +311,8 @@  static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
 }
 
 static void imx_tve_encoder_mode_set(struct drm_encoder *encoder,
-				     struct drm_display_mode *orig_mode,
-				     struct drm_display_mode *mode)
+				     const struct drm_display_mode *orig_mode,
+				     const struct drm_display_mode *mode)
 {
 	struct imx_tve *tve = enc_to_tve(encoder);
 	unsigned long rounded_rate;
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 900dda6..03928c2 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -130,8 +130,8 @@  static void imx_pd_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void imx_pd_encoder_mode_set(struct drm_encoder *encoder,
-			 struct drm_display_mode *orig_mode,
-			 struct drm_display_mode *mode)
+			 const struct drm_display_mode *orig_mode,
+			 const struct drm_display_mode *mode)
 {
 }
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index f99c53d..a0f3cd9 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1380,8 +1380,8 @@  static bool mga_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void mga_encoder_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 
 }
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
index 7896323..189d1e2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
@@ -102,8 +102,8 @@  static bool mdp4_dtv_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void mdp4_dtv_encoder_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *drm_mode,
+		const struct drm_display_mode *mode)
 {
 	struct mdp4_dtv_encoder *mdp4_dtv_encoder = to_mdp4_dtv_encoder(encoder);
 	struct mdp4_kms *mdp4_kms = get_kms(encoder);
@@ -111,8 +111,6 @@  static void mdp4_dtv_encoder_mode_set(struct drm_encoder *encoder,
 	uint32_t display_v_start, display_v_end;
 	uint32_t hsync_start_x, hsync_end_x;
 
-	mode = adjusted_mode;
-
 	DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
 			mode->base.id, mode->name,
 			mode->vrefresh, mode->clock,
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index 60ec822..a80679a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
@@ -267,8 +267,8 @@  static bool mdp4_lcdc_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void mdp4_lcdc_encoder_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *drm_mode,
+		const struct drm_display_mode *mode)
 {
 	struct mdp4_lcdc_encoder *mdp4_lcdc_encoder =
 			to_mdp4_lcdc_encoder(encoder);
@@ -277,8 +277,6 @@  static void mdp4_lcdc_encoder_mode_set(struct drm_encoder *encoder,
 	uint32_t display_v_start, display_v_end;
 	uint32_t hsync_start_x, hsync_end_x;
 
-	mode = adjusted_mode;
-
 	DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
 			mode->base.id, mode->name,
 			mode->vrefresh, mode->clock,
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index af0e02f..23d4aae 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -119,8 +119,8 @@  static bool mdp5_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *drm_mode,
+		const struct drm_display_mode *mode)
 {
 	struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
 	struct mdp5_kms *mdp5_kms = get_kms(encoder);
@@ -133,8 +133,6 @@  static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
 	uint32_t format = 0x2100;
 	unsigned long flags;
 
-	mode = adjusted_mode;
-
 	DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
 			mode->base.id, mode->name,
 			mode->vrefresh, mode->clock,
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dac.c b/drivers/gpu/drm/nouveau/dispnv04/dac.c
index d7b495a..0dfe9b8 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/dac.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/dac.c
@@ -368,8 +368,8 @@  static void nv04_dac_prepare(struct drm_encoder *encoder)
 }
 
 static void nv04_dac_mode_set(struct drm_encoder *encoder,
-			      struct drm_display_mode *mode,
-			      struct drm_display_mode *adjusted_mode)
+			      const struct drm_display_mode *mode,
+			      const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
index f6ca343..2660585 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
@@ -277,8 +277,8 @@  static void nv04_dfp_prepare(struct drm_encoder *encoder)
 
 
 static void nv04_dfp_mode_set(struct drm_encoder *encoder,
-			      struct drm_display_mode *mode,
-			      struct drm_display_mode *adjusted_mode)
+			      const struct drm_display_mode *mode,
+			      const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nvif_device *device = &nouveau_drm(dev)->device;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
index d9664b3..435696d 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
@@ -135,8 +135,8 @@  static void nv04_tv_prepare(struct drm_encoder *encoder)
 }
 
 static void nv04_tv_mode_set(struct drm_encoder *encoder,
-			     struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode)
+			     const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index c77ffe3..e4b8afc 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -463,8 +463,8 @@  static void nv17_tv_prepare(struct drm_encoder *encoder)
 }
 
 static void nv17_tv_mode_set(struct drm_encoder *encoder,
-			     struct drm_display_mode *drm_mode,
-			     struct drm_display_mode *adjusted_mode)
+			     const struct drm_display_mode *drm_mode,
+			     const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 7da7958..0819978 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1549,8 +1549,9 @@  nv50_dac_commit(struct drm_encoder *encoder)
 }
 
 static void
-nv50_dac_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
-		  struct drm_display_mode *adjusted_mode)
+nv50_dac_mode_set(struct drm_encoder *encoder,
+		  const struct drm_display_mode *mode,
+		  const struct drm_display_mode *adjusted_mode)
 {
 	struct nv50_mast *mast = nv50_mast(encoder->dev);
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
@@ -1703,7 +1704,8 @@  nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
  * Audio
  *****************************************************************************/
 static void
-nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
+nv50_audio_mode_set(struct drm_encoder *encoder,
+		    const struct drm_display_mode *mode)
 {
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@@ -1757,7 +1759,8 @@  nv50_audio_disconnect(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
  * HDMI
  *****************************************************************************/
 static void
-nv50_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
+nv50_hdmi_mode_set(struct drm_encoder *encoder,
+		   const struct drm_display_mode *mode)
 {
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@@ -1905,8 +1908,9 @@  nv50_sor_commit(struct drm_encoder *encoder)
 }
 
 static void
-nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
-		  struct drm_display_mode *mode)
+nv50_sor_mode_set(struct drm_encoder *encoder,
+		  const struct drm_display_mode *umode,
+		  const struct drm_display_mode *mode)
 {
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@@ -2135,8 +2139,9 @@  nv50_pior_commit(struct drm_encoder *encoder)
 }
 
 static void
-nv50_pior_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
-		   struct drm_display_mode *adjusted_mode)
+nv50_pior_mode_set(struct drm_encoder *encoder,
+		   const struct drm_display_mode *mode,
+		   const struct drm_display_mode *adjusted_mode)
 {
 	struct nv50_mast *mast = nv50_mast(encoder->dev);
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 7445fb1..0b68dc6 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -88,8 +88,8 @@  static bool omap_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void omap_encoder_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 77fb4b4..481612a 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -795,8 +795,8 @@  static void qxl_enc_commit(struct drm_encoder *encoder)
 }
 
 static void qxl_enc_mode_set(struct drm_encoder *encoder,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
 {
 	DRM_DEBUG("\n");
 }
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index c39c1d0..b91c6f1 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1957,7 +1957,7 @@  atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
 
 static void
 atombios_apply_encoder_quirks(struct drm_encoder *encoder,
-			      struct drm_display_mode *mode)
+			      const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -2137,8 +2137,8 @@  radeon_atom_encoder_init(struct radeon_device *rdev)
 
 static void
 radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
-			     struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode)
+			     const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -2483,8 +2483,8 @@  static void radeon_atom_ext_commit(struct drm_encoder *encoder)
 
 static void
 radeon_atom_ext_mode_set(struct drm_encoder *encoder,
-			 struct drm_display_mode *mode,
-			 struct drm_display_mode *adjusted_mode)
+			 const struct drm_display_mode *mode,
+			 const struct drm_display_mode *adjusted_mode)
 {
 
 }
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index b21ef69..dbd4052 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -57,9 +57,11 @@  void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
 void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
 		u8 *sadb, int sad_count);
 void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
-		struct drm_connector *connector, struct drm_display_mode *mode);
+		struct drm_connector *connector,
+		const struct drm_display_mode *mode);
 void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
-		struct drm_connector *connector, struct drm_display_mode *mode);
+		struct drm_connector *connector,
+		const struct drm_display_mode *mode);
 struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev);
 struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev);
 void dce6_afmt_select_pin(struct drm_encoder *encoder);
@@ -96,9 +98,9 @@  void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
 void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
 void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
 static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
-	struct drm_display_mode *mode);
+	const struct drm_display_mode *mode);
 static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,
-	struct drm_display_mode *mode);
+	const struct drm_display_mode *mode);
 void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
 void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
 void evergreen_dp_enable(struct drm_encoder *encoder, bool enable);
@@ -400,7 +402,7 @@  static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
 }
 
 static void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
-	struct drm_display_mode *mode)
+	const struct drm_display_mode *mode)
 {
 	struct radeon_encoder *radeon_encoder;
 	struct drm_connector *connector;
@@ -515,7 +517,7 @@  static void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock
 }
 
 static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
-	struct drm_display_mode *mode)
+	const struct drm_display_mode *mode)
 {
 	struct radeon_device *rdev = encoder->dev->dev_private;
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -691,7 +693,7 @@  static void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute)
  * update the info frames with the data from the current display mode
  */
 static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode)
+				       const struct drm_display_mode *mode)
 {
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
@@ -718,7 +720,7 @@  static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
 }
 
 static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,
-	struct drm_display_mode *mode)
+	const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -747,7 +749,7 @@  static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,
 }
 
 void radeon_audio_mode_set(struct drm_encoder *encoder,
-	struct drm_display_mode *mode)
+	const struct drm_display_mode *mode)
 {
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 
diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h
index c92d059..ed08a54 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.h
+++ b/drivers/gpu/drm/radeon/radeon_audio.h
@@ -46,7 +46,8 @@  struct radeon_audio_funcs
 	void (*select_pin)(struct drm_encoder *encoder);
 	struct r600_audio_pin* (*get_pin)(struct radeon_device *rdev);
 	void (*write_latency_fields)(struct drm_encoder *encoder,
-		struct drm_connector *connector, struct drm_display_mode *mode);
+		struct drm_connector *connector,
+		const struct drm_display_mode *mode);
 	void (*write_sad_regs)(struct drm_encoder *encoder,
 		struct cea_sad *sads, int sad_count);
 	void (*write_speaker_allocation)(struct drm_encoder *encoder,
@@ -62,7 +63,7 @@  struct radeon_audio_funcs
 	void (*set_audio_packet)(struct drm_encoder *encoder, u32 offset);
 	void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute);
 	void (*mode_set)(struct drm_encoder *encoder,
-		struct drm_display_mode *mode);
+		const struct drm_display_mode *mode);
 	void (*dpms)(struct drm_encoder *encoder, bool mode);
 };
 
@@ -78,7 +79,7 @@  void radeon_audio_enable(struct radeon_device *rdev,
 	struct r600_audio_pin *pin, u8 enable_mask);
 void radeon_audio_fini(struct radeon_device *rdev);
 void radeon_audio_mode_set(struct drm_encoder *encoder,
-	struct drm_display_mode *mode);
+	const struct drm_display_mode *mode);
 void radeon_audio_dpms(struct drm_encoder *encoder, int mode);
 
 #endif
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index c89971d..21ad6ab 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -174,8 +174,8 @@  static void radeon_legacy_lvds_commit(struct drm_encoder *encoder)
 }
 
 static void radeon_legacy_lvds_mode_set(struct drm_encoder *encoder,
-					struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted_mode)
+					const struct drm_display_mode *mode,
+					const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -574,8 +574,8 @@  static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder)
 }
 
 static void radeon_legacy_primary_dac_mode_set(struct drm_encoder *encoder,
-					       struct drm_display_mode *mode,
-					       struct drm_display_mode *adjusted_mode)
+					       const struct drm_display_mode *mode,
+					       const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -771,8 +771,8 @@  static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder)
 }
 
 static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder,
-					    struct drm_display_mode *mode,
-					    struct drm_display_mode *adjusted_mode)
+					    const struct drm_display_mode *mode,
+					    const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -936,8 +936,8 @@  static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder)
 }
 
 static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder,
-					    struct drm_display_mode *mode,
-					    struct drm_display_mode *adjusted_mode)
+					    const struct drm_display_mode *mode,
+					    const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -1142,8 +1142,8 @@  static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder)
 }
 
 static void radeon_legacy_tv_dac_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *mode,
+		const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_tv.c b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
index 49750d0..d73c08b 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_tv.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
@@ -529,8 +529,8 @@  static bool radeon_legacy_tv_init_restarts(struct drm_encoder *encoder)
 }
 
 void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 391f78e..7c4f6be 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -911,8 +911,8 @@  void radeon_legacy_tv_adjust_pll2(struct drm_encoder *encoder,
 				  uint32_t *htotal2_cntl, uint32_t *p2pll_ref_div,
 				  uint32_t *p2pll_div_0, uint32_t *pixclks_cntl);
 void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode);
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode);
 
 /* fmt blocks */
 void avivo_program_fmt(struct drm_encoder *encoder);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index d0ae1e8..0db6a54 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -100,8 +100,8 @@  static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
 }
 
 static void rcar_du_encoder_mode_set(struct drm_encoder *encoder,
-				     struct drm_display_mode *mode,
-				     struct drm_display_mode *adjusted_mode)
+				     const struct drm_display_mode *mode,
+				     const struct drm_display_mode *adjusted_mode)
 {
 	struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
index 81da841..c000850 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
@@ -85,8 +85,8 @@  static int rcar_du_hdmienc_atomic_check(struct drm_encoder *encoder,
 }
 
 static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder,
-				     struct drm_display_mode *mode,
-				     struct drm_display_mode *adjusted_mode)
+				     const struct drm_display_mode *mode,
+				     const struct drm_display_mode *adjusted_mode)
 {
 	struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
 	struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index a58cdac..2a8f7a7 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -190,8 +190,8 @@  dw_hdmi_rockchip_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
-					      struct drm_display_mode *mode,
-					      struct drm_display_mode *adj_mode)
+					      const struct drm_display_mode *mode,
+					      const struct drm_display_mode *adj_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 859ccb6..fdba183 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -575,8 +575,8 @@  static void shmob_drm_encoder_mode_prepare(struct drm_encoder *encoder)
 }
 
 static void shmob_drm_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted_mode)
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted_mode)
 {
 	/* No-op, everything is handled in the CRTC code. */
 }
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 5cc5311..64ecc23 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -448,8 +448,8 @@  static bool sti_tvout_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static void sti_tvout_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted_mode)
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted_mode)
 {
 }
 
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 97bfa42..4714eb4 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -795,8 +795,8 @@  static void tegra_dsi_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted)
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted)
 {
 	struct tegra_output *output = encoder_to_output(encoder);
 	struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index b502f4e..68d315e 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -638,7 +638,7 @@  static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data,
 }
 
 static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
-					   struct drm_display_mode *mode)
+					   const struct drm_display_mode *mode)
 {
 	struct hdmi_avi_infoframe frame;
 	u8 buffer[17];
@@ -831,8 +831,8 @@  static void tegra_hdmi_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder,
-					struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted)
+					const struct drm_display_mode *mode,
+					const struct drm_display_mode *adjusted)
 {
 	unsigned int h_sync_width, h_front_porch, h_back_porch, i, rekey;
 	struct tegra_output *output = encoder_to_output(encoder);
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index b120cc2..745759a 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -138,8 +138,8 @@  static void tegra_rgb_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tegra_rgb_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted)
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted)
 {
 	struct tegra_output *output = encoder_to_output(encoder);
 	struct tegra_rgb *rgb = to_rgb(output);
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index a2ed3b6..fe86207 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -384,7 +384,7 @@  static int tegra_sor_compute_params(struct tegra_sor *sor,
 }
 
 static int tegra_sor_calc_config(struct tegra_sor *sor,
-				 struct drm_display_mode *mode,
+				 const struct drm_display_mode *mode,
 				 struct tegra_sor_config *config,
 				 struct drm_dp_link *link)
 {
@@ -781,8 +781,8 @@  static void tegra_sor_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tegra_sor_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted)
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted)
 {
 	struct tegra_output *output = encoder_to_output(encoder);
 	struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 9580467..ede8846 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -91,8 +91,8 @@  static void panel_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void panel_encoder_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *mode,
+		const struct drm_display_mode *adjusted_mode)
 {
 	/* nothing needed */
 }
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
index 8363848..6fc064f 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
@@ -96,13 +96,6 @@  static bool slave_encoder_fixup(struct drm_encoder *encoder,
 	return drm_i2c_encoder_mode_fixup(encoder, mode, adjusted_mode);
 }
 
-static void slave_encoder_mode_set(struct drm_encoder *encoder,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode)
-{
-	drm_i2c_encoder_mode_set(encoder, mode, adjusted_mode);
-}
-
 static const struct drm_encoder_funcs slave_encoder_funcs = {
 		.destroy        = slave_encoder_destroy,
 };
@@ -112,7 +105,7 @@  static const struct drm_encoder_helper_funcs slave_encoder_helper_funcs = {
 		.mode_fixup     = slave_encoder_fixup,
 		.prepare        = slave_encoder_prepare,
 		.commit         = drm_i2c_encoder_commit,
-		.mode_set       = slave_encoder_mode_set,
+		.mode_set       = drm_i2c_encoder_mode_set,
 		.save           = drm_i2c_encoder_save,
 		.restore        = drm_i2c_encoder_restore,
 };
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index 695f66d..f616a09 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -100,8 +100,8 @@  static void tfp410_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void tfp410_encoder_mode_set(struct drm_encoder *encoder,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode)
+		const struct drm_display_mode *mode,
+		const struct drm_display_mode *adjusted_mode)
 {
 	/* nothing needed */
 }
diff --git a/drivers/gpu/drm/udl/udl_encoder.c b/drivers/gpu/drm/udl/udl_encoder.c
index 4052c46..d9cd5d8 100644
--- a/drivers/gpu/drm/udl/udl_encoder.c
+++ b/drivers/gpu/drm/udl/udl_encoder.c
@@ -42,8 +42,8 @@  static void udl_encoder_commit(struct drm_encoder *encoder)
 }
 
 static void udl_encoder_mode_set(struct drm_encoder *encoder,
-				 struct drm_display_mode *mode,
-				 struct drm_display_mode *adjusted_mode)
+				 const struct drm_display_mode *mode,
+				 const struct drm_display_mode *adjusted_mode)
 {
 }
 
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 29204f4..a356a59 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -147,8 +147,8 @@  struct drm_encoder_helper_funcs {
 	void (*prepare)(struct drm_encoder *encoder);
 	void (*commit)(struct drm_encoder *encoder);
 	void (*mode_set)(struct drm_encoder *encoder,
-			 struct drm_display_mode *mode,
-			 struct drm_display_mode *adjusted_mode);
+			 const struct drm_display_mode *mode,
+			 const struct drm_display_mode *adjusted_mode);
 	struct drm_crtc *(*get_crtc)(struct drm_encoder *encoder);
 	/* detect for DAC style encoders */
 	enum drm_connector_status (*detect)(struct drm_encoder *encoder,