mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
iio: imu: adis16475: Add buffer padding after temp channel
The temperature channel has 16-bit storage size. We need to perform
the padding to have the buffer elements naturally aligned in case
the temperature channel is enabled and there are any 32-bit storage
size channels enabled which have a scan index higher than the
temperature channel scan index.
Fixes: 8f6bc87d67
("iio: imu: adis16475.c: Add delta angle and delta velocity channels")
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230926085721.645687-2-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
500d7640f6
commit
d2d1ecc67c
1 changed files with 10 additions and 0 deletions
|
@ -1197,6 +1197,16 @@ static irqreturn_t adis16475_trigger_handler(int irq, void *p)
|
|||
switch (bit) {
|
||||
case ADIS16475_SCAN_TEMP:
|
||||
st->data[i++] = buffer[offset];
|
||||
/*
|
||||
* The temperature channel has 16-bit storage size.
|
||||
* We need to perform the padding to have the buffer
|
||||
* elements naturally aligned in case there are any
|
||||
* 32-bit storage size channels enabled which have a
|
||||
* scan index higher than the temperature channel scan
|
||||
* index.
|
||||
*/
|
||||
if (*indio_dev->active_scan_mask & GENMASK(ADIS16475_SCAN_DELTVEL_Z, ADIS16475_SCAN_DELTANG_X))
|
||||
st->data[i++] = 0;
|
||||
break;
|
||||
case ADIS16475_SCAN_DELTANG_X ... ADIS16475_SCAN_DELTVEL_Z:
|
||||
buff_offset = ADIS16475_SCAN_DELTANG_X;
|
||||
|
|
Loading…
Reference in a new issue