drm/i915: Constify adjusted_mode
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 8 Sep 2015 10:40:49 +0000 (13:40 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 30 Sep 2015 08:20:11 +0000 (10:20 +0200)
Make adjusted_mode const whereever we don't have to modify it. This only
covers cases when we have a local adjusted_mode variable, and doesn't
make any difference for cases where we just dereference
pipe_config->adjusted_mode.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
19 files changed:
drivers/gpu/drm/i915/dvo.h
drivers/gpu/drm/i915/dvo_ch7017.c
drivers/gpu/drm/i915/dvo_ch7xxx.c
drivers/gpu/drm/i915/dvo_ivch.c
drivers/gpu/drm/i915/dvo_ns2501.c
drivers/gpu/drm/i915/dvo_sil164.c
drivers/gpu/drm/i915/dvo_tfp410.c
drivers/gpu/drm/i915/intel_audio.c
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp_mst.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_panel.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_sdvo.c

index 312163379db9e1ecdb064d6d3cc0e8a885b726c6..0e2c1b9648a7328f372a629a5ed597114a5cf506 100644 (file)
@@ -94,8 +94,8 @@ struct intel_dvo_dev_ops {
         * after this function is called.
         */
        void (*mode_set)(struct intel_dvo_device *dvo,
-                        struct drm_display_mode *mode,
-                        struct drm_display_mode *adjusted_mode);
+                        const struct drm_display_mode *mode,
+                        const struct drm_display_mode *adjusted_mode);
 
        /*
         * Probe for a connected output, and return detect_status.
index 86b27d1d90c22d5c899d4da78410ce80752c7bd6..cbb22027a3ce4ba4116a4fae6a8d4e3697b614e3 100644 (file)
@@ -255,8 +255,8 @@ static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
 }
 
 static void ch7017_mode_set(struct intel_dvo_device *dvo,
-                           struct drm_display_mode *mode,
-                           struct drm_display_mode *adjusted_mode)
+                           const struct drm_display_mode *mode,
+                           const struct drm_display_mode *adjusted_mode)
 {
        uint8_t lvds_pll_feedback_div, lvds_pll_vco_control;
        uint8_t outputs_enable, lvds_control_2, lvds_power_down;
index 80449f47596085406cb525fab2288c4489c2811e..4b4acc1a06fe8677ac1f91b4aea39f6b4ed767e4 100644 (file)
@@ -275,8 +275,8 @@ static enum drm_mode_status ch7xxx_mode_valid(struct intel_dvo_device *dvo,
 }
 
 static void ch7xxx_mode_set(struct intel_dvo_device *dvo,
-                           struct drm_display_mode *mode,
-                           struct drm_display_mode *adjusted_mode)
+                           const struct drm_display_mode *mode,
+                           const struct drm_display_mode *adjusted_mode)
 {
        uint8_t tvco, tpcp, tpd, tlpf, idf;
 
index e082f75317a0dd8d1871dde9fe194666743b3901..ff9f1b077d83e98bacb97872abfcd6736c0eb3ea 100644 (file)
@@ -394,8 +394,8 @@ static bool ivch_get_hw_state(struct intel_dvo_device *dvo)
 }
 
 static void ivch_mode_set(struct intel_dvo_device *dvo,
-                         struct drm_display_mode *mode,
-                         struct drm_display_mode *adjusted_mode)
+                         const struct drm_display_mode *mode,
+                         const struct drm_display_mode *adjusted_mode)
 {
        struct ivch_priv *priv = dvo->dev_priv;
        uint16_t vr40 = 0;
index 97ae8aa157e9ad0a8f4d07a086eb69d9f8786978..063859fff0f02b13da6496012b4ab224d4d37bd1 100644 (file)
@@ -546,8 +546,8 @@ static enum drm_mode_status ns2501_mode_valid(struct intel_dvo_device *dvo,
 }
 
 static void ns2501_mode_set(struct intel_dvo_device *dvo,
-                           struct drm_display_mode *mode,
-                           struct drm_display_mode *adjusted_mode)
+                           const struct drm_display_mode *mode,
+                           const struct drm_display_mode *adjusted_mode)
 {
        const struct ns2501_configuration *conf;
        struct ns2501_priv *ns = (struct ns2501_priv *)(dvo->dev_priv);
index fa011496707659a1e1439dad0297d2f920c34039..26f13eb634f977da9cd74ac1eeb32319308a4b78 100644 (file)
@@ -190,8 +190,8 @@ static enum drm_mode_status sil164_mode_valid(struct intel_dvo_device *dvo,
 }
 
 static void sil164_mode_set(struct intel_dvo_device *dvo,
-                           struct drm_display_mode *mode,
-                           struct drm_display_mode *adjusted_mode)
+                           const struct drm_display_mode *mode,
+                           const struct drm_display_mode *adjusted_mode)
 {
        /* As long as the basics are set up, since we don't have clock
         * dependencies in the mode setup, we can just leave the
index 7853719a0e8132dc5af19dcdee0089f236ff2b45..6f1a0a6d4e2211895d71a3510ad21fbaea4e8fd1 100644 (file)
@@ -222,8 +222,8 @@ static enum drm_mode_status tfp410_mode_valid(struct intel_dvo_device *dvo,
 }
 
 static void tfp410_mode_set(struct intel_dvo_device *dvo,
-                           struct drm_display_mode *mode,
-                           struct drm_display_mode *adjusted_mode)
+                           const struct drm_display_mode *mode,
+                           const struct drm_display_mode *adjusted_mode)
 {
        /* As long as the basics are set up, since we don't have clock dependencies
        * in the mode setup, we can just leave the registers alone and everything
index e4c30e8c2674b02e62df7a410a2206746db0b358..b08b4a7fae49e4b55e53a158f083717377ce698e 100644 (file)
@@ -397,7 +397,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 {
        struct drm_encoder *encoder = &intel_encoder->base;
        struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        struct drm_connector *connector;
        struct drm_device *dev = encoder->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
index 6ce38e3edf21a9b215e201b637ffb3a3bccdd417..cac7928ebc49a4ed9d09e7add8a7b2e25bd284a0 100644 (file)
@@ -158,7 +158,7 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
        struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        u32 adpa;
 
        if (INTEL_INFO(dev)->gen >= 5)
index 5105e09b65cc2f6bcbb1c8ee31e014094d5aade2..47bf13ff5e24a63b5473825e286b52296059a7e1 100644 (file)
@@ -4392,7 +4392,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 int skl_update_scaler_crtc(struct intel_crtc_state *state)
 {
        struct intel_crtc *intel_crtc = to_intel_crtc(state->base.crtc);
-       struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
 
        DRM_DEBUG_KMS("Updating scaler for [CRTC:%i] scaler_user index %u.%u\n",
                      intel_crtc->base.base.id, intel_crtc->pipe, SKL_CRTC_INDEX);
@@ -6477,7 +6477,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
                                       struct intel_crtc_state *pipe_config)
 {
        struct drm_device *dev = intel_crtc->base.dev;
-       struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
        int lane, link_bw, fdi_dotclock, ret;
        bool needs_recompute = false;
 
@@ -6556,7 +6556,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
 {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 
        /* FIXME should check pixel clock limits on all platforms */
        if (INTEL_INFO(dev)->gen < 4) {
@@ -7624,7 +7624,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
        struct drm_i915_private *dev_priv = dev->dev_private;
        enum pipe pipe = intel_crtc->pipe;
        enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
        uint32_t crtc_vtotal, crtc_vblank_end;
        int vsyncshift = 0;
 
index 06a2b1046daf73bf06a3bed1d66a57d9f1750b4e..77f733007e3200c6353f140b1b8663a93ec69f9f 100644 (file)
@@ -1587,7 +1587,7 @@ static void intel_dp_prepare(struct intel_encoder *encoder)
        struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
        enum port port = dp_to_dig_port(intel_dp)->port;
        struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
 
        intel_dp_set_link_params(intel_dp, crtc->config);
 
index cccf014d55c1e72cd08cce4c969f98f2b2a1d354..ca4d0220ecd4499aa555bc5d4b986895655d944d 100644 (file)
@@ -40,7 +40,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
        struct drm_atomic_state *state;
        int bpp, i;
        int lane_count, slots;
-       struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
        struct drm_connector *drm_connector;
        struct intel_connector *connector, *found = NULL;
        struct drm_connector_state *connector_state;
index c96289dba380328a01bfb1d9d6b58302891488a1..c98ed81c3a2e20425a503eb8bce24044f35446f5 100644 (file)
@@ -683,7 +683,7 @@ struct intel_hdmi {
                                const void *frame, ssize_t len);
        void (*set_infoframes)(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode);
+                              const struct drm_display_mode *adjusted_mode);
        bool (*infoframe_enabled)(struct drm_encoder *encoder);
 };
 
index 4fb97c07bbc26630dd8d04ec9acb84c013f94550..eb86ba7faaacfa0efe604ef45e2e995133fde8fe 100644 (file)
@@ -774,7 +774,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
        struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
        enum port port;
        unsigned int bpp = intel_crtc->config->pipe_bpp;
        u32 val, tmp;
index 555afbcb6043612bddc7afac5c0f8e5fe1bcb8d2..8492053e0ff0067f58a268fc528fb3249a9e86f9 100644 (file)
@@ -251,7 +251,7 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder)
        struct drm_device *dev = encoder->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
        int pipe = crtc->pipe;
        u32 dvo_val;
index 08f8399f841875daceb0fecd99a52f8b0391f77b..af231ede477673efbe4f354be906ef36be90fa6c 100644 (file)
@@ -447,7 +447,7 @@ static void intel_write_infoframe(struct drm_encoder *encoder,
 }
 
 static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
-                                        struct drm_display_mode *adjusted_mode)
+                                        const struct drm_display_mode *adjusted_mode)
 {
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
@@ -491,7 +491,7 @@ static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
 
 static void
 intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
-                             struct drm_display_mode *adjusted_mode)
+                             const struct drm_display_mode *adjusted_mode)
 {
        union hdmi_infoframe frame;
        int ret;
@@ -506,7 +506,7 @@ intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
 
 static void g4x_set_infoframes(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
        struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
@@ -658,7 +658,7 @@ static bool intel_hdmi_set_gcp_infoframe(struct drm_encoder *encoder)
 
 static void ibx_set_infoframes(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
@@ -710,7 +710,7 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
 
 static void cpt_set_infoframes(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
@@ -752,7 +752,7 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
 
 static void vlv_set_infoframes(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
        struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
@@ -804,7 +804,7 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
 
 static void hsw_set_infoframes(struct drm_encoder *encoder,
                               bool enable,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
@@ -841,7 +841,7 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        u32 hdmi_val;
 
        hdmi_val = SDVO_ENCODING_HDMI;
@@ -1537,7 +1537,7 @@ static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
 {
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 
        intel_hdmi_prepare(encoder);
 
@@ -1554,7 +1554,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc =
                to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
        enum dpio_channel port = vlv_dport_to_channel(dport);
        int pipe = intel_crtc->pipe;
        u32 val;
@@ -1820,7 +1820,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc =
                to_intel_crtc(encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
        enum dpio_channel ch = vlv_dport_to_channel(dport);
        int pipe = intel_crtc->pipe;
        int data, i, stagger;
index 2806049e3a62d79547d1355faa41a76525dece41..dd71e7f139e3715b5f889daf84ec035d6ee47201 100644 (file)
@@ -105,12 +105,8 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
                        struct intel_crtc_state *pipe_config,
                        int fitting_mode)
 {
-       struct drm_display_mode *adjusted_mode;
-       int x, y, width, height;
-
-       adjusted_mode = &pipe_config->base.adjusted_mode;
-
-       x = y = width = height = 0;
+       const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+       int x = 0, y = 0, width = 0, height = 0;
 
        /* Native modes don't need fitting */
        if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w &&
@@ -230,7 +226,7 @@ static inline u32 panel_fitter_scaling(u32 source, u32 target)
 static void i965_scale_aspect(struct intel_crtc_state *pipe_config,
                              u32 *pfit_control)
 {
-       struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
        u32 scaled_width = adjusted_mode->crtc_hdisplay *
                pipe_config->pipe_src_h;
        u32 scaled_height = pipe_config->pipe_src_w *
@@ -310,9 +306,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 {
        struct drm_device *dev = intel_crtc->base.dev;
        u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0;
-       struct drm_display_mode *adjusted_mode;
-
-       adjusted_mode = &pipe_config->base.adjusted_mode;
+       struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 
        /* Native modes don't need fitting */
        if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w &&
index d5c60bbb9c4c56676dd4421e208b6334b64d8198..7da3358405d4a4cfc68a338ed31a382c82cf75d8 100644 (file)
@@ -703,12 +703,9 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc)
 
        crtc = single_enabled_crtc(dev);
        if (crtc) {
-               const struct drm_display_mode *adjusted_mode;
+               const struct drm_display_mode *adjusted_mode = &to_intel_crtc(crtc)->config->base.adjusted_mode;
                int pixel_size = crtc->primary->state->fb->bits_per_pixel / 8;
-               int clock;
-
-               adjusted_mode = &to_intel_crtc(crtc)->config->base.adjusted_mode;
-               clock = adjusted_mode->crtc_clock;
+               int clock = adjusted_mode->crtc_clock;
 
                /* Display SR */
                wm = intel_calculate_wm(clock, &pineview_display_wm,
@@ -2086,7 +2083,7 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
        u32 linetime, ips_linetime;
 
        if (!intel_crtc->active)
index 9df6bbd1872c19ae480d36963a2f1e2a84163fd2..857b1bd7115657ac582645e192a37e0862654a42 100644 (file)
@@ -1189,7 +1189,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)
        struct drm_device *dev = intel_encoder->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *crtc = to_intel_crtc(intel_encoder->base.crtc);
-       struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+       const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        struct drm_display_mode *mode = &crtc->config->base.mode;
        struct intel_sdvo *intel_sdvo = to_sdvo(intel_encoder);
        u32 sdvox;