Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: accel: adxl345: simplify reading the FIFO

Bulk FIFO reading can be streamlined by eliminating redundant variables and
simplifying the process of reading x-, y-, and z-axis measurement sets.

This is a refactoring change with no expected impact on functionality.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Link: https://patch.msgid.link/20250702230315.19297-3-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Lothar Rubusch and committed by
Jonathan Cameron
f057897d 7a7242d8

+2 -5
+2 -5
drivers/iio/accel/adxl345_core.c
··· 885 885 */ 886 886 static int adxl345_fifo_transfer(struct adxl345_state *st, int samples) 887 887 { 888 - size_t count; 889 888 int i, ret = 0; 890 889 891 - /* count is the 3x the fifo_buf element size, hence 6B */ 892 - count = sizeof(st->fifo_buf[0]) * ADXL345_DIRS; 893 890 for (i = 0; i < samples; i++) { 894 - /* read 3x 2 byte elements from base address into next fifo_buf position */ 895 891 ret = regmap_bulk_read(st->regmap, ADXL345_REG_XYZ_BASE, 896 - st->fifo_buf + (i * count / 2), count); 892 + st->fifo_buf + (i * ADXL345_DIRS), 893 + sizeof(st->fifo_buf[0]) * ADXL345_DIRS); 897 894 if (ret) 898 895 return ret; 899 896