drm/omap: dss: Constify omap_dss_driver operations structure
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 14 Feb 2018 01:12:37 +0000 (03:12 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:25 +0000 (16:13 +0300)
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@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
14 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-dvi.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/panel-dpi.c
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_connector.c
drivers/gpu/drm/omapdrm/omap_encoder.c

index 5fdecc12b608550988ab4ab6f415b5384d8a955d..a49bc4a8dcae6daead6facfe7fff0e41160aee44 100644 (file)
@@ -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,
 
index 6d8cbd9e21101df8630872b18457775183ec1a33..c320f3c5ae6cfd5ed90f76051d7d97f86170ec30 100644 (file)
@@ -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,
 
index ca30ed9da7eb7d968e19e0b6dee2cb63d9016d83..6f12f9bb8054c98a61f9e409169305a273412323 100644 (file)
@@ -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,
 
index 6cbf570d67273927a5a1e095faf89d062a32cc02..e874f0b72798cbe74f1393da4b20833f0ae5bc9d 100644 (file)
@@ -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,
 
index 428de90fced18b1077dc7b9c6ab4a1a393b92739..d7c57d84d7bdb3cfd5b6b6eec42b9677843f9011 100644 (file)
@@ -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,
 
index 75419709944012834cefbc8e16dbbd6ff77bc247..ad98d2ffcf1b9a96af0260b2ac94f047720974a5 100644 (file)
@@ -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,
 
index 9a3b27fa5cb57ae1cbaab63a2b99226a7f771701..0846fb594352e77dba0d317c59a732c15006eac0 100644 (file)
@@ -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,
 
index bb5b680cabfedc1c74f91e991aedf132199abf26..e7c4a830e214a697afac7e06e3fb3bcded775792 100644 (file)
@@ -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,
 
index f34c06bb5bd74395a73b36b25dc2e0b166c353c5..02415592f85681b17c5ed2ce058ebb12eb185d7d 100644 (file)
@@ -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,
 
index a1f1dc18407a3e9b083eece383276f8bce79f4fe..3c4036ee7b0c6610392eec440fbbc401821d82a2 100644 (file)
@@ -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,
 
index c08e22b434472d99ea1274c38109b6c2d9612909..14a37b82ee13e941fb16c703c47fed54adadf359 100644 (file)
@@ -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,
 
index 426ac8297f5fcfdb09361e06a600428d3f118d7f..e3d31b2fee4c45d780eaea436793469b5a1c2fcc 100644 (file)
@@ -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;
index 2ddb856666c465c0ce0dc0bc48a4240498e560a1..3b60086f293869d71e8e6d29ccad9a8c25f13ed4 100644 (file)
@@ -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;
index fcdf4b0a8eecab83fdd8bd1a230e15747dae79d8..ec0f451e3b366e6d0d92bdb55f4e091a35335e7d 100644 (file)
@@ -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),