From: Julia Lawall <Julia.Lawall@xxxxxxx> Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the bufferin each case. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a,b,c; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b, .len = c, .flags = I2C_M_RD} + I2C_MSG_READ(a,b,c) ; @@ expression a,b,c; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b, .len = c, .flags = 0} + I2C_MSG_WRITE(a,b,c) ; @@ expression a,b,c,d; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b, .len = c, .flags = d} + I2C_MSG_OP(a,b,c,d) ; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx> --- drivers/media/tuners/tda8290.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/tuners/tda8290.c b/drivers/media/tuners/tda8290.c index 8c48521..83ecee2 100644 --- a/drivers/media/tuners/tda8290.c +++ b/drivers/media/tuners/tda8290.c @@ -463,7 +463,8 @@ static void tda8290_standby(struct dvb_frontend *fe) unsigned char cb1[] = { 0x30, 0xD0 }; unsigned char tda8290_standby[] = { 0x00, 0x02 }; unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; - struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; + struct i2c_msg msg = I2C_MSG_WRITE(priv->tda827x_addr, cb1, + sizeof(cb1)); tda8290_i2c_bridge(fe, 1); if (priv->ver & TDA8275A) @@ -532,8 +533,8 @@ static void tda8290_init_tuner(struct dvb_frontend *fe) 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; - struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, - .buf=tda8275_init, .len = 14}; + struct i2c_msg msg = I2C_MSG_WRITE(priv->tda827x_addr, tda8275_init, + sizeof(tda8275_init)); if (priv->ver & TDA8275A) msg.buf = tda8275a_init; @@ -569,7 +570,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) int i, ret, tuners_found; u32 tuner_addrs; u8 data; - struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 }; + struct i2c_msg msg = I2C_MSG_READ(0, &data, sizeof(data)); if (!analog_ops->i2c_gate_ctrl) { printk(KERN_ERR "tda8290: no gate control were provided!\n"); @@ -658,8 +659,8 @@ static int tda8290_probe(struct tuner_i2c_props *i2c_props) #define TDA8290_ID 0x89 u8 reg = 0x1f, id; struct i2c_msg msg_read[] = { - { .addr = i2c_props->addr, .flags = 0, .len = 1, .buf = ® }, - { .addr = i2c_props->addr, .flags = I2C_M_RD, .len = 1, .buf = &id }, + I2C_MSG_WRITE(i2c_props->addr, ®, sizeof(reg)), + I2C_MSG_READ(i2c_props->addr, &id, sizeof(id)), }; /* detect tda8290 */ @@ -685,8 +686,8 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) #define TDA8295C2_ID 0x8b u8 reg = 0x2f, id; struct i2c_msg msg_read[] = { - { .addr = i2c_props->addr, .flags = 0, .len = 1, .buf = ® }, - { .addr = i2c_props->addr, .flags = I2C_M_RD, .len = 1, .buf = &id }, + I2C_MSG_WRITE(i2c_props->addr, ®, sizeof(reg)), + I2C_MSG_READ(i2c_props->addr, &id, sizeof(id)), }; /* detect tda8295 */ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html