From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Victor Chernyakin <chernyakin.victor.j@outlook.com>
Cc: broonie@kernel.org, dakr@kernel.org, driver-core@lists.linux.dev,
gregkh@linuxfoundation.org, johan@kernel.org,
linux-kernel@vger.kernel.org, peng.fan@nxp.com,
rafael@kernel.org
Subject: Re: [PATCH v1 1/1] regmap: Add REG_FIELD_GENMASK() helper macro
Date: Thu, 5 Nov 2026 19:54:15 +0200 [thread overview]
Message-ID: <auzCxxkUB9p6WKNC@ashevche-desk.local> (raw)
In-Reply-To: <SN1PR12MB2528E9E6548816E119881537A5772@SN1PR12MB2528.namprd12.prod.outlook.com>
On Thu, Nov 05, 2026 at 09:39:45AM -0600, Victor Chernyakin wrote:
> > #define REG_FIELD_GENMASK(_reg_field) GENMASK(_reg_field.msb, _reg_field.lsb)
>
> Macro parameter should have parens around it:
In this case no, it shouldn't. It a shortcut which assumes that _reg_field is
not an expression.
> + #define REG_FIELD_GENMASK(_reg_field) GENMASK((_reg_field).msb, (_reg_field).lsb)
This doesn't look good as it implies that _reg_field can be an expression that
will be evaluated twice.
> (In the patch you link to, I wrote it without parens at first too,
> then had to figure out why I was getting "too many arguments to macro"
> error messages)
This is strange.
I have compiled it with GCC-15 and clang-22 (in both cases sparse enabled),
no such a problem (It's also -Werror build). Can you elaborate?
> BTW, I've been thinking about making reg_field store the mask directly,
> by putting GENMASK(lsb, msb) in the REG_FIELD macro, but that's probably
> a more involved change.
But it's already there as you see in the regmap core. What you want is to make
it at the beginning. Not sure if it's feasible and needed change.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-11-05 17:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 10:34 Andy Shevchenko
2026-11-05 15:39 ` Victor Chernyakin
2026-11-05 17:54 ` Andy Shevchenko [this message]
2026-11-05 23:10 ` Victor Chernyakin
2026-11-05 23:26 ` Victor Chernyakin
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=auzCxxkUB9p6WKNC@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=chernyakin.victor.j@outlook.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=rafael@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
all inboxes | Powered by JetHome®