[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250614144750.1f1a7a0f@jic23-huawei>
Date: Sat, 14 Jun 2025 14:47:50 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, dlechner@...libre.com,
nuno.sa@...log.com, andy@...nel.org, corbet@....net,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, eraretuya@...il.com
Subject: Re: [PATCH v9 05/11] iio: accel: adxl345: simplify reading the FIFO
On Tue, 10 Jun 2025 21:59:27 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:
> Bulk reading from the FIFO can be simplified. Remove unnecessary
> variables and simplify reading sets of x-, y- and z-axis measurements.
>
> This is a refactoring change and should not impact functionality.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
> ---
> drivers/iio/accel/adxl345_core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
> index 18c625d323ba..dcfbfe4cac0f 100644
> --- a/drivers/iio/accel/adxl345_core.c
> +++ b/drivers/iio/accel/adxl345_core.c
> @@ -884,15 +884,13 @@ static int adxl345_get_samples(struct adxl345_state *st)
> */
> static int adxl345_fifo_transfer(struct adxl345_state *st, int samples)
> {
> - size_t count;
> int i, ret = 0;
>
> - /* count is the 3x the fifo_buf element size, hence 6B */
> - count = sizeof(st->fifo_buf[0]) * ADXL345_DIRS;
> for (i = 0; i < samples; i++) {
> /* read 3x 2 byte elements from base address into next fifo_buf position */
> ret = regmap_bulk_read(st->regmap, ADXL345_REG_XYZ_BASE,
> - st->fifo_buf + (i * count / 2), count);
> + st->fifo_buf + (i * ADXL345_DIRS),
> + 2 * ADXL345_DIRS);
sizeof(st->fifo_buf[0]) * ADXL345_DIRS);
As it's not locally obvious where that 2 comes from.
> if (ret)
> return ret;
>
Powered by blists - more mailing lists