diff mbox

[RFC,15/37] drm: crtc-helper: Constify mode_set parameters

Message ID 1426739616-10635-15-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.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 drivers/gpu/drm/armada/armada_crtc.c         |  3 ++-
 drivers/gpu/drm/ast/ast_mode.c               | 31 +++++++++++++++++-----------
 drivers/gpu/drm/bochs/bochs.h                |  2 +-
 drivers/gpu/drm/bochs/bochs_hw.c             |  2 +-
 drivers/gpu/drm/bochs/bochs_kms.c            |  4 ++--
 drivers/gpu/drm/cirrus/cirrus_mode.c         |  4 ++--
 drivers/gpu/drm/drm_crtc_helper.c            |  8 ++++---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c     |  8 ++++---
 drivers/gpu/drm/gma500/cdv_intel_display.c   |  4 ++--
 drivers/gpu/drm/gma500/mdfld_intel_display.c |  8 +++----
 drivers/gpu/drm/gma500/oaktrail.h            |  6 ++++--
 drivers/gpu/drm/gma500/oaktrail_crtc.c       |  4 ++--
 drivers/gpu/drm/gma500/oaktrail_hdmi.c       |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_display.c   |  4 ++--
 drivers/gpu/drm/imx/ipuv3-crtc.c             |  4 ++--
 drivers/gpu/drm/imx/ipuv3-plane.c            |  2 +-
 drivers/gpu/drm/imx/ipuv3-plane.h            |  2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c       |  4 ++--
 drivers/gpu/drm/nouveau/dispnv04/crtc.c      | 15 +++++++++-----
 drivers/gpu/drm/nouveau/nv50_display.c       |  6 ++++--
 drivers/gpu/drm/omapdrm/omap_crtc.c          |  6 ++----
 drivers/gpu/drm/qxl/qxl_display.c            |  4 ++--
 drivers/gpu/drm/radeon/atombios_crtc.c       | 15 +++++++-------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c  | 14 +++++++------
 drivers/gpu/drm/radeon/radeon_mode.h         |  4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c  |  4 ++--
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c    |  4 ++--
 drivers/gpu/drm/sti/sti_drm_crtc.c           |  6 ++++--
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c         |  4 ++--
 drivers/gpu/drm/udl/udl_modeset.c            |  7 ++++---
 include/drm/drm_crtc_helper.h                | 14 ++++++++-----
 31 files changed, 118 insertions(+), 89 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index c74faf9..187cdd2 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -493,7 +493,8 @@  static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc)
 
 /* The mode_config.mutex will be held for this call */
 static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
-	struct drm_display_mode *mode, struct drm_display_mode *adj,
+	const struct drm_display_mode *mode,
+	const struct drm_display_mode *adj,
 	int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 76e7d56..fb11f75 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -174,7 +174,8 @@  static bool ast_get_vbios_mode_info(struct drm_crtc *crtc,
 	return true;
 }
 
-static void ast_set_port_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+static void ast_set_port_reg(struct drm_crtc *crtc,
+			     const struct drm_display_mode *mode,
 			     struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = crtc->dev->dev_private;
@@ -210,7 +211,8 @@  static void ast_set_port_reg(struct drm_crtc *crtc, struct drm_display_mode *mod
 	}
 }
 
-static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+static void ast_set_std_reg(struct drm_crtc *crtc,
+			    const struct drm_display_mode *mode,
 			    struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = crtc->dev->dev_private;
@@ -255,7 +257,8 @@  static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode
 		ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]);
 }
 
-static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+static void ast_set_crtc_reg(struct drm_crtc *crtc,
+			     const struct drm_display_mode *mode,
 			     struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = crtc->dev->dev_private;
@@ -366,7 +369,8 @@  static void ast_set_offset_reg(struct drm_crtc *crtc)
 	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f);
 }
 
-static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mode,
+static void ast_set_dclk_reg(struct drm_device *dev,
+			     const struct drm_display_mode *mode,
 			     struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = dev->dev_private;
@@ -380,8 +384,9 @@  static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mo
 			       (clk_info->param3 & 0x80) | ((clk_info->param3 & 0x3) << 4));
 }
 
-static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			     struct ast_vbios_mode_info *vbios_mode)
+static void ast_set_ext_reg(struct drm_crtc *crtc,
+			    const struct drm_display_mode *mode,
+			    struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = crtc->dev->dev_private;
 	u8 jregA0 = 0, jregA3 = 0, jregA8 = 0;
@@ -425,8 +430,9 @@  static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode
 	}
 }
 
-static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mode,
-		      struct ast_vbios_mode_info *vbios_mode)
+static void ast_set_sync_reg(struct drm_device *dev,
+			     const struct drm_display_mode *mode,
+			     struct ast_vbios_mode_info *vbios_mode)
 {
 	struct ast_private *ast = dev->dev_private;
 	u8 jreg;
@@ -438,8 +444,9 @@  static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mo
 	ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
 }
 
-static bool ast_set_dac_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
-		     struct ast_vbios_mode_info *vbios_mode)
+static bool ast_set_dac_reg(struct drm_crtc *crtc,
+			    const struct drm_display_mode *mode,
+			    struct ast_vbios_mode_info *vbios_mode)
 {
 	switch (crtc->primary->fb->bits_per_pixel) {
 	case 8:
@@ -582,8 +589,8 @@  static int ast_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 }
 
 static int ast_crtc_mode_set(struct drm_crtc *crtc,
-			     struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode,
+			     const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode,
 			     int x, int y,
 			     struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
index 71f2687..dee026c 100644
--- a/drivers/gpu/drm/bochs/bochs.h
+++ b/drivers/gpu/drm/bochs/bochs.h
@@ -129,7 +129,7 @@  int bochs_hw_init(struct drm_device *dev, uint32_t flags);
 void bochs_hw_fini(struct drm_device *dev);
 
 void bochs_hw_setmode(struct bochs_device *bochs,
-		      struct drm_display_mode *mode);
+		      const struct drm_display_mode *mode);
 void bochs_hw_setbase(struct bochs_device *bochs,
 		      int x, int y, u64 addr);
 
diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c
index 4603897..09031e2 100644
--- a/drivers/gpu/drm/bochs/bochs_hw.c
+++ b/drivers/gpu/drm/bochs/bochs_hw.c
@@ -150,7 +150,7 @@  void bochs_hw_fini(struct drm_device *dev)
 }
 
 void bochs_hw_setmode(struct bochs_device *bochs,
-		      struct drm_display_mode *mode)
+		      const struct drm_display_mode *mode)
 {
 	bochs->xres = mode->hdisplay;
 	bochs->yres = mode->vdisplay;
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 3967559..f1ad0b5 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -80,8 +80,8 @@  static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 }
 
 static int bochs_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
 			       int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct bochs_device *bochs =
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index b77938d..bf8f36a 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -191,8 +191,8 @@  static int cirrus_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
  * be something that can be correctly programmed and displayed
  */
 static int cirrus_crtc_mode_set(struct drm_crtc *crtc,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode,
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode,
 				int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index dd895c4..c6063ff 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -265,7 +265,7 @@  drm_crtc_prepare_encoders(struct drm_device *dev)
  * True if the mode was set successfully, false otherwise.
  */
 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
-			      struct drm_display_mode *mode,
+			      const struct drm_display_mode *mode,
 			      int x, int y,
 			      struct drm_framebuffer *old_fb)
 {
@@ -931,8 +931,10 @@  EXPORT_SYMBOL(drm_helper_resume_force_mode);
  * This is a transitional helper useful for converting drivers to the atomic
  * interfaces.
  */
-int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode, int x, int y,
+int drm_helper_crtc_mode_set(struct drm_crtc *crtc,
+                             const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode,
+			     int x, int y,
 			     struct drm_framebuffer *old_fb)
 {
 	struct drm_crtc_state *crtc_state;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5f1816c..bd27444 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -83,9 +83,11 @@  exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 }
 
 static int
-exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			  struct drm_display_mode *adjusted_mode, int x, int y,
-			  struct drm_framebuffer *old_fb)
+exynos_drm_crtc_mode_set(struct drm_crtc *crtc,
+			 const struct drm_display_mode *mode,
+			 const struct drm_display_mode *adjusted_mode,
+			 int x, int y,
+			 struct drm_framebuffer *old_fb)
 {
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	unsigned int crtc_w;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 6672732..b1ef8c0 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -576,8 +576,8 @@  static int cdv_intel_panel_fitter_pipe(struct drm_device *dev)
 }
 
 static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
 			       int x, int y,
 			       struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c
index 8cc8a5a..0c842c4 100644
--- a/drivers/gpu/drm/gma500/mdfld_intel_display.c
+++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c
@@ -663,10 +663,10 @@  mdfldFindBestPLL(struct drm_crtc *crtc, int target, int refclk,
 }
 
 static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
-			      struct drm_display_mode *mode,
-			      struct drm_display_mode *adjusted_mode,
-			      int x, int y,
-			      struct drm_framebuffer *old_fb)
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
+			       int x, int y,
+			       struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
 	struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
diff --git a/drivers/gpu/drm/gma500/oaktrail.h b/drivers/gpu/drm/gma500/oaktrail.h
index 30adbbe2..3a58c93 100644
--- a/drivers/gpu/drm/gma500/oaktrail.h
+++ b/drivers/gpu/drm/gma500/oaktrail.h
@@ -249,8 +249,10 @@  extern void oaktrail_hdmi_i2c_exit(struct pci_dev *dev);
 extern void oaktrail_hdmi_save(struct drm_device *dev);
 extern void oaktrail_hdmi_restore(struct drm_device *dev);
 extern void oaktrail_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev);
-extern int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-						struct drm_display_mode *adjusted_mode, int x, int y,
+extern int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
+						const struct drm_display_mode *mode,
+						const struct drm_display_mode *adjusted_mode,
+						int x, int y,
 						struct drm_framebuffer *old_fb);
 extern void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode);
 
diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c
index 2de216c..18c408c 100644
--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
+++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
@@ -362,8 +362,8 @@  static int oaktrail_panel_fitter_pipe(struct drm_device *dev)
 }
 
 static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
-			      struct drm_display_mode *mode,
-			      struct drm_display_mode *adjusted_mode,
+			      const struct drm_display_mode *mode,
+			      const struct drm_display_mode *adjusted_mode,
 			      int x, int y,
 			      struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 877b63c..428ccbe 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -257,8 +257,8 @@  static void oaktrail_hdmi_reset(struct drm_device *dev)
 }
 
 int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
-			    struct drm_display_mode *mode,
-			    struct drm_display_mode *adjusted_mode,
+			    const struct drm_display_mode *mode,
+			    const struct drm_display_mode *adjusted_mode,
 			    int x, int y,
 			    struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index b21a094..29a472c 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -100,8 +100,8 @@  static int psb_intel_panel_fitter_pipe(struct drm_device *dev)
 }
 
 static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
 			       int x, int y,
 			       struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 98551e3..28e6b4e 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -135,8 +135,8 @@  static const struct drm_crtc_funcs ipu_crtc_funcs = {
 };
 
 static int ipu_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *orig_mode,
-			       struct drm_display_mode *mode,
+			       const struct drm_display_mode *orig_mode,
+			       const struct drm_display_mode *mode,
 			       int x, int y,
 			       struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 6987e16..5035fff 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -95,7 +95,7 @@  int ipu_plane_set_base(struct ipu_plane *ipu_plane, struct drm_framebuffer *fb,
 }
 
 int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
-		       struct drm_display_mode *mode,
+		       const struct drm_display_mode *mode,
 		       struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 		       unsigned int crtc_w, unsigned int crtc_h,
 		       uint32_t src_x, uint32_t src_y,
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.h b/drivers/gpu/drm/imx/ipuv3-plane.h
index af125fb..ee13a37 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.h
+++ b/drivers/gpu/drm/imx/ipuv3-plane.h
@@ -38,7 +38,7 @@  struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
 
 /* Init IDMAC, DMFC, DP */
 int ipu_plane_mode_set(struct ipu_plane *plane, struct drm_crtc *crtc,
-		       struct drm_display_mode *mode,
+		       const struct drm_display_mode *mode,
 		       struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 		       unsigned int crtc_w, unsigned int crtc_h,
 		       uint32_t src_x, uint32_t src_y, uint32_t src_w,
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index a0f3cd9..2153c28 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -778,8 +778,8 @@  static int mga_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 }
 
 static int mga_crtc_mode_set(struct drm_crtc *crtc,
-				struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode,
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode,
 				int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 542bb266..093a420 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -108,7 +108,9 @@  static void nv_crtc_set_image_sharpening(struct drm_crtc *crtc, int level)
  * bits 28-31: related to single stage mode? (bit 8/12)
  */
 
-static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mode * mode, int dot_clock)
+static void nv_crtc_calc_state_ext(struct drm_crtc *crtc,
+				   const struct drm_display_mode * mode,
+				   int dot_clock)
 {
 	struct drm_device *dev = crtc->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
@@ -235,7 +237,8 @@  nv_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode,
 }
 
 static void
-nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode)
+nv_crtc_mode_set_vga(struct drm_crtc *crtc,
+		     const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
@@ -459,7 +462,8 @@  nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode)
  * be easily turned on/off after this.
  */
 static void
-nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
+nv_crtc_mode_set_regs(struct drm_crtc *crtc,
+		      const struct drm_display_mode * mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
@@ -633,8 +637,9 @@  nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb)
  * be easily turned on/off after this.
  */
 static int
-nv_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-		 struct drm_display_mode *adjusted_mode,
+nv_crtc_mode_set(struct drm_crtc *crtc,
+		 const struct drm_display_mode *mode,
+		 const struct drm_display_mode *adjusted_mode,
 		 int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 0819978..05b21ef 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1109,8 +1109,10 @@  nv50_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb)
 }
 
 static int
-nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
-		   struct drm_display_mode *mode, int x, int y,
+nv50_crtc_mode_set(struct drm_crtc *crtc,
+		   const struct drm_display_mode *umode,
+		   const struct drm_display_mode *mode,
+		   int x, int y,
 		   struct drm_framebuffer *old_fb)
 {
 	struct nv50_mast *mast = nv50_mast(crtc->dev);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index b0566a1..f394fdd 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -237,15 +237,13 @@  static bool omap_crtc_mode_fixup(struct drm_crtc *crtc,
 }
 
 static int omap_crtc_mode_set(struct drm_crtc *crtc,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode,
+		const struct drm_display_mode *drm_mode,
+		const struct drm_display_mode *mode,
 		int x, int y,
 		struct drm_framebuffer *old_fb)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
-	mode = adjusted_mode;
-
 	DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
 			omap_crtc->name, mode->base.id, mode->name,
 			mode->vrefresh, mode->clock,
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 481612a..189119d 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -585,8 +585,8 @@  static void qxl_monitors_config_set(struct qxl_device *qdev,
 }
 
 static int qxl_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
 			       int x, int y,
 			       struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 86807ee..050e908 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -32,8 +32,8 @@ 
 #include "atom-bits.h"
 
 static void atombios_overscan_setup(struct drm_crtc *crtc,
-				    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 = crtc->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -295,7 +295,7 @@  void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
 
 static void
 atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
-			     struct drm_display_mode *mode)
+			     const struct drm_display_mode *mode)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
@@ -340,7 +340,7 @@  atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
 }
 
 static void atombios_crtc_set_timing(struct drm_crtc *crtc,
-				     struct drm_display_mode *mode)
+				     const struct drm_display_mode *mode)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
@@ -1038,7 +1038,8 @@  static bool atombios_crtc_prepare_pll(struct drm_crtc *crtc, struct drm_display_
 	return true;
 }
 
-static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
+static void atombios_crtc_set_pll(struct drm_crtc *crtc,
+				  const struct drm_display_mode *mode)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
@@ -2005,8 +2006,8 @@  void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev)
 }
 
 int atombios_crtc_mode_set(struct drm_crtc *crtc,
-			   struct drm_display_mode *mode,
-			   struct drm_display_mode *adjusted_mode,
+			   const struct drm_display_mode *mode,
+			   const struct drm_display_mode *adjusted_mode,
 			   int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 678b438..fa8f7da 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -31,7 +31,7 @@ 
 #include "atom.h"
 
 static void radeon_overscan_setup(struct drm_crtc *crtc,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -43,7 +43,7 @@  static void radeon_overscan_setup(struct drm_crtc *crtc,
 }
 
 static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc,
-				       struct drm_display_mode *mode)
+				       const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -571,7 +571,8 @@  retry:
 	return 0;
 }
 
-static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mode *mode)
+static bool radeon_set_crtc_timing(struct drm_crtc *crtc,
+				   const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -730,7 +731,8 @@  static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod
 	return true;
 }
 
-static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
+static void radeon_set_pll(struct drm_crtc *crtc,
+			   const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -1033,8 +1035,8 @@  static bool radeon_crtc_mode_fixup(struct drm_crtc *crtc,
 }
 
 static int radeon_crtc_mode_set(struct drm_crtc *crtc,
-				 struct drm_display_mode *mode,
-				 struct drm_display_mode *adjusted_mode,
+				 const struct drm_display_mode *mode,
+				 const struct drm_display_mode *adjusted_mode,
 				 int x, int y, struct drm_framebuffer *old_fb)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 7c4f6be..9b9cd14 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -793,8 +793,8 @@  extern int atombios_crtc_set_base_atomic(struct drm_crtc *crtc,
 					 int x, int y,
 					 enum mode_set_atomic state);
 extern int atombios_crtc_mode_set(struct drm_crtc *crtc,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode,
+				   const struct drm_display_mode *mode,
+				   const struct drm_display_mode *adjusted_mode,
 				   int x, int y,
 				   struct drm_framebuffer *old_fb);
 extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 9a5c571..25f89b3 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -832,8 +832,8 @@  static int vop_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 }
 
 static int vop_crtc_mode_set(struct drm_crtc *crtc,
-			     struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode,
+			     const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode,
 			     int x, int y, struct drm_framebuffer *fb)
 {
 	struct vop *vop = to_vop(crtc);
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index fdba183..ab3b4f4 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -372,8 +372,8 @@  static void shmob_drm_crtc_mode_prepare(struct drm_crtc *crtc)
 }
 
 static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode,
+				   const struct drm_display_mode *mode,
+				   const struct drm_display_mode *adjusted_mode,
 				   int x, int y,
 				   struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c b/drivers/gpu/drm/sti/sti_drm_crtc.c
index 4721e91..cfb75dc 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -77,8 +77,10 @@  static bool sti_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 }
 
 static int
-sti_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-		      struct drm_display_mode *adjusted_mode, int x, int y,
+sti_drm_crtc_mode_set(struct drm_crtc *crtc,
+		      const struct drm_display_mode *mode,
+		      const struct drm_display_mode *adjusted_mode,
+		      int x, int y,
 		      struct drm_framebuffer *old_fb)
 {
 	struct sti_mixer *mixer = to_sti_mixer(crtc);
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 8514055..d5fafef 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -227,8 +227,8 @@  static void tilcdc_crtc_commit(struct drm_crtc *crtc)
 }
 
 static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
-		struct drm_display_mode *mode,
-		struct drm_display_mode *adjusted_mode,
+		const struct drm_display_mode *mode,
+		const struct drm_display_mode *adjusted_mode,
 		int x, int y,
 		struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
index 677190a6..7c694f5 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -160,7 +160,8 @@  static char *udl_set_register_lfsr16(char *wrptr, u8 reg, u16 value)
 
   ERR(vbuf(dev, WRITE_VIDREG_UNLOCK, DSIZEOF(WRITE_VIDREG_UNLOCK)));
  */
-static char *udl_set_vid_cmds(char *wrptr, struct drm_display_mode *mode)
+static char *udl_set_vid_cmds(char *wrptr,
+				const struct drm_display_mode *mode)
 {
 	u16 xds, yds;
 	u16 xde, yde;
@@ -304,8 +305,8 @@  udl_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 #endif
 
 static int udl_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
+			       const struct drm_display_mode *mode,
+			       const struct drm_display_mode *adjusted_mode,
 			       int x, int y,
 			       struct drm_framebuffer *old_fb)
 
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index a356a59..ece3819 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -86,8 +86,10 @@  struct drm_crtc_helper_funcs {
 			   const struct drm_display_mode *mode,
 			   struct drm_display_mode *adjusted_mode);
 	/* Actually set the mode */
-	int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			struct drm_display_mode *adjusted_mode, int x, int y,
+	int (*mode_set)(struct drm_crtc *crtc,
+	                const struct drm_display_mode *mode,
+			const struct drm_display_mode *adjusted_mode,
+			int x, int y,
 			struct drm_framebuffer *old_fb);
 	/* Actually set the mode for atomic helpers, optional */
 	void (*mode_set_nofb)(struct drm_crtc *crtc);
@@ -181,7 +183,7 @@  struct drm_connector_helper_funcs {
 extern void drm_helper_disable_unused_functions(struct drm_device *dev);
 extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
 extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
-				     struct drm_display_mode *mode,
+				     const struct drm_display_mode *mode,
 				     int x, int y,
 				     struct drm_framebuffer *old_fb);
 extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
@@ -214,8 +216,10 @@  static inline void drm_connector_helper_add(struct drm_connector *connector,
 
 extern void drm_helper_resume_force_mode(struct drm_device *dev);
 
-int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			     struct drm_display_mode *adjusted_mode, int x, int y,
+int drm_helper_crtc_mode_set(struct drm_crtc *crtc,
+                             const struct drm_display_mode *mode,
+			     const struct drm_display_mode *adjusted_mode,
+			     int x, int y,
 			     struct drm_framebuffer *old_fb);
 int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 				  struct drm_framebuffer *old_fb);