i2c: Convert struct i2c_msg initialization to C99 format
Convert the struct i2c_msg initialization to C99 format. This makes maintaining and editing the code simpler. Also helps once other fields like transferred are added in future. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
committed by
Jean Delvare
parent
71b578452e
commit
230da09435
@@ -1989,12 +1989,22 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
|
|||||||
unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
|
unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
|
||||||
unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
|
unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
|
||||||
int num = read_write == I2C_SMBUS_READ ? 2 : 1;
|
int num = read_write == I2C_SMBUS_READ ? 2 : 1;
|
||||||
struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 },
|
|
||||||
{ addr, flags | I2C_M_RD, 0, msgbuf1 }
|
|
||||||
};
|
|
||||||
int i;
|
int i;
|
||||||
u8 partial_pec = 0;
|
u8 partial_pec = 0;
|
||||||
int status;
|
int status;
|
||||||
|
struct i2c_msg msg[2] = {
|
||||||
|
{
|
||||||
|
.addr = addr,
|
||||||
|
.flags = flags,
|
||||||
|
.len = 1,
|
||||||
|
.buf = msgbuf0,
|
||||||
|
}, {
|
||||||
|
.addr = addr,
|
||||||
|
.flags = flags | I2C_M_RD,
|
||||||
|
.len = 0,
|
||||||
|
.buf = msgbuf1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
msgbuf0[0] = command;
|
msgbuf0[0] = command;
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user