drm: bridge: Constify mode arguments to bridge .mode_set() operation
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 6 Apr 2018 14:39:01 +0000 (17:39 +0300)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 14 Jan 2019 01:51:14 +0000 (03:51 +0200)
The mode and ajusted_mode passed to the bridge .mode_set() operation
should never be modified by the bridge (and are not in any of the
existing bridge drivers). Make them const to make this clear.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
26 files changed:
drivers/gpu/drm/bridge/adv7511/adv7511.h
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
drivers/gpu/drm/bridge/adv7511/adv7533.c
drivers/gpu/drm/bridge/analogix-anx78xx.c
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
drivers/gpu/drm/bridge/sii902x.c
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
drivers/gpu/drm/bridge/tc358767.c
drivers/gpu/drm/drm_bridge.c
drivers/gpu/drm/exynos/exynos_drm_mic.c
drivers/gpu/drm/i2c/tda998x_drv.c
drivers/gpu/drm/mediatek/mtk_hdmi.c
drivers/gpu/drm/msm/dsi/dsi.h
drivers/gpu/drm/msm/dsi/dsi_host.c
drivers/gpu/drm/msm/dsi/dsi_manager.c
drivers/gpu/drm/msm/edp/edp_bridge.c
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
drivers/gpu/drm/rcar-du/rcar_lvds.c
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
drivers/gpu/drm/sti/sti_dvo.c
drivers/gpu/drm/sti/sti_hda.c
drivers/gpu/drm/sti/sti_hdmi.c
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
include/drm/bridge/dw_mipi_dsi.h
include/drm/drm_bridge.h

index 73d8ccb977427a5b995081db91de5126165565db..2b6e0832d1cfd50f165ad775efccad6c96879d67 100644 (file)
@@ -395,7 +395,7 @@ static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
 #ifdef CONFIG_DRM_I2C_ADV7533
 void adv7533_dsi_power_on(struct adv7511 *adv);
 void adv7533_dsi_power_off(struct adv7511 *adv);
-void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode);
+void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode);
 int adv7533_patch_registers(struct adv7511 *adv);
 int adv7533_patch_cec_registers(struct adv7511 *adv);
 int adv7533_attach_dsi(struct adv7511 *adv);
@@ -411,7 +411,7 @@ static inline void adv7533_dsi_power_off(struct adv7511 *adv)
 }
 
 static inline void adv7533_mode_set(struct adv7511 *adv,
-                                   struct drm_display_mode *mode)
+                                   const struct drm_display_mode *mode)
 {
 }
 
index 85c2d407a52e1a5476b3269d13655606d10478fd..d0e98caa2e2a1d95f38dce89213cae84cde6490a 100644 (file)
@@ -676,8 +676,8 @@ static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511,
 }
 
 static void adv7511_mode_set(struct adv7511 *adv7511,
-                            struct drm_display_mode *mode,
-                            struct drm_display_mode *adj_mode)
+                            const struct drm_display_mode *mode,
+                            const struct drm_display_mode *adj_mode)
 {
        unsigned int low_refresh_rate;
        unsigned int hsync_polarity = 0;
@@ -839,8 +839,8 @@ static void adv7511_bridge_disable(struct drm_bridge *bridge)
 }
 
 static void adv7511_bridge_mode_set(struct drm_bridge *bridge,
-                                   struct drm_display_mode *mode,
-                                   struct drm_display_mode *adj_mode)
+                                   const struct drm_display_mode *mode,
+                                   const struct drm_display_mode *adj_mode)
 {
        struct adv7511 *adv = bridge_to_adv7511(bridge);
 
index 185b6d84216653003bdd0cd26df89bd6e598b3ad..5d5e7d9eded2f4bda06c8baf8ffd4070a5786207 100644 (file)
@@ -108,7 +108,7 @@ void adv7533_dsi_power_off(struct adv7511 *adv)
        regmap_write(adv->regmap_cec, 0x27, 0x0b);
 }
 
-void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode)
+void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode)
 {
        struct mipi_dsi_device *dsi = adv->dsi;
        int lanes, ret;
index f8433c93f4634620c177c77ac67aea70337288ec..705620e9f505e3b79620d4d9fdab25a62d1517c1 100644 (file)
@@ -1082,8 +1082,8 @@ static void anx78xx_bridge_disable(struct drm_bridge *bridge)
 }
 
 static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
-                                   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 anx78xx *anx78xx = bridge_to_anx78xx(bridge);
        struct hdmi_avi_infoframe frame;
index 753e96129ab7a63355d3d50e322780f563e76684..4d5b475858348f9aaf65e81493b241faca560991 100644 (file)
@@ -1361,8 +1361,8 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
 }
 
 static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
-                                       struct drm_display_mode *orig_mode,
-                                       struct drm_display_mode *mode)
+                               const struct drm_display_mode *orig_mode,
+                               const struct drm_display_mode *mode)
 {
        struct analogix_dp_device *dp = bridge->driver_private;
        struct drm_display_info *display_info = &dp->connector.display_info;
index bfa902013aa42e06f3eff686d25ba593cd9b2b89..a0b3a568dd9c37cf5097b088e121326f371fb125 100644 (file)
@@ -232,8 +232,8 @@ static void sii902x_bridge_enable(struct drm_bridge *bridge)
 }
 
 static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
-                                   struct drm_display_mode *mode,
-                                   struct drm_display_mode *adj)
+                                   const struct drm_display_mode *mode,
+                                   const struct drm_display_mode *adj)
 {
        struct sii902x *sii902x = bridge_to_sii902x(bridge);
        struct regmap *regmap = sii902x->regmap;
index 64c3cf0275182649d9a5572ce6f3d907165f822a..4fed3eda6ded9e9953de7bf4e334a8bf8fff5d4a 100644 (file)
@@ -1998,8 +1998,8 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
 }
 
 static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
-                                   struct drm_display_mode *orig_mode,
-                                   struct drm_display_mode *mode)
+                                   const struct drm_display_mode *orig_mode,
+                                   const struct drm_display_mode *mode)
 {
        struct dw_hdmi *hdmi = bridge->driver_private;
 
index 2f4b145b73af23d7db14845a111c5fc9d4f27736..23a5977a3b0a01eec66cf2e8269ac58e137c9642 100644 (file)
@@ -248,7 +248,7 @@ static inline bool dw_mipi_is_dual_mode(struct dw_mipi_dsi *dsi)
  * The controller should generate 2 frames before
  * preparing the peripheral.
  */
-static void dw_mipi_dsi_wait_for_two_frames(struct drm_display_mode *mode)
+static void dw_mipi_dsi_wait_for_two_frames(const struct drm_display_mode *mode)
 {
        int refresh, two_frames;
 
@@ -564,7 +564,7 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
 }
 
 static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi,
-                                  struct drm_display_mode *mode)
+                                  const struct drm_display_mode *mode)
 {
        u32 val = 0, color = 0;
 
@@ -607,7 +607,7 @@ static void dw_mipi_dsi_packet_handler_config(struct dw_mipi_dsi *dsi)
 }
 
 static void dw_mipi_dsi_video_packet_config(struct dw_mipi_dsi *dsi,
-                                           struct drm_display_mode *mode)
+                                           const struct drm_display_mode *mode)
 {
        /*
         * TODO dw drv improvements
@@ -642,7 +642,7 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)
 
 /* Get lane byte clock cycles. */
 static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
-                                          struct drm_display_mode *mode,
+                                          const struct drm_display_mode *mode,
                                           u32 hcomponent)
 {
        u32 frac, lbcc;
@@ -658,7 +658,7 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
 }
 
 static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi,
-                                         struct drm_display_mode *mode)
+                                         const struct drm_display_mode *mode)
 {
        u32 htotal, hsa, hbp, lbcc;
 
@@ -681,7 +681,7 @@ static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi,
 }
 
 static void dw_mipi_dsi_vertical_timing_config(struct dw_mipi_dsi *dsi,
-                                              struct drm_display_mode *mode)
+                                       const struct drm_display_mode *mode)
 {
        u32 vactive, vsa, vfp, vbp;
 
@@ -818,7 +818,7 @@ static unsigned int dw_mipi_dsi_get_lanes(struct dw_mipi_dsi *dsi)
 }
 
 static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,
-                               struct drm_display_mode *adjusted_mode)
+                                const struct drm_display_mode *adjusted_mode)
 {
        const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
        void *priv_data = dsi->plat_data->priv_data;
@@ -861,8 +861,8 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,
 }
 
 static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
-                                       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 dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
 
index 8e28e738cb52dec6ee8ea7eda2d655fc7035be93..4df07f4cbff556a10931072aa3bcc88d7ae87973 100644 (file)
@@ -203,7 +203,7 @@ struct tc_data {
        /* display edid */
        struct edid             *edid;
        /* current mode */
-       struct drm_display_mode *mode;
+       const struct drm_display_mode   *mode;
 
        u32                     rev;
        u8                      assr;
@@ -648,7 +648,8 @@ err_dpcd_read:
        return ret;
 }
 
-static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
+static int tc_set_video_mode(struct tc_data *tc,
+                            const struct drm_display_mode *mode)
 {
        int ret;
        int vid_sync_dly;
@@ -1113,8 +1114,8 @@ static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connec
 }
 
 static void tc_bridge_mode_set(struct drm_bridge *bridge,
-                              struct drm_display_mode *mode,
-                              struct drm_display_mode *adj)
+                              const struct drm_display_mode *mode,
+                              const struct drm_display_mode *adj)
 {
        struct tc_data *tc = bridge_to_tc(bridge);
 
index ba7025041e4641ea16858497fde02dee9dd3c8f4..138b2711d389ebc0b49f2a2a7aab1e012e722347 100644 (file)
@@ -294,8 +294,8 @@ EXPORT_SYMBOL(drm_bridge_post_disable);
  * Note: the bridge passed should be the one closest to the encoder
  */
 void drm_bridge_mode_set(struct drm_bridge *bridge,
-                       struct drm_display_mode *mode,
-                       struct drm_display_mode *adjusted_mode)
+                        const struct drm_display_mode *mode,
+                        const struct drm_display_mode *adjusted_mode)
 {
        if (!bridge)
                return;
index 2fd299a58297edd559b2b5928a63833b3c2622df..dd02e8a323ef524488bf68b7ff01469f44184aa5 100644 (file)
@@ -246,8 +246,8 @@ already_disabled:
 }
 
 static void mic_mode_set(struct drm_bridge *bridge,
-                       struct drm_display_mode *mode,
-                       struct drm_display_mode *adjusted_mode)
+                        const struct drm_display_mode *mode,
+                        const struct drm_display_mode *adjusted_mode)
 {
        struct exynos_mic *mic = bridge->driver_private;
 
index a7c39f39793ff2c2ce152e3cba3c3036513a7f19..a6ba461749b2d7bd65cea02392534b91ffd6dc66 100644 (file)
@@ -845,7 +845,7 @@ static int tda998x_write_aif(struct tda998x_priv *priv,
 }
 
 static void
-tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
+tda998x_write_avi(struct tda998x_priv *priv, const struct drm_display_mode *mode)
 {
        union hdmi_infoframe frame;
 
@@ -1339,8 +1339,8 @@ static void tda998x_bridge_disable(struct drm_bridge *bridge)
 }
 
 static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
-                                   struct drm_display_mode *mode,
-                                   struct drm_display_mode *adjusted_mode)
+                                   const struct drm_display_mode *mode,
+                                   const struct drm_display_mode *adjusted_mode)
 {
        struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge);
        unsigned long tmds_clock;
index 862f3ec221318800f9850755e2ec2d89deec7df4..994f0d8646bfeafea84d545a14215ffc7c3c0ffe 100644 (file)
@@ -1370,8 +1370,8 @@ static void mtk_hdmi_bridge_post_disable(struct drm_bridge *bridge)
 }
 
 static void mtk_hdmi_bridge_mode_set(struct drm_bridge *bridge,
-                                    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 mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
 
index 08f3fc6771b7829de66c1af953cbb3abb16ccee2..9c6b31c2d79f01948836c77cbdf1b8628708441e 100644 (file)
@@ -168,7 +168,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
                        bool is_dual_dsi);
 int msm_dsi_host_power_off(struct mipi_dsi_host *host);
 int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
-                                       struct drm_display_mode *mode);
+                                 const struct drm_display_mode *mode);
 struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host,
                                        unsigned long *panel_flags);
 struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host);
index 38e481d2d606f9f8d3a0600c8e5f5495db00a848..610183db1daf640498568fe272e6100a75d22b93 100644 (file)
@@ -2424,7 +2424,7 @@ unlock_ret:
 }
 
 int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
-                                       struct drm_display_mode *mode)
+                                 const struct drm_display_mode *mode)
 {
        struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 
index 80aa6344185e13068ad4442e069fbe2a91cb1e52..bdb063b2dc4a238a8686ab4a17fa75586e3c7ed2 100644 (file)
@@ -527,8 +527,8 @@ disable_phy:
 }
 
 static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge,
-               struct drm_display_mode *mode,
-               struct drm_display_mode *adjusted_mode)
+               const struct drm_display_mode *mode,
+               const struct drm_display_mode *adjusted_mode)
 {
        int id = dsi_mgr_bridge_get_id(bridge);
        struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
index 931a5c97cccf6fc65066b4bf77a67a6e274cecaa..86366ba03e6076d4963ae0845e9d172d04cd118a 100644 (file)
@@ -52,8 +52,8 @@ static void edp_bridge_post_disable(struct drm_bridge *bridge)
 }
 
 static void edp_bridge_mode_set(struct drm_bridge *bridge,
-               struct drm_display_mode *mode,
-               struct drm_display_mode *adjusted_mode)
+               const struct drm_display_mode *mode,
+               const struct drm_display_mode *adjusted_mode)
 {
        struct drm_device *dev = bridge->dev;
        struct drm_connector *connector;
index 98d61c690260f49a09228c75ee325738ed484aa5..b42feb80531b3203082e09578750c013c1b1d2ec 100644 (file)
@@ -207,8 +207,8 @@ static void msm_hdmi_bridge_post_disable(struct drm_bridge *bridge)
 }
 
 static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge,
-                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 hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
        struct hdmi *hdmi = hdmi_bridge->hdmi;
index 534a128a869d51e438ed5e5c7172ec306ef5a025..c62136a1e94198f57fe9f82ea5636b7dbfac3253 100644 (file)
@@ -520,8 +520,8 @@ static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
 }
 
 static void rcar_lvds_mode_set(struct drm_bridge *bridge,
-                              struct drm_display_mode *mode,
-                              struct drm_display_mode *adjusted_mode)
+                              const struct drm_display_mode *mode,
+                              const struct drm_display_mode *adjusted_mode)
 {
        struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
 
index 7ee359bcee62521b5e83ef2533fcb065998440b9..ef8486e5e2cd121681a0710e4b5b41e06f24bd50 100644 (file)
@@ -467,7 +467,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
 }
 
 static int
-dw_mipi_dsi_get_lane_mbps(void *priv_data, struct drm_display_mode *mode,
+dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
                          unsigned long mode_flags, u32 lanes, u32 format,
                          unsigned int *lane_mbps)
 {
index b08376b7611b896fbcb8fd6b3e91fe44dd4b7015..6d33772f77eb11c7d3bd66ec31949daa31dc9892 100644 (file)
@@ -277,8 +277,8 @@ static void sti_dvo_pre_enable(struct drm_bridge *bridge)
 }
 
 static void sti_dvo_set_mode(struct drm_bridge *bridge,
-                            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 sti_dvo *dvo = bridge->driver_private;
        struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc);
index 19b9b5ed129700730e5c77ea5c37e9edbb0db5e0..a63dd5eb70819361746dd937126801ae155dea6d 100644 (file)
@@ -508,8 +508,8 @@ static void sti_hda_pre_enable(struct drm_bridge *bridge)
 }
 
 static void sti_hda_set_mode(struct drm_bridge *bridge,
-               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 sti_hda *hda = bridge->driver_private;
        u32 mode_idx;
index ccf718404a1c23e557dd6ff097d779f3bff9729c..fbef4ad6c8efc63cd841327353f2c4b93377a6ec 100644 (file)
@@ -917,8 +917,8 @@ static void sti_hdmi_pre_enable(struct drm_bridge *bridge)
 }
 
 static void sti_hdmi_set_mode(struct drm_bridge *bridge,
-               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 sti_hdmi *hdmi = bridge->driver_private;
        int ret;
index a514b593f37c531b2a1f7fa3b04d625f64edd8a3..a672b59a22262c949c8519840e9f29c1225d5f83 100644 (file)
@@ -215,7 +215,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
 }
 
 static int
-dw_mipi_dsi_get_lane_mbps(void *priv_data, struct drm_display_mode *mode,
+dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
                          unsigned long mode_flags, u32 lanes, u32 format,
                          unsigned int *lane_mbps)
 {
index 48a671e782cafd6ec3ef405f615802c187733ff5..7d3dd69a5caa73a6b23ee11f74c5d4a98f640028 100644 (file)
@@ -14,7 +14,8 @@ struct dw_mipi_dsi;
 
 struct dw_mipi_dsi_phy_ops {
        int (*init)(void *priv_data);
-       int (*get_lane_mbps)(void *priv_data, struct drm_display_mode *mode,
+       int (*get_lane_mbps)(void *priv_data,
+                            const struct drm_display_mode *mode,
                             unsigned long mode_flags, u32 lanes, u32 format,
                             unsigned int *lane_mbps);
 };
index bd850747ce5472fe477919db42f4cb5d1911f61f..9da8c93f79764ab5c246afa612a7eb748962153a 100644 (file)
@@ -196,8 +196,8 @@ struct drm_bridge_funcs {
         * the DRM framework will have to be extended with DRM bridge states.
         */
        void (*mode_set)(struct drm_bridge *bridge,
-                        struct drm_display_mode *mode,
-                        struct drm_display_mode *adjusted_mode);
+                        const struct drm_display_mode *mode,
+                        const struct drm_display_mode *adjusted_mode);
        /**
         * @pre_enable:
         *
@@ -310,8 +310,8 @@ enum drm_mode_status drm_bridge_mode_valid(struct drm_bridge *bridge,
 void drm_bridge_disable(struct drm_bridge *bridge);
 void drm_bridge_post_disable(struct drm_bridge *bridge);
 void drm_bridge_mode_set(struct drm_bridge *bridge,
-                        struct drm_display_mode *mode,
-                        struct drm_display_mode *adjusted_mode);
+                        const struct drm_display_mode *mode,
+                        const struct drm_display_mode *adjusted_mode);
 void drm_bridge_pre_enable(struct drm_bridge *bridge);
 void drm_bridge_enable(struct drm_bridge *bridge);