Re: [PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-13 Thread Daniel Vetter
On Mon, Apr 09, 2018 at 12:43:07PM +0300, Laurent Pinchart wrote:
> Hi Daniel,
> 
> On Monday, 9 April 2018 12:18:28 EEST Daniel Vetter wrote:
> > On Mon, Apr 09, 2018 at 11:56:55AM +0300, Laurent Pinchart wrote:
> > > On Monday, 9 April 2018 11:53:07 EEST Daniel Vetter wrote:
> > >> On Fri, Apr 06, 2018 at 07:23:57PM +0300, Laurent Pinchart wrote:
> > >>> 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
> > >> > 
> > >> 
> > >> Why should the adjusted_mode not be modified?
> > > 
> > > Why should it ? .mode_set() performs a mode set, mode adjustment should be
> > > performed in .mode_fixup().
> > 
> > Oh right, totally missed that you're only touching the ->mode_set
> > callbacks. Assuming gcc is happy (not going to check for that, too lazy):
> > 
> > Reviewed-by: Daniel Vetter 
> 
> I've compile-tested this patch for all the drivers it touches and gcc didn't 
> complain. I'll give 0day a few days to give it a go too, just in case.

btw in case it's not clear: Since you have drm-misc commit rights I won't
push this for you :-)
-Daniel
> 
> > >>> ---
> > >>> 
> > >>>  drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
> > >>>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
> > >>>  drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
> > >>>  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
> > >>>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
> > >>>  drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
> > >>>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
> > >>>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 ---
> > >>>  drivers/gpu/drm/bridge/tc358767.c  |  9 +
> > >>>  drivers/gpu/drm/drm_bridge.c   |  4 ++--
> > >>>  drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
> > >>>  drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
> > >>>  drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
> > >>>  drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
> > >>>  drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
> > >>>  drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
> > >>>  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
> > >>>  drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
> > >>>  drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
> > >>>  drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
> > >>>  drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
> > >>>  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
> > >>>  include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
> > >>>  include/drm/drm_bridge.h   |  8 
> > >>>  24 files changed, 57 insertions(+), 55 deletions(-)
> > >>> 
> > >>> Philippe,
> > >>> 
> > >>> I wrote this patch while reviewing your adjusted_mode documentation. I
> > >>> initially wanted to document the fact that the adjusted_mode argument
> > >>> to the bridge .mode_set() operation should not be modified by the
> > >>> bridge, and then realized that constifying it would be a better way to
> > >>> express that. I thus wouldn't mind if you took that patch in your tree
> > >>> and pushed it with the documentation patch once we get the necessary
> > >>> acks :-)
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-09 Thread Laurent Pinchart
Hi Daniel,

On Monday, 9 April 2018 12:18:28 EEST Daniel Vetter wrote:
> On Mon, Apr 09, 2018 at 11:56:55AM +0300, Laurent Pinchart wrote:
> > On Monday, 9 April 2018 11:53:07 EEST Daniel Vetter wrote:
> >> On Fri, Apr 06, 2018 at 07:23:57PM +0300, Laurent Pinchart wrote:
> >>> 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
> >> > 
> >> 
> >> Why should the adjusted_mode not be modified?
> > 
> > Why should it ? .mode_set() performs a mode set, mode adjustment should be
> > performed in .mode_fixup().
> 
> Oh right, totally missed that you're only touching the ->mode_set
> callbacks. Assuming gcc is happy (not going to check for that, too lazy):
> 
> Reviewed-by: Daniel Vetter 

I've compile-tested this patch for all the drivers it touches and gcc didn't 
complain. I'll give 0day a few days to give it a go too, just in case.

> >>> ---
> >>> 
> >>>  drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
> >>>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
> >>>  drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
> >>>  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
> >>>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
> >>>  drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
> >>>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
> >>>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 ---
> >>>  drivers/gpu/drm/bridge/tc358767.c  |  9 +
> >>>  drivers/gpu/drm/drm_bridge.c   |  4 ++--
> >>>  drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
> >>>  drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
> >>>  drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
> >>>  drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
> >>>  drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
> >>>  drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
> >>>  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
> >>>  drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
> >>>  drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
> >>>  drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
> >>>  drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
> >>>  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
> >>>  include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
> >>>  include/drm/drm_bridge.h   |  8 
> >>>  24 files changed, 57 insertions(+), 55 deletions(-)
> >>> 
> >>> Philippe,
> >>> 
> >>> I wrote this patch while reviewing your adjusted_mode documentation. I
> >>> initially wanted to document the fact that the adjusted_mode argument
> >>> to the bridge .mode_set() operation should not be modified by the
> >>> bridge, and then realized that constifying it would be a better way to
> >>> express that. I thus wouldn't mind if you took that patch in your tree
> >>> and pushed it with the documentation patch once we get the necessary
> >>> acks :-)

-- 
Regards,

Laurent Pinchart



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-09 Thread Daniel Vetter
On Mon, Apr 09, 2018 at 11:56:55AM +0300, Laurent Pinchart wrote:
> On Monday, 9 April 2018 11:53:07 EEST Daniel Vetter wrote:
> > On Fri, Apr 06, 2018 at 07:23:57PM +0300, Laurent Pinchart wrote:
> > > 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
> > > 
> > 
> > Why should the adjusted_mode not be modified?
> 
> Why should it ? .mode_set() performs a mode set, mode adjustment should be 
> performed in .mode_fixup().

Oh right, totally missed that you're only touching the ->mode_set
callbacks. Assuming gcc is happy (not going to check for that, too lazy):

Reviewed-by: Daniel Vetter 

> 
> > 
> > > ---
> > > 
> > >  drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
> > >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
> > >  drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
> > >  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
> > >  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
> > >  drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
> > >  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
> > >  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 
> > >  drivers/gpu/drm/bridge/tc358767.c  |  9 +
> > >  drivers/gpu/drm/drm_bridge.c   |  4 ++--
> > >  drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
> > >  drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
> > >  drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
> > >  drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
> > >  drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
> > >  drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
> > >  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
> > >  drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
> > >  drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
> > >  drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
> > >  drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
> > >  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
> > >  include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
> > >  include/drm/drm_bridge.h   |  8 
> > >  24 files changed, 57 insertions(+), 55 deletions(-)
> > > 
> > > Philippe,
> > > 
> > > I wrote this patch while reviewing your adjusted_mode documentation. I
> > > initially wanted to document the fact that the adjusted_mode argument to
> > > the bridge .mode_set() operation should not be modified by the bridge,
> > > and then realized that constifying it would be a better way to express
> > > that. I thus wouldn't mind if you took that patch in your tree and
> > > pushed it with the documentation patch once we get the necessary acks
> > > 
> > > :-)
> > > 
> > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > > b/drivers/gpu/drm/bridge/adv7511/adv7511.h index
> > > d034b2cb5eee..f60d29defd18 100644
> > > --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > > @@ -389,7 +389,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);
> > > 
> > > @@ -405,7 +405,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)
> > > 
> > >  {
> > >  }
> > > 
> > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index
> > > efa29db5fc2b..99028d36ed74 100644
> > > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > > @@ -664,8 +664,8 @@ static int 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 

Re: [PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-09 Thread Laurent Pinchart
On Monday, 9 April 2018 11:53:07 EEST Daniel Vetter wrote:
> On Fri, Apr 06, 2018 at 07:23:57PM +0300, Laurent Pinchart wrote:
> > 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
> > 
> 
> Why should the adjusted_mode not be modified?

Why should it ? .mode_set() performs a mode set, mode adjustment should be 
performed in .mode_fixup().

> 
> > ---
> > 
> >  drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
> >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
> >  drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
> >  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
> >  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
> >  drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
> >  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
> >  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 
> >  drivers/gpu/drm/bridge/tc358767.c  |  9 +
> >  drivers/gpu/drm/drm_bridge.c   |  4 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
> >  drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
> >  drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
> >  drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
> >  drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
> >  drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
> >  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
> >  drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
> >  drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
> >  drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
> >  drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
> >  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
> >  include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
> >  include/drm/drm_bridge.h   |  8 
> >  24 files changed, 57 insertions(+), 55 deletions(-)
> > 
> > Philippe,
> > 
> > I wrote this patch while reviewing your adjusted_mode documentation. I
> > initially wanted to document the fact that the adjusted_mode argument to
> > the bridge .mode_set() operation should not be modified by the bridge,
> > and then realized that constifying it would be a better way to express
> > that. I thus wouldn't mind if you took that patch in your tree and
> > pushed it with the documentation patch once we get the necessary acks
> > 
> > :-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > b/drivers/gpu/drm/bridge/adv7511/adv7511.h index
> > d034b2cb5eee..f60d29defd18 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > @@ -389,7 +389,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);
> > 
> > @@ -405,7 +405,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)
> > 
> >  {
> >  }
> > 
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index
> > efa29db5fc2b..99028d36ed74 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > @@ -664,8 +664,8 @@ static int 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;
> > 
> > @@ -827,8 +827,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,
> > - 

Re: [PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-09 Thread Daniel Vetter
On Fri, Apr 06, 2018 at 07:23:57PM +0300, Laurent Pinchart wrote:
> 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 

Why should the adjusted_mode not be modified?
-Daniel

> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
>  drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
>  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
>  drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 
>  drivers/gpu/drm/bridge/tc358767.c  |  9 +
>  drivers/gpu/drm/drm_bridge.c   |  4 ++--
>  drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
>  drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
>  drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
>  drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
>  drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
>  drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
>  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
>  drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
>  drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
>  drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
>  drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
>  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
>  include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
>  include/drm/drm_bridge.h   |  8 
>  24 files changed, 57 insertions(+), 55 deletions(-)
> 
> Philippe,
> 
> I wrote this patch while reviewing your adjusted_mode documentation. I
> initially wanted to document the fact that the adjusted_mode argument to
> the bridge .mode_set() operation should not be modified by the bridge,
> and then realized that constifying it would be a better way to express
> that. I thus wouldn't mind if you took that patch in your tree and
> pushed it with the documentation patch once we get the necessary acks
> :-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h 
> b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> index d034b2cb5eee..f60d29defd18 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> @@ -389,7 +389,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);
> @@ -405,7 +405,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)
>  {
>  }
>  
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index efa29db5fc2b..99028d36ed74 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -664,8 +664,8 @@ static int 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;
> @@ -827,8 +827,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);
>  
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c 
> b/drivers/gpu/drm/bridge/adv7511/adv7533.c
> index 185b6d842166..5d5e7d9eded2 

[PATCH] drm: bridge: Constify mode arguments to bridge .mode_set() operation

2018-04-06 Thread Laurent Pinchart
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 
---
 drivers/gpu/drm/bridge/adv7511/adv7511.h   |  4 ++--
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |  8 
 drivers/gpu/drm/bridge/adv7511/adv7533.c   |  2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c  |  4 ++--
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
 drivers/gpu/drm/bridge/sii902x.c   |  4 ++--
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  4 ++--
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c  | 16 
 drivers/gpu/drm/bridge/tc358767.c  |  9 +
 drivers/gpu/drm/drm_bridge.c   |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_mic.c|  4 ++--
 drivers/gpu/drm/mediatek/mtk_hdmi.c|  4 ++--
 drivers/gpu/drm/msm/dsi/dsi.h  |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_manager.c  |  4 ++--
 drivers/gpu/drm/msm/edp/edp_bridge.c   |  4 ++--
 drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  4 ++--
 drivers/gpu/drm/rcar-du/rcar_lvds.c|  4 ++--
 drivers/gpu/drm/sti/sti_dvo.c  |  4 ++--
 drivers/gpu/drm/sti/sti_hda.c  |  4 ++--
 drivers/gpu/drm/sti/sti_hdmi.c |  4 ++--
 drivers/gpu/drm/stm/dw_mipi_dsi-stm.c  |  2 +-
 include/drm/bridge/dw_mipi_dsi.h   |  3 ++-
 include/drm/drm_bridge.h   |  8 
 24 files changed, 57 insertions(+), 55 deletions(-)

Philippe,

I wrote this patch while reviewing your adjusted_mode documentation. I
initially wanted to document the fact that the adjusted_mode argument to
the bridge .mode_set() operation should not be modified by the bridge,
and then realized that constifying it would be a better way to express
that. I thus wouldn't mind if you took that patch in your tree and
pushed it with the documentation patch once we get the necessary acks
:-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h 
b/drivers/gpu/drm/bridge/adv7511/adv7511.h
index d034b2cb5eee..f60d29defd18 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
@@ -389,7 +389,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);
@@ -405,7 +405,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)
 {
 }
 
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index efa29db5fc2b..99028d36ed74 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -664,8 +664,8 @@ static int 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;
@@ -827,8 +827,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);
 
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c 
b/drivers/gpu/drm/bridge/adv7511/adv7533.c
index 185b6d842166..5d5e7d9eded2 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7533.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c
@@ -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