[PATCH v3 1/4] tpm: Use a threaded interrupt handler

From: Lino Sanfilippo
Date: Sat May 01 2021 - 10:01:55 EST


The interrupt handler uses tpm_tis_read32() and tpm_tis_write32() to access
the interrupt status register. In case of SPI those accesses are done with
the spi_bus_lock mutex held. This means that the status register cannot
be read or written in interrupt context.

For this reason request a threaded interrupt handler so that the required
accesses can be done in process context.

Reviewed-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
Signed-off-by: Lino Sanfilippo <LinoSanfilippo@xxxxxx>
---
drivers/char/tpm/tpm_tis_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index a2e0395cbe61..a12992ae2a3e 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -737,8 +737,10 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
int rc;
u32 int_status;

- if (devm_request_irq(chip->dev.parent, irq, tis_int_handler, flags,
- dev_name(&chip->dev), chip) != 0) {
+
+ if (devm_request_threaded_irq(chip->dev.parent, irq, NULL,
+ tis_int_handler, IRQF_ONESHOT | flags,
+ dev_name(&chip->dev), chip) != 0) {
dev_info(&chip->dev, "Unable to request irq: %d for probe\n",
irq);
return -1;
--
2.31.1