[media] constify i2c_algorithm structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Mon, 29 Aug 2016 13:12:01 +0000 (10:12 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:27:02 +0000 (16:27 -0300)
commit78f2c50bb4e1884318542cc5f674afb106555273
treec50077b5d7a9f352a73e994b6b49e29e87e8cdfd
parentf3c4a8f8d8eb3ed97bccf4776079af3ec5daa147
[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>
12 files changed:
drivers/media/pci/cx23885/cx23885-i2c.c
drivers/media/pci/cx25821/cx25821-i2c.c
drivers/media/pci/ivtv/ivtv-i2c.c
drivers/media/pci/saa7134/saa7134-i2c.c
drivers/media/pci/saa7164/saa7164-i2c.c
drivers/media/radio/si4713/radio-usb-si4713.c
drivers/media/usb/cx231xx/cx231xx-i2c.c
drivers/media/usb/em28xx/em28xx-i2c.c
drivers/media/usb/go7007/go7007-i2c.c
drivers/media/usb/go7007/go7007-usb.c
drivers/media/usb/hdpvr/hdpvr-i2c.c
drivers/media/usb/stk1160/stk1160-i2c.c