Skip to content

Commit da682c0

Browse files
committed
tpm, tpm_tis: do not check for the active locality in interrupt handler
JIRA: https://issues.redhat.com/browse/RHEL-72765 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 35f6212 Author: Lino Sanfilippo <l.sanfilippo@kunbus.com> Date: Thu Nov 24 14:55:32 2022 +0100 tpm, tpm_tis: do not check for the active locality in interrupt handler After driver initialization tpm_tis_data->locality may only be modified in case of a LOCALITY CHANGE interrupt. In this case the interrupt handler iterates over all localities only to assign the active one to tpm_tis_data->locality. However this information is never used any more, so the assignment is not needed. Furthermore without the assignment tpm_tis_data->locality cannot change any more at driver runtime, and thus no protection against concurrent modification is required when the variable is read at other places. So remove this iteration entirely. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Tested-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent 7ff1172 commit da682c0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/char/tpm/tpm_tis_core.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
714714
struct tpm_chip *chip = dev_id;
715715
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
716716
u32 interrupt;
717-
int i, rc;
717+
int rc;
718718

719719
rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt);
720720
if (rc < 0)
@@ -726,10 +726,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
726726
set_bit(TPM_TIS_IRQ_TESTED, &priv->flags);
727727
if (interrupt & TPM_INTF_DATA_AVAIL_INT)
728728
wake_up_interruptible(&priv->read_queue);
729-
if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT)
730-
for (i = 0; i < 5; i++)
731-
if (check_locality(chip, i))
732-
break;
729+
733730
if (interrupt &
734731
(TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
735732
TPM_INTF_CMD_READY_INT))

0 commit comments

Comments
 (0)