diff options
| author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-08-29 09:12:01 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-19 15:27:02 -0400 |
| commit | 78f2c50bb4e1884318542cc5f674afb106555273 (patch) | |
| tree | c50077b5d7a9f352a73e994b6b49e29e87e8cdfd | |
| parent | f3c4a8f8d8eb3ed97bccf4776079af3ec5daa147 (diff) | |
[media] constify i2c_algorithm structures
These i2c_algorithm structures are only stored in the alg field of an
i2c_adapter structure, which is declared as const. This declare the
structures as const as well.
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 i2c_algorithm i@p = { ... };
@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.alg = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct i2c_algorithm 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>
| -rw-r--r-- | drivers/media/pci/cx23885/cx23885-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/pci/cx25821/cx25821-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/pci/ivtv/ivtv-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/pci/saa7134/saa7134-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/pci/saa7164/saa7164-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/radio/si4713/radio-usb-si4713.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/go7007/go7007-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/go7007/go7007-usb.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/hdpvr/hdpvr-i2c.c | 2 | ||||
| -rw-r--r-- | drivers/media/usb/stk1160/stk1160-i2c.c | 2 |
12 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c index ae061b358591..61591225be9a 100644 --- a/drivers/media/pci/cx23885/cx23885-i2c.c +++ b/drivers/media/pci/cx23885/cx23885-i2c.c | |||
| @@ -258,7 +258,7 @@ static u32 cx23885_functionality(struct i2c_adapter *adap) | |||
| 258 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; | 258 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | static struct i2c_algorithm cx23885_i2c_algo_template = { | 261 | static const struct i2c_algorithm cx23885_i2c_algo_template = { |
| 262 | .master_xfer = i2c_xfer, | 262 | .master_xfer = i2c_xfer, |
| 263 | .functionality = cx23885_functionality, | 263 | .functionality = cx23885_functionality, |
| 264 | }; | 264 | }; |
diff --git a/drivers/media/pci/cx25821/cx25821-i2c.c b/drivers/media/pci/cx25821/cx25821-i2c.c index dca37c7dba73..63ba25b82692 100644 --- a/drivers/media/pci/cx25821/cx25821-i2c.c +++ b/drivers/media/pci/cx25821/cx25821-i2c.c | |||
| @@ -281,7 +281,7 @@ static u32 cx25821_functionality(struct i2c_adapter *adap) | |||
| 281 | I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA; | 281 | I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | static struct i2c_algorithm cx25821_i2c_algo_template = { | 284 | static const struct i2c_algorithm cx25821_i2c_algo_template = { |
| 285 | .master_xfer = i2c_xfer, | 285 | .master_xfer = i2c_xfer, |
| 286 | .functionality = cx25821_functionality, | 286 | .functionality = cx25821_functionality, |
| 287 | #ifdef NEED_ALGO_CONTROL | 287 | #ifdef NEED_ALGO_CONTROL |
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c index bccbf2d18e30..dd57442cf086 100644 --- a/drivers/media/pci/ivtv/ivtv-i2c.c +++ b/drivers/media/pci/ivtv/ivtv-i2c.c | |||
| @@ -625,7 +625,7 @@ static u32 ivtv_functionality(struct i2c_adapter *adap) | |||
| 625 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 625 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | static struct i2c_algorithm ivtv_algo = { | 628 | static const struct i2c_algorithm ivtv_algo = { |
| 629 | .master_xfer = ivtv_xfer, | 629 | .master_xfer = ivtv_xfer, |
| 630 | .functionality = ivtv_functionality, | 630 | .functionality = ivtv_functionality, |
| 631 | }; | 631 | }; |
diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c b/drivers/media/pci/saa7134/saa7134-i2c.c index 8ef6399d794f..2dac48fa1386 100644 --- a/drivers/media/pci/saa7134/saa7134-i2c.c +++ b/drivers/media/pci/saa7134/saa7134-i2c.c | |||
| @@ -338,7 +338,7 @@ static u32 functionality(struct i2c_adapter *adap) | |||
| 338 | return I2C_FUNC_SMBUS_EMUL; | 338 | return I2C_FUNC_SMBUS_EMUL; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | static struct i2c_algorithm saa7134_algo = { | 341 | static const struct i2c_algorithm saa7134_algo = { |
| 342 | .master_xfer = saa7134_i2c_xfer, | 342 | .master_xfer = saa7134_i2c_xfer, |
| 343 | .functionality = functionality, | 343 | .functionality = functionality, |
| 344 | }; | 344 | }; |
diff --git a/drivers/media/pci/saa7164/saa7164-i2c.c b/drivers/media/pci/saa7164/saa7164-i2c.c index 0342d84913b8..024f4e29e840 100644 --- a/drivers/media/pci/saa7164/saa7164-i2c.c +++ b/drivers/media/pci/saa7164/saa7164-i2c.c | |||
| @@ -75,7 +75,7 @@ static u32 saa7164_functionality(struct i2c_adapter *adap) | |||
| 75 | return I2C_FUNC_I2C; | 75 | return I2C_FUNC_I2C; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | static struct i2c_algorithm saa7164_i2c_algo_template = { | 78 | static const struct i2c_algorithm saa7164_i2c_algo_template = { |
| 79 | .master_xfer = i2c_xfer, | 79 | .master_xfer = i2c_xfer, |
| 80 | .functionality = saa7164_functionality, | 80 | .functionality = saa7164_functionality, |
| 81 | }; | 81 | }; |
diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c b/drivers/media/radio/si4713/radio-usb-si4713.c index 5146be2a1a50..e5e5a1672bdb 100644 --- a/drivers/media/radio/si4713/radio-usb-si4713.c +++ b/drivers/media/radio/si4713/radio-usb-si4713.c | |||
| @@ -402,7 +402,7 @@ static u32 si4713_functionality(struct i2c_adapter *adapter) | |||
| 402 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 402 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | static struct i2c_algorithm si4713_algo = { | 405 | static const struct i2c_algorithm si4713_algo = { |
| 406 | .master_xfer = si4713_transfer, | 406 | .master_xfer = si4713_transfer, |
| 407 | .functionality = si4713_functionality, | 407 | .functionality = si4713_functionality, |
| 408 | }; | 408 | }; |
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 3e7982ef180a..35e9acfe63d3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c | |||
| @@ -454,7 +454,7 @@ static u32 functionality(struct i2c_adapter *adap) | |||
| 454 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; | 454 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | static struct i2c_algorithm cx231xx_algo = { | 457 | static const struct i2c_algorithm cx231xx_algo = { |
| 458 | .master_xfer = cx231xx_i2c_xfer, | 458 | .master_xfer = cx231xx_i2c_xfer, |
| 459 | .functionality = functionality, | 459 | .functionality = functionality, |
| 460 | }; | 460 | }; |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 1a9e1e556706..8b690ac908a4 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
| @@ -855,7 +855,7 @@ static u32 functionality(struct i2c_adapter *i2c_adap) | |||
| 855 | return 0; | 855 | return 0; |
| 856 | } | 856 | } |
| 857 | 857 | ||
| 858 | static struct i2c_algorithm em28xx_algo = { | 858 | static const struct i2c_algorithm em28xx_algo = { |
| 859 | .master_xfer = em28xx_i2c_xfer, | 859 | .master_xfer = em28xx_i2c_xfer, |
| 860 | .functionality = functionality, | 860 | .functionality = functionality, |
| 861 | }; | 861 | }; |
diff --git a/drivers/media/usb/go7007/go7007-i2c.c b/drivers/media/usb/go7007/go7007-i2c.c index 55addfa855d4..c084bf794b56 100644 --- a/drivers/media/usb/go7007/go7007-i2c.c +++ b/drivers/media/usb/go7007/go7007-i2c.c | |||
| @@ -191,7 +191,7 @@ static u32 go7007_functionality(struct i2c_adapter *adapter) | |||
| 191 | return I2C_FUNC_SMBUS_BYTE_DATA; | 191 | return I2C_FUNC_SMBUS_BYTE_DATA; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static struct i2c_algorithm go7007_algo = { | 194 | static const struct i2c_algorithm go7007_algo = { |
| 195 | .smbus_xfer = go7007_smbus_xfer, | 195 | .smbus_xfer = go7007_smbus_xfer, |
| 196 | .master_xfer = go7007_i2c_master_xfer, | 196 | .master_xfer = go7007_i2c_master_xfer, |
| 197 | .functionality = go7007_functionality, | 197 | .functionality = go7007_functionality, |
diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index 14d3f8c1ce4a..ed9bcaf08d5e 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c | |||
| @@ -1032,7 +1032,7 @@ static u32 go7007_usb_functionality(struct i2c_adapter *adapter) | |||
| 1032 | return (I2C_FUNC_SMBUS_EMUL) & ~I2C_FUNC_SMBUS_QUICK; | 1032 | return (I2C_FUNC_SMBUS_EMUL) & ~I2C_FUNC_SMBUS_QUICK; |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| 1035 | static struct i2c_algorithm go7007_usb_algo = { | 1035 | static const struct i2c_algorithm go7007_usb_algo = { |
| 1036 | .master_xfer = go7007_usb_i2c_master_xfer, | 1036 | .master_xfer = go7007_usb_i2c_master_xfer, |
| 1037 | .functionality = go7007_usb_functionality, | 1037 | .functionality = go7007_usb_functionality, |
| 1038 | }; | 1038 | }; |
diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index a38f58c4c6bf..608ae96dc0e5 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c | |||
| @@ -180,7 +180,7 @@ static u32 hdpvr_functionality(struct i2c_adapter *adapter) | |||
| 180 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 180 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static struct i2c_algorithm hdpvr_algo = { | 183 | static const struct i2c_algorithm hdpvr_algo = { |
| 184 | .master_xfer = hdpvr_transfer, | 184 | .master_xfer = hdpvr_transfer, |
| 185 | .functionality = hdpvr_functionality, | 185 | .functionality = hdpvr_functionality, |
| 186 | }; | 186 | }; |
diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c index 850cf285ada8..3f2517be02bb 100644 --- a/drivers/media/usb/stk1160/stk1160-i2c.c +++ b/drivers/media/usb/stk1160/stk1160-i2c.c | |||
| @@ -235,7 +235,7 @@ static u32 functionality(struct i2c_adapter *adap) | |||
| 235 | return I2C_FUNC_SMBUS_EMUL; | 235 | return I2C_FUNC_SMBUS_EMUL; |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static struct i2c_algorithm algo = { | 238 | static const struct i2c_algorithm algo = { |
| 239 | .master_xfer = stk1160_i2c_xfer, | 239 | .master_xfer = stk1160_i2c_xfer, |
| 240 | .functionality = functionality, | 240 | .functionality = functionality, |
| 241 | }; | 241 | }; |
