driver: sensor: adxl367: Fix for SPI

Fix for SPI communication when RTIO is used in SPI driver. When in
adxl367_bus_access, const struct spi_buf buf[3] is used,
spi_rtio_copy function won't set correct buffers and length
for buf[2] and that will cause exception when that buffer is
processed.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
This commit is contained in:
Vladislav Pejic 2024-11-01 14:22:24 +01:00 committed by Anas Nashif
commit eb15f306b6

View file

@ -32,13 +32,12 @@ static int adxl367_bus_access(const struct device *dev, uint8_t reg,
addr_reg = ADXL367_TO_REG(reg);
const struct spi_buf buf[3] = {
uint8_t access[2] = {rw_reg, addr_reg};
const struct spi_buf buf[2] = {
{
.buf = &rw_reg,
.len = 1
}, {
.buf = &addr_reg,
.len = 1
.buf = access,
.len = 2
}, {
.buf = data,
.len = length
@ -52,15 +51,15 @@ static int adxl367_bus_access(const struct device *dev, uint8_t reg,
if ((reg & ADXL367_READ) != 0) {
const struct spi_buf_set rx = {
.buffers = buf,
.count = 3
.count = 2
};
tx.count = 2;
tx.count = 1;
return spi_transceive_dt(&config->spi, &tx, &rx);
}
tx.count = 3;
tx.count = 2;
return spi_write_dt(&config->spi, &tx);
}