[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aO-luIfTsekQC3e4@smile.fi.intel.com>
Date: Wed, 15 Oct 2025 16:46:32 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
jic23@...nel.org, michael.hennerich@...log.com, nuno.sa@...log.com,
eblanc@...libre.com, dlechner@...libre.com, andy@...nel.org,
robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
corbet@....net, marcelo.schmitt1@...il.com,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v5 4/7] iio: adc: ad4030: Use BIT macro to improve code
readability
On Tue, Oct 14, 2025 at 07:21:58PM -0300, Marcelo Schmitt wrote:
> Use BIT macro to make the list of average modes more readable.
>
> Suggested-by: Andy Shevchenko <andy.shevchenko@...il.com>
Okay, but...
...
> 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 averaging/oversampling */
> + BIT(1), BIT(2), BIT(3), BIT(4), /* 2 to 16 */
> + BIT(5), BIT(6), BIT(7), BIT(8), /* 32 to 256 */
> + BIT(9), BIT(10), BIT(11), BIT(12), /* 512 to 4096 */
> + BIT(13), BIT(14), BIT(15), BIT(16), /* 8192 to 65536 */
...the comments now a bit odd as it's unclear in which step the values are.
Taking this into account I would rather drop the comments for all bits but
0.
Or even drop all and make a top comment to explain the meaning of values
0, 1, and bit permutations, if any.
> };
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists