diff mbox series

[v3,3/3] iio: ti-ads8688: Update buffer allocation for timestamps

Message ID 20190111195707.2086-3-dmurphy@ti.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/3] iio: ti-ads124s08: Add DT binding documentation | expand

Commit Message

Dan Murphy Jan. 11, 2019, 7:57 p.m. UTC
Per Jonathan Cameron, the buffer needs to allocate room for a
64 bit timestamp as well as the channels.  Change the buffer
to allocate this additional space.

Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v3 - Updated the buffer allocation definition I also dropped the device managed
patch as I don't have time to invest in that code - https://lore.kernel.org/patchwork/patch/1023971/
v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/

 drivers/iio/adc/ti-ads8688.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jonathan Cameron Jan. 12, 2019, 6:33 p.m. UTC | #1
On Fri, 11 Jan 2019 13:57:07 -0600
Dan Murphy <dmurphy@ti.com> wrote:

> Per Jonathan Cameron, the buffer needs to allocate room for a
> 64 bit timestamp as well as the channels.  Change the buffer
> to allocate this additional space.
> 
> Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks for fixing this up!

Jonathan

> ---
> 
> v3 - Updated the buffer allocation definition I also dropped the device managed
> patch as I don't have time to invest in that code - https://lore.kernel.org/patchwork/patch/1023971/
> v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/
> 
>  drivers/iio/adc/ti-ads8688.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c
> index 184d686ebd99..8b4568edd5cb 100644
> --- a/drivers/iio/adc/ti-ads8688.c
> +++ b/drivers/iio/adc/ti-ads8688.c
> @@ -41,6 +41,7 @@
>  
>  #define ADS8688_VREF_MV			4096
>  #define ADS8688_REALBITS		16
> +#define ADS8688_MAX_CHANNELS		8
>  
>  /*
>   * enum ads8688_range - ADS8688 reference voltage range
> @@ -385,7 +386,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p)
>  {
>  	struct iio_poll_func *pf = p;
>  	struct iio_dev *indio_dev = pf->indio_dev;
> -	u16 buffer[8];
> +	u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)];
>  	int i, j = 0;
>  
>  	for (i = 0; i < indio_dev->masklength; i++) {
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c
index 184d686ebd99..8b4568edd5cb 100644
--- a/drivers/iio/adc/ti-ads8688.c
+++ b/drivers/iio/adc/ti-ads8688.c
@@ -41,6 +41,7 @@ 
 
 #define ADS8688_VREF_MV			4096
 #define ADS8688_REALBITS		16
+#define ADS8688_MAX_CHANNELS		8
 
 /*
  * enum ads8688_range - ADS8688 reference voltage range
@@ -385,7 +386,7 @@  static irqreturn_t ads8688_trigger_handler(int irq, void *p)
 {
 	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
-	u16 buffer[8];
+	u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)];
 	int i, j = 0;
 
 	for (i = 0; i < indio_dev->masklength; i++) {