Commit eef8b629 authored by Shubhrajyoti Datta's avatar Shubhrajyoti Datta Committed by Kent Yoder

char/tpm: 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.

Thanks to Julia Lawall for automating the conversion.
Signed-off-by: default avatarShubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: default avatarPeter Huewe <peter.huewe@infineon.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarKent Yoder <key@linux.vnet.ibm.com>
parent e361200b
...@@ -90,8 +90,17 @@ static struct i2c_driver tpm_tis_i2c_driver; ...@@ -90,8 +90,17 @@ static struct i2c_driver tpm_tis_i2c_driver;
static int iic_tpm_read(u8 addr, u8 *buffer, size_t len) static int iic_tpm_read(u8 addr, u8 *buffer, size_t len)
{ {
struct i2c_msg msg1 = { tpm_dev.client->addr, 0, 1, &addr }; struct i2c_msg msg1 = {
struct i2c_msg msg2 = { tpm_dev.client->addr, I2C_M_RD, len, buffer }; .addr = tpm_dev.client->addr,
.len = 1,
.buf = &addr
};
struct i2c_msg msg2 = {
.addr = tpm_dev.client->addr,
.flags = I2C_M_RD,
.len = len,
.buf = buffer
};
int rc; int rc;
int count; int count;
...@@ -138,7 +147,11 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len, ...@@ -138,7 +147,11 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
int rc = -EIO; int rc = -EIO;
int count; int count;
struct i2c_msg msg1 = { tpm_dev.client->addr, 0, len + 1, tpm_dev.buf }; struct i2c_msg msg1 = {
.addr = tpm_dev.client->addr,
.len = len + 1,
.buf = tpm_dev.buf
};
if (len > TPM_BUFSIZE) if (len > TPM_BUFSIZE)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment