Skip to contentSkip to conversation

tpm: cleanup tpm_tis_remove()

PATCH In review Jarkko Sakkinen 2 participants 7 messages Mar 31, 2016 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: cleanup tpm_tis_remove()

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

---
 drivers/char/tpm/tpm_tis.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm_tis.c +5 -6
index 068f021..ce2b984 100644
@@ -658,15 +658,14 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts");
 
 static void tpm_tis_remove(struct tpm_chip *chip)
 {
+	void __iomem *reg = chip->vendor.iobase +
+		TPM_INT_ENABLE(chip->vendor.locality);
+
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
 		tpm2_shutdown(chip, TPM2_SU_CLEAR);
 
-	iowrite32(~TPM_GLOBAL_INT_ENABLE &
-		  ioread32(chip->vendor.iobase +
-			   TPM_INT_ENABLE(chip->vendor.
-					  locality)),
-		  chip->vendor.iobase +
-		  TPM_INT_ENABLE(chip->vendor.locality));
+	iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg);
+
 	release_locality(chip, chip->vendor.locality, 1);
 }
 
Signature · 9 lines
2.7.4


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
#1 lore raw

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

/Jarkko

Quoted 33 lines
---
 drivers/char/tpm/tpm_tis.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm_tis.c +5 -6
index 068f021..ce2b984 100644
@@ -658,15 +658,14 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts");
 
 static void tpm_tis_remove(struct tpm_chip *chip)
 {
+	void __iomem *reg = chip->vendor.iobase +
+		TPM_INT_ENABLE(chip->vendor.locality);
+
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
 		tpm2_shutdown(chip, TPM2_SU_CLEAR);
 
-	iowrite32(~TPM_GLOBAL_INT_ENABLE &
-		  ioread32(chip->vendor.iobase +
-			   TPM_INT_ENABLE(chip->vendor.
-					  locality)),
-		  chip->vendor.iobase +
-		  TPM_INT_ENABLE(chip->vendor.locality));
+	iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg);
+
 	release_locality(chip, chip->vendor.locality, 1);
 }
 
Signature · 1 line
2.7.4
#2 lore raw
Quoted 8 lines · Jarkko Sakkinen

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Quoted 5 lines

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

And yes I'll fix all the typos in the commit msg in this patch before applying it :)

/Jarkko

------------------------------------------------------------------------------
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140

#3 lore raw
Quoted 9 lines · Jarkko Sakkinen
Quoted 8 lines · Jarkko Sakkinen

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Quoted 8 lines
Quoted 5 lines

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

And yes I'll fix all the typos in the commit msg in this patch before applying it :)

I committed this to my master branch with the option to drop if there it does not get reviewed/tested-by's (which I doubt). Since this touches multiple patches (locality patch too) and in addition there was couple glitches maybe it would be good if you would prepare one more round of the series if you don't mind?

/Jarkko

------------------------------------------------------------------------------
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140

#4 lore raw

This patch will get tested in the afternoon.

I don't mind doing a new round will be done tonight if everything go smoothly.

Best Regards
Christophe

-----Original Message-----
From: Jarkko Sakkinen [mailto:jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]]
Sent: jeudi 31 mars 2016 12:30
To: Christophe Henri RICARD
Cc: Marcel Selhorst; Jason Gunthorpe; moderated list:TPM DEVICE DRIVER; open list; Peter Huewe
Subject: Re: [PATCH] tpm: cleanup tpm_tis_remove()

Quoted 9 lines · Jarkko Sakkinen
Quoted 8 lines · Jarkko Sakkinen

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Quoted 8 lines
Quoted 5 lines

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

And yes I'll fix all the typos in the commit msg in this patch before applying it :)

I committed this to my master branch with the option to drop if there it does not get reviewed/tested-by's (which I doubt). Since this touches multiple patches (locality patch too) and in addition there was couple glitches maybe it would be good if you would prepare one more round of the series if you don't mind?

/Jarkko

------------------------------------------------------------------------------
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140

#5 lore raw
In reply to Jarkko Sakkinen

-----Original Message-----
From: Jarkko Sakkinen [mailto:jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]]
Sent: jeudi 31 mars 2016 12:30
To: Christophe Henri RICARD
Cc: Marcel Selhorst; Jason Gunthorpe; moderated list:TPM DEVICE DRIVER; open list; Peter Huewe
Subject: Re: [PATCH] tpm: cleanup tpm_tis_remove()

Quoted 9 lines · Jarkko Sakkinen
Quoted 8 lines · Jarkko Sakkinen

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Quoted 8 lines
Quoted 5 lines

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

And yes I'll fix all the typos in the commit msg in this patch before applying it :)

I committed this to my master branch with the option to drop if there it does not get reviewed/tested-by's (which I doubt). Since this touches multiple patches (locality patch too) and in addition there was couple glitches maybe it would be good if you would prepare one more round of the series if you don't mind?

/Jarkko

------------------------------------------------------------------------------
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140

#6 lore raw
Quoted 1 line · Christophe Henri RICARD

Thanks. This is quite on brainer cleanup and since it is peer tested you should be able safely rebase your patch set on top of it. It's applied to my master branch.

/Jarkko

Quoted 23 lines

-----Original Message-----
From: Jarkko Sakkinen [mailto:jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]]
Sent: jeudi 31 mars 2016 12:30
To: Christophe Henri RICARD
Cc: Marcel Selhorst; Jason Gunthorpe; moderated list:TPM DEVICE DRIVER; open list; Peter Huewe
Subject: Re: [PATCH] tpm: cleanup tpm_tis_remove()

Quoted 15 lines · Jarkko Sakkinen
Quoted 13 lines · Jarkko Sakkinen

Christophe,

Quoted 4 lines · Jarkko Sakkinen

Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters.

Can you test this patch your hardware and reply with Tested-by tag if it does? I can then update your iobase patch to apply on top of this.

I thought it was better idea to simplify the expression a little bit than make it even worse mess.

Quoted 6 lines
Quoted 2 lines

And yes I'll fix all the typos in the commit msg in this patch before applying it :)

I committed this to my master branch with the option to drop if there it does not get reviewed/tested-by's (which I doubt). Since this touches multiple patches (locality patch too) and in addition there was couple glitches maybe it would be good if you would prepare one more round of the series if you don't mind?

/Jarkko

------------------------------------------------------------------------------
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140