[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>
This commit is contained in:
Julia Lawall
2016-08-29 10:12:01 -03:00
کامیت شده توسط Mauro Carvalho Chehab
والد f3c4a8f8d8
کامیت 78f2c50bb4
12فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده

مشاهده پرونده

@@ -258,7 +258,7 @@ static u32 cx23885_functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
}
static struct i2c_algorithm cx23885_i2c_algo_template = {
static const struct i2c_algorithm cx23885_i2c_algo_template = {
.master_xfer = i2c_xfer,
.functionality = cx23885_functionality,
};

مشاهده پرونده

@@ -281,7 +281,7 @@ static u32 cx25821_functionality(struct i2c_adapter *adap)
I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA;
}
static struct i2c_algorithm cx25821_i2c_algo_template = {
static const struct i2c_algorithm cx25821_i2c_algo_template = {
.master_xfer = i2c_xfer,
.functionality = cx25821_functionality,
#ifdef NEED_ALGO_CONTROL

مشاهده پرونده

@@ -625,7 +625,7 @@ static u32 ivtv_functionality(struct i2c_adapter *adap)
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
}
static struct i2c_algorithm ivtv_algo = {
static const struct i2c_algorithm ivtv_algo = {
.master_xfer = ivtv_xfer,
.functionality = ivtv_functionality,
};

مشاهده پرونده

@@ -338,7 +338,7 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL;
}
static struct i2c_algorithm saa7134_algo = {
static const struct i2c_algorithm saa7134_algo = {
.master_xfer = saa7134_i2c_xfer,
.functionality = functionality,
};

مشاهده پرونده

@@ -75,7 +75,7 @@ static u32 saa7164_functionality(struct i2c_adapter *adap)
return I2C_FUNC_I2C;
}
static struct i2c_algorithm saa7164_i2c_algo_template = {
static const struct i2c_algorithm saa7164_i2c_algo_template = {
.master_xfer = i2c_xfer,
.functionality = saa7164_functionality,
};