diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-12 16:42:09 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-09-15 16:04:21 +0300 |
commit | eb5854e764b91a71106f159a4ac264ffed1eebf2 (patch) | |
tree | 4d888861aa2e9211cfa7c1d92097f7cfb5a8f79d /drivers/char/tpm/tpm_tis_core.c | |
parent | d4abd9565dd6da1ab2a402af77617d32949ed06c (diff) | |
download | talos-obmc-linux-eb5854e764b91a71106f159a4ac264ffed1eebf2.tar.gz talos-obmc-linux-eb5854e764b91a71106f159a4ac264ffed1eebf2.zip |
tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Since tpm_gen_interrupt() is only used in tpm_tis_core.c this commit
replaces it with an internal tpm_tis_gen_interrupt(). The semantics
also changed in a way that on a system error the driver initialization
is failed.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Diffstat (limited to 'drivers/char/tpm/tpm_tis_core.c')
-rw-r--r-- | drivers/char/tpm/tpm_tis_core.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index d66f51b3648e..f22caf802e56 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -526,6 +526,18 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) return IRQ_HANDLED; } +static int tpm_tis_gen_interrupt(struct tpm_chip *chip) +{ + const char *desc = "attempting to generate an interrupt"; + u32 cap2; + cap_t cap; + + if (chip->flags & TPM_CHIP_FLAG_TPM2) + return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); + else + return tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc); +} + /* Register the IRQ and issue a command that will cause an interrupt. If an * irq is seen then leave the chip setup for IRQ operation, otherwise reverse * everything and leave in polling mode. Returns 0 on success. @@ -575,10 +587,9 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, /* Generate an interrupt by having the core call through to * tpm_tis_send */ - if (chip->flags & TPM_CHIP_FLAG_TPM2) - tpm2_gen_interrupt(chip); - else - tpm_gen_interrupt(chip); + rc = tpm_tis_gen_interrupt(chip); + if (rc < 0) + return rc; /* tpm_tis_send will either confirm the interrupt is working or it * will call disable_irq which undoes all of the above. |