diff mbox series

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

Message ID 20181211191207.21900-3-dmurphy@ti.com
State New
Headers show
Series [v2,1/4] iio: ti-ads124s08: Add DT binding documentation | expand

Commit Message

Dan Murphy Dec. 11, 2018, 7:12 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.

Signed-off-by: Dan Murphy <dmurphy@ti.com>

---

v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/

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

-- 
2.20.0.rc2.7.g965798d1f2

Comments

Jonathan Cameron Dec. 16, 2018, 11:06 a.m. UTC | #1
On Tue, 11 Dec 2018 13:12:06 -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.

> 

> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Same question around data types as in the previous patch.

If you can track down the original patch that introduced the bug and add
add a fixes tag, that would be great as well.  This one should go into
stable.

Thanks,

Jonathan
> ---

> 

> v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/

> 

>  drivers/iio/adc/ti-ads8688.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c

> index 184d686ebd99..3597bc0697ee 100644

> --- a/drivers/iio/adc/ti-ads8688.c

> +++ b/drivers/iio/adc/ti-ads8688.c

> @@ -385,7 +385,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];

> +	unsigned short buffer[8 + sizeof(s64)/sizeof(short)];

Why change from a well defined size of data to one that is only
defined by the c spec to be no more than the size of an int?

>  	int i, j = 0;

>  

>  	for (i = 0; i < indio_dev->masklength; i++) {
Dan Murphy Dec. 19, 2018, 5:45 p.m. UTC | #2
On 12/16/2018 05:06 AM, Jonathan Cameron wrote:
> On Tue, 11 Dec 2018 13:12:06 -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.

>>

>> Signed-off-by: Dan Murphy <dmurphy@ti.com>

> Same question around data types as in the previous patch.

> 

> If you can track down the original patch that introduced the bug and add

> add a fixes tag, that would be great as well.  This one should go into

> stable.


I will git blame it and call it out.

> 

> Thanks,

> 

> Jonathan

>> ---

>>

>> v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/

>>

>>  drivers/iio/adc/ti-ads8688.c | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c

>> index 184d686ebd99..3597bc0697ee 100644

>> --- a/drivers/iio/adc/ti-ads8688.c

>> +++ b/drivers/iio/adc/ti-ads8688.c

>> @@ -385,7 +385,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];

>> +	unsigned short buffer[8 + sizeof(s64)/sizeof(short)];

> Why change from a well defined size of data to one that is only

> defined by the c spec to be no more than the size of an int?


I took the define from the ina2xx-adc I will change it back to the u16.

Dan

> 

>>  	int i, j = 0;

>>  

>>  	for (i = 0; i < indio_dev->masklength; i++) {

> 



-- 
------------------
Dan Murphy
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c
index 184d686ebd99..3597bc0697ee 100644
--- a/drivers/iio/adc/ti-ads8688.c
+++ b/drivers/iio/adc/ti-ads8688.c
@@ -385,7 +385,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];
+	unsigned short buffer[8 + sizeof(s64)/sizeof(short)];
 	int i, j = 0;
 
 	for (i = 0; i < indio_dev->masklength; i++) {