Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1368142 > unrolled thread

[PATCH] tpm: cleanup tpm_tis_remove()

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2016-03-31 12:20 +0200
Last post2016-03-31 12:20 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tpm: cleanup tpm_tis_remove() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-03-31 12:20 +0200
    Re: [PATCH] tpm: cleanup tpm_tis_remove() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-03-31 12:20 +0200
      RE: [PATCH] tpm: cleanup tpm_tis_remove() Christophe Henri RICARD <christophe-h.ricard@st.com> - 2016-03-31 12:40 +0200
      Re: [PATCH] tpm: cleanup tpm_tis_remove() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-03-31 12:40 +0200
        RE: [PATCH] tpm: cleanup tpm_tis_remove() Christophe Henri RICARD <christophe-h.ricard@st.com> - 2016-03-31 17:00 +0200
          Re: [PATCH] tpm: cleanup tpm_tis_remove() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-03-31 18:30 +0200
    Re: [PATCH] tpm: cleanup tpm_tis_remove() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-03-31 12:20 +0200

#1368142 — [PATCH] tpm: cleanup tpm_tis_remove()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-03-31 12:20 +0200
Subject[PATCH] tpm: cleanup tpm_tis_remove()
Message-ID<riHRM-3pE-15@gated-at.bofh.it>
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.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_tis.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 068f021..ce2b984 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -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);
 }
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1368143

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-03-31 12:20 +0200
Message-ID<riHRM-3pE-21@gated-at.bofh.it>
In reply to#1368142
On Thu, Mar 31, 2016 at 01:15:36PM +0300, Jarkko Sakkinen wrote:
> Christophe,
> 
> On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> > 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.

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

/Jarkko

[toc] | [prev] | [next] | [standalone]


#1368161

FromChristophe Henri RICARD <christophe-h.ricard@st.com>
Date2016-03-31 12:40 +0200
Message-ID<riIb8-3Af-27@gated-at.bofh.it>
In reply to#1368143
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@linux.intel.com] 
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()

On Thu, Mar 31, 2016 at 01:17:13PM +0300, Jarkko Sakkinen wrote:
> On Thu, Mar 31, 2016 at 01:15:36PM +0300, Jarkko Sakkinen wrote:
> > Christophe,
> > 
> > On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> > > 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.
> 
> 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

[toc] | [prev] | [next] | [standalone]


#1368164

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-03-31 12:40 +0200
Message-ID<riIb8-3Af-29@gated-at.bofh.it>
In reply to#1368143
On Thu, Mar 31, 2016 at 01:17:13PM +0300, Jarkko Sakkinen wrote:
> On Thu, Mar 31, 2016 at 01:15:36PM +0300, Jarkko Sakkinen wrote:
> > Christophe,
> > 
> > On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> > > 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.
> 
> 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

[toc] | [prev] | [next] | [standalone]


#1368375

FromChristophe Henri RICARD <christophe-h.ricard@st.com>
Date2016-03-31 17:00 +0200
Message-ID<riMeJ-6A1-1@gated-at.bofh.it>
In reply to#1368164
Tested-by: Christophe Ricard <christophe-h.ricard@st.com>

-----Original Message-----
From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com] 
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()

On Thu, Mar 31, 2016 at 01:17:13PM +0300, Jarkko Sakkinen wrote:
> On Thu, Mar 31, 2016 at 01:15:36PM +0300, Jarkko Sakkinen wrote:
> > Christophe,
> > 
> > On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> > > 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.
> 
> 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

[toc] | [prev] | [next] | [standalone]


#1368431

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-03-31 18:30 +0200
Message-ID<riNDQ-7LE-27@gated-at.bofh.it>
In reply to#1368375
On Thu, Mar 31, 2016 at 04:55:50PM +0200, Christophe Henri RICARD wrote:
> Tested-by: Christophe Ricard <christophe-h.ricard@st.com>

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

> -----Original Message-----
> From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com] 
> 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()
> 
> On Thu, Mar 31, 2016 at 01:17:13PM +0300, Jarkko Sakkinen wrote:
> > On Thu, Mar 31, 2016 at 01:15:36PM +0300, Jarkko Sakkinen wrote:
> > > Christophe,
> > > 
> > > On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> > > > 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.
> > 
> > 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

[toc] | [prev] | [next] | [standalone]


#1368144

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-03-31 12:20 +0200
Message-ID<riHRM-3pE-23@gated-at.bofh.it>
In reply to#1368142
Christophe,

On Thu, Mar 31, 2016 at 01:11:27PM +0300, Jarkko Sakkinen wrote:
> 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

> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  drivers/char/tpm/tpm_tis.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 068f021..ce2b984 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -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);
>  }
>  
> -- 
> 2.7.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web