[media] dvb-frontends: constify dvb_tuner_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 11 Sep 2016 14:44:12 +0000 (11:44 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:22:55 +0000 (16:22 -0300)
These structures are only used to copy into other structures, so declare
them as const.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct dvb_tuner_ops i@p = { ... };

@ok1@
identifier r.i;
expression e;
position p;
@@
e = i@p

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
memcpy(e1, &i@p, e2)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct dvb_tuner_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct dvb_tuner_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17 files changed:
drivers/media/dvb-frontends/ascot2e.c
drivers/media/dvb-frontends/dvb-pll.c
drivers/media/dvb-frontends/helene.c
drivers/media/dvb-frontends/horus3a.c
drivers/media/dvb-frontends/ix2505v.c
drivers/media/dvb-frontends/stb6000.c
drivers/media/dvb-frontends/stb6100.c
drivers/media/dvb-frontends/stv6110.c
drivers/media/dvb-frontends/stv6110x.c
drivers/media/dvb-frontends/tda18271c2dd.c
drivers/media/dvb-frontends/tda665x.c
drivers/media/dvb-frontends/tda8261.c
drivers/media/dvb-frontends/tda826x.c
drivers/media/dvb-frontends/ts2020.c
drivers/media/dvb-frontends/tua6100.c
drivers/media/dvb-frontends/zl10036.c
drivers/media/dvb-frontends/zl10039.c

index 8cc8c4597b6a7bf6cf6790a3a146de7850902859..ad304eed656d7e16f14261281145706fe2e73330 100644 (file)
@@ -464,7 +464,7 @@ static int ascot2e_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops ascot2e_tuner_ops = {
+static const struct dvb_tuner_ops ascot2e_tuner_ops = {
        .info = {
                .name = "Sony ASCOT2E",
                .frequency_min = 1000000,
index 53089e142715a05043b841fca325d274a98c9cb1..735a9666202250dafc8b1c096f0fcbf62c6e822c 100644 (file)
@@ -739,7 +739,7 @@ static int dvb_pll_init(struct dvb_frontend *fe)
        return -EINVAL;
 }
 
-static struct dvb_tuner_ops dvb_pll_tuner_ops = {
+static const struct dvb_tuner_ops dvb_pll_tuner_ops = {
        .release = dvb_pll_release,
        .sleep = dvb_pll_sleep,
        .init = dvb_pll_init,
index 3d1cd5fa49041c5e0f76406205469458b7b19672..dc43c5f6d0ea450c96b8e8c27d4533b0ed59c1a6 100644 (file)
@@ -842,7 +842,7 @@ static int helene_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops helene_tuner_ops = {
+static const struct dvb_tuner_ops helene_tuner_ops = {
        .info = {
                .name = "Sony HELENE Ter tuner",
                .frequency_min = 1000000,
@@ -856,7 +856,7 @@ static struct dvb_tuner_ops helene_tuner_ops = {
        .get_frequency = helene_get_frequency,
 };
 
-static struct dvb_tuner_ops helene_tuner_ops_s = {
+static const struct dvb_tuner_ops helene_tuner_ops_s = {
        .info = {
                .name = "Sony HELENE Sat tuner",
                .frequency_min = 500000,
index a98bca5270d90dddfbbd1522d05d0d05b2b01533..0c089b5986a1928faceabdedf65034396f549fcd 100644 (file)
@@ -326,7 +326,7 @@ static int horus3a_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops horus3a_tuner_ops = {
+static const struct dvb_tuner_ops horus3a_tuner_ops = {
        .info = {
                .name = "Sony Horus3a",
                .frequency_min = 950000,
index 0e3387e0095267b88e1517491be75601bf9f295b..2826bbb36b731518ae7ff9214084d796bcbbe025 100644 (file)
@@ -258,7 +258,7 @@ static int ix2505v_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops ix2505v_tuner_ops = {
+static const struct dvb_tuner_ops ix2505v_tuner_ops = {
        .info = {
                .name = "Sharp IX2505V (B0017)",
                .frequency_min = 950000,
index a0c3c526b132415d5bc705c2f5c8064e64fb9243..73347d51f340b5a923b2976b69fd9ab59cc54ca1 100644 (file)
@@ -186,7 +186,7 @@ static int stb6000_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops stb6000_tuner_ops = {
+static const struct dvb_tuner_ops stb6000_tuner_ops = {
        .info = {
                .name = "ST STB6000",
                .frequency_min = 950000,
index b9c2511bf019866ee06d863fa73fce3f61040d2e..5add1182c3cae6f5f172d0a4e57e82c46ea8ed74 100644 (file)
@@ -522,7 +522,7 @@ static int stb6100_set_params(struct dvb_frontend *fe)
        return 0;
 }
 
-static struct dvb_tuner_ops stb6100_ops = {
+static const struct dvb_tuner_ops stb6100_ops = {
        .info = {
                .name                   = "STB6100 Silicon Tuner",
                .frequency_min          = 950000,
index 91c6dcf65d2a1f7fcbab3794703f67aef3423626..66a5a7f2295c09f8f35538a0a7303dc4c52218d5 100644 (file)
@@ -382,7 +382,7 @@ static int stv6110_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
        return 0;
 }
 
-static struct dvb_tuner_ops stv6110_tuner_ops = {
+static const struct dvb_tuner_ops stv6110_tuner_ops = {
        .info = {
                .name = "ST STV6110",
                .frequency_min = 950000,
index a62c01e454f518399270443f0311106a39ef426b..c611ad210b5c264fe2f3c5f0dfa0b452f7ed5f6c 100644 (file)
@@ -345,7 +345,7 @@ static int stv6110x_release(struct dvb_frontend *fe)
        return 0;
 }
 
-static struct dvb_tuner_ops stv6110x_ops = {
+static const struct dvb_tuner_ops stv6110x_ops = {
        .info = {
                .name           = "STV6110(A) Silicon Tuner",
                .frequency_min  =  950000,
index de0a1c1109723d794d707e13518e2c971d3a1825..bc247f9b553a3a659c74800db0460fe56a5bd907 100644 (file)
@@ -1217,7 +1217,7 @@ static int get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
 }
 
 
-static struct dvb_tuner_ops tuner_ops = {
+static const struct dvb_tuner_ops tuner_ops = {
        .info = {
                .name = "NXP TDA18271C2D",
                .frequency_min  =  47125000,
index 82f8cc534f3399633a0c19a170046c989e061913..7ca965987f40ac10d3f3acdb48e88557e46a0290 100644 (file)
@@ -206,7 +206,7 @@ static int tda665x_release(struct dvb_frontend *fe)
        return 0;
 }
 
-static struct dvb_tuner_ops tda665x_ops = {
+static const struct dvb_tuner_ops tda665x_ops = {
        .get_status     = tda665x_get_status,
        .set_params     = tda665x_set_params,
        .get_frequency  = tda665x_get_frequency,
index 3285b1bc46427476dff902d0113a83ff4ef0098d..e0df93191b9e8cd6b2a62774d11630e78470ba75 100644 (file)
@@ -161,7 +161,7 @@ static int tda8261_release(struct dvb_frontend *fe)
        return 0;
 }
 
-static struct dvb_tuner_ops tda8261_ops = {
+static const struct dvb_tuner_ops tda8261_ops = {
 
        .info = {
                .name           = "TDA8261",
index 04bbcc24de0a7834c0b6b4d1132157472cd173a5..2ec671df1441315e49226c6ff5acb529a5bd2896 100644 (file)
@@ -129,7 +129,7 @@ static int tda826x_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops tda826x_tuner_ops = {
+static const struct dvb_tuner_ops tda826x_tuner_ops = {
        .info = {
                .name = "Philips TDA826X",
                .frequency_min = 950000,
index 14b410ffe612c2d76381ab0177d82970384913e8..a9f6bbea6df368fbea92a47457dec33730bf90c3 100644 (file)
@@ -496,7 +496,7 @@ static int ts2020_read_signal_strength(struct dvb_frontend *fe,
        return 0;
 }
 
-static struct dvb_tuner_ops ts2020_tuner_ops = {
+static const struct dvb_tuner_ops ts2020_tuner_ops = {
        .info = {
                .name = "TS2020",
                .frequency_min = 950000,
index 029384d1fdddd0caa08a333b37fb50968df0caa5..6da12b9e55ebe2e658a92e1d94e18afa7cde8658 100644 (file)
@@ -157,7 +157,7 @@ static int tua6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
        return 0;
 }
 
-static struct dvb_tuner_ops tua6100_tuner_ops = {
+static const struct dvb_tuner_ops tua6100_tuner_ops = {
        .info = {
                .name = "Infineon TUA6100",
                .frequency_min = 950000,
index 0903d461b8fa769ca5fe2db4a918edfc2388d4bf..7ed81315965f7559dc82a4c29f2e4551f1c1b2cd 100644 (file)
@@ -446,7 +446,7 @@ static int zl10036_init(struct dvb_frontend *fe)
        return ret;
 }
 
-static struct dvb_tuner_ops zl10036_tuner_ops = {
+static const struct dvb_tuner_ops zl10036_tuner_ops = {
        .info = {
                .name = "Zarlink ZL10036",
                .frequency_min = 950000,
index ee09ec26c553ef7aa4e8387f4ba7bcab3948db37..f8c271be196c19180007560b73f7272f3c804719 100644 (file)
@@ -255,7 +255,7 @@ static int zl10039_release(struct dvb_frontend *fe)
        return 0;
 }
 
-static struct dvb_tuner_ops zl10039_ops = {
+static const struct dvb_tuner_ops zl10039_ops = {
        .release = zl10039_release,
        .init = zl10039_init,
        .sleep = zl10039_sleep,