From: Andy Shevchenko <andy@kernel.org>
To: "Paller, Kim Seer" <KimSeer.Paller@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <noname.nuno@gmail.com>,
"Sa, Nuno" <Nuno.Sa@analog.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] iio: dac: ad3530r: Add driver for AD3530R and AD3531R
Date: Wed, 23 Apr 2025 19:52:13 +0300 [thread overview]
Message-ID: <aAkavQVd7Px3qPU0@smile.fi.intel.com> (raw)
In-Reply-To: <PH0PR03MB7141E6D1A077B0E02368CBDDF9BA2@PH0PR03MB7141.namprd03.prod.outlook.com>
On Wed, Apr 23, 2025 at 07:50:51AM +0000, Paller, Kim Seer wrote:
> > From: Jonathan Cameron <jic23@kernel.org>
> > Sent: Monday, April 21, 2025 9:48 PM
> > To: Paller, Kim Seer <KimSeer.Paller@analog.com>
> > On Mon, 21 Apr 2025 12:24:54 +0800
> > Kim Seer Paller <kimseer.paller@analog.com> wrote:
...
> > > + mask = GENMASK(chan->address + 1, chan->address);
> >
> > I think maybe we need a macro to get the mask from the channel number?
> > Using address for this seems overkill given how simple that maths is.
> > Ideally that macro could perhaps be used in the code below to avoid
> > all the defines I suggested.
>
> The motivation for using the chan->address field was to hide the calculation a bit.
> However, would using a macro like
> #define AD3530R_OP_MODE_CHAN_MSK(chan) GENMASK(2 * chan + 1, 2 * chan)
> be a good approach in this case? This drops the need for the address field and
> can also be used to explicitly set the operating mode for the 4 fields of the register.
> What do you think?
Please, note that doing GENMASK(foo + X, foo) is highly discouraged as it may
give a very bad generated code (although I haven't checked recently if it's
still the case). The preferred way is GENMASK(X, 0) << foo. Where X is a
compile time constant.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-04-23 16:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 4:24 [PATCH v5 0/3] Add driver for AD3530R and AD3531R DACs Kim Seer Paller
2025-04-21 4:24 ` [PATCH v5 1/3] iio: ABI: add new DAC powerdown mode Kim Seer Paller
2025-04-21 4:24 ` [PATCH v5 2/3] dt-bindings: iio: dac: Add adi,ad3530r.yaml Kim Seer Paller
2025-04-21 5:28 ` Rob Herring (Arm)
2025-04-23 7:50 ` Paller, Kim Seer
2025-04-21 4:24 ` [PATCH v5 3/3] iio: dac: ad3530r: Add driver for AD3530R and AD3531R Kim Seer Paller
2025-04-21 13:48 ` Jonathan Cameron
2025-04-23 7:50 ` Paller, Kim Seer
2025-04-23 16:52 ` Andy Shevchenko [this message]
2025-04-25 8:26 ` Jonathan Cameron
2025-04-22 15:11 ` Andy Shevchenko
2025-04-22 16:37 ` David Lechner
2025-04-22 16:46 ` Andy Shevchenko
2025-04-23 7:53 ` Paller, Kim Seer
2025-04-23 16:49 ` Andy Shevchenko
2025-04-24 9:48 ` Paller, Kim Seer
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=aAkavQVd7Px3qPU0@smile.fi.intel.com \
--to=andy@kernel.org \
--cc=KimSeer.Paller@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=Nuno.Sa@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.