diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2018-06-29 15:24:50 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2018-07-28 17:03:11 +0300 |
commit | 58bac8cc3010ccb845572a3512fc16c9aaa5e50e (patch) | |
tree | 5ccd8ecaaae93054e587293bf2ac33244f922a02 /drivers/char/tpm/tpm-interface.c | |
parent | eccc9bb844838b6b7a9691b31747416c4c34a83f (diff) | |
download | blackbird-op-linux-58bac8cc3010ccb845572a3512fc16c9aaa5e50e.tar.gz blackbird-op-linux-58bac8cc3010ccb845572a3512fc16c9aaa5e50e.zip |
tpm: replace TPM_TRANSMIT_RAW with TPM_TRANSMIT_NESTED
As TPM_TRANSMIT_RAW always requires also not to take locks for obvious
reasons (deadlock), this commit renames the flag as TPM_TRANSMIT_NESTED
and prevents taking tpm_mutex when the flag is given to tpm_transmit().
Suggested-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm-interface.c')
-rw-r--r-- | drivers/char/tpm/tpm-interface.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index ad761e629a0f..1a803b0cf980 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -372,7 +372,7 @@ static int tpm_request_locality(struct tpm_chip *chip, unsigned int flags) { int rc; - if (flags & TPM_TRANSMIT_RAW) + if (flags & TPM_TRANSMIT_NESTED) return 0; if (!chip->ops->request_locality) @@ -391,7 +391,7 @@ static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags) { int rc; - if (flags & TPM_TRANSMIT_RAW) + if (flags & TPM_TRANSMIT_NESTED) return; if (!chip->ops->relinquish_locality) @@ -406,7 +406,7 @@ static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags) static int tpm_cmd_ready(struct tpm_chip *chip, unsigned int flags) { - if (flags & TPM_TRANSMIT_RAW) + if (flags & TPM_TRANSMIT_NESTED) return 0; if (!chip->ops->cmd_ready) @@ -417,7 +417,7 @@ static int tpm_cmd_ready(struct tpm_chip *chip, unsigned int flags) static int tpm_go_idle(struct tpm_chip *chip, unsigned int flags) { - if (flags & TPM_TRANSMIT_RAW) + if (flags & TPM_TRANSMIT_NESTED) return 0; if (!chip->ops->go_idle) @@ -466,10 +466,9 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, return -E2BIG; } - if (!(flags & TPM_TRANSMIT_UNLOCKED)) + if (!(flags & TPM_TRANSMIT_UNLOCKED) && !(flags & TPM_TRANSMIT_NESTED)) mutex_lock(&chip->tpm_mutex); - if (chip->ops->clk_enable != NULL) chip->ops->clk_enable(chip, true); @@ -559,7 +558,7 @@ out_no_locality: if (chip->ops->clk_enable != NULL) chip->ops->clk_enable(chip, false); - if (!(flags & TPM_TRANSMIT_UNLOCKED)) + if (!(flags & TPM_TRANSMIT_UNLOCKED) && !(flags & TPM_TRANSMIT_NESTED)) mutex_unlock(&chip->tpm_mutex); return rc ? rc : len; } |