drm: Constify mode argument to connector .mode_valid() helper operation

Submitted by Laurent Pinchart on June 6, 2018, 9:08 a.m.

Details

Message ID 20180606090812.20349-1-laurent.pinchart@ideasonboard.com
State New
Headers show
Series "drm: Constify mode argument to connector .mode_valid() helper operation" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Laurent Pinchart June 6, 2018, 9:08 a.m.
The drm_connector_helper_funcs .mode_valid() operation should not modify
the mode it receives in any way. To make this explicit, constify the
mode pointer as done for all other .mode_valid() operations, and update
all drivers accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---

This patch touches lots of drivers, so checkpatch.pl created a huge CC list
that would likely be too large for the mailing list. As changes to most files
just boil down to adding a const keyword, I've decided to only CC the DRM misc
maintainers, as well as Tomi for omapdrm as the change to that driver is
slightly more complex.

 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c                 |  2 +-
 drivers/gpu/drm/amd/amdgpu/atombios_dp.h                 |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c                 |  2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c        |  2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h        |  2 +-
 drivers/gpu/drm/ast/ast_mode.c                           |  2 +-
 drivers/gpu/drm/bochs/bochs_kms.c                        |  2 +-
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c             |  4 ++--
 drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |  2 +-
 drivers/gpu/drm/bridge/sii902x.c                         |  2 +-
 drivers/gpu/drm/bridge/tc358767.c                        |  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c                     |  2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c                |  2 +-
 drivers/gpu/drm/gma500/cdv_intel_crt.c                   |  2 +-
 drivers/gpu/drm/gma500/cdv_intel_dp.c                    |  2 +-
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c                  |  2 +-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c                  |  2 +-
 drivers/gpu/drm/gma500/mdfld_dsi_output.c                |  2 +-
 drivers/gpu/drm/gma500/oaktrail_hdmi.c                   |  2 +-
 drivers/gpu/drm/gma500/psb_intel_drv.h                   |  2 +-
 drivers/gpu/drm/gma500/psb_intel_lvds.c                  |  2 +-
 drivers/gpu/drm/gma500/psb_intel_sdvo.c                  |  2 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c         |  2 +-
 drivers/gpu/drm/i2c/ch7006_drv.c                         |  2 +-
 drivers/gpu/drm/i2c/sil164_drv.c                         |  2 +-
 drivers/gpu/drm/i2c/tda998x_drv.c                        |  2 +-
 drivers/gpu/drm/i915/dvo.h                               |  2 +-
 drivers/gpu/drm/i915/dvo_ch7017.c                        |  2 +-
 drivers/gpu/drm/i915/dvo_ch7xxx.c                        |  2 +-
 drivers/gpu/drm/i915/dvo_ivch.c                          |  2 +-
 drivers/gpu/drm/i915/dvo_ns2501.c                        |  2 +-
 drivers/gpu/drm/i915/dvo_sil164.c                        |  2 +-
 drivers/gpu/drm/i915/dvo_tfp410.c                        |  2 +-
 drivers/gpu/drm/i915/intel_crt.c                         |  2 +-
 drivers/gpu/drm/i915/intel_dp.c                          |  2 +-
 drivers/gpu/drm/i915/intel_dp_mst.c                      |  2 +-
 drivers/gpu/drm/i915/intel_dsi.c                         |  2 +-
 drivers/gpu/drm/i915/intel_dvo.c                         |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c                        |  2 +-
 drivers/gpu/drm/i915/intel_lvds.c                        |  2 +-
 drivers/gpu/drm/i915/intel_sdvo.c                        |  2 +-
 drivers/gpu/drm/i915/intel_tv.c                          |  2 +-
 drivers/gpu/drm/imx/imx-tve.c                            |  2 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c                      |  2 +-
 drivers/gpu/drm/meson/meson_venc_cvbs.c                  |  2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c                   |  4 ++--
 drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c      |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_manager.c                    |  2 +-
 drivers/gpu/drm/msm/edp/edp_connector.c                  |  2 +-
 drivers/gpu/drm/msm/hdmi/hdmi_connector.c                |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c                |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c                  |  2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c              |  2 +-
 drivers/gpu/drm/omapdrm/omap_connector.c                 |  7 ++++---
 drivers/gpu/drm/qxl/qxl_display.c                        |  2 +-
 drivers/gpu/drm/radeon/atombios_dp.c                     |  2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c               | 10 +++++-----
 drivers/gpu/drm/radeon/radeon_dp_mst.c                   |  2 +-
 drivers/gpu/drm/radeon/radeon_mode.h                     |  2 +-
 drivers/gpu/drm/rockchip/cdn-dp-core.c                   |  2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c                     |  2 +-
 drivers/gpu/drm/sti/sti_dvo.c                            |  2 +-
 drivers/gpu/drm/sti/sti_hda.c                            |  2 +-
 drivers/gpu/drm/sti/sti_hdmi.c                           |  2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c                         |  2 +-
 drivers/gpu/drm/tegra/dsi.c                              |  2 +-
 drivers/gpu/drm/tegra/hdmi.c                             |  2 +-
 drivers/gpu/drm/tegra/rgb.c                              |  2 +-
 drivers/gpu/drm/tegra/sor.c                              |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c                     |  3 ++-
 drivers/gpu/drm/tilcdc/tilcdc_drv.h                      |  3 ++-
 drivers/gpu/drm/tilcdc/tilcdc_external.c                 |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_panel.c                    |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c                   |  2 +-
 drivers/gpu/drm/udl/udl_connector.c                      |  2 +-
 drivers/gpu/drm/virtio/virtgpu_display.c                 |  2 +-
 drivers/gpu/drm/zte/zx_hdmi.c                            |  2 +-
 drivers/gpu/drm/zte/zx_tvenc.c                           |  4 ++--
 drivers/gpu/drm/zte/zx_vga.c                             |  2 +-
 drivers/staging/vboxvideo/vbox_mode.c                    |  2 +-
 include/drm/drm_encoder_slave.h                          |  2 +-
 include/drm/drm_modeset_helper_vtables.h                 |  2 +-
 83 files changed, 98 insertions(+), 95 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index 8e66851eb427..0572576f7acd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -692,7 +692,7 @@  static int amdgpu_connector_lvds_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status amdgpu_connector_lvds_mode_valid(struct drm_connector *connector,
-					     struct drm_display_mode *mode)
+					     const struct drm_display_mode *mode)
 {
 	struct drm_encoder *encoder = amdgpu_connector_best_single_encoder(connector);
 
@@ -844,7 +844,7 @@  static int amdgpu_connector_vga_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status amdgpu_connector_vga_mode_valid(struct drm_connector *connector,
-					    struct drm_display_mode *mode)
+					    const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct amdgpu_device *adev = dev->dev_private;
@@ -1173,7 +1173,7 @@  static void amdgpu_connector_dvi_force(struct drm_connector *connector)
 }
 
 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
-					    struct drm_display_mode *mode)
+					    const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct amdgpu_device *adev = dev->dev_private;
@@ -1449,7 +1449,7 @@  amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 }
 
 static enum drm_mode_status amdgpu_connector_dp_mode_valid(struct drm_connector *connector,
-					   struct drm_display_mode *mode)
+					   const struct drm_display_mode *mode)
 {
 	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 	struct amdgpu_connector_atom_dig *amdgpu_dig_connector = amdgpu_connector->con_priv;
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
index f81068ba4cc6..c4469702ddc2 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
@@ -420,7 +420,7 @@  void amdgpu_atombios_dp_set_link_config(struct drm_connector *connector,
 }
 
 int amdgpu_atombios_dp_mode_valid_helper(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 	struct amdgpu_connector_atom_dig *dig_connector;
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.h b/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
index f59d85eaddf0..3e24acf8133f 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
@@ -32,7 +32,7 @@  int amdgpu_atombios_dp_get_panel_mode(struct drm_encoder *encoder,
 void amdgpu_atombios_dp_set_link_config(struct drm_connector *connector,
 				 const struct drm_display_mode *mode);
 int amdgpu_atombios_dp_mode_valid_helper(struct drm_connector *connector,
-				  struct drm_display_mode *mode);
+				  const struct drm_display_mode *mode);
 bool amdgpu_atombios_dp_needs_link_train(struct amdgpu_connector *amdgpu_connector);
 void amdgpu_atombios_dp_set_rx_power_state(struct drm_connector *connector,
 				    u8 power_state);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index dbf2ccd0c744..b595622ab0e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -328,7 +328,7 @@  static int dce_virtual_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status dce_virtual_mode_valid(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1ce10bc2d37b..a46aadcc42e8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2836,7 +2836,7 @@  static void handle_edid_mgmt(struct amdgpu_dm_connector *aconnector)
 }
 
 enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector,
-				   struct drm_display_mode *mode)
+				   const struct drm_display_mode *mode)
 {
 	int result = MODE_ERROR;
 	struct dc_sink *dc_sink;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index d5aa89ad5571..8ff95533b38c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -248,7 +248,7 @@  void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 				     int link_index);
 
 enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector,
-				   struct drm_display_mode *mode);
+				   const struct drm_display_mode *mode);
 
 void dm_restore_drm_connector_state(struct drm_device *dev,
 				    struct drm_connector *connector);
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 036dff8a1f33..bac038a99c28 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -800,7 +800,7 @@  static int ast_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
-			  struct drm_display_mode *mode)
+			  const struct drm_display_mode *mode)
 {
 	struct ast_private *ast = connector->dev->dev_private;
 	int flags = MODE_NOMODE;
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 233980a78591..246e461598d6 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -189,7 +189,7 @@  static int bochs_connector_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status bochs_connector_mode_valid(struct drm_connector *connector,
-				      struct drm_display_mode *mode)
+				      const struct drm_display_mode *mode)
 {
 	struct bochs_device *bochs =
 		container_of(connector, struct bochs_device, connector);
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 73021b388e12..e701c4715c78 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -655,7 +655,7 @@  adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
 }
 
 static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511,
-			      struct drm_display_mode *mode)
+			      const struct drm_display_mode *mode)
 {
 	if (mode->clock > 165000)
 		return MODE_CLOCK_HIGH;
@@ -777,7 +777,7 @@  static int adv7511_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 adv7511_connector_mode_valid(struct drm_connector *connector,
-			     struct drm_display_mode *mode)
+			     const struct drm_display_mode *mode)
 {
 	struct adv7511 *adv = connector_to_adv7511(connector);
 
diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
index 7ccadba7c98c..94b5610e99fd 100644
--- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
+++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
@@ -162,7 +162,7 @@  static int ge_b850v3_lvds_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status ge_b850v3_lvds_mode_valid(
-		struct drm_connector *connector, struct drm_display_mode *mode)
+		struct drm_connector *connector, const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 60373d7eb220..c01da1b69362 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -221,7 +221,7 @@  static int sii902x_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status sii902x_mode_valid(struct drm_connector *connector,
-					       struct drm_display_mode *mode)
+					       const struct drm_display_mode *mode)
 {
 	/* TODO: check mode */
 
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 0fd9cf27542c..526ba25a1960 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1103,7 +1103,7 @@  static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,
 }
 
 static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector,
-				   struct drm_display_mode *mode)
+				   const struct drm_display_mode *mode)
 {
 	/* DPI interface clock limitation: upto 154 MHz */
 	if (mode->clock > 154000)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 09c4bc0b1859..2a7237c8f56d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -912,7 +912,7 @@  static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
 }
 
 static int hdmi_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
+			const struct drm_display_mode *mode)
 {
 	struct hdmi_context *hdata = connector_to_hdmi(connector);
 	int ret;
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index c54806d08dd7..a428ab2ddf00 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -84,7 +84,7 @@  static int fsl_dcu_drm_connector_get_modes(struct drm_connector *connector)
 }
 
 static int fsl_dcu_drm_connector_mode_valid(struct drm_connector *connector,
-					    struct drm_display_mode *mode)
+					    const struct drm_display_mode *mode)
 {
 	if (mode->hdisplay & 0xf)
 		return MODE_ERROR;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index cb5a14b7ec7f..db9d3b91e970 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -65,7 +65,7 @@  static void cdv_intel_crt_dpms(struct drm_encoder *encoder, int mode)
 }
 
 static enum drm_mode_status cdv_intel_crt_mode_valid(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
 		return MODE_NO_DBLESCAN;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 5ea785f07ba8..883a7d54e2a3 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -507,7 +507,7 @@  static void cdv_intel_edp_backlight_off (struct gma_encoder *intel_encoder)
 
 static enum drm_mode_status
 cdv_intel_dp_mode_valid(struct drm_connector *connector,
-		    struct drm_display_mode *mode)
+		    const struct drm_display_mode *mode)
 {
 	struct gma_encoder *encoder = gma_attached_encoder(connector);
 	struct cdv_intel_dp *intel_dp = encoder->dev_priv;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index f0878998526a..5185006fcf9c 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -224,7 +224,7 @@  static int cdv_hdmi_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status cdv_hdmi_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	if (mode->clock > 165000)
 		return MODE_CLOCK_HIGH;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index de9531caaca0..c4ed824645fb 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -245,7 +245,7 @@  static void cdv_intel_lvds_restore(struct drm_connector *connector)
 }
 
 static enum drm_mode_status cdv_intel_lvds_mode_valid(struct drm_connector *connector,
-			      struct drm_display_mode *mode)
+			      const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_psb_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index fe020926ea4f..efcd25d0041c 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -347,7 +347,7 @@  static int mdfld_dsi_connector_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status mdfld_dsi_connector_mode_valid(struct drm_connector *connector,
-						struct drm_display_mode *mode)
+						const struct drm_display_mode *mode)
 {
 	struct mdfld_dsi_connector *dsi_connector =
 					mdfld_dsi_connector(connector);
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 78566a80ad25..a5a189b7585d 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -510,7 +510,7 @@  static void oaktrail_hdmi_dpms(struct drm_encoder *encoder, int mode)
 }
 
 static enum drm_mode_status oaktrail_hdmi_mode_valid(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	if (mode->clock > 165000)
 		return MODE_CLOCK_HIGH;
diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
index e05e5399af2d..b0dc6ce0c10f 100644
--- a/drivers/gpu/drm/gma500/psb_intel_drv.h
+++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
@@ -256,7 +256,7 @@  extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
 				      const struct drm_display_mode *mode,
 				      struct drm_display_mode *adjusted_mode);
 extern enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
-				     struct drm_display_mode *mode);
+				     const struct drm_display_mode *mode);
 extern int psb_intel_lvds_set_property(struct drm_connector *connector,
 					struct drm_property *property,
 					uint64_t value);
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 8baf6325c6e4..57a81cb6dacd 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -344,7 +344,7 @@  static void psb_intel_lvds_restore(struct drm_connector *connector)
 }
 
 enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct drm_psb_private *dev_priv = connector->dev->dev_private;
 	struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index f2ee6aa10afa..3abbe392f1c1 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -1158,7 +1158,7 @@  static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
 }
 
 static enum drm_mode_status psb_intel_sdvo_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct psb_intel_sdvo *psb_intel_sdvo = intel_attached_sdvo(connector);
 
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
index d2f4749ebf8d..5baee4995ae3 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
@@ -28,7 +28,7 @@  static int hibmc_connector_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status hibmc_connector_mode_valid(struct drm_connector *connector,
-				      struct drm_display_mode *mode)
+				      const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index 544a8a2d3562..d97dea4dc582 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -102,7 +102,7 @@  static bool ch7006_encoder_mode_fixup(struct drm_encoder *encoder,
 }
 
 static int ch7006_encoder_mode_valid(struct drm_encoder *encoder,
-				     struct drm_display_mode *mode)
+				     const struct drm_display_mode *mode)
 {
 	if (ch7006_lookup_mode(encoder, mode))
 		return MODE_OK;
diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
index c52d7a3af786..e86c386a6fc7 100644
--- a/drivers/gpu/drm/i2c/sil164_drv.c
+++ b/drivers/gpu/drm/i2c/sil164_drv.c
@@ -254,7 +254,7 @@  sil164_encoder_restore(struct drm_encoder *encoder)
 
 static int
 sil164_encoder_mode_valid(struct drm_encoder *encoder,
-			  struct drm_display_mode *mode)
+			  const struct drm_display_mode *mode)
 {
 	struct sil164_priv *priv = to_sil164_priv(encoder);
 
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 6ebd8842dbcc..4106bf9aba5d 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1243,7 +1243,7 @@  static int tda998x_connector_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status tda998x_connector_mode_valid(struct drm_connector *connector,
-					struct drm_display_mode *mode)
+					const struct drm_display_mode *mode)
 {
 	/* TDA19988 dotclock can go up to 165MHz */
 	struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
diff --git a/drivers/gpu/drm/i915/dvo.h b/drivers/gpu/drm/i915/dvo.h
index 5e6a3013da49..d7a259afdbc5 100644
--- a/drivers/gpu/drm/i915/dvo.h
+++ b/drivers/gpu/drm/i915/dvo.h
@@ -75,7 +75,7 @@  struct intel_dvo_dev_ops {
 	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
 	 */
 	int (*mode_valid)(struct intel_dvo_device *dvo,
-			  struct drm_display_mode *mode);
+			  const struct drm_display_mode *mode);
 
 	/*
 	 * Callback for preparing mode changes on an output
diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c b/drivers/gpu/drm/i915/dvo_ch7017.c
index 80b3e16cf48c..21a76b89209a 100644
--- a/drivers/gpu/drm/i915/dvo_ch7017.c
+++ b/drivers/gpu/drm/i915/dvo_ch7017.c
@@ -246,7 +246,7 @@  static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
-					      struct drm_display_mode *mode)
+					      const struct drm_display_mode *mode)
 {
 	if (mode->clock > 160000)
 		return MODE_CLOCK_HIGH;
diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c
index 7aeeffd2428b..48c69b290621 100644
--- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
+++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
@@ -264,7 +264,7 @@  static enum drm_connector_status ch7xxx_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status ch7xxx_mode_valid(struct intel_dvo_device *dvo,
-					      struct drm_display_mode *mode)
+					      const struct drm_display_mode *mode)
 {
 	if (mode->clock > 165000)
 		return MODE_CLOCK_HIGH;
diff --git a/drivers/gpu/drm/i915/dvo_ivch.c b/drivers/gpu/drm/i915/dvo_ivch.c
index c73aff163908..9b61e7e4ef05 100644
--- a/drivers/gpu/drm/i915/dvo_ivch.c
+++ b/drivers/gpu/drm/i915/dvo_ivch.c
@@ -313,7 +313,7 @@  static enum drm_connector_status ivch_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status ivch_mode_valid(struct intel_dvo_device *dvo,
-					    struct drm_display_mode *mode)
+					    const struct drm_display_mode *mode)
 {
 	if (mode->clock > 112000)
 		return MODE_CLOCK_HIGH;
diff --git a/drivers/gpu/drm/i915/dvo_ns2501.c b/drivers/gpu/drm/i915/dvo_ns2501.c
index 2379c33cfe51..087c87802be6 100644
--- a/drivers/gpu/drm/i915/dvo_ns2501.c
+++ b/drivers/gpu/drm/i915/dvo_ns2501.c
@@ -524,7 +524,7 @@  static enum drm_connector_status ns2501_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status ns2501_mode_valid(struct intel_dvo_device *dvo,
-					      struct drm_display_mode *mode)
+					      const struct drm_display_mode *mode)
 {
 	DRM_DEBUG_KMS
 	    ("is mode valid (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d)\n",
diff --git a/drivers/gpu/drm/i915/dvo_sil164.c b/drivers/gpu/drm/i915/dvo_sil164.c
index 1c1a0674dbab..d92634cd47e5 100644
--- a/drivers/gpu/drm/i915/dvo_sil164.c
+++ b/drivers/gpu/drm/i915/dvo_sil164.c
@@ -184,7 +184,7 @@  static enum drm_connector_status sil164_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status sil164_mode_valid(struct intel_dvo_device *dvo,
-					      struct drm_display_mode *mode)
+					      const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/i915/dvo_tfp410.c b/drivers/gpu/drm/i915/dvo_tfp410.c
index 31e181da93db..0dce97a92343 100644
--- a/drivers/gpu/drm/i915/dvo_tfp410.c
+++ b/drivers/gpu/drm/i915/dvo_tfp410.c
@@ -216,7 +216,7 @@  static enum drm_connector_status tfp410_detect(struct intel_dvo_device *dvo)
 }
 
 static enum drm_mode_status tfp410_mode_valid(struct intel_dvo_device *dvo,
-					      struct drm_display_mode *mode)
+					      const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index de0e22322c76..95604c767f89 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -297,7 +297,7 @@  static void intel_enable_crt(struct intel_encoder *encoder,
 
 static enum drm_mode_status
 intel_crt_mode_valid(struct drm_connector *connector,
-		     struct drm_display_mode *mode)
+		     const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index dde92e4af5d3..f8f4884b5add 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -411,7 +411,7 @@  int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
-		    struct drm_display_mode *mode)
+		    const struct drm_display_mode *mode)
 {
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	struct intel_connector *intel_connector = to_intel_connector(connector);
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 9e6956c08688..6a1c590f8615 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -355,7 +355,7 @@  static int intel_dp_mst_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 intel_dp_mst_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
+			const struct drm_display_mode *mode)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct intel_dp *intel_dp = intel_connector->mst_port;
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 51a1d6868b1e..8c2d4f7f4dba 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1258,7 +1258,7 @@  static void intel_dsi_get_config(struct intel_encoder *encoder,
 
 static enum drm_mode_status
 intel_dsi_mode_valid(struct drm_connector *connector,
-		     struct drm_display_mode *mode)
+		     const struct drm_display_mode *mode)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	const struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index eb0c559b2715..103cfbc07a9b 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -211,7 +211,7 @@  static void intel_enable_dvo(struct intel_encoder *encoder,
 
 static enum drm_mode_status
 intel_dvo_mode_valid(struct drm_connector *connector,
-		     struct drm_display_mode *mode)
+		     const struct drm_display_mode *mode)
 {
 	struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
 	const struct drm_display_mode *fixed_mode =
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ee929f31f7db..d0191649be32 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1546,7 +1546,7 @@  hdmi_port_clock_valid(struct intel_hdmi *hdmi,
 
 static enum drm_mode_status
 intel_hdmi_mode_valid(struct drm_connector *connector,
-		      struct drm_display_mode *mode)
+		      const struct drm_display_mode *mode)
 {
 	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
 	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 8691c86f579c..bbf7b1f103c8 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -374,7 +374,7 @@  static void pch_post_disable_lvds(struct intel_encoder *encoder,
 
 static enum drm_mode_status
 intel_lvds_mode_valid(struct drm_connector *connector,
-		      struct drm_display_mode *mode)
+		      const struct drm_display_mode *mode)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 25005023c243..2edbe16dbae7 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1616,7 +1616,7 @@  static void intel_enable_sdvo(struct intel_encoder *encoder,
 
 static enum drm_mode_status
 intel_sdvo_mode_valid(struct drm_connector *connector,
-		      struct drm_display_mode *mode)
+		      const struct drm_display_mode *mode)
 {
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 885fc3809f7f..761eefa4f5b2 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -845,7 +845,7 @@  static const struct tv_mode *intel_tv_mode_find(const struct drm_connector_state
 
 static enum drm_mode_status
 intel_tv_mode_valid(struct drm_connector *connector,
-		    struct drm_display_mode *mode)
+		    const struct drm_display_mode *mode)
 {
 	const struct tv_mode *tv_mode = intel_tv_mode_find(connector->state);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index bc27c2699464..9bf5dd96147e 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -244,7 +244,7 @@  static int imx_tve_connector_get_modes(struct drm_connector *connector)
 }
 
 static int imx_tve_connector_mode_valid(struct drm_connector *connector,
-					struct drm_display_mode *mode)
+					const struct drm_display_mode *mode)
 {
 	struct imx_tve *tve = con_to_tve(connector);
 	unsigned long rate;
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 59a11026dceb..7145a9aebfd7 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1228,7 +1228,7 @@  static int mtk_hdmi_conn_get_modes(struct drm_connector *conn)
 }
 
 static int mtk_hdmi_conn_mode_valid(struct drm_connector *conn,
-				    struct drm_display_mode *mode)
+				    const struct drm_display_mode *mode)
 {
 	struct mtk_hdmi *hdmi = hdmi_ctx_from_conn(conn);
 
diff --git a/drivers/gpu/drm/meson/meson_venc_cvbs.c b/drivers/gpu/drm/meson/meson_venc_cvbs.c
index 79d95ca8a0c0..641447cadd94 100644
--- a/drivers/gpu/drm/meson/meson_venc_cvbs.c
+++ b/drivers/gpu/drm/meson/meson_venc_cvbs.c
@@ -111,7 +111,7 @@  static int meson_cvbs_connector_get_modes(struct drm_connector *connector)
 }
 
 static int meson_cvbs_connector_mode_valid(struct drm_connector *connector,
-					   struct drm_display_mode *mode)
+					   const struct drm_display_mode *mode)
 {
 	/* Validate the modes added in get_modes */
 	return MODE_OK;
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 8918539a19aa..c188bbd16845 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1560,7 +1560,7 @@  static int mga_vga_get_modes(struct drm_connector *connector)
 	return ret;
 }
 
-static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode *mode,
+static uint32_t mga_vga_calculate_mode_bandwidth(const struct drm_display_mode *mode,
 							int bits_per_pixel)
 {
 	uint32_t total_area, divisor;
@@ -1587,7 +1587,7 @@  static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode *mode,
 #define MODE_BANDWIDTH	MODE_BAD
 
 static enum drm_mode_status mga_vga_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct mga_device *mdev = (struct mga_device*)dev->dev_private;
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
index e3b1c86b7aae..1b09df4524ba 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
@@ -72,7 +72,7 @@  static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
 }
 
 static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct mdp4_lvds_connector *mdp4_lvds_connector =
 			to_mdp4_lvds_connector(connector);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4cb1cb68878b..a024acf9b793 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -405,7 +405,7 @@  static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
 }
 
 static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	int id = dsi_mgr_connector_get_id(connector);
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c
index 6f3fc6b0f0a3..af05c3090036 100644
--- a/drivers/gpu/drm/msm/edp/edp_connector.c
+++ b/drivers/gpu/drm/msm/edp/edp_connector.c
@@ -64,7 +64,7 @@  static int edp_connector_get_modes(struct drm_connector *connector)
 }
 
 static int edp_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct edp_connector *edp_connector = to_edp_connector(connector);
 	struct msm_edp *edp = edp_connector->edp;
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
index c0848dfedd50..ba218c611021 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
@@ -403,7 +403,7 @@  static int msm_hdmi_connector_get_modes(struct drm_connector *connector)
 }
 
 static int msm_hdmi_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector);
 	struct hdmi *hdmi = hdmi_connector->hdmi;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index 6d99f11fee4e..6dd956bf77b9 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -301,7 +301,7 @@  static int nv17_tv_get_modes(struct drm_encoder *encoder,
 }
 
 static int nv17_tv_mode_valid(struct drm_encoder *encoder,
-			      struct drm_display_mode *mode)
+			      const struct drm_display_mode *mode)
 {
 	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index b83465ae7c1b..92cf754842a3 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -838,7 +838,7 @@  nv50_mstc_best_encoder(struct drm_connector *connector)
 
 static enum drm_mode_status
 nv50_mstc_mode_valid(struct drm_connector *connector,
-		     struct drm_display_mode *mode)
+		     const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7b557c354307..308e28c1871d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1007,7 +1007,7 @@  get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi)
 
 static enum drm_mode_status
 nouveau_connector_mode_valid(struct drm_connector *connector,
-			     struct drm_display_mode *mode)
+			     const struct drm_display_mode *mode)
 {
 	struct nouveau_connector *nv_connector = nouveau_connector(connector);
 	struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 5cde26ac937b..e316f6d5ac5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -166,7 +166,7 @@  static int omap_connector_get_modes(struct drm_connector *connector)
 }
 
 static int omap_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
+				 const struct drm_display_mode *mode)
 {
 	struct omap_connector *omap_connector = to_omap_connector(connector);
 	struct omap_dss_device *dssdev = omap_connector->dssdev;
@@ -174,10 +174,11 @@  static int omap_connector_mode_valid(struct drm_connector *connector,
 	struct videomode vm = {0};
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *new_mode;
+	unsigned int vrefresh;
 	int r, ret = MODE_BAD;
 
 	drm_display_mode_to_videomode(mode, &vm);
-	mode->vrefresh = drm_mode_vrefresh(mode);
+	vrefresh = drm_mode_vrefresh(mode);
 
 	/*
 	 * if the panel driver doesn't have a check_timings, it's most likely
@@ -212,7 +213,7 @@  static int omap_connector_mode_valid(struct drm_connector *connector,
 
 		new_mode->clock = vm.pixelclock / 1000;
 		new_mode->vrefresh = 0;
-		if (mode->vrefresh == drm_mode_vrefresh(new_mode))
+		if (vrefresh == drm_mode_vrefresh(new_mode))
 			ret = MODE_OK;
 		drm_mode_destroy(dev, new_mode);
 	}
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index b8cda9449241..1e261962f03d 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -955,7 +955,7 @@  static int qxl_conn_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status qxl_conn_mode_valid(struct drm_connector *connector,
-			       struct drm_display_mode *mode)
+			       const struct drm_display_mode *mode)
 {
 	struct drm_device *ddev = connector->dev;
 	struct qxl_device *qdev = ddev->dev_private;
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 3e798593e042..d3cd8169fd68 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -474,7 +474,7 @@  void radeon_dp_set_link_config(struct drm_connector *connector,
 }
 
 int radeon_dp_mode_valid_helper(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 	struct radeon_connector_atom_dig *dig_connector;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2aea2bdff99b..1d84aad22858 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -853,7 +853,7 @@  static int radeon_lvds_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status radeon_lvds_mode_valid(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
 
@@ -1013,7 +1013,7 @@  static int radeon_vga_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status radeon_vga_mode_valid(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -1157,7 +1157,7 @@  static int radeon_tv_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status radeon_tv_mode_valid(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	if ((mode->hdisplay > 1024) || (mode->vdisplay > 768))
 		return MODE_CLOCK_RANGE;
@@ -1499,7 +1499,7 @@  static void radeon_dvi_force(struct drm_connector *connector)
 }
 
 static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct radeon_device *rdev = dev->dev_private;
@@ -1801,7 +1801,7 @@  radeon_dp_detect(struct drm_connector *connector, bool force)
 }
 
 static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connector,
-				  struct drm_display_mode *mode)
+				  const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct radeon_device *rdev = dev->dev_private;
diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
index cd8a3ee16649..fc188cafe8e8 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
@@ -211,7 +211,7 @@  static int radeon_dp_mst_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 radeon_dp_mst_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
+			 const struct drm_display_mode *mode)
 {
 	/* TODO - validate mode against available PBN for link */
 	if (mode->clock < 10000)
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..f87e1ac1384b 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -746,7 +746,7 @@  extern struct edid *radeon_connector_edid(struct drm_connector *connector);
 
 extern void radeon_connector_hotplug(struct drm_connector *connector);
 extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
-				       struct drm_display_mode *mode);
+				       const struct drm_display_mode *mode);
 extern void radeon_dp_set_link_config(struct drm_connector *connector,
 				      const struct drm_display_mode *mode);
 extern void radeon_dp_link_train(struct drm_encoder *encoder,
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index c6fbdcd87c16..605dc0c3d100 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -284,7 +284,7 @@  static int cdn_dp_connector_get_modes(struct drm_connector *connector)
 }
 
 static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
-				       struct drm_display_mode *mode)
+				       const struct drm_display_mode *mode)
 {
 	struct cdn_dp_device *dp = connector_to_dp(connector);
 	struct drm_display_info *display_info = &dp->connector.display_info;
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
index 88d0774c97bd..0707cbab5644 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -575,7 +575,7 @@  static int inno_hdmi_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 inno_hdmi_connector_mode_valid(struct drm_connector *connector,
-			       struct drm_display_mode *mode)
+			       const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index a5979cd25cc7..5dc71bc9a7b4 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -347,7 +347,7 @@  static int sti_dvo_connector_get_modes(struct drm_connector *connector)
 #define CLK_TOLERANCE_HZ 50
 
 static int sti_dvo_connector_mode_valid(struct drm_connector *connector,
-					struct drm_display_mode *mode)
+					const struct drm_display_mode *mode)
 {
 	int target = mode->clock * 1000;
 	int target_min = target - CLK_TOLERANCE_HZ;
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 67bbdb49fffc..b65c9c596a89 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -597,7 +597,7 @@  static int sti_hda_connector_get_modes(struct drm_connector *connector)
 #define CLK_TOLERANCE_HZ 50
 
 static int sti_hda_connector_mode_valid(struct drm_connector *connector,
-					struct drm_display_mode *mode)
+					const struct drm_display_mode *mode)
 {
 	int target = mode->clock * 1000;
 	int target_min = target - CLK_TOLERANCE_HZ;
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 58f431102512..ef8a7c78f00a 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -990,7 +990,7 @@  static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
 #define CLK_TOLERANCE_HZ 50
 
 static int sti_hdmi_connector_mode_valid(struct drm_connector *connector,
-					struct drm_display_mode *mode)
+					const struct drm_display_mode *mode)
 {
 	int target = mode->clock * 1000;
 	int target_min = target - CLK_TOLERANCE_HZ;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index b070d522ed8d..9808d0ee7fa8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -508,7 +508,7 @@  static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
 }
 
 static int sun4i_tv_comp_mode_valid(struct drm_connector *connector,
-				    struct drm_display_mode *mode)
+				    const struct drm_display_mode *mode)
 {
 	/* TODO */
 	return MODE_OK;
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 87c5d89bc9ba..6a7d17740a44 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -815,7 +815,7 @@  static const struct drm_connector_funcs tegra_dsi_connector_funcs = {
 
 static enum drm_mode_status
 tegra_dsi_connector_mode_valid(struct drm_connector *connector,
-			       struct drm_display_mode *mode)
+			       const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 784739a9f497..788a8f6753d7 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1164,7 +1164,7 @@  static const struct drm_connector_funcs tegra_hdmi_connector_funcs = {
 
 static enum drm_mode_status
 tegra_hdmi_connector_mode_valid(struct drm_connector *connector,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	struct tegra_output *output = connector_to_output(connector);
 	struct tegra_hdmi *hdmi = to_hdmi(output);
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index 78ec5193741d..da605bea82ea 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -98,7 +98,7 @@  static const struct drm_connector_funcs tegra_rgb_connector_funcs = {
 
 static enum drm_mode_status
 tegra_rgb_connector_mode_valid(struct drm_connector *connector,
-			       struct drm_display_mode *mode)
+			       const struct drm_display_mode *mode)
 {
 	/*
 	 * FIXME: For now, always assume that the mode is okay. There are
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 7d2a955fc515..05f93200646a 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1493,7 +1493,7 @@  static int tegra_sor_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 tegra_sor_connector_mode_valid(struct drm_connector *connector,
-			       struct drm_display_mode *mode)
+			       const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 1067e702c22c..08ea0da4d66a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -749,7 +749,8 @@  int tilcdc_crtc_max_width(struct drm_crtc *crtc)
 	return max_width;
 }
 
-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode)
+int tilcdc_crtc_mode_valid(struct drm_crtc *crtc,
+			   const struct drm_display_mode *mode)
 {
 	struct tilcdc_drm_private *priv = crtc->dev->dev_private;
 	unsigned int bandwidth;
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index ead512216669..61b4111b61b7 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -171,7 +171,8 @@  void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
 		const struct tilcdc_panel_info *info);
 void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc,
 					bool simulate_vesa_sync);
-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode);
+int tilcdc_crtc_mode_valid(struct drm_crtc *crtc,
+			   const struct drm_display_mode *mode);
 int tilcdc_crtc_max_width(struct drm_crtc *crtc);
 void tilcdc_crtc_shutdown(struct drm_crtc *crtc);
 int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index d651bdd6597e..6f548c9f81b1 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -41,7 +41,7 @@  static const struct tilcdc_panel_info panel_info_default = {
 };
 
 static int tilcdc_external_mode_valid(struct drm_connector *connector,
-				      struct drm_display_mode *mode)
+				      const struct drm_display_mode *mode)
 {
 	struct tilcdc_drm_private *priv = connector->dev->dev_private;
 	int ret;
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index d616d64a6725..f1825a6b7d57 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -171,7 +171,7 @@  static int panel_connector_get_modes(struct drm_connector *connector)
 }
 
 static int panel_connector_mode_valid(struct drm_connector *connector,
-		  struct drm_display_mode *mode)
+		  const struct drm_display_mode *mode)
 {
 	struct tilcdc_drm_private *priv = connector->dev->dev_private;
 	/* our only constraints are what the crtc can generate: */
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index c45cabb38db0..153ffbdc4106 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -184,7 +184,7 @@  static int tfp410_connector_get_modes(struct drm_connector *connector)
 }
 
 static int tfp410_connector_mode_valid(struct drm_connector *connector,
-		  struct drm_display_mode *mode)
+		  const struct drm_display_mode *mode)
 {
 	struct tilcdc_drm_private *priv = connector->dev->dev_private;
 	/* our only constraints are what the crtc can generate: */
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 09dc585aa46f..5477767de55c 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -106,7 +106,7 @@  static int udl_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status udl_mode_valid(struct drm_connector *connector,
-			  struct drm_display_mode *mode)
+			  const struct drm_display_mode *mode)
 {
 	struct udl_device *udl = connector->dev->dev_private;
 	if (!udl->sku_pixel_limit)
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index a5edd86603d9..69453a2cfcd9 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -209,7 +209,7 @@  static int virtio_gpu_conn_get_modes(struct drm_connector *connector)
 }
 
 static enum drm_mode_status virtio_gpu_conn_mode_valid(struct drm_connector *connector,
-				      struct drm_display_mode *mode)
+				      const struct drm_display_mode *mode)
 {
 	struct virtio_gpu_output *output =
 		drm_connector_to_virtio_gpu_output(connector);
diff --git a/drivers/gpu/drm/zte/zx_hdmi.c b/drivers/gpu/drm/zte/zx_hdmi.c
index 13ea90f7a185..e2d151b37c06 100644
--- a/drivers/gpu/drm/zte/zx_hdmi.c
+++ b/drivers/gpu/drm/zte/zx_hdmi.c
@@ -281,7 +281,7 @@  static int zx_hdmi_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 zx_hdmi_connector_mode_valid(struct drm_connector *connector,
-			     struct drm_display_mode *mode)
+			     const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/gpu/drm/zte/zx_tvenc.c b/drivers/gpu/drm/zte/zx_tvenc.c
index 0de1a71ca4e0..fd1c20e234ce 100644
--- a/drivers/gpu/drm/zte/zx_tvenc.c
+++ b/drivers/gpu/drm/zte/zx_tvenc.c
@@ -132,7 +132,7 @@  static const struct zx_tvenc_mode *tvenc_modes[] = {
 };
 
 static const struct zx_tvenc_mode *
-zx_tvenc_find_zmode(struct drm_display_mode *mode)
+zx_tvenc_find_zmode(const struct drm_display_mode *mode)
 {
 	int i;
 
@@ -249,7 +249,7 @@  static int zx_tvenc_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 zx_tvenc_connector_mode_valid(struct drm_connector *connector,
-			      struct drm_display_mode *mode)
+			      const struct drm_display_mode *mode)
 {
 	struct zx_tvenc *tvenc = to_zx_tvenc(connector);
 	const struct zx_tvenc_mode *zmode;
diff --git a/drivers/gpu/drm/zte/zx_vga.c b/drivers/gpu/drm/zte/zx_vga.c
index 3e7e33cd3dfa..450f8938daa5 100644
--- a/drivers/gpu/drm/zte/zx_vga.c
+++ b/drivers/gpu/drm/zte/zx_vga.c
@@ -118,7 +118,7 @@  static int zx_vga_connector_get_modes(struct drm_connector *connector)
 
 static enum drm_mode_status
 zx_vga_connector_mode_valid(struct drm_connector *connector,
-			    struct drm_display_mode *mode)
+			    const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index b265fe924556..8cde6ca7014c 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -574,7 +574,7 @@  static int vbox_get_modes(struct drm_connector *connector)
 }
 
 static int vbox_mode_valid(struct drm_connector *connector,
-			   struct drm_display_mode *mode)
+			   const struct drm_display_mode *mode)
 {
 	return MODE_OK;
 }
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
index 1107b4b1c599..b79094bc2fcd 100644
--- a/include/drm/drm_encoder_slave.h
+++ b/include/drm/drm_encoder_slave.h
@@ -58,7 +58,7 @@  struct drm_encoder_slave_funcs {
 			   const struct drm_display_mode *mode,
 			   struct drm_display_mode *adjusted_mode);
 	int (*mode_valid)(struct drm_encoder *encoder,
-			  struct drm_display_mode *mode);
+			  const struct drm_display_mode *mode);
 	void (*mode_set)(struct drm_encoder *encoder,
 			 struct drm_display_mode *mode,
 			 struct drm_display_mode *adjusted_mode);
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 35e2a3a79fc5..19bb03213af3 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -881,7 +881,7 @@  struct drm_connector_helper_funcs {
 	 * drm_mode_status.
 	 */
 	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
-					   struct drm_display_mode *mode);
+					   const struct drm_display_mode *mode);
 	/**
 	 * @best_encoder:
 	 *

Comments

On Wed, Jun 06, 2018 at 12:08:12PM +0300, Laurent Pinchart wrote:
> The drm_connector_helper_funcs .mode_valid() operation should not modify
> the mode it receives in any way. To make this explicit, constify the
> mode pointer as done for all other .mode_valid() operations, and update
> all drivers accordingly.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Didn't spot anything wrong. I think the omap case should be fine as
well since the probe helper will populate the vrefresh for the mode
eventually.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
> 
> This patch touches lots of drivers, so checkpatch.pl created a huge CC list
> that would likely be too large for the mailing list. As changes to most files
> just boil down to adding a const keyword, I've decided to only CC the DRM misc
> maintainers, as well as Tomi for omapdrm as the change to that driver is
> slightly more complex.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |  8 ++++----
>  drivers/gpu/drm/amd/amdgpu/atombios_dp.c                 |  2 +-
>  drivers/gpu/drm/amd/amdgpu/atombios_dp.h                 |  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c                 |  2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c        |  2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h        |  2 +-
>  drivers/gpu/drm/ast/ast_mode.c                           |  2 +-
>  drivers/gpu/drm/bochs/bochs_kms.c                        |  2 +-
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c             |  4 ++--
>  drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |  2 +-
>  drivers/gpu/drm/bridge/sii902x.c                         |  2 +-
>  drivers/gpu/drm/bridge/tc358767.c                        |  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c                     |  2 +-
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c                |  2 +-
>  drivers/gpu/drm/gma500/cdv_intel_crt.c                   |  2 +-
>  drivers/gpu/drm/gma500/cdv_intel_dp.c                    |  2 +-
>  drivers/gpu/drm/gma500/cdv_intel_hdmi.c                  |  2 +-
>  drivers/gpu/drm/gma500/cdv_intel_lvds.c                  |  2 +-
>  drivers/gpu/drm/gma500/mdfld_dsi_output.c                |  2 +-
>  drivers/gpu/drm/gma500/oaktrail_hdmi.c                   |  2 +-
>  drivers/gpu/drm/gma500/psb_intel_drv.h                   |  2 +-
>  drivers/gpu/drm/gma500/psb_intel_lvds.c                  |  2 +-
>  drivers/gpu/drm/gma500/psb_intel_sdvo.c                  |  2 +-
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c         |  2 +-
>  drivers/gpu/drm/i2c/ch7006_drv.c                         |  2 +-
>  drivers/gpu/drm/i2c/sil164_drv.c                         |  2 +-
>  drivers/gpu/drm/i2c/tda998x_drv.c                        |  2 +-
>  drivers/gpu/drm/i915/dvo.h                               |  2 +-
>  drivers/gpu/drm/i915/dvo_ch7017.c                        |  2 +-
>  drivers/gpu/drm/i915/dvo_ch7xxx.c                        |  2 +-
>  drivers/gpu/drm/i915/dvo_ivch.c                          |  2 +-
>  drivers/gpu/drm/i915/dvo_ns2501.c                        |  2 +-
>  drivers/gpu/drm/i915/dvo_sil164.c                        |  2 +-
>  drivers/gpu/drm/i915/dvo_tfp410.c                        |  2 +-
>  drivers/gpu/drm/i915/intel_crt.c                         |  2 +-
>  drivers/gpu/drm/i915/intel_dp.c                          |  2 +-
>  drivers/gpu/drm/i915/intel_dp_mst.c                      |  2 +-
>  drivers/gpu/drm/i915/intel_dsi.c                         |  2 +-
>  drivers/gpu/drm/i915/intel_dvo.c                         |  2 +-
>  drivers/gpu/drm/i915/intel_hdmi.c                        |  2 +-
>  drivers/gpu/drm/i915/intel_lvds.c                        |  2 +-
>  drivers/gpu/drm/i915/intel_sdvo.c                        |  2 +-
>  drivers/gpu/drm/i915/intel_tv.c                          |  2 +-
>  drivers/gpu/drm/imx/imx-tve.c                            |  2 +-
>  drivers/gpu/drm/mediatek/mtk_hdmi.c                      |  2 +-
>  drivers/gpu/drm/meson/meson_venc_cvbs.c                  |  2 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c                   |  4 ++--
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c      |  2 +-
>  drivers/gpu/drm/msm/dsi/dsi_manager.c                    |  2 +-
>  drivers/gpu/drm/msm/edp/edp_connector.c                  |  2 +-
>  drivers/gpu/drm/msm/hdmi/hdmi_connector.c                |  2 +-
>  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c                |  2 +-
>  drivers/gpu/drm/nouveau/dispnv50/disp.c                  |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_connector.c              |  2 +-
>  drivers/gpu/drm/omapdrm/omap_connector.c                 |  7 ++++---
>  drivers/gpu/drm/qxl/qxl_display.c                        |  2 +-
>  drivers/gpu/drm/radeon/atombios_dp.c                     |  2 +-
>  drivers/gpu/drm/radeon/radeon_connectors.c               | 10 +++++-----
>  drivers/gpu/drm/radeon/radeon_dp_mst.c                   |  2 +-
>  drivers/gpu/drm/radeon/radeon_mode.h                     |  2 +-
>  drivers/gpu/drm/rockchip/cdn-dp-core.c                   |  2 +-
>  drivers/gpu/drm/rockchip/inno_hdmi.c                     |  2 +-
>  drivers/gpu/drm/sti/sti_dvo.c                            |  2 +-
>  drivers/gpu/drm/sti/sti_hda.c                            |  2 +-
>  drivers/gpu/drm/sti/sti_hdmi.c                           |  2 +-
>  drivers/gpu/drm/sun4i/sun4i_tv.c                         |  2 +-
>  drivers/gpu/drm/tegra/dsi.c                              |  2 +-
>  drivers/gpu/drm/tegra/hdmi.c                             |  2 +-
>  drivers/gpu/drm/tegra/rgb.c                              |  2 +-
>  drivers/gpu/drm/tegra/sor.c                              |  2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c                     |  3 ++-
>  drivers/gpu/drm/tilcdc/tilcdc_drv.h                      |  3 ++-
>  drivers/gpu/drm/tilcdc/tilcdc_external.c                 |  2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_panel.c                    |  2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c                   |  2 +-
>  drivers/gpu/drm/udl/udl_connector.c                      |  2 +-
>  drivers/gpu/drm/virtio/virtgpu_display.c                 |  2 +-
>  drivers/gpu/drm/zte/zx_hdmi.c                            |  2 +-
>  drivers/gpu/drm/zte/zx_tvenc.c                           |  4 ++--
>  drivers/gpu/drm/zte/zx_vga.c                             |  2 +-
>  drivers/staging/vboxvideo/vbox_mode.c                    |  2 +-
>  include/drm/drm_encoder_slave.h                          |  2 +-
>  include/drm/drm_modeset_helper_vtables.h                 |  2 +-
>  83 files changed, 98 insertions(+), 95 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index 8e66851eb427..0572576f7acd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -692,7 +692,7 @@ static int amdgpu_connector_lvds_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status amdgpu_connector_lvds_mode_valid(struct drm_connector *connector,
> -					     struct drm_display_mode *mode)
> +					     const struct drm_display_mode *mode)
>  {
>  	struct drm_encoder *encoder = amdgpu_connector_best_single_encoder(connector);
>  
> @@ -844,7 +844,7 @@ static int amdgpu_connector_vga_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status amdgpu_connector_vga_mode_valid(struct drm_connector *connector,
> -					    struct drm_display_mode *mode)
> +					    const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct amdgpu_device *adev = dev->dev_private;
> @@ -1173,7 +1173,7 @@ static void amdgpu_connector_dvi_force(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
> -					    struct drm_display_mode *mode)
> +					    const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct amdgpu_device *adev = dev->dev_private;
> @@ -1449,7 +1449,7 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
>  }
>  
>  static enum drm_mode_status amdgpu_connector_dp_mode_valid(struct drm_connector *connector,
> -					   struct drm_display_mode *mode)
> +					   const struct drm_display_mode *mode)
>  {
>  	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>  	struct amdgpu_connector_atom_dig *amdgpu_dig_connector = amdgpu_connector->con_priv;
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
> index f81068ba4cc6..c4469702ddc2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
> @@ -420,7 +420,7 @@ void amdgpu_atombios_dp_set_link_config(struct drm_connector *connector,
>  }
>  
>  int amdgpu_atombios_dp_mode_valid_helper(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>  	struct amdgpu_connector_atom_dig *dig_connector;
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.h b/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
> index f59d85eaddf0..3e24acf8133f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.h
> @@ -32,7 +32,7 @@ int amdgpu_atombios_dp_get_panel_mode(struct drm_encoder *encoder,
>  void amdgpu_atombios_dp_set_link_config(struct drm_connector *connector,
>  				 const struct drm_display_mode *mode);
>  int amdgpu_atombios_dp_mode_valid_helper(struct drm_connector *connector,
> -				  struct drm_display_mode *mode);
> +				  const struct drm_display_mode *mode);
>  bool amdgpu_atombios_dp_needs_link_train(struct amdgpu_connector *amdgpu_connector);
>  void amdgpu_atombios_dp_set_rx_power_state(struct drm_connector *connector,
>  				    u8 power_state);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index dbf2ccd0c744..b595622ab0e5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -328,7 +328,7 @@ static int dce_virtual_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status dce_virtual_mode_valid(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 1ce10bc2d37b..a46aadcc42e8 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2836,7 +2836,7 @@ static void handle_edid_mgmt(struct amdgpu_dm_connector *aconnector)
>  }
>  
>  enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *mode)
>  {
>  	int result = MODE_ERROR;
>  	struct dc_sink *dc_sink;
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> index d5aa89ad5571..8ff95533b38c 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> @@ -248,7 +248,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
>  				     int link_index);
>  
>  enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector,
> -				   struct drm_display_mode *mode);
> +				   const struct drm_display_mode *mode);
>  
>  void dm_restore_drm_connector_state(struct drm_device *dev,
>  				    struct drm_connector *connector);
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 036dff8a1f33..bac038a99c28 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -800,7 +800,7 @@ static int ast_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> +			  const struct drm_display_mode *mode)
>  {
>  	struct ast_private *ast = connector->dev->dev_private;
>  	int flags = MODE_NOMODE;
> diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
> index 233980a78591..246e461598d6 100644
> --- a/drivers/gpu/drm/bochs/bochs_kms.c
> +++ b/drivers/gpu/drm/bochs/bochs_kms.c
> @@ -189,7 +189,7 @@ static int bochs_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status bochs_connector_mode_valid(struct drm_connector *connector,
> -				      struct drm_display_mode *mode)
> +				      const struct drm_display_mode *mode)
>  {
>  	struct bochs_device *bochs =
>  		container_of(connector, struct bochs_device, connector);
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index 73021b388e12..e701c4715c78 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -655,7 +655,7 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511,
> -			      struct drm_display_mode *mode)
> +			      const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 165000)
>  		return MODE_CLOCK_HIGH;
> @@ -777,7 +777,7 @@ static int adv7511_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  adv7511_connector_mode_valid(struct drm_connector *connector,
> -			     struct drm_display_mode *mode)
> +			     const struct drm_display_mode *mode)
>  {
>  	struct adv7511 *adv = connector_to_adv7511(connector);
>  
> diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
> index 7ccadba7c98c..94b5610e99fd 100644
> --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
> +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
> @@ -162,7 +162,7 @@ static int ge_b850v3_lvds_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status ge_b850v3_lvds_mode_valid(
> -		struct drm_connector *connector, struct drm_display_mode *mode)
> +		struct drm_connector *connector, const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
> index 60373d7eb220..c01da1b69362 100644
> --- a/drivers/gpu/drm/bridge/sii902x.c
> +++ b/drivers/gpu/drm/bridge/sii902x.c
> @@ -221,7 +221,7 @@ static int sii902x_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status sii902x_mode_valid(struct drm_connector *connector,
> -					       struct drm_display_mode *mode)
> +					       const struct drm_display_mode *mode)
>  {
>  	/* TODO: check mode */
>  
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 0fd9cf27542c..526ba25a1960 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -1103,7 +1103,7 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,
>  }
>  
>  static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector,
> -				   struct drm_display_mode *mode)
> +				   const struct drm_display_mode *mode)
>  {
>  	/* DPI interface clock limitation: upto 154 MHz */
>  	if (mode->clock > 154000)
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 09c4bc0b1859..2a7237c8f56d 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -912,7 +912,7 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
>  }
>  
>  static int hdmi_mode_valid(struct drm_connector *connector,
> -			struct drm_display_mode *mode)
> +			const struct drm_display_mode *mode)
>  {
>  	struct hdmi_context *hdata = connector_to_hdmi(connector);
>  	int ret;
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> index c54806d08dd7..a428ab2ddf00 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -84,7 +84,7 @@ static int fsl_dcu_drm_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int fsl_dcu_drm_connector_mode_valid(struct drm_connector *connector,
> -					    struct drm_display_mode *mode)
> +					    const struct drm_display_mode *mode)
>  {
>  	if (mode->hdisplay & 0xf)
>  		return MODE_ERROR;
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
> index cb5a14b7ec7f..db9d3b91e970 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
> @@ -65,7 +65,7 @@ static void cdv_intel_crt_dpms(struct drm_encoder *encoder, int mode)
>  }
>  
>  static enum drm_mode_status cdv_intel_crt_mode_valid(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
>  		return MODE_NO_DBLESCAN;
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> index 5ea785f07ba8..883a7d54e2a3 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> @@ -507,7 +507,7 @@ static void cdv_intel_edp_backlight_off (struct gma_encoder *intel_encoder)
>  
>  static enum drm_mode_status
>  cdv_intel_dp_mode_valid(struct drm_connector *connector,
> -		    struct drm_display_mode *mode)
> +		    const struct drm_display_mode *mode)
>  {
>  	struct gma_encoder *encoder = gma_attached_encoder(connector);
>  	struct cdv_intel_dp *intel_dp = encoder->dev_priv;
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> index f0878998526a..5185006fcf9c 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> @@ -224,7 +224,7 @@ static int cdv_hdmi_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status cdv_hdmi_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 165000)
>  		return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> index de9531caaca0..c4ed824645fb 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> @@ -245,7 +245,7 @@ static void cdv_intel_lvds_restore(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status cdv_intel_lvds_mode_valid(struct drm_connector *connector,
> -			      struct drm_display_mode *mode)
> +			      const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct drm_psb_private *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
> index fe020926ea4f..efcd25d0041c 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
> @@ -347,7 +347,7 @@ static int mdfld_dsi_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status mdfld_dsi_connector_mode_valid(struct drm_connector *connector,
> -						struct drm_display_mode *mode)
> +						const struct drm_display_mode *mode)
>  {
>  	struct mdfld_dsi_connector *dsi_connector =
>  					mdfld_dsi_connector(connector);
> diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> index 78566a80ad25..a5a189b7585d 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> @@ -510,7 +510,7 @@ static void oaktrail_hdmi_dpms(struct drm_encoder *encoder, int mode)
>  }
>  
>  static enum drm_mode_status oaktrail_hdmi_mode_valid(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 165000)
>  		return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
> index e05e5399af2d..b0dc6ce0c10f 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_drv.h
> +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
> @@ -256,7 +256,7 @@ extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
>  				      const struct drm_display_mode *mode,
>  				      struct drm_display_mode *adjusted_mode);
>  extern enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
> -				     struct drm_display_mode *mode);
> +				     const struct drm_display_mode *mode);
>  extern int psb_intel_lvds_set_property(struct drm_connector *connector,
>  					struct drm_property *property,
>  					uint64_t value);
> diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
> index 8baf6325c6e4..57a81cb6dacd 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
> @@ -344,7 +344,7 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
>  }
>  
>  enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct drm_psb_private *dev_priv = connector->dev->dev_private;
>  	struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
> diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> index f2ee6aa10afa..3abbe392f1c1 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> @@ -1158,7 +1158,7 @@ static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
>  }
>  
>  static enum drm_mode_status psb_intel_sdvo_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct psb_intel_sdvo *psb_intel_sdvo = intel_attached_sdvo(connector);
>  
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index d2f4749ebf8d..5baee4995ae3 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -28,7 +28,7 @@ static int hibmc_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status hibmc_connector_mode_valid(struct drm_connector *connector,
> -				      struct drm_display_mode *mode)
> +				      const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
> index 544a8a2d3562..d97dea4dc582 100644
> --- a/drivers/gpu/drm/i2c/ch7006_drv.c
> +++ b/drivers/gpu/drm/i2c/ch7006_drv.c
> @@ -102,7 +102,7 @@ static bool ch7006_encoder_mode_fixup(struct drm_encoder *encoder,
>  }
>  
>  static int ch7006_encoder_mode_valid(struct drm_encoder *encoder,
> -				     struct drm_display_mode *mode)
> +				     const struct drm_display_mode *mode)
>  {
>  	if (ch7006_lookup_mode(encoder, mode))
>  		return MODE_OK;
> diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
> index c52d7a3af786..e86c386a6fc7 100644
> --- a/drivers/gpu/drm/i2c/sil164_drv.c
> +++ b/drivers/gpu/drm/i2c/sil164_drv.c
> @@ -254,7 +254,7 @@ sil164_encoder_restore(struct drm_encoder *encoder)
>  
>  static int
>  sil164_encoder_mode_valid(struct drm_encoder *encoder,
> -			  struct drm_display_mode *mode)
> +			  const struct drm_display_mode *mode)
>  {
>  	struct sil164_priv *priv = to_sil164_priv(encoder);
>  
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 6ebd8842dbcc..4106bf9aba5d 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1243,7 +1243,7 @@ static int tda998x_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status tda998x_connector_mode_valid(struct drm_connector *connector,
> -					struct drm_display_mode *mode)
> +					const struct drm_display_mode *mode)
>  {
>  	/* TDA19988 dotclock can go up to 165MHz */
>  	struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
> diff --git a/drivers/gpu/drm/i915/dvo.h b/drivers/gpu/drm/i915/dvo.h
> index 5e6a3013da49..d7a259afdbc5 100644
> --- a/drivers/gpu/drm/i915/dvo.h
> +++ b/drivers/gpu/drm/i915/dvo.h
> @@ -75,7 +75,7 @@ struct intel_dvo_dev_ops {
>  	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
>  	 */
>  	int (*mode_valid)(struct intel_dvo_device *dvo,
> -			  struct drm_display_mode *mode);
> +			  const struct drm_display_mode *mode);
>  
>  	/*
>  	 * Callback for preparing mode changes on an output
> diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c b/drivers/gpu/drm/i915/dvo_ch7017.c
> index 80b3e16cf48c..21a76b89209a 100644
> --- a/drivers/gpu/drm/i915/dvo_ch7017.c
> +++ b/drivers/gpu/drm/i915/dvo_ch7017.c
> @@ -246,7 +246,7 @@ static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
> -					      struct drm_display_mode *mode)
> +					      const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 160000)
>  		return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c
> index 7aeeffd2428b..48c69b290621 100644
> --- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
> +++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
> @@ -264,7 +264,7 @@ static enum drm_connector_status ch7xxx_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status ch7xxx_mode_valid(struct intel_dvo_device *dvo,
> -					      struct drm_display_mode *mode)
> +					      const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 165000)
>  		return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/i915/dvo_ivch.c b/drivers/gpu/drm/i915/dvo_ivch.c
> index c73aff163908..9b61e7e4ef05 100644
> --- a/drivers/gpu/drm/i915/dvo_ivch.c
> +++ b/drivers/gpu/drm/i915/dvo_ivch.c
> @@ -313,7 +313,7 @@ static enum drm_connector_status ivch_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status ivch_mode_valid(struct intel_dvo_device *dvo,
> -					    struct drm_display_mode *mode)
> +					    const struct drm_display_mode *mode)
>  {
>  	if (mode->clock > 112000)
>  		return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/i915/dvo_ns2501.c b/drivers/gpu/drm/i915/dvo_ns2501.c
> index 2379c33cfe51..087c87802be6 100644
> --- a/drivers/gpu/drm/i915/dvo_ns2501.c
> +++ b/drivers/gpu/drm/i915/dvo_ns2501.c
> @@ -524,7 +524,7 @@ static enum drm_connector_status ns2501_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status ns2501_mode_valid(struct intel_dvo_device *dvo,
> -					      struct drm_display_mode *mode)
> +					      const struct drm_display_mode *mode)
>  {
>  	DRM_DEBUG_KMS
>  	    ("is mode valid (hdisplay=%d,htotal=%d,vdisplay=%d,vtotal=%d)\n",
> diff --git a/drivers/gpu/drm/i915/dvo_sil164.c b/drivers/gpu/drm/i915/dvo_sil164.c
> index 1c1a0674dbab..d92634cd47e5 100644
> --- a/drivers/gpu/drm/i915/dvo_sil164.c
> +++ b/drivers/gpu/drm/i915/dvo_sil164.c
> @@ -184,7 +184,7 @@ static enum drm_connector_status sil164_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status sil164_mode_valid(struct intel_dvo_device *dvo,
> -					      struct drm_display_mode *mode)
> +					      const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/i915/dvo_tfp410.c b/drivers/gpu/drm/i915/dvo_tfp410.c
> index 31e181da93db..0dce97a92343 100644
> --- a/drivers/gpu/drm/i915/dvo_tfp410.c
> +++ b/drivers/gpu/drm/i915/dvo_tfp410.c
> @@ -216,7 +216,7 @@ static enum drm_connector_status tfp410_detect(struct intel_dvo_device *dvo)
>  }
>  
>  static enum drm_mode_status tfp410_mode_valid(struct intel_dvo_device *dvo,
> -					      struct drm_display_mode *mode)
> +					      const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index de0e22322c76..95604c767f89 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -297,7 +297,7 @@ static void intel_enable_crt(struct intel_encoder *encoder,
>  
>  static enum drm_mode_status
>  intel_crt_mode_valid(struct drm_connector *connector,
> -		     struct drm_display_mode *mode)
> +		     const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index dde92e4af5d3..f8f4884b5add 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -411,7 +411,7 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
>  
>  static enum drm_mode_status
>  intel_dp_mode_valid(struct drm_connector *connector,
> -		    struct drm_display_mode *mode)
> +		    const struct drm_display_mode *mode)
>  {
>  	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 9e6956c08688..6a1c590f8615 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -355,7 +355,7 @@ static int intel_dp_mst_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  intel_dp_mst_mode_valid(struct drm_connector *connector,
> -			struct drm_display_mode *mode)
> +			const struct drm_display_mode *mode)
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct intel_dp *intel_dp = intel_connector->mst_port;
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 51a1d6868b1e..8c2d4f7f4dba 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -1258,7 +1258,7 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,
>  
>  static enum drm_mode_status
>  intel_dsi_mode_valid(struct drm_connector *connector,
> -		     struct drm_display_mode *mode)
> +		     const struct drm_display_mode *mode)
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	const struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index eb0c559b2715..103cfbc07a9b 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -211,7 +211,7 @@ static void intel_enable_dvo(struct intel_encoder *encoder,
>  
>  static enum drm_mode_status
>  intel_dvo_mode_valid(struct drm_connector *connector,
> -		     struct drm_display_mode *mode)
> +		     const struct drm_display_mode *mode)
>  {
>  	struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
>  	const struct drm_display_mode *fixed_mode =
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ee929f31f7db..d0191649be32 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1546,7 +1546,7 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi,
>  
>  static enum drm_mode_status
>  intel_hdmi_mode_valid(struct drm_connector *connector,
> -		      struct drm_display_mode *mode)
> +		      const struct drm_display_mode *mode)
>  {
>  	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
>  	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 8691c86f579c..bbf7b1f103c8 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -374,7 +374,7 @@ static void pch_post_disable_lvds(struct intel_encoder *encoder,
>  
>  static enum drm_mode_status
>  intel_lvds_mode_valid(struct drm_connector *connector,
> -		      struct drm_display_mode *mode)
> +		      const struct drm_display_mode *mode)
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 25005023c243..2edbe16dbae7 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1616,7 +1616,7 @@ static void intel_enable_sdvo(struct intel_encoder *encoder,
>  
>  static enum drm_mode_status
>  intel_sdvo_mode_valid(struct drm_connector *connector,
> -		      struct drm_display_mode *mode)
> +		      const struct drm_display_mode *mode)
>  {
>  	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
>  	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 885fc3809f7f..761eefa4f5b2 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -845,7 +845,7 @@ static const struct tv_mode *intel_tv_mode_find(const struct drm_connector_state
>  
>  static enum drm_mode_status
>  intel_tv_mode_valid(struct drm_connector *connector,
> -		    struct drm_display_mode *mode)
> +		    const struct drm_display_mode *mode)
>  {
>  	const struct tv_mode *tv_mode = intel_tv_mode_find(connector->state);
>  	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
> diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
> index bc27c2699464..9bf5dd96147e 100644
> --- a/drivers/gpu/drm/imx/imx-tve.c
> +++ b/drivers/gpu/drm/imx/imx-tve.c
> @@ -244,7 +244,7 @@ static int imx_tve_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int imx_tve_connector_mode_valid(struct drm_connector *connector,
> -					struct drm_display_mode *mode)
> +					const struct drm_display_mode *mode)
>  {
>  	struct imx_tve *tve = con_to_tve(connector);
>  	unsigned long rate;
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 59a11026dceb..7145a9aebfd7 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1228,7 +1228,7 @@ static int mtk_hdmi_conn_get_modes(struct drm_connector *conn)
>  }
>  
>  static int mtk_hdmi_conn_mode_valid(struct drm_connector *conn,
> -				    struct drm_display_mode *mode)
> +				    const struct drm_display_mode *mode)
>  {
>  	struct mtk_hdmi *hdmi = hdmi_ctx_from_conn(conn);
>  
> diff --git a/drivers/gpu/drm/meson/meson_venc_cvbs.c b/drivers/gpu/drm/meson/meson_venc_cvbs.c
> index 79d95ca8a0c0..641447cadd94 100644
> --- a/drivers/gpu/drm/meson/meson_venc_cvbs.c
> +++ b/drivers/gpu/drm/meson/meson_venc_cvbs.c
> @@ -111,7 +111,7 @@ static int meson_cvbs_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int meson_cvbs_connector_mode_valid(struct drm_connector *connector,
> -					   struct drm_display_mode *mode)
> +					   const struct drm_display_mode *mode)
>  {
>  	/* Validate the modes added in get_modes */
>  	return MODE_OK;
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index 8918539a19aa..c188bbd16845 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -1560,7 +1560,7 @@ static int mga_vga_get_modes(struct drm_connector *connector)
>  	return ret;
>  }
>  
> -static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode *mode,
> +static uint32_t mga_vga_calculate_mode_bandwidth(const struct drm_display_mode *mode,
>  							int bits_per_pixel)
>  {
>  	uint32_t total_area, divisor;
> @@ -1587,7 +1587,7 @@ static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode *mode,
>  #define MODE_BANDWIDTH	MODE_BAD
>  
>  static enum drm_mode_status mga_vga_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct mga_device *mdev = (struct mga_device*)dev->dev_private;
> diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> index e3b1c86b7aae..1b09df4524ba 100644
> --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> @@ -72,7 +72,7 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct mdp4_lvds_connector *mdp4_lvds_connector =
>  			to_mdp4_lvds_connector(connector);
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index 4cb1cb68878b..a024acf9b793 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -405,7 +405,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	int id = dsi_mgr_connector_get_id(connector);
>  	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
> diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c
> index 6f3fc6b0f0a3..af05c3090036 100644
> --- a/drivers/gpu/drm/msm/edp/edp_connector.c
> +++ b/drivers/gpu/drm/msm/edp/edp_connector.c
> @@ -64,7 +64,7 @@ static int edp_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int edp_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct edp_connector *edp_connector = to_edp_connector(connector);
>  	struct msm_edp *edp = edp_connector->edp;
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> index c0848dfedd50..ba218c611021 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> @@ -403,7 +403,7 @@ static int msm_hdmi_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int msm_hdmi_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector);
>  	struct hdmi *hdmi = hdmi_connector->hdmi;
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> index 6d99f11fee4e..6dd956bf77b9 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> @@ -301,7 +301,7 @@ static int nv17_tv_get_modes(struct drm_encoder *encoder,
>  }
>  
>  static int nv17_tv_mode_valid(struct drm_encoder *encoder,
> -			      struct drm_display_mode *mode)
> +			      const struct drm_display_mode *mode)
>  {
>  	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
>  
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index b83465ae7c1b..92cf754842a3 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -838,7 +838,7 @@ nv50_mstc_best_encoder(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  nv50_mstc_mode_valid(struct drm_connector *connector,
> -		     struct drm_display_mode *mode)
> +		     const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 7b557c354307..308e28c1871d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -1007,7 +1007,7 @@ get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi)
>  
>  static enum drm_mode_status
>  nouveau_connector_mode_valid(struct drm_connector *connector,
> -			     struct drm_display_mode *mode)
> +			     const struct drm_display_mode *mode)
>  {
>  	struct nouveau_connector *nv_connector = nouveau_connector(connector);
>  	struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> index 5cde26ac937b..e316f6d5ac5d 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -166,7 +166,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int omap_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> +				 const struct drm_display_mode *mode)
>  {
>  	struct omap_connector *omap_connector = to_omap_connector(connector);
>  	struct omap_dss_device *dssdev = omap_connector->dssdev;
> @@ -174,10 +174,11 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
>  	struct videomode vm = {0};
>  	struct drm_device *dev = connector->dev;
>  	struct drm_display_mode *new_mode;
> +	unsigned int vrefresh;
>  	int r, ret = MODE_BAD;
>  
>  	drm_display_mode_to_videomode(mode, &vm);
> -	mode->vrefresh = drm_mode_vrefresh(mode);
> +	vrefresh = drm_mode_vrefresh(mode);
>  
>  	/*
>  	 * if the panel driver doesn't have a check_timings, it's most likely
> @@ -212,7 +213,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
>  
>  		new_mode->clock = vm.pixelclock / 1000;
>  		new_mode->vrefresh = 0;
> -		if (mode->vrefresh == drm_mode_vrefresh(new_mode))
> +		if (vrefresh == drm_mode_vrefresh(new_mode))
>  			ret = MODE_OK;
>  		drm_mode_destroy(dev, new_mode);
>  	}
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index b8cda9449241..1e261962f03d 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -955,7 +955,7 @@ static int qxl_conn_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status qxl_conn_mode_valid(struct drm_connector *connector,
> -			       struct drm_display_mode *mode)
> +			       const struct drm_display_mode *mode)
>  {
>  	struct drm_device *ddev = connector->dev;
>  	struct qxl_device *qdev = ddev->dev_private;
> diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
> index 3e798593e042..d3cd8169fd68 100644
> --- a/drivers/gpu/drm/radeon/atombios_dp.c
> +++ b/drivers/gpu/drm/radeon/atombios_dp.c
> @@ -474,7 +474,7 @@ void radeon_dp_set_link_config(struct drm_connector *connector,
>  }
>  
>  int radeon_dp_mode_valid_helper(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>  	struct radeon_connector_atom_dig *dig_connector;
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 2aea2bdff99b..1d84aad22858 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -853,7 +853,7 @@ static int radeon_lvds_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status radeon_lvds_mode_valid(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
>  
> @@ -1013,7 +1013,7 @@ static int radeon_vga_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status radeon_vga_mode_valid(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct radeon_device *rdev = dev->dev_private;
> @@ -1157,7 +1157,7 @@ static int radeon_tv_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status radeon_tv_mode_valid(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	if ((mode->hdisplay > 1024) || (mode->vdisplay > 768))
>  		return MODE_CLOCK_RANGE;
> @@ -1499,7 +1499,7 @@ static void radeon_dvi_force(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct radeon_device *rdev = dev->dev_private;
> @@ -1801,7 +1801,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
>  }
>  
>  static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connector,
> -				  struct drm_display_mode *mode)
> +				  const struct drm_display_mode *mode)
>  {
>  	struct drm_device *dev = connector->dev;
>  	struct radeon_device *rdev = dev->dev_private;
> diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> index cd8a3ee16649..fc188cafe8e8 100644
> --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> @@ -211,7 +211,7 @@ static int radeon_dp_mst_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  radeon_dp_mst_mode_valid(struct drm_connector *connector,
> -			struct drm_display_mode *mode)
> +			 const struct drm_display_mode *mode)
>  {
>  	/* TODO - validate mode against available PBN for link */
>  	if (mode->clock < 10000)
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..f87e1ac1384b 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -746,7 +746,7 @@ extern struct edid *radeon_connector_edid(struct drm_connector *connector);
>  
>  extern void radeon_connector_hotplug(struct drm_connector *connector);
>  extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
> -				       struct drm_display_mode *mode);
> +				       const struct drm_display_mode *mode);
>  extern void radeon_dp_set_link_config(struct drm_connector *connector,
>  				      const struct drm_display_mode *mode);
>  extern void radeon_dp_link_train(struct drm_encoder *encoder,
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index c6fbdcd87c16..605dc0c3d100 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> @@ -284,7 +284,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
> -				       struct drm_display_mode *mode)
> +				       const struct drm_display_mode *mode)
>  {
>  	struct cdn_dp_device *dp = connector_to_dp(connector);
>  	struct drm_display_info *display_info = &dp->connector.display_info;
> diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
> index 88d0774c97bd..0707cbab5644 100644
> --- a/drivers/gpu/drm/rockchip/inno_hdmi.c
> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
> @@ -575,7 +575,7 @@ static int inno_hdmi_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  inno_hdmi_connector_mode_valid(struct drm_connector *connector,
> -			       struct drm_display_mode *mode)
> +			       const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index a5979cd25cc7..5dc71bc9a7b4 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -347,7 +347,7 @@ static int sti_dvo_connector_get_modes(struct drm_connector *connector)
>  #define CLK_TOLERANCE_HZ 50
>  
>  static int sti_dvo_connector_mode_valid(struct drm_connector *connector,
> -					struct drm_display_mode *mode)
> +					const struct drm_display_mode *mode)
>  {
>  	int target = mode->clock * 1000;
>  	int target_min = target - CLK_TOLERANCE_HZ;
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 67bbdb49fffc..b65c9c596a89 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -597,7 +597,7 @@ static int sti_hda_connector_get_modes(struct drm_connector *connector)
>  #define CLK_TOLERANCE_HZ 50
>  
>  static int sti_hda_connector_mode_valid(struct drm_connector *connector,
> -					struct drm_display_mode *mode)
> +					const struct drm_display_mode *mode)
>  {
>  	int target = mode->clock * 1000;
>  	int target_min = target - CLK_TOLERANCE_HZ;
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 58f431102512..ef8a7c78f00a 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -990,7 +990,7 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
>  #define CLK_TOLERANCE_HZ 50
>  
>  static int sti_hdmi_connector_mode_valid(struct drm_connector *connector,
> -					struct drm_display_mode *mode)
> +					const struct drm_display_mode *mode)
>  {
>  	int target = mode->clock * 1000;
>  	int target_min = target - CLK_TOLERANCE_HZ;
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
> index b070d522ed8d..9808d0ee7fa8 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
> @@ -508,7 +508,7 @@ static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
>  }
>  
>  static int sun4i_tv_comp_mode_valid(struct drm_connector *connector,
> -				    struct drm_display_mode *mode)
> +				    const struct drm_display_mode *mode)
>  {
>  	/* TODO */
>  	return MODE_OK;
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index 87c5d89bc9ba..6a7d17740a44 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -815,7 +815,7 @@ static const struct drm_connector_funcs tegra_dsi_connector_funcs = {
>  
>  static enum drm_mode_status
>  tegra_dsi_connector_mode_valid(struct drm_connector *connector,
> -			       struct drm_display_mode *mode)
> +			       const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
> index 784739a9f497..788a8f6753d7 100644
> --- a/drivers/gpu/drm/tegra/hdmi.c
> +++ b/drivers/gpu/drm/tegra/hdmi.c
> @@ -1164,7 +1164,7 @@ static const struct drm_connector_funcs tegra_hdmi_connector_funcs = {
>  
>  static enum drm_mode_status
>  tegra_hdmi_connector_mode_valid(struct drm_connector *connector,
> -				struct drm_display_mode *mode)
> +				const struct drm_display_mode *mode)
>  {
>  	struct tegra_output *output = connector_to_output(connector);
>  	struct tegra_hdmi *hdmi = to_hdmi(output);
> diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
> index 78ec5193741d..da605bea82ea 100644
> --- a/drivers/gpu/drm/tegra/rgb.c
> +++ b/drivers/gpu/drm/tegra/rgb.c
> @@ -98,7 +98,7 @@ static const struct drm_connector_funcs tegra_rgb_connector_funcs = {
>  
>  static enum drm_mode_status
>  tegra_rgb_connector_mode_valid(struct drm_connector *connector,
> -			       struct drm_display_mode *mode)
> +			       const struct drm_display_mode *mode)
>  {
>  	/*
>  	 * FIXME: For now, always assume that the mode is okay. There are
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 7d2a955fc515..05f93200646a 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -1493,7 +1493,7 @@ static int tegra_sor_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  tegra_sor_connector_mode_valid(struct drm_connector *connector,
> -			       struct drm_display_mode *mode)
> +			       const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index 1067e702c22c..08ea0da4d66a 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -749,7 +749,8 @@ int tilcdc_crtc_max_width(struct drm_crtc *crtc)
>  	return max_width;
>  }
>  
> -int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode)
> +int tilcdc_crtc_mode_valid(struct drm_crtc *crtc,
> +			   const struct drm_display_mode *mode)
>  {
>  	struct tilcdc_drm_private *priv = crtc->dev->dev_private;
>  	unsigned int bandwidth;
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> index ead512216669..61b4111b61b7 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> @@ -171,7 +171,8 @@ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
>  		const struct tilcdc_panel_info *info);
>  void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc,
>  					bool simulate_vesa_sync);
> -int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode);
> +int tilcdc_crtc_mode_valid(struct drm_crtc *crtc,
> +			   const struct drm_display_mode *mode);
>  int tilcdc_crtc_max_width(struct drm_crtc *crtc);
>  void tilcdc_crtc_shutdown(struct drm_crtc *crtc);
>  int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> index d651bdd6597e..6f548c9f81b1 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> @@ -41,7 +41,7 @@ static const struct tilcdc_panel_info panel_info_default = {
>  };
>  
>  static int tilcdc_external_mode_valid(struct drm_connector *connector,
> -				      struct drm_display_mode *mode)
> +				      const struct drm_display_mode *mode)
>  {
>  	struct tilcdc_drm_private *priv = connector->dev->dev_private;
>  	int ret;
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
> index d616d64a6725..f1825a6b7d57 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
> @@ -171,7 +171,7 @@ static int panel_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int panel_connector_mode_valid(struct drm_connector *connector,
> -		  struct drm_display_mode *mode)
> +		  const struct drm_display_mode *mode)
>  {
>  	struct tilcdc_drm_private *priv = connector->dev->dev_private;
>  	/* our only constraints are what the crtc can generate: */
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> index c45cabb38db0..153ffbdc4106 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> @@ -184,7 +184,7 @@ static int tfp410_connector_get_modes(struct drm_connector *connector)
>  }
>  
>  static int tfp410_connector_mode_valid(struct drm_connector *connector,
> -		  struct drm_display_mode *mode)
> +		  const struct drm_display_mode *mode)
>  {
>  	struct tilcdc_drm_private *priv = connector->dev->dev_private;
>  	/* our only constraints are what the crtc can generate: */
> diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
> index 09dc585aa46f..5477767de55c 100644
> --- a/drivers/gpu/drm/udl/udl_connector.c
> +++ b/drivers/gpu/drm/udl/udl_connector.c
> @@ -106,7 +106,7 @@ static int udl_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status udl_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> +			  const struct drm_display_mode *mode)
>  {
>  	struct udl_device *udl = connector->dev->dev_private;
>  	if (!udl->sku_pixel_limit)
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index a5edd86603d9..69453a2cfcd9 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -209,7 +209,7 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector)
>  }
>  
>  static enum drm_mode_status virtio_gpu_conn_mode_valid(struct drm_connector *connector,
> -				      struct drm_display_mode *mode)
> +				      const struct drm_display_mode *mode)
>  {
>  	struct virtio_gpu_output *output =
>  		drm_connector_to_virtio_gpu_output(connector);
> diff --git a/drivers/gpu/drm/zte/zx_hdmi.c b/drivers/gpu/drm/zte/zx_hdmi.c
> index 13ea90f7a185..e2d151b37c06 100644
> --- a/drivers/gpu/drm/zte/zx_hdmi.c
> +++ b/drivers/gpu/drm/zte/zx_hdmi.c
> @@ -281,7 +281,7 @@ static int zx_hdmi_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  zx_hdmi_connector_mode_valid(struct drm_connector *connector,
> -			     struct drm_display_mode *mode)
> +			     const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/gpu/drm/zte/zx_tvenc.c b/drivers/gpu/drm/zte/zx_tvenc.c
> index 0de1a71ca4e0..fd1c20e234ce 100644
> --- a/drivers/gpu/drm/zte/zx_tvenc.c
> +++ b/drivers/gpu/drm/zte/zx_tvenc.c
> @@ -132,7 +132,7 @@ static const struct zx_tvenc_mode *tvenc_modes[] = {
>  };
>  
>  static const struct zx_tvenc_mode *
> -zx_tvenc_find_zmode(struct drm_display_mode *mode)
> +zx_tvenc_find_zmode(const struct drm_display_mode *mode)
>  {
>  	int i;
>  
> @@ -249,7 +249,7 @@ static int zx_tvenc_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  zx_tvenc_connector_mode_valid(struct drm_connector *connector,
> -			      struct drm_display_mode *mode)
> +			      const struct drm_display_mode *mode)
>  {
>  	struct zx_tvenc *tvenc = to_zx_tvenc(connector);
>  	const struct zx_tvenc_mode *zmode;
> diff --git a/drivers/gpu/drm/zte/zx_vga.c b/drivers/gpu/drm/zte/zx_vga.c
> index 3e7e33cd3dfa..450f8938daa5 100644
> --- a/drivers/gpu/drm/zte/zx_vga.c
> +++ b/drivers/gpu/drm/zte/zx_vga.c
> @@ -118,7 +118,7 @@ static int zx_vga_connector_get_modes(struct drm_connector *connector)
>  
>  static enum drm_mode_status
>  zx_vga_connector_mode_valid(struct drm_connector *connector,
> -			    struct drm_display_mode *mode)
> +			    const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
> index b265fe924556..8cde6ca7014c 100644
> --- a/drivers/staging/vboxvideo/vbox_mode.c
> +++ b/drivers/staging/vboxvideo/vbox_mode.c
> @@ -574,7 +574,7 @@ static int vbox_get_modes(struct drm_connector *connector)
>  }
>  
>  static int vbox_mode_valid(struct drm_connector *connector,
> -			   struct drm_display_mode *mode)
> +			   const struct drm_display_mode *mode)
>  {
>  	return MODE_OK;
>  }
> diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
> index 1107b4b1c599..b79094bc2fcd 100644
> --- a/include/drm/drm_encoder_slave.h
> +++ b/include/drm/drm_encoder_slave.h
> @@ -58,7 +58,7 @@ struct drm_encoder_slave_funcs {
>  			   const struct drm_display_mode *mode,
>  			   struct drm_display_mode *adjusted_mode);
>  	int (*mode_valid)(struct drm_encoder *encoder,
> -			  struct drm_display_mode *mode);
> +			  const struct drm_display_mode *mode);
>  	void (*mode_set)(struct drm_encoder *encoder,
>  			 struct drm_display_mode *mode,
>  			 struct drm_display_mode *adjusted_mode);
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 35e2a3a79fc5..19bb03213af3 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -881,7 +881,7 @@ struct drm_connector_helper_funcs {
>  	 * drm_mode_status.
>  	 */
>  	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
> -					   struct drm_display_mode *mode);
> +					   const struct drm_display_mode *mode);
>  	/**
>  	 * @best_encoder:
>  	 *
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
On 07/06/18 15:03, Ville Syrjälä wrote:
> On Wed, Jun 06, 2018 at 12:08:12PM +0300, Laurent Pinchart wrote:
>> The drm_connector_helper_funcs .mode_valid() operation should not modify
>> the mode it receives in any way. To make this explicit, constify the
>> mode pointer as done for all other .mode_valid() operations, and update
>> all drivers accordingly.
>>
>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Didn't spot anything wrong. I think the omap case should be fine as
> well since the probe helper will populate the vrefresh for the mode
> eventually.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Looks fine to me too, although in omap_connector the debug print at the
end will print the original vrefresh, not the calculated one. I'm not
sure which one it should print, though.

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Hi Ville,

On Thursday, 7 June 2018 15:03:12 EEST Ville Syrjälä wrote:
> On Wed, Jun 06, 2018 at 12:08:12PM +0300, Laurent Pinchart wrote:
> > The drm_connector_helper_funcs .mode_valid() operation should not modify
> > the mode it receives in any way. To make this explicit, constify the
> > mode pointer as done for all other .mode_valid() operations, and update
> > all drivers accordingly.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Didn't spot anything wrong. I think the omap case should be fine as
> well since the probe helper will populate the vrefresh for the mode
> eventually.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

The patch has lived in my public tree for a few days now and the kbuild bot 
hasn't complained (or rather it complained on the previous version that I 
hadn't posted to the list yet, and I've fixed the problems before posting this 
version). Given the risk of conflicts I'd rather get this merged sooner than 
later. Is that fine with you ?

> > ---
> > 
> > This patch touches lots of drivers, so checkpatch.pl created a huge CC
> > list that would likely be too large for the mailing list. As changes to
> > most files just boil down to adding a const keyword, I've decided to only
> > CC the DRM misc maintainers, as well as Tomi for omapdrm as the change to
> > that driver is slightly more complex.
> > 
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |  8 ++++----
> >  drivers/gpu/drm/amd/amdgpu/atombios_dp.c                 |  2 +-
> >  drivers/gpu/drm/amd/amdgpu/atombios_dp.h                 |  2 +-
> >  drivers/gpu/drm/amd/amdgpu/dce_virtual.c                 |  2 +-
> >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c        |  2 +-
> >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h        |  2 +-
> >  drivers/gpu/drm/ast/ast_mode.c                           |  2 +-
> >  drivers/gpu/drm/bochs/bochs_kms.c                        |  2 +-
> >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c             |  4 ++--
> >  drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |  2 +-
> >  drivers/gpu/drm/bridge/sii902x.c                         |  2 +-
> >  drivers/gpu/drm/bridge/tc358767.c                        |  2 +-
> >  drivers/gpu/drm/exynos/exynos_hdmi.c                     |  2 +-
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c                |  2 +-
> >  drivers/gpu/drm/gma500/cdv_intel_crt.c                   |  2 +-
> >  drivers/gpu/drm/gma500/cdv_intel_dp.c                    |  2 +-
> >  drivers/gpu/drm/gma500/cdv_intel_hdmi.c                  |  2 +-
> >  drivers/gpu/drm/gma500/cdv_intel_lvds.c                  |  2 +-
> >  drivers/gpu/drm/gma500/mdfld_dsi_output.c                |  2 +-
> >  drivers/gpu/drm/gma500/oaktrail_hdmi.c                   |  2 +-
> >  drivers/gpu/drm/gma500/psb_intel_drv.h                   |  2 +-
> >  drivers/gpu/drm/gma500/psb_intel_lvds.c                  |  2 +-
> >  drivers/gpu/drm/gma500/psb_intel_sdvo.c                  |  2 +-
> >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c         |  2 +-
> >  drivers/gpu/drm/i2c/ch7006_drv.c                         |  2 +-
> >  drivers/gpu/drm/i2c/sil164_drv.c                         |  2 +-
> >  drivers/gpu/drm/i2c/tda998x_drv.c                        |  2 +-
> >  drivers/gpu/drm/i915/dvo.h                               |  2 +-
> >  drivers/gpu/drm/i915/dvo_ch7017.c                        |  2 +-
> >  drivers/gpu/drm/i915/dvo_ch7xxx.c                        |  2 +-
> >  drivers/gpu/drm/i915/dvo_ivch.c                          |  2 +-
> >  drivers/gpu/drm/i915/dvo_ns2501.c                        |  2 +-
> >  drivers/gpu/drm/i915/dvo_sil164.c                        |  2 +-
> >  drivers/gpu/drm/i915/dvo_tfp410.c                        |  2 +-
> >  drivers/gpu/drm/i915/intel_crt.c                         |  2 +-
> >  drivers/gpu/drm/i915/intel_dp.c                          |  2 +-
> >  drivers/gpu/drm/i915/intel_dp_mst.c                      |  2 +-
> >  drivers/gpu/drm/i915/intel_dsi.c                         |  2 +-
> >  drivers/gpu/drm/i915/intel_dvo.c                         |  2 +-
> >  drivers/gpu/drm/i915/intel_hdmi.c                        |  2 +-
> >  drivers/gpu/drm/i915/intel_lvds.c                        |  2 +-
> >  drivers/gpu/drm/i915/intel_sdvo.c                        |  2 +-
> >  drivers/gpu/drm/i915/intel_tv.c                          |  2 +-
> >  drivers/gpu/drm/imx/imx-tve.c                            |  2 +-
> >  drivers/gpu/drm/mediatek/mtk_hdmi.c                      |  2 +-
> >  drivers/gpu/drm/meson/meson_venc_cvbs.c                  |  2 +-
> >  drivers/gpu/drm/mgag200/mgag200_mode.c                   |  4 ++--
> >  drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c      |  2 +-
> >  drivers/gpu/drm/msm/dsi/dsi_manager.c                    |  2 +-
> >  drivers/gpu/drm/msm/edp/edp_connector.c                  |  2 +-
> >  drivers/gpu/drm/msm/hdmi/hdmi_connector.c                |  2 +-
> >  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c                |  2 +-
> >  drivers/gpu/drm/nouveau/dispnv50/disp.c                  |  2 +-
> >  drivers/gpu/drm/nouveau/nouveau_connector.c              |  2 +-
> >  drivers/gpu/drm/omapdrm/omap_connector.c                 |  7 ++++---
> >  drivers/gpu/drm/qxl/qxl_display.c                        |  2 +-
> >  drivers/gpu/drm/radeon/atombios_dp.c                     |  2 +-
> >  drivers/gpu/drm/radeon/radeon_connectors.c               | 10 +++++-----
> >  drivers/gpu/drm/radeon/radeon_dp_mst.c                   |  2 +-
> >  drivers/gpu/drm/radeon/radeon_mode.h                     |  2 +-
> >  drivers/gpu/drm/rockchip/cdn-dp-core.c                   |  2 +-
> >  drivers/gpu/drm/rockchip/inno_hdmi.c                     |  2 +-
> >  drivers/gpu/drm/sti/sti_dvo.c                            |  2 +-
> >  drivers/gpu/drm/sti/sti_hda.c                            |  2 +-
> >  drivers/gpu/drm/sti/sti_hdmi.c                           |  2 +-
> >  drivers/gpu/drm/sun4i/sun4i_tv.c                         |  2 +-
> >  drivers/gpu/drm/tegra/dsi.c                              |  2 +-
> >  drivers/gpu/drm/tegra/hdmi.c                             |  2 +-
> >  drivers/gpu/drm/tegra/rgb.c                              |  2 +-
> >  drivers/gpu/drm/tegra/sor.c                              |  2 +-
> >  drivers/gpu/drm/tilcdc/tilcdc_crtc.c                     |  3 ++-
> >  drivers/gpu/drm/tilcdc/tilcdc_drv.h                      |  3 ++-
> >  drivers/gpu/drm/tilcdc/tilcdc_external.c                 |  2 +-
> >  drivers/gpu/drm/tilcdc/tilcdc_panel.c                    |  2 +-
> >  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c                   |  2 +-
> >  drivers/gpu/drm/udl/udl_connector.c                      |  2 +-
> >  drivers/gpu/drm/virtio/virtgpu_display.c                 |  2 +-
> >  drivers/gpu/drm/zte/zx_hdmi.c                            |  2 +-
> >  drivers/gpu/drm/zte/zx_tvenc.c                           |  4 ++--
> >  drivers/gpu/drm/zte/zx_vga.c                             |  2 +-
> >  drivers/staging/vboxvideo/vbox_mode.c                    |  2 +-
> >  include/drm/drm_encoder_slave.h                          |  2 +-
> >  include/drm/drm_modeset_helper_vtables.h                 |  2 +-
> >  83 files changed, 98 insertions(+), 95 deletions(-)

[snip]
On Thu, Jun 07, 2018 at 03:13:23PM +0300, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Thursday, 7 June 2018 15:03:12 EEST Ville Syrjälä wrote:
> > On Wed, Jun 06, 2018 at 12:08:12PM +0300, Laurent Pinchart wrote:
> > > The drm_connector_helper_funcs .mode_valid() operation should not modify
> > > the mode it receives in any way. To make this explicit, constify the
> > > mode pointer as done for all other .mode_valid() operations, and update
> > > all drivers accordingly.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > Didn't spot anything wrong. I think the omap case should be fine as
> > well since the probe helper will populate the vrefresh for the mode
> > eventually.
> > 
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The patch has lived in my public tree for a few days now and the kbuild bot 
> hasn't complained (or rather it complained on the previous version that I 
> hadn't posted to the list yet, and I've fixed the problems before posting this 
> version). Given the risk of conflicts I'd rather get this merged sooner than 
> later. Is that fine with you ?

Seems safe to me. So IMO just push if no one has complained.

> 
> > > ---
> > > 
> > > This patch touches lots of drivers, so checkpatch.pl created a huge CC
> > > list that would likely be too large for the mailing list. As changes to
> > > most files just boil down to adding a const keyword, I've decided to only
> > > CC the DRM misc maintainers, as well as Tomi for omapdrm as the change to
> > > that driver is slightly more complex.
> > > 
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |  8 ++++----
> > >  drivers/gpu/drm/amd/amdgpu/atombios_dp.c                 |  2 +-
> > >  drivers/gpu/drm/amd/amdgpu/atombios_dp.h                 |  2 +-
> > >  drivers/gpu/drm/amd/amdgpu/dce_virtual.c                 |  2 +-
> > >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c        |  2 +-
> > >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h        |  2 +-
> > >  drivers/gpu/drm/ast/ast_mode.c                           |  2 +-
> > >  drivers/gpu/drm/bochs/bochs_kms.c                        |  2 +-
> > >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c             |  4 ++--
> > >  drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |  2 +-
> > >  drivers/gpu/drm/bridge/sii902x.c                         |  2 +-
> > >  drivers/gpu/drm/bridge/tc358767.c                        |  2 +-
> > >  drivers/gpu/drm/exynos/exynos_hdmi.c                     |  2 +-
> > >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c                |  2 +-
> > >  drivers/gpu/drm/gma500/cdv_intel_crt.c                   |  2 +-
> > >  drivers/gpu/drm/gma500/cdv_intel_dp.c                    |  2 +-
> > >  drivers/gpu/drm/gma500/cdv_intel_hdmi.c                  |  2 +-
> > >  drivers/gpu/drm/gma500/cdv_intel_lvds.c                  |  2 +-
> > >  drivers/gpu/drm/gma500/mdfld_dsi_output.c                |  2 +-
> > >  drivers/gpu/drm/gma500/oaktrail_hdmi.c                   |  2 +-
> > >  drivers/gpu/drm/gma500/psb_intel_drv.h                   |  2 +-
> > >  drivers/gpu/drm/gma500/psb_intel_lvds.c                  |  2 +-
> > >  drivers/gpu/drm/gma500/psb_intel_sdvo.c                  |  2 +-
> > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c         |  2 +-
> > >  drivers/gpu/drm/i2c/ch7006_drv.c                         |  2 +-
> > >  drivers/gpu/drm/i2c/sil164_drv.c                         |  2 +-
> > >  drivers/gpu/drm/i2c/tda998x_drv.c                        |  2 +-
> > >  drivers/gpu/drm/i915/dvo.h                               |  2 +-
> > >  drivers/gpu/drm/i915/dvo_ch7017.c                        |  2 +-
> > >  drivers/gpu/drm/i915/dvo_ch7xxx.c                        |  2 +-
> > >  drivers/gpu/drm/i915/dvo_ivch.c                          |  2 +-
> > >  drivers/gpu/drm/i915/dvo_ns2501.c                        |  2 +-
> > >  drivers/gpu/drm/i915/dvo_sil164.c                        |  2 +-
> > >  drivers/gpu/drm/i915/dvo_tfp410.c                        |  2 +-
> > >  drivers/gpu/drm/i915/intel_crt.c                         |  2 +-
> > >  drivers/gpu/drm/i915/intel_dp.c                          |  2 +-
> > >  drivers/gpu/drm/i915/intel_dp_mst.c                      |  2 +-
> > >  drivers/gpu/drm/i915/intel_dsi.c                         |  2 +-
> > >  drivers/gpu/drm/i915/intel_dvo.c                         |  2 +-
> > >  drivers/gpu/drm/i915/intel_hdmi.c                        |  2 +-
> > >  drivers/gpu/drm/i915/intel_lvds.c                        |  2 +-
> > >  drivers/gpu/drm/i915/intel_sdvo.c                        |  2 +-
> > >  drivers/gpu/drm/i915/intel_tv.c                          |  2 +-
> > >  drivers/gpu/drm/imx/imx-tve.c                            |  2 +-
> > >  drivers/gpu/drm/mediatek/mtk_hdmi.c                      |  2 +-
> > >  drivers/gpu/drm/meson/meson_venc_cvbs.c                  |  2 +-
> > >  drivers/gpu/drm/mgag200/mgag200_mode.c                   |  4 ++--
> > >  drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c      |  2 +-
> > >  drivers/gpu/drm/msm/dsi/dsi_manager.c                    |  2 +-
> > >  drivers/gpu/drm/msm/edp/edp_connector.c                  |  2 +-
> > >  drivers/gpu/drm/msm/hdmi/hdmi_connector.c                |  2 +-
> > >  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c                |  2 +-
> > >  drivers/gpu/drm/nouveau/dispnv50/disp.c                  |  2 +-
> > >  drivers/gpu/drm/nouveau/nouveau_connector.c              |  2 +-
> > >  drivers/gpu/drm/omapdrm/omap_connector.c                 |  7 ++++---
> > >  drivers/gpu/drm/qxl/qxl_display.c                        |  2 +-
> > >  drivers/gpu/drm/radeon/atombios_dp.c                     |  2 +-
> > >  drivers/gpu/drm/radeon/radeon_connectors.c               | 10 +++++-----
> > >  drivers/gpu/drm/radeon/radeon_dp_mst.c                   |  2 +-
> > >  drivers/gpu/drm/radeon/radeon_mode.h                     |  2 +-
> > >  drivers/gpu/drm/rockchip/cdn-dp-core.c                   |  2 +-
> > >  drivers/gpu/drm/rockchip/inno_hdmi.c                     |  2 +-
> > >  drivers/gpu/drm/sti/sti_dvo.c                            |  2 +-
> > >  drivers/gpu/drm/sti/sti_hda.c                            |  2 +-
> > >  drivers/gpu/drm/sti/sti_hdmi.c                           |  2 +-
> > >  drivers/gpu/drm/sun4i/sun4i_tv.c                         |  2 +-
> > >  drivers/gpu/drm/tegra/dsi.c                              |  2 +-
> > >  drivers/gpu/drm/tegra/hdmi.c                             |  2 +-
> > >  drivers/gpu/drm/tegra/rgb.c                              |  2 +-
> > >  drivers/gpu/drm/tegra/sor.c                              |  2 +-
> > >  drivers/gpu/drm/tilcdc/tilcdc_crtc.c                     |  3 ++-
> > >  drivers/gpu/drm/tilcdc/tilcdc_drv.h                      |  3 ++-
> > >  drivers/gpu/drm/tilcdc/tilcdc_external.c                 |  2 +-
> > >  drivers/gpu/drm/tilcdc/tilcdc_panel.c                    |  2 +-
> > >  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c                   |  2 +-
> > >  drivers/gpu/drm/udl/udl_connector.c                      |  2 +-
> > >  drivers/gpu/drm/virtio/virtgpu_display.c                 |  2 +-
> > >  drivers/gpu/drm/zte/zx_hdmi.c                            |  2 +-
> > >  drivers/gpu/drm/zte/zx_tvenc.c                           |  4 ++--
> > >  drivers/gpu/drm/zte/zx_vga.c                             |  2 +-
> > >  drivers/staging/vboxvideo/vbox_mode.c                    |  2 +-
> > >  include/drm/drm_encoder_slave.h                          |  2 +-
> > >  include/drm/drm_modeset_helper_vtables.h                 |  2 +-
> > >  83 files changed, 98 insertions(+), 95 deletions(-)
> 
> [snip]
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 
>
On Mon, Jun 11, 2018 at 07:51:01PM +0300, Ville Syrjälä wrote:
> On Thu, Jun 07, 2018 at 03:13:23PM +0300, Laurent Pinchart wrote:
> > Hi Ville,
> > 
> > On Thursday, 7 June 2018 15:03:12 EEST Ville Syrjälä wrote:
> > > On Wed, Jun 06, 2018 at 12:08:12PM +0300, Laurent Pinchart wrote:
> > > > The drm_connector_helper_funcs .mode_valid() operation should not modify
> > > > the mode it receives in any way. To make this explicit, constify the
> > > > mode pointer as done for all other .mode_valid() operations, and update
> > > > all drivers accordingly.
> > > > 
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > 
> > > Didn't spot anything wrong. I think the omap case should be fine as
> > > well since the probe helper will populate the vrefresh for the mode
> > > eventually.
> > > 
> > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > The patch has lived in my public tree for a few days now and the kbuild bot 
> > hasn't complained (or rather it complained on the previous version that I 
> > hadn't posted to the list yet, and I've fixed the problems before posting this 
> > version). Given the risk of conflicts I'd rather get this merged sooner than 
> > later. Is that fine with you ?
> 
> Seems safe to me. So IMO just push if no one has complained.

Hm I haven't seen this land yet. Since you (= Laurent) have commit rights,
I assume it'll hapen without my involvement ...
-Daniel

> 
> > 
> > > > ---
> > > > 
> > > > This patch touches lots of drivers, so checkpatch.pl created a huge CC
> > > > list that would likely be too large for the mailing list. As changes to
> > > > most files just boil down to adding a const keyword, I've decided to only
> > > > CC the DRM misc maintainers, as well as Tomi for omapdrm as the change to
> > > > that driver is slightly more complex.
> > > > 
> > > >  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |  8 ++++----
> > > >  drivers/gpu/drm/amd/amdgpu/atombios_dp.c                 |  2 +-
> > > >  drivers/gpu/drm/amd/amdgpu/atombios_dp.h                 |  2 +-
> > > >  drivers/gpu/drm/amd/amdgpu/dce_virtual.c                 |  2 +-
> > > >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c        |  2 +-
> > > >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h        |  2 +-
> > > >  drivers/gpu/drm/ast/ast_mode.c                           |  2 +-
> > > >  drivers/gpu/drm/bochs/bochs_kms.c                        |  2 +-
> > > >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c             |  4 ++--
> > > >  drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |  2 +-
> > > >  drivers/gpu/drm/bridge/sii902x.c                         |  2 +-
> > > >  drivers/gpu/drm/bridge/tc358767.c                        |  2 +-
> > > >  drivers/gpu/drm/exynos/exynos_hdmi.c                     |  2 +-
> > > >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c                |  2 +-
> > > >  drivers/gpu/drm/gma500/cdv_intel_crt.c                   |  2 +-
> > > >  drivers/gpu/drm/gma500/cdv_intel_dp.c                    |  2 +-
> > > >  drivers/gpu/drm/gma500/cdv_intel_hdmi.c                  |  2 +-
> > > >  drivers/gpu/drm/gma500/cdv_intel_lvds.c                  |  2 +-
> > > >  drivers/gpu/drm/gma500/mdfld_dsi_output.c                |  2 +-
> > > >  drivers/gpu/drm/gma500/oaktrail_hdmi.c                   |  2 +-
> > > >  drivers/gpu/drm/gma500/psb_intel_drv.h                   |  2 +-
> > > >  drivers/gpu/drm/gma500/psb_intel_lvds.c                  |  2 +-
> > > >  drivers/gpu/drm/gma500/psb_intel_sdvo.c                  |  2 +-
> > > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c         |  2 +-
> > > >  drivers/gpu/drm/i2c/ch7006_drv.c                         |  2 +-
> > > >  drivers/gpu/drm/i2c/sil164_drv.c                         |  2 +-
> > > >  drivers/gpu/drm/i2c/tda998x_drv.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/dvo.h                               |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_ch7017.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_ch7xxx.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_ivch.c                          |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_ns2501.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_sil164.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/dvo_tfp410.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/intel_crt.c                         |  2 +-
> > > >  drivers/gpu/drm/i915/intel_dp.c                          |  2 +-
> > > >  drivers/gpu/drm/i915/intel_dp_mst.c                      |  2 +-
> > > >  drivers/gpu/drm/i915/intel_dsi.c                         |  2 +-
> > > >  drivers/gpu/drm/i915/intel_dvo.c                         |  2 +-
> > > >  drivers/gpu/drm/i915/intel_hdmi.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/intel_lvds.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/intel_sdvo.c                        |  2 +-
> > > >  drivers/gpu/drm/i915/intel_tv.c                          |  2 +-
> > > >  drivers/gpu/drm/imx/imx-tve.c                            |  2 +-
> > > >  drivers/gpu/drm/mediatek/mtk_hdmi.c                      |  2 +-
> > > >  drivers/gpu/drm/meson/meson_venc_cvbs.c                  |  2 +-
> > > >  drivers/gpu/drm/mgag200/mgag200_mode.c                   |  4 ++--
> > > >  drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c      |  2 +-
> > > >  drivers/gpu/drm/msm/dsi/dsi_manager.c                    |  2 +-
> > > >  drivers/gpu/drm/msm/edp/edp_connector.c                  |  2 +-
> > > >  drivers/gpu/drm/msm/hdmi/hdmi_connector.c                |  2 +-
> > > >  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c                |  2 +-
> > > >  drivers/gpu/drm/nouveau/dispnv50/disp.c                  |  2 +-
> > > >  drivers/gpu/drm/nouveau/nouveau_connector.c              |  2 +-
> > > >  drivers/gpu/drm/omapdrm/omap_connector.c                 |  7 ++++---
> > > >  drivers/gpu/drm/qxl/qxl_display.c                        |  2 +-
> > > >  drivers/gpu/drm/radeon/atombios_dp.c                     |  2 +-
> > > >  drivers/gpu/drm/radeon/radeon_connectors.c               | 10 +++++-----
> > > >  drivers/gpu/drm/radeon/radeon_dp_mst.c                   |  2 +-
> > > >  drivers/gpu/drm/radeon/radeon_mode.h                     |  2 +-
> > > >  drivers/gpu/drm/rockchip/cdn-dp-core.c                   |  2 +-
> > > >  drivers/gpu/drm/rockchip/inno_hdmi.c                     |  2 +-
> > > >  drivers/gpu/drm/sti/sti_dvo.c                            |  2 +-
> > > >  drivers/gpu/drm/sti/sti_hda.c                            |  2 +-
> > > >  drivers/gpu/drm/sti/sti_hdmi.c                           |  2 +-
> > > >  drivers/gpu/drm/sun4i/sun4i_tv.c                         |  2 +-
> > > >  drivers/gpu/drm/tegra/dsi.c                              |  2 +-
> > > >  drivers/gpu/drm/tegra/hdmi.c                             |  2 +-
> > > >  drivers/gpu/drm/tegra/rgb.c                              |  2 +-
> > > >  drivers/gpu/drm/tegra/sor.c                              |  2 +-
> > > >  drivers/gpu/drm/tilcdc/tilcdc_crtc.c                     |  3 ++-
> > > >  drivers/gpu/drm/tilcdc/tilcdc_drv.h                      |  3 ++-
> > > >  drivers/gpu/drm/tilcdc/tilcdc_external.c                 |  2 +-
> > > >  drivers/gpu/drm/tilcdc/tilcdc_panel.c                    |  2 +-
> > > >  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c                   |  2 +-
> > > >  drivers/gpu/drm/udl/udl_connector.c                      |  2 +-
> > > >  drivers/gpu/drm/virtio/virtgpu_display.c                 |  2 +-
> > > >  drivers/gpu/drm/zte/zx_hdmi.c                            |  2 +-
> > > >  drivers/gpu/drm/zte/zx_tvenc.c                           |  4 ++--
> > > >  drivers/gpu/drm/zte/zx_vga.c                             |  2 +-
> > > >  drivers/staging/vboxvideo/vbox_mode.c                    |  2 +-
> > > >  include/drm/drm_encoder_slave.h                          |  2 +-
> > > >  include/drm/drm_modeset_helper_vtables.h                 |  2 +-
> > > >  83 files changed, 98 insertions(+), 95 deletions(-)
> > 
> > [snip]
> > 
> > -- 
> > Regards,
> > 
> > Laurent Pinchart
> > 
> > 
> 
> -- 
> Ville Syrjälä
> Intel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel