Skip to content

Commit 250b76f

Browse files
AndrewIjanojic23
authored andcommitted
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@alumni.usp.br> Co-developed-by: Gustavo Bastos <gustavobastos@usp.br> Signed-off-by: Gustavo Bastos <gustavobastos@usp.br> Link: https://patch.msgid.link/20250618031638.26477-3-andrew.lopes@alumni.usp.br Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent ca66d82 commit 250b76f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/iio/accel/sca3000.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@ static const struct attribute_group sca3000_attribute_group = {
937937

938938
static int sca3000_read_data(struct sca3000_state *st,
939939
u8 reg_address_high,
940-
u8 *rx,
941940
int len)
942941
{
943942
int ret;
@@ -947,18 +946,15 @@ static int sca3000_read_data(struct sca3000_state *st,
947946
.tx_buf = st->tx,
948947
}, {
949948
.len = len,
950-
.rx_buf = rx,
949+
.rx_buf = st->rx,
951950
}
952951
};
953952

954953
st->tx[0] = SCA3000_READ_REG(reg_address_high);
955954
ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
956-
if (ret) {
955+
if (ret)
957956
dev_err(&st->us->dev, "problem reading register\n");
958-
return ret;
959-
}
960-
961-
return 0;
957+
return ret;
962958
}
963959

964960
/**
@@ -982,8 +978,7 @@ static void sca3000_ring_int_process(u8 val, struct iio_dev *indio_dev)
982978
* num_available is the total number of samples available
983979
* i.e. number of time points * number of channels.
984980
*/
985-
ret = sca3000_read_data(st, SCA3000_REG_RING_OUT_ADDR, st->rx,
986-
num_available * 2);
981+
ret = sca3000_read_data(st, SCA3000_REG_RING_OUT_ADDR, num_available * 2);
987982
if (ret)
988983
goto error_ret;
989984
for (i = 0; i < num_available / 3; i++) {

0 commit comments

Comments
 (0)