[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250701183618.43ccb548@jic23-huawei>
Date: Tue, 1 Jul 2025 18:36:18 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: David Lechner <dlechner@...libre.com>, Michael Hennerich
<Michael.Hennerich@...log.com>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Mark
Brown <broonie@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-spi@...r.kernel.org
Subject: Re: [PATCH v2 04/11] iio: adc: ad_sigma_delta: use BITS_TO_BYTES()
macro
On Tue, 1 Jul 2025 16:47:02 +0300
Andy Shevchenko <andriy.shevchenko@...el.com> wrote:
> On Mon, Jun 30, 2025 at 08:33:59AM -0500, David Lechner wrote:
> > On 6/30/25 3:59 AM, Andy Shevchenko wrote:
> > > On Sat, Jun 28, 2025 at 03:56:43PM +0100, Jonathan Cameron wrote:
> > >> On Fri, 27 Jun 2025 18:40:00 -0500
> > >> David Lechner <dlechner@...libre.com> wrote:
>
> ...
>
> > >>> - samples_buf_size = ALIGN(slot * indio_dev->channels[0].scan_type.storagebits / 8, 8);
> > >>> + samples_buf_size = ALIGN(slot * BITS_TO_BYTES(scan_type->storagebits), 8);
> > >>
> > >> Ah. You do it here. Fair enough and no problem wrt to patch 1 then.
> > >
> > > Hmm... Should the second 8 be something like sizeof(unsigned long lone) for
> > > semantic distinguishing with 8-bit bytes?
> >
> > Yeah, I considered to use sizeof(s64) to match the next line, but it
> > it seems like a separate change, so in the end I decided against doing
> > it in this patch and it seems too small of a thing for a separate patch.
>
> The problem in not the size of the change, the problem is that semantically
> those 8:s are _different_ and code readability will be much better if we make
> them so explicitly.
Agreed. It's not so bad once we are down to just one magic 8 (ball :) but
definitely makes sense to give them both explicit meaning.
A tiny follow up patch, or rolling it in here with a comment in the patch
description would both be fine.
Jonathan
>
Powered by blists - more mailing lists