From: Bjorn Andersson <andersson@kernel.org>
To: Konrad Dybcio <konradybcio@kernel.org>
Cc: Abel Vesa <abelvesa@kernel.org>,
linux-arm-msm@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH] soc: qcom: socinfo: Use GENMASK/FIELD_PREP/GET for SOCINFO ver helpers
Date: Fri, 4 Dec 2026 17:35:39 -0600 [thread overview]
Message-ID: <axNOJ2hMh93oAeuD@zenbook> (raw)
In-Reply-To: <20261203-topic-socinfo_genmask-v1-1-b38887d793a6@oss.qualcomm.com>
On Thu, Dec 03, 2026 at 02:18:17PM +0100, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Define the bitfields explicitly and use the compile-time-checked
> helpers to improve code hygiene.
>
I think this looks good, but it doesn't compile for me on ARCH=arm
Regards,
Bjorn
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> include/linux/soc/qcom/socinfo.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h
> index ba823a0013c5..0a78decfab97 100644
> --- a/include/linux/soc/qcom/socinfo.h
> +++ b/include/linux/soc/qcom/socinfo.h
> @@ -3,6 +3,7 @@
> #ifndef __QCOM_SOCINFO_H__
> #define __QCOM_SOCINFO_H__
>
> +#include <linux/bitfield.h>
> #include <linux/types.h>
>
> /*
> @@ -14,13 +15,12 @@
> #define SMEM_SOCINFO_BUILD_ID_LENGTH 32
> #define SMEM_SOCINFO_CHIP_ID_LENGTH 32
>
> -/*
> - * SoC version type with major number in the upper 16 bits and minor
> - * number in the lower 16 bits.
> - */
> -#define SOCINFO_MAJOR(ver) (((ver) >> 16) & 0xffff)
> -#define SOCINFO_MINOR(ver) ((ver) & 0xffff)
> -#define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
> +#define SOCINFO_VER_MAJOR GENMASK(31, 16)
> +#define SOCINFO_VER_MINOR GENMASK(15, 0)
> +#define SOCINFO_MAJOR(ver) FIELD_GET(SOCINFO_VER_MAJOR, (ver))
> +#define SOCINFO_MINOR(ver) FIELD_GET(SOCINFO_VER_MINOR, (ver))
> +#define SOCINFO_VERSION(maj, min) \
> + (FIELD_PREP(SOCINFO_VER_MAJOR, (maj)) | FIELD_PREP(SOCINFO_VER_MINOR, (min)))
>
> /* Socinfo SMEM item structure */
> struct socinfo {
>
> ---
> base-commit: d138596e9f822033490b2e577ec2ea64f2aa246c
> change-id: 20261203-topic-socinfo_genmask-4cf16cd87d82
>
> Best regards,
> --
> Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
prev parent reply other threads:[~2026-12-04 23:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 13:18 [PATCH] soc: qcom: socinfo: Use GENMASK/FIELD_PREP/GET for SOCINFO ver helpers Konrad Dybcio
2026-12-04 23:35 ` Bjorn Andersson [this message]
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=axNOJ2hMh93oAeuD@zenbook \
--to=andersson@kernel.org \
--cc=abelvesa@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
/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