summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/st33zp24
diff options
context:
space:
mode:
authorJerry Snitselaar <jsnitsel@redhat.com>2017-03-18 11:59:57 +0300
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-04-03 22:46:02 +0300
commit84d25940678b7f93665d0964c9729680fa4a97e9 (patch)
tree4aa7db7e0fb56e77fc83bb013937edac9053f304 /drivers/char/tpm/st33zp24
parent67c2f3d388efe1a47e201b906d80545eaab7da22 (diff)
downloadlinux-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/st33zp24')
-rw-r--r--drivers/char/tpm/st33zp24/st33zp24.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c
index e8e0f7c02686..4d1dc8b46877 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.c
+++ b/drivers/char/tpm/st33zp24/st33zp24.c
@@ -117,9 +117,9 @@ static u8 st33zp24_status(struct tpm_chip *chip)
/*
* check_locality if the locality is active
* @param: chip, the tpm chip description
- * @return: the active locality or -EACCESS.
+ * @return: true if LOCALITY0 is active, otherwise false
*/
-static int check_locality(struct tpm_chip *chip)
+static bool check_locality(struct tpm_chip *chip)
{
struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
u8 data;
@@ -129,9 +129,9 @@ static int check_locality(struct tpm_chip *chip)
if (status && (data &
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
- return tpm_dev->locality;
+ return true;
- return -EACCES;
+ return false;
} /* check_locality() */
/*
@@ -146,7 +146,7 @@ static int request_locality(struct tpm_chip *chip)
long ret;
u8 data;
- if (check_locality(chip) == tpm_dev->locality)
+ if (check_locality(chip))
return tpm_dev->locality;
data = TPM_ACCESS_REQUEST_USE;
@@ -158,7 +158,7 @@ static int request_locality(struct tpm_chip *chip)
/* Request locality is usually effective after the request */
do {
- if (check_locality(chip) >= 0)
+ if (check_locality(chip))
return tpm_dev->locality;
msleep(TPM_TIMEOUT);
} while (time_before(jiffies, stop));