Skip to contentSkip to conversation

char/tpm: Convert struct i2c_msg initialization to C99 format

PATCH RESEND In review Jean Delvare 4 participants 7 messages Feb 28, 2013 – Mar 4, 2013 1 message not in the archive TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 char/tpm: Convert struct i2c_msg initialization to C99 format

From: Shubhrajyoti Datta <[email protected]>

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.

---
v2: removed zero initialization of flags.

Patch already sent by Shubhrajyoti Datta on 2012-10-10.

 drivers/char/tpm/tpm_i2c_infineon.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_i2c_infineon.c +16 -3
@@ -90,8 +90,17 @@ static struct i2c_driver tpm_tis_i2c_dri
 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 msg2 = { tpm_dev.client->addr, I2C_M_RD, len, buffer };
+	struct i2c_msg msg1 = {
+		.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 count;
@@ -138,7 +147,11 @@ static int iic_tpm_write_generic(u8 addr
 	int rc = -EIO;
 	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)
 		return -EINVAL;
Signature · 1 line
Jean Delvare
maintainer
#1 lore raw

Hi,

thanks for resending.

Am Donnerstag, 28. Februar 2013, 11:06:11 schrieb Jean Delvare:

Quoted 11 lines

From: Shubhrajyoti Datta <[email protected]>

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.

Quoted 7 lines

---
v2: removed zero initialization of flags.

Patch already sent by Shubhrajyoti Datta on 2012-10-10.

 drivers/char/tpm/tpm_i2c_infineon.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

As it was not yet applied I folded it into my patch "Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C)"

Thanks,
Peter

#2 lore raw
Quoted 1 line · Peter Hüwe

thanks for resending.

You're welcome.

Quoted 15 lines

Am Donnerstag, 28. Februar 2013, 11:06:11 schrieb Jean Delvare:

Quoted 14 lines

From: Shubhrajyoti Datta <[email protected]>

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.

---
v2: removed zero initialization of flags.

Quoted 7 lines
Quoted 4 lines

Patch already sent by Shubhrajyoti Datta on 2012-10-10.

 drivers/char/tpm/tpm_i2c_infineon.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

As it was not yet applied I folded it into my patch "Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C)"

I'd suggest not to. Mixing actual changes with cleanups is generally discouraged.

Signature · 1 line
Jean Delvare
#3 lore raw
Quoted 22 lines · Jean Delvare
Quoted 1 line · Peter Hüwe

thanks for resending.

You're welcome.

Quoted 17 lines

Am Donnerstag, 28. Februar 2013, 11:06:11 schrieb Jean Delvare:

Quoted 16 lines

From: Shubhrajyoti Datta <[email protected]>

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.

---
v2: removed zero initialization of flags.

Patch already sent by Shubhrajyoti Datta on 2012-10-10.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
 drivers/char/tpm/tpm_i2c_infineon.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

As it was not yet applied I folded it into my patch "Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C)"

I'd suggest not to. Mixing actual changes with cleanups is generally discouraged.

Yes, please don't do this. Also because it makes it really
confusing for me to figure out whether something has been applied or not and if I have the right people on the sign off.

Peter, can you resend without it? I'll have a new staging tree with
everything up in the next day or two.

Thanks,
Kent

Quoted 7 lines

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

maintainer
#4 lore raw
Quoted 9 lines
Quoted 2 lines

I'd suggest not to. Mixing actual changes with cleanups is generally discouraged.

Yes, please don't do this. Also because it makes it really
confusing for me to figure out whether something has been applied or not and if I have the right people on the sign off.

Peter, can you resend without it? I'll have a new staging tree with
everything up in the next day or two.

Yes, no problem.
I'll create a patch without it -
I'll make it this way that you can apply the conversion patch first and then the change.

Thanks,
Peter

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 7 lines
Quoted 4 lines

Yes, no problem.
I'll create a patch without it -
I'll make it this way that you can apply the conversion patch first and then the change.

Thanks!
Kent

The new version of my patch was just sent - please apply this one first.

Thanks,
Peter

-----------------------------------------------
Peter Huewe
Dipl. Inf. (FH)

Infineon Technologies AG
CCS TI SWT SW ESW
Tel: +49 821 25851-86
Fax: +49 821 25851-40

[email protected]

****VISIT US AT: www.infineon.com *****
Infineon Technologies AG
Vorsitzender des Aufsichtsrats: Wolfgang Mayrhuber
Vorstand: Dr. Reinhard Ploss (Vorsitzender), Dominik Asam, Arunjai Mittal Sitz der Gesellschaft: Neubiberg
Registergericht: München HRB 126492

#7 lore raw
In reply to Jean Delvare
Quoted 7 lines · Jean Delvare

From: Shubhrajyoti Datta <[email protected]>

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.

Staged here:

https://github.com/shpedoikal/linux.git tpmdd-03-04-13

Thanks,
Kent

Quoted 55 lines

---
v2: removed zero initialization of flags.

Patch already sent by Shubhrajyoti Datta on 2012-10-10.

 drivers/char/tpm/tpm_i2c_infineon.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_i2c_infineon.c 2013-02-28 10:59:08.639682373 +0100 renamed from drivers/char/tpm/tpm_i2c_infineon.c 2013-02-28 09:54:50.184560055 +0100 +16 -4
@@ -90,8 +90,17 @@ static struct i2c_driver tpm_tis_i2c_dri
 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 msg2 = { tpm_dev.client->addr, I2C_M_RD, len, buffer };
+       struct i2c_msg msg1 = {
+               .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 count;
@@ -138,7 +147,11 @@ static int iic_tpm_write_generic(u8 addr
        int rc = -EIO;
        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)
                return -EINVAL;
 
 
--

Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/