Re: [PATCH v5 06/10] tpm, tpm_tis: Only handle supported interrupts in wait_for_tpm_stat()

From: Lino Sanfilippo
Date: Wed Jun 15 2022 - 18:08:59 EST


On 15.06.22 at 20:21, Jarkko Sakkinen wrote:
> On Fri, Jun 10, 2022 at 01:08:42PM +0200, LinoSanfilippo@xxxxxx wrote:
>> From: Lino Sanfilippo <l.sanfilippo@xxxxxxxxxx>
>>
>> According to the TPM Interface Specification (TIS) interrupts for
>> "stsValid" and "commandReady" might not be supported.
>>
>> Take this into account and only wait for interrupts which are actually in
>> use in wait_for_tpm_stat(). After that process all the remaining status
>> changes by polling the status register.
>>
>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@xxxxxxxxxx>
>> ---
>> drivers/char/tpm/tpm_tis_core.c | 46 ++++++++++++++++++++++++---------
>> 1 file changed, 34 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
>> index 2f03fefa1706..028bec44362d 100644
>> --- a/drivers/char/tpm/tpm_tis_core.c
>> +++ b/drivers/char/tpm/tpm_tis_core.c
>> @@ -53,41 +53,63 @@ static int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask,
>> long rc;
>> u8 status;
>> bool canceled = false;
>> + u8 active_irqs = 0;
>
> Something like sts_mask would be a better name. Calling it
> 'active_irqs' is a bit confusing.

Ok.

Regards,
Lino