diff mbox

[tpmdd-devel,3/3] tpm: Get rid of TPM_CHIP_FLAG_REGISTERED

Message ID 1477520926-32594-3-git-send-email-jgunthorpe@obsidianresearch.com
State New
Headers show

Commit Message

Jason Gunthorpe Oct. 26, 2016, 10:28 p.m. UTC
This is no longer necessary, all calls to tpm_chip_unregister happen
in remove() callbacks.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 drivers/char/tpm/tpm-chip.c | 5 -----
 drivers/char/tpm/tpm.h      | 1 -
 2 files changed, 6 deletions(-)

Comments

Winkler, Tomas Oct. 27, 2016, 8:35 p.m. UTC | #1
> 
> This is no longer necessary, all calls to tpm_chip_unregister happen in
> remove() callbacks.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> ---
>  drivers/char/tpm/tpm-chip.c | 5 -----
>  drivers/char/tpm/tpm.h      | 1 -
>  2 files changed, 6 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index
> e5950131bd90..836f056f7d27 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -375,8 +375,6 @@ int tpm_chip_register(struct tpm_chip *chip)
>  		return rc;
>  	}
> 
> -	chip->flags |= TPM_CHIP_FLAG_REGISTERED;
> -
>  	rc = tpm_add_legacy_sysfs(chip);
>  	if (rc) {
>  		tpm_chip_unregister(chip);
> @@ -402,9 +400,6 @@ EXPORT_SYMBOL_GPL(tpm_chip_register);
>   */
>  void tpm_chip_unregister(struct tpm_chip *chip)  {
> -	if (!(chip->flags & TPM_CHIP_FLAG_REGISTERED))
> -		return;
> -
>  	tpm_del_legacy_sysfs(chip);
> 
>  	tpm1_chip_unregister(chip);
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index
> 2611459271e5..79ce937ec557 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -139,7 +139,6 @@ enum tpm2_startup_types {
>  #define TPM_PPI_VERSION_LEN		3
> 
>  enum tpm_chip_flags {
> -	TPM_CHIP_FLAG_REGISTERED	= BIT(0),
>  	TPM_CHIP_FLAG_TPM2		= BIT(1),
>  	TPM_CHIP_FLAG_IRQ		= BIT(2),
>  	TPM_CHIP_FLAG_VIRTUAL		= BIT(3),
> --
> 2.1.4
> 
Reviewed-by: Tomas Winkler <tomas.winkler@intel.com>


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
Jarkko Sakkinen Nov. 2, 2016, 10:33 a.m. UTC | #2
On Wed, Oct 26, 2016 at 04:28:46PM -0600, Jason Gunthorpe wrote:
> This is no longer necessary, all calls to tpm_chip_unregister happen
> in remove() callbacks.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

> ---
>  drivers/char/tpm/tpm-chip.c | 5 -----
>  drivers/char/tpm/tpm.h      | 1 -
>  2 files changed, 6 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index e5950131bd90..836f056f7d27 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -375,8 +375,6 @@ int tpm_chip_register(struct tpm_chip *chip)
>  		return rc;
>  	}
>  
> -	chip->flags |= TPM_CHIP_FLAG_REGISTERED;
> -
>  	rc = tpm_add_legacy_sysfs(chip);
>  	if (rc) {
>  		tpm_chip_unregister(chip);
> @@ -402,9 +400,6 @@ EXPORT_SYMBOL_GPL(tpm_chip_register);
>   */
>  void tpm_chip_unregister(struct tpm_chip *chip)
>  {
> -	if (!(chip->flags & TPM_CHIP_FLAG_REGISTERED))
> -		return;
> -
>  	tpm_del_legacy_sysfs(chip);
>  
>  	tpm1_chip_unregister(chip);
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index 2611459271e5..79ce937ec557 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -139,7 +139,6 @@ enum tpm2_startup_types {
>  #define TPM_PPI_VERSION_LEN		3
>  
>  enum tpm_chip_flags {
> -	TPM_CHIP_FLAG_REGISTERED	= BIT(0),
>  	TPM_CHIP_FLAG_TPM2		= BIT(1),
>  	TPM_CHIP_FLAG_IRQ		= BIT(2),
>  	TPM_CHIP_FLAG_VIRTUAL		= BIT(3),
> -- 
> 2.1.4
> 

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
Jarkko Sakkinen Nov. 4, 2016, 7:22 a.m. UTC | #3
On Wed, Nov 02, 2016 at 04:33:03AM -0600, Jarkko Sakkinen wrote:
> On Wed, Oct 26, 2016 at 04:28:46PM -0600, Jason Gunthorpe wrote:
> > This is no longer necessary, all calls to tpm_chip_unregister happen
> > in remove() callbacks.
> > 
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> 
> /Jarkko

Applied.

/Jarkko

> 
> > ---
> >  drivers/char/tpm/tpm-chip.c | 5 -----
> >  drivers/char/tpm/tpm.h      | 1 -
> >  2 files changed, 6 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index e5950131bd90..836f056f7d27 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -375,8 +375,6 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  		return rc;
> >  	}
> >  
> > -	chip->flags |= TPM_CHIP_FLAG_REGISTERED;
> > -
> >  	rc = tpm_add_legacy_sysfs(chip);
> >  	if (rc) {
> >  		tpm_chip_unregister(chip);
> > @@ -402,9 +400,6 @@ EXPORT_SYMBOL_GPL(tpm_chip_register);
> >   */
> >  void tpm_chip_unregister(struct tpm_chip *chip)
> >  {
> > -	if (!(chip->flags & TPM_CHIP_FLAG_REGISTERED))
> > -		return;
> > -
> >  	tpm_del_legacy_sysfs(chip);
> >  
> >  	tpm1_chip_unregister(chip);
> > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> > index 2611459271e5..79ce937ec557 100644
> > --- a/drivers/char/tpm/tpm.h
> > +++ b/drivers/char/tpm/tpm.h
> > @@ -139,7 +139,6 @@ enum tpm2_startup_types {
> >  #define TPM_PPI_VERSION_LEN		3
> >  
> >  enum tpm_chip_flags {
> > -	TPM_CHIP_FLAG_REGISTERED	= BIT(0),
> >  	TPM_CHIP_FLAG_TPM2		= BIT(1),
> >  	TPM_CHIP_FLAG_IRQ		= BIT(2),
> >  	TPM_CHIP_FLAG_VIRTUAL		= BIT(3),
> > -- 
> > 2.1.4
> > 
> 
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> tpmdd-devel mailing list
> tpmdd-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index e5950131bd90..836f056f7d27 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -375,8 +375,6 @@  int tpm_chip_register(struct tpm_chip *chip)
 		return rc;
 	}
 
-	chip->flags |= TPM_CHIP_FLAG_REGISTERED;
-
 	rc = tpm_add_legacy_sysfs(chip);
 	if (rc) {
 		tpm_chip_unregister(chip);
@@ -402,9 +400,6 @@  EXPORT_SYMBOL_GPL(tpm_chip_register);
  */
 void tpm_chip_unregister(struct tpm_chip *chip)
 {
-	if (!(chip->flags & TPM_CHIP_FLAG_REGISTERED))
-		return;
-
 	tpm_del_legacy_sysfs(chip);
 
 	tpm1_chip_unregister(chip);
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 2611459271e5..79ce937ec557 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -139,7 +139,6 @@  enum tpm2_startup_types {
 #define TPM_PPI_VERSION_LEN		3
 
 enum tpm_chip_flags {
-	TPM_CHIP_FLAG_REGISTERED	= BIT(0),
 	TPM_CHIP_FLAG_TPM2		= BIT(1),
 	TPM_CHIP_FLAG_IRQ		= BIT(2),
 	TPM_CHIP_FLAG_VIRTUAL		= BIT(3),