diff options
author | Jerry Snitselaar <jsnitsel@redhat.com> | 2017-03-18 11:59:57 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2017-04-03 22:46:02 +0300 |
commit | 84d25940678b7f93665d0964c9729680fa4a97e9 (patch) | |
tree | 4aa7db7e0fb56e77fc83bb013937edac9053f304 /drivers/char/tpm/tpm_i2c_infineon.c | |
parent | 67c2f3d388efe1a47e201b906d80545eaab7da22 (diff) | |
download | linux-84d25940678b7f93665d0964c9729680fa4a97e9.tar.xz |
tpm: make check_locality return bool
Since check_locality is checking to see if a certain
locality is active, return true if active otherwise
return false.
Cc: Christophe Ricard <christophe.ricard@gmail.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Marcel Selhorst <tpmdd@selhorst.net>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_i2c_infineon.c')
-rw-r--r-- | drivers/char/tpm/tpm_i2c_infineon.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 62ee44e57ddc..dc47fa222a26 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -278,22 +278,22 @@ enum tis_defaults { #define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4)) #define TPM_DID_VID(l) (0x0006 | ((l) << 4)) -static int check_locality(struct tpm_chip *chip, int loc) +static bool check_locality(struct tpm_chip *chip, int loc) { u8 buf; int rc; rc = iic_tpm_read(TPM_ACCESS(loc), &buf, 1); if (rc < 0) - return rc; + return false; if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) { tpm_dev.locality = loc; - return loc; + return true; } - return -EIO; + return false; } /* implementation similar to tpm_tis */ @@ -315,7 +315,7 @@ static int request_locality(struct tpm_chip *chip, int loc) unsigned long stop; u8 buf = TPM_ACCESS_REQUEST_USE; - if (check_locality(chip, loc) >= 0) + if (check_locality(chip, loc)) return loc; iic_tpm_write(TPM_ACCESS(loc), &buf, 1); @@ -323,7 +323,7 @@ static int request_locality(struct tpm_chip *chip, int loc) /* wait for burstcount */ stop = jiffies + chip->timeout_a; do { - if (check_locality(chip, loc) >= 0) + if (check_locality(chip, loc)) return loc; usleep_range(TPM_TIMEOUT_US_LOW, TPM_TIMEOUT_US_HI); } while (time_before(jiffies, stop)); |