[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250618031638.26477-3-andrew.lopes@alumni.usp.br>
Date: Wed, 18 Jun 2025 00:12:17 -0300
From: Andrew Ijano <andrew.ijano@...il.com>
To: jic23@...nel.org
Cc: andrew.lopes@...mni.usp.br,
gustavobastos@....br,
dlechner@...libre.com,
nuno.sa@...log.com,
andy@...nel.org,
jstephan@...libre.com,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v6 2/4] iio: accel: sca3000: clean sca3000_read_data()
Clean internal sca3000_read_data() helper by removing unnecessary
arguments and return logic.
Signed-off-by: Andrew Ijano <andrew.lopes@...mni.usp.br>
Co-developed-by: Gustavo Bastos <gustavobastos@....br>
Signed-off-by: Gustavo Bastos <gustavobastos@....br>
---
drivers/iio/accel/sca3000.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index c85a06cbea37..7145b4541264 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -939,7 +939,6 @@ static const struct attribute_group sca3000_attribute_group = {
static int sca3000_read_data(struct sca3000_state *st,
u8 reg_address_high,
- u8 *rx,
int len)
{
int ret;
@@ -949,18 +948,15 @@ static int sca3000_read_data(struct sca3000_state *st,
.tx_buf = st->tx,
}, {
.len = len,
- .rx_buf = rx,
+ .rx_buf = st->rx,
}
};
st->tx[0] = SCA3000_READ_REG(reg_address_high);
ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
- if (ret) {
+ if (ret)
dev_err(&st->us->dev, "problem reading register\n");
- return ret;
- }
-
- return 0;
+ return ret;
}
/**
@@ -984,8 +980,7 @@ static void sca3000_ring_int_process(u8 val, struct iio_dev *indio_dev)
* num_available is the total number of samples available
* i.e. number of time points * number of channels.
*/
- ret = sca3000_read_data(st, SCA3000_REG_RING_OUT_ADDR, st->rx,
- num_available * 2);
+ ret = sca3000_read_data(st, SCA3000_REG_RING_OUT_ADDR, num_available * 2);
if (ret)
goto error_ret;
for (i = 0; i < num_available / 3; i++) {
--
2.49.0
Powered by blists - more mailing lists