[PATCH v2 11/60] drm/omap: dss: Constify omap_dss_driver operations structure

Sebastian Reichel sre at kernel.org
Sun Jun 10 16:20:54 UTC 2018


Hi,

On Sat, May 26, 2018 at 08:24:29PM +0300, Laurent Pinchart wrote:
> The structure contains function pointers that don't need to be modified.
> Make all its instances const to improve security.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c      | 2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c            | 2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c           | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c                | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c             | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c     | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c     | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c     | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c     | 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h                       | 2 +-
>  drivers/gpu/drm/omapdrm/omap_connector.c                    | 6 +++---
>  drivers/gpu/drm/omapdrm/omap_encoder.c                      | 6 +++---
>  14 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 5fdecc12b608..a49bc4a8dcae 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -154,7 +154,7 @@ static int tvc_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.atv->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver tvc_driver = {
> +static const struct omap_dss_driver tvc_driver = {
>  	.connect		= tvc_connect,
>  	.disconnect		= tvc_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 6d8cbd9e2110..c320f3c5ae6c 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -297,7 +297,7 @@ static void dvic_disable_hpd(struct omap_dss_device *dssdev)
>  	mutex_unlock(&ddata->hpd_lock);
>  }
>  
> -static struct omap_dss_driver dvic_driver = {
> +static const struct omap_dss_driver dvic_driver = {
>  	.connect	= dvic_connect,
>  	.disconnect	= dvic_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index ca30ed9da7eb..6f12f9bb8054 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -269,7 +269,7 @@ static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
>  	return in->ops.hdmi->set_infoframe(in, avi);
>  }
>  
> -static struct omap_dss_driver hdmic_driver = {
> +static const struct omap_dss_driver hdmic_driver = {
>  	.connect		= hdmic_connect,
>  	.disconnect		= hdmic_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 6cbf570d6727..e874f0b72798 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -153,7 +153,7 @@ static int panel_dpi_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver panel_dpi_ops = {
> +static const struct omap_dss_driver panel_dpi_ops = {
>  	.connect	= panel_dpi_connect,
>  	.disconnect	= panel_dpi_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 428de90fced1..d7c57d84d7bd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1210,7 +1210,7 @@ static void dsicm_get_size(struct omap_dss_device *dssdev,
>  	*height = ddata->height_mm;
>  }
>  
> -static struct omap_dss_driver dsicm_ops = {
> +static const struct omap_dss_driver dsicm_ops = {
>  	.connect	= dsicm_connect,
>  	.disconnect	= dsicm_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> index 754197099440..ad98d2ffcf1b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -228,7 +228,7 @@ static int lb035q02_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver lb035q02_ops = {
> +static const struct omap_dss_driver lb035q02_ops = {
>  	.connect	= lb035q02_connect,
>  	.disconnect	= lb035q02_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> index 9a3b27fa5cb5..0846fb594352 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> @@ -222,7 +222,7 @@ static int nec_8048_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver nec_8048_ops = {
> +static const struct omap_dss_driver nec_8048_ops = {
>  	.connect	= nec_8048_connect,
>  	.disconnect	= nec_8048_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> index bb5b680cabfe..e7c4a830e214 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> @@ -192,7 +192,7 @@ static int sharp_ls_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver sharp_ls_ops = {
> +static const struct omap_dss_driver sharp_ls_ops = {
>  	.connect	= sharp_ls_connect,
>  	.disconnect	= sharp_ls_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> index 92fe125ce22e..c650f575b5c3 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> @@ -693,7 +693,7 @@ static int acx565akm_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.sdi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver acx565akm_ops = {
> +static const struct omap_dss_driver acx565akm_ops = {
>  	.connect	= acx565akm_connect,
>  	.disconnect	= acx565akm_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> index b5d8a00df811..0f2ecc2bcf4f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> @@ -362,7 +362,7 @@ static int td028ttec1_panel_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver td028ttec1_ops = {
> +static const struct omap_dss_driver td028ttec1_ops = {
>  	.connect	= td028ttec1_panel_connect,
>  	.disconnect	= td028ttec1_panel_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> index c08e22b43447..14a37b82ee13 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> @@ -456,7 +456,7 @@ static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
>  	return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver tpo_td043_ops = {
> +static const struct omap_dss_driver tpo_td043_ops = {
>  	.connect	= tpo_td043_connect,
>  	.disconnect	= tpo_td043_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 426ac8297f5f..e3d31b2fee4c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -466,7 +466,7 @@ struct omap_dss_device {
>  
>  	const char *name;
>  
> -	struct omap_dss_driver *driver;
> +	const struct omap_dss_driver *driver;
>  
>  	union {
>  		const struct omapdss_dpi_ops *dpi;
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> index 5cde26ac937b..eec3aa83dfcd 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -62,7 +62,7 @@ static enum drm_connector_status omap_connector_detect(
>  {
>  	struct omap_connector *omap_connector = to_omap_connector(connector);
>  	struct omap_dss_device *dssdev = omap_connector->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  	enum drm_connector_status ret;
>  
>  	if (dssdrv->detect) {
> @@ -107,7 +107,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
>  {
>  	struct omap_connector *omap_connector = to_omap_connector(connector);
>  	struct omap_dss_device *dssdev = omap_connector->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  	struct drm_device *dev = connector->dev;
>  	int n = 0;
>  
> @@ -170,7 +170,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
>  {
>  	struct omap_connector *omap_connector = to_omap_connector(connector);
>  	struct omap_dss_device *dssdev = omap_connector->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  	struct videomode vm = {0};
>  	struct drm_device *dev = connector->dev;
>  	struct drm_display_mode *new_mode;
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index fcdf4b0a8eec..ec0f451e3b36 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -94,7 +94,7 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  {
>  	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>  	struct omap_dss_device *dssdev = omap_encoder->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  
>  	dssdrv->disable(dssdev);
>  }
> @@ -106,7 +106,7 @@ static int omap_encoder_update(struct drm_encoder *encoder,
>  	struct drm_device *dev = encoder->dev;
>  	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>  	struct omap_dss_device *dssdev = omap_encoder->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  	int ret;
>  
>  	if (dssdrv->check_timings) {
> @@ -137,7 +137,7 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  {
>  	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>  	struct omap_dss_device *dssdev = omap_encoder->dssdev;
> -	struct omap_dss_driver *dssdrv = dssdev->driver;
> +	const struct omap_dss_driver *dssdrv = dssdev->driver;
>  	int r;
>  
>  	omap_encoder_update(encoder, omap_crtc_channel(encoder->crtc),
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180610/7d8968d0/attachment-0001.sig>


More information about the dri-devel mailing list