summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-buffer.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 09:05:34 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 09:05:34 +0100
commitc318f074d9fdeae16e19cbb2ed53b50d2bcdfdb8 (patch)
tree44c6552fa919dfe1fc681949bf5d81fcf6a2beb8 /drivers/iio/industrialio-buffer.c
parent7b2d7faa09fcbd0184634544f732f4b2da0b20a8 (diff)
parentdef9d2780727cec3313ed3522d0123158d87224d (diff)
Merge 5.5-rc7 into staging-next
We want the staging fixes in here as well Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r--drivers/iio/industrialio-buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index dbbf0cf4cac9..4ada5592aa2b 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
const unsigned long *mask, bool timestamp)
{
unsigned bytes = 0;
- int length, i;
+ int length, i, largest = 0;
/* How much space will the demuxed element take? */
for_each_set_bit(i, mask,
@@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
length = iio_storage_bytes_for_si(indio_dev, i);
bytes = ALIGN(bytes, length);
bytes += length;
+ largest = max(largest, length);
}
if (timestamp) {
length = iio_storage_bytes_for_timestamp(indio_dev);
bytes = ALIGN(bytes, length);
bytes += length;
+ largest = max(largest, length);
}
+
+ bytes = ALIGN(bytes, largest);
return bytes;
}