lkml.org 
[lkml]   [2023]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] platform/x86/intel/tpmi: Add defines to get version information
On Wed, 4 Oct 2023, Andy Shevchenko wrote:

> On Tue, Oct 03, 2023 at 11:49:14AM -0700, Srinivas Pandruvada wrote:
> > Add defines to get major and minor version from a TPMI version field
> > value. This will avoid code duplication to convert in every feature
> > driver. Also add define for invalid version field.
>
> ...
>
> > +#define TPMI_VERSION_INVALID 0xff
>
> I would make it clearer with (GENMASK(7, 5) | GENMASK(4, 0))
> or even with specific masks defined and used in both cases:
> #def
>
> #define TPMI_MINVER_MASK GENMASK(4, 0)
> #define TPMI_MAJVER_MASK GENMASK(7, 5)
>
> #define TPMI_VERSION_INVALID (TPMI_MINVER_MASK | TPMI_MAJVER_MASK)
>
> #define TPMI_MINOR_VERSION(val) FIELD_GET(TPMI_MINVER_MASK, val)
> #define TPMI_MAJOR_VERSION(val) FIELD_GET(TPMI_MAJVER_MASK, val)
>
> > +#define TPMI_MINOR_VERSION(val) FIELD_GET(GENMASK(4, 0), val)
> > +#define TPMI_MAJOR_VERSION(val) FIELD_GET(GENMASK(7, 5), val)

In case somebody does, please do it on top of the existing changes as
I already applied the series.


--
i.

\
 
 \ /
  Last update: 2023-10-04 15:04    [W:0.048 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site