Re: [PATCH v3 12/20] platform/x86/intel/tpmi: Turn TPMI_GET_SINGLE_ENTRY_SIZE() into a function
From: Andy Shevchenko
Date: Thu Oct 01 2026 - 14:10:46 EST
On Wed, Sep 30, 2026 at 10:29:09AM -0700, Kuppuswamy Sathyanarayanan wrote:
> The macro computing a feature instance size has a few problems. Its
> comment says the hardware reports the size in u32 units, but the
> conversion to bytes is spelled as a shift by 2, so the comment and the
> code have to be read together to see that they agree. Its body is a
> single conditional expression wrapped in a statement expression that it
> never needed. And it evaluates its argument twice.
>
> Make it a plain static function, tpmi_get_single_entry_size(), which
> fixes all three: the conversion becomes a multiply by sizeof(u32), there
> is nothing left to wrap, and the argument is evaluated once and type
> checked.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko