public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: hdegoede@redhat.com, markgross@kernel.org,
	ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] platform/x86/intel/tpmi: Add defines to get version information
Date: Wed, 4 Oct 2023 15:59:57 +0300	[thread overview]
Message-ID: <ZR1hzZ4KNZqElGGH@smile.fi.intel.com> (raw)
In-Reply-To: <20231003184916.1860084-2-srinivas.pandruvada@linux.intel.com>

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)

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-10-04 13:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 18:49 [PATCH v2 0/3] TPMI feature major/minor version check Srinivas Pandruvada
2023-10-03 18:49 ` [PATCH v2 1/3] platform/x86/intel/tpmi: Add defines to get version information Srinivas Pandruvada
2023-10-04 12:59   ` Andy Shevchenko [this message]
2023-10-04 13:03     ` Ilpo Järvinen
2023-10-04 18:37     ` srinivas pandruvada
2023-10-03 18:49 ` [PATCH v2 2/3] platform/x86: ISST: Ignore minor version change Srinivas Pandruvada
2023-10-03 18:49 ` [PATCH v2 3/3] platform/x86/intel-uncore-freq: " Srinivas Pandruvada
2023-10-04  9:08 ` [PATCH v2 0/3] TPMI feature major/minor version check Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZR1hzZ4KNZqElGGH@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox