lkml.org 
[lkml]   [2022]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6 5/9] tpm, tpm_tis: Only handle supported interrupts
From
Date
On 26.06.22 at 08:40, Jarkko Sakkinen wrote:
>
> I would instead mask out bits and write a helper function
> taking care of this:
>
> static u8 tpm_tis_filter_sts_mask(u8 int_mask, u8 sts_mask)
> {
> struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
>
> if (!(int_mask & TPM_INTF_STS_VALID_INT))
> sts_mask &= ~TPM_STS_VALID;
>
> if (!(int_mask & TPM_INTF_DATA_AVAIL_INT))
> sts_mask &= ~TPM_STS_DATA_AVAIL;
>
> if (!(int_mask & TPM_INTF_CMD_READY_INT))
> sts_mask &= ~TPM_STS_COMMAND_READY;
>
> return sts_mask;
> }
>
> Less operations and imho somewhat cleaner structure.
>
> Add suggested-by if you want.

I thought of a helper like this before but then decided to
not introduce another function to keep the code changes minimal. But yes,
it is indeed cleaner. I will do the change and resubmit the series.

Thanks for the review!

Regards,
Lino

\
 
 \ /
  Last update: 2022-06-26 14:19    [W:0.054 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site