]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad4030: Use BIT macro to improve code readability
authorMarcelo Schmitt <marcelo.schmitt@analog.com>
Mon, 16 Feb 2026 15:00:22 +0000 (12:00 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 08:24:24 +0000 (08:24 +0000)
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>
drivers/iio/adc/ad4030.c

index 68446db9bef1b719f43905310a849c480b72e29f..def3e1d01ceb53dfa9f876e5d4bcb08fe14bb0fc 100644 (file)
@@ -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)