From 78f2c50bb4e1884318542cc5f674afb106555273 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 29 Aug 2016 10:12:01 -0300 Subject: [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/) // @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 = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/go7007/go7007-i2c.c | 2 +- drivers/media/usb/go7007/go7007-usb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb/go7007') 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) return I2C_FUNC_SMBUS_BYTE_DATA; } -static struct i2c_algorithm go7007_algo = { +static const struct i2c_algorithm go7007_algo = { .smbus_xfer = go7007_smbus_xfer, .master_xfer = go7007_i2c_master_xfer, .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) return (I2C_FUNC_SMBUS_EMUL) & ~I2C_FUNC_SMBUS_QUICK; } -static struct i2c_algorithm go7007_usb_algo = { +static const struct i2c_algorithm go7007_usb_algo = { .master_xfer = go7007_usb_i2c_master_xfer, .functionality = go7007_usb_functionality, }; -- cgit v1.2.3-59-g8ed1b