]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.22/iio-ti-ads8688-update-buffer-allocation-for-timestamps.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.19.22 / iio-ti-ads8688-update-buffer-allocation-for-timestamps.patch
1 From f214ff521fb1f861c8d7f7d0af98b06bf61b3369 Mon Sep 17 00:00:00 2001
2 From: Dan Murphy <dmurphy@ti.com>
3 Date: Fri, 11 Jan 2019 13:57:07 -0600
4 Subject: iio: ti-ads8688: Update buffer allocation for timestamps
5
6 From: Dan Murphy <dmurphy@ti.com>
7
8 commit f214ff521fb1f861c8d7f7d0af98b06bf61b3369 upstream.
9
10 Per Jonathan Cameron, the buffer needs to allocate room for a
11 64 bit timestamp as well as the channels. Change the buffer
12 to allocate this additional space.
13
14 Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support")
15 Signed-off-by: Dan Murphy <dmurphy@ti.com>
16 Cc: <Stable@vger.kernel.org>
17 Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/iio/adc/ti-ads8688.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
23
24 --- a/drivers/iio/adc/ti-ads8688.c
25 +++ b/drivers/iio/adc/ti-ads8688.c
26 @@ -41,6 +41,7 @@
27
28 #define ADS8688_VREF_MV 4096
29 #define ADS8688_REALBITS 16
30 +#define ADS8688_MAX_CHANNELS 8
31
32 /*
33 * enum ads8688_range - ADS8688 reference voltage range
34 @@ -385,7 +386,7 @@ static irqreturn_t ads8688_trigger_handl
35 {
36 struct iio_poll_func *pf = p;
37 struct iio_dev *indio_dev = pf->indio_dev;
38 - u16 buffer[8];
39 + u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)];
40 int i, j = 0;
41
42 for (i = 0; i < indio_dev->masklength; i++) {