Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] iio: adc: ad7606: fix reading unnecessary data from device
@ 2019-11-04 16:26 Beniamin Bia
  2019-11-10 10:46 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Beniamin Bia @ 2019-11-04 16:26 UTC (permalink / raw)
  To: jic23
  Cc: lars, Michael.Hennerich, knaack.h, pmeerw, linux-iio,
	biabeniamin, rwoerle, Beniamin Bia

When a conversion result is being read from ADC, the driver reads the
number of channels + 1 because it thinks that IIO_CHAN_SOFT_TIMESTAMP
is also a physical channel. This patch fixes this issue.

Fixes: 552a21f35477 ("staging: iio: adc: ad7606: Move out of staging")
Reported-by: Robert Wörle <rwoerle@mibtec.de>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
---
 drivers/iio/adc/ad7606.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index f5ba94c03a8d..e4683a68522a 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -85,7 +85,7 @@ static int ad7606_reg_access(struct iio_dev *indio_dev,
 
 static int ad7606_read_samples(struct ad7606_state *st)
 {
-	unsigned int num = st->chip_info->num_channels;
+	unsigned int num = st->chip_info->num_channels - 1;
 	u16 *data = st->data;
 	int ret;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: ad7606: fix reading unnecessary data from device
  2019-11-04 16:26 [PATCH] iio: adc: ad7606: fix reading unnecessary data from device Beniamin Bia
@ 2019-11-10 10:46 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2019-11-10 10:46 UTC (permalink / raw)
  To: Beniamin Bia
  Cc: lars, Michael.Hennerich, knaack.h, pmeerw, linux-iio,
	biabeniamin, rwoerle

On Mon, 4 Nov 2019 18:26:34 +0200
Beniamin Bia <beniamin.bia@analog.com> wrote:

> When a conversion result is being read from ADC, the driver reads the
> number of channels + 1 because it thinks that IIO_CHAN_SOFT_TIMESTAMP
> is also a physical channel. This patch fixes this issue.
> 
> Fixes: 552a21f35477 ("staging: iio: adc: ad7606: Move out of staging")
> Reported-by: Robert Wörle <rwoerle@mibtec.de>
> Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.

We are at that point in the cycle where I 'might' move this into
the togreg branch for the merge window.  All depends on what Linus
says in his rc7 email that'll probably be out later today.
Previously he hinted we'd have an rc8 this time. If that happens
I'll do one last pull request and hence take the queued up fixes
in with that for the merge window.  I don't have anything critical
enough to do a fixes pull this later in the cycle.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad7606.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index f5ba94c03a8d..e4683a68522a 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -85,7 +85,7 @@ static int ad7606_reg_access(struct iio_dev *indio_dev,
>  
>  static int ad7606_read_samples(struct ad7606_state *st)
>  {
> -	unsigned int num = st->chip_info->num_channels;
> +	unsigned int num = st->chip_info->num_channels - 1;
>  	u16 *data = st->data;
>  	int ret;
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 16:26 [PATCH] iio: adc: ad7606: fix reading unnecessary data from device Beniamin Bia
2019-11-10 10:46 ` Jonathan Cameron

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git