From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Marcelo Schmitt" <marcelo.schmitt@analog.com>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/3] iio: adc: ad4030: Use BIT macro to improve code readability
Date: Wed, 7 Oct 2026 02:10:42 -0400 [thread overview]
Message-ID: <20261007060913.1488382-2-sashal@kernel.org> (raw)
In-Reply-To: <20261007060913.1488382-1-sashal@kernel.org>
From: Marcelo Schmitt <marcelo.schmitt@analog.com>
[ Upstream commit a10f6dd4eef2e64fe1f366613bed45aa308494de ]
Use BIT macro to make the list of average modes more readable.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stable-dep-of: d61521056420 ("iio: adc: ad4030: fix invalid oversampling_ratio validation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/adc/ad4030.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ad4030.c b/drivers/iio/adc/ad4030.c
index d8bee6a4215a3..aec95aceb81fa 100644
--- a/drivers/iio/adc/ad4030.c
+++ b/drivers/iio/adc/ad4030.c
@@ -232,10 +232,16 @@ struct ad4030_state {
.num_ext_scan_type = ARRAY_SIZE(_scan_type), \
}
+/*
+ * AD4030 can average over 2^N samples, where N = 1, 2, 3, ..., 16.
+ * We use N = 0 to mean no sample averaging.
+ */
static const int ad4030_average_modes[] = {
- 1, 2, 4, 8, 16, 32, 64, 128,
- 256, 512, 1024, 2048, 4096, 8192, 16384, 32768,
- 65536,
+ BIT(0), /* No sampling average */
+ BIT(1), BIT(2), BIT(3), BIT(4),
+ BIT(5), BIT(6), BIT(7), BIT(8),
+ BIT(9), BIT(10), BIT(11), BIT(12),
+ BIT(13), BIT(14), BIT(15), BIT(16),
};
static int ad4030_enter_config_mode(struct ad4030_state *st)
--
2.53.0
next prev parent reply other threads:[~2026-10-07 6:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 7:43 FAILED: patch "[PATCH] iio: adc: ad4030: fix invalid oversampling_ratio validation" failed to apply to 6.18-stable tree gregkh
2026-10-07 6:10 ` [PATCH 6.18.y 1/3] units: Add HZ_PER_GHZ Sasha Levin
2026-10-07 6:10 ` Sasha Levin [this message]
2026-10-07 6:10 ` [PATCH 6.18.y 3/3] iio: adc: ad4030: fix invalid oversampling_ratio validation Sasha Levin
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=20261007060913.1488382-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=stable@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