From: Siratul Islam <siratul.islam@linux.dev>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux@analog.com, linux-iio@vger.kernel.org
Cc: "Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>
Subject: Re: [PATCH v2 1/1] iio: dac: ad5766: Convert GENMASK() to use static parameters
Date: Wed, 18 Nov 2026 13:36:42 +0600 [thread overview]
Message-ID: <1a261f19fff18b074ed3e004c4896f2cf586b611.camel@linux.dev> (raw)
In-Reply-To: <20261117160857.1799863-1-andriy.shevchenko@linux.intel.com>
On Tue, 2026-11-17 at 17:08 +0100, Andy Shevchenko wrote:
> There is no need to use run-time calculated masks in the code. Besides,
> GENMASK() over non-static parameters might lead compiler to generate
> much worse code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> v2: fixed typo
>
> drivers/iio/dac/ad5766.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5766.c b/drivers/iio/dac/ad5766.c
> index 061b43fc0345..ba6c54e2c9ac 100644
> --- a/drivers/iio/dac/ad5766.c
> +++ b/drivers/iio/dac/ad5766.c
> @@ -18,9 +18,9 @@
>
> #define AD5766_UPPER_WORD_SPI_MASK GENMASK(31, 16)
> #define AD5766_LOWER_WORD_SPI_MASK GENMASK(15, 0)
> -#define AD5766_DITHER_SOURCE_MASK(ch) GENMASK(((2 * ch) + 1), (2 * ch))
> +#define AD5766_DITHER_SOURCE_MASK(ch) (GENMASK(1, 0) << ((ch) * 2))
> #define AD5766_DITHER_SOURCE(ch, source) BIT((ch * 2) + source)
> -#define AD5766_DITHER_SCALE_MASK(x) AD5766_DITHER_SOURCE_MASK(x)
> +#define AD5766_DITHER_SCALE_MASK(ch) (GENMASK(1, 0) << ((ch) * 2))
This could have remained unchanged?
> #define AD5766_DITHER_SCALE(ch, scale) (scale << (ch * 2))
> #define AD5766_DITHER_ENABLE_MASK(ch) BIT(ch)
> #define AD5766_DITHER_ENABLE(ch, state) ((!state) << ch)
prev parent reply other threads:[~2026-11-18 7:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:08 [PATCH v2 1/1] iio: dac: ad5766: Convert GENMASK() to use static parameters Andy Shevchenko
2026-11-18 7:36 ` Siratul Islam [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=1a261f19fff18b074ed3e004c4896f2cf586b611.camel@linux.dev \
--to=siratul.islam@linux.dev \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.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