stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices
       [not found] <20210818111139.330636-1-miquel.raynal@bootlin.com>
@ 2021-08-18 11:11 ` Miquel Raynal
  2021-08-20  7:02   ` Sa, Nuno
  2021-08-18 11:11 ` [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels Miquel Raynal
  1 sibling, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2021-08-18 11:11 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen
  Cc: Thomas Petazzoni, linux-iio, linux-kernel, Miquel Raynal, stable

10-bit devices must shift the value twice.
This is not needed anymore on 12-bit devices.

Fixes: ae47d009b508 ("iio: adc: max1027: Introduce 12-bit devices support")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/iio/adc/max1027.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 655ab02d03d8..4a42d140a4b0 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
 			.sign = 'u',					\
 			.realbits = depth,				\
 			.storagebits = 16,				\
-			.shift = 2,					\
+			.shift = (depth == 10) ? 2 : 0,			\
 			.endianness = IIO_BE,				\
 		},							\
 	}
-- 
2.27.0


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

* [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels
       [not found] <20210818111139.330636-1-miquel.raynal@bootlin.com>
  2021-08-18 11:11 ` [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices Miquel Raynal
@ 2021-08-18 11:11 ` Miquel Raynal
  2021-08-20  7:03   ` Sa, Nuno
  1 sibling, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2021-08-18 11:11 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen
  Cc: Thomas Petazzoni, linux-iio, linux-kernel, Miquel Raynal, stable

The macro MAX1X29_CHANNELS() already calls MAX1X27_CHANNELS().
Calling MAX1X27_CHANNELS() before MAX1X29_CHANNELS() in the definition
of MAX1X31_CHANNELS() declares the first 8 channels twice. So drop this
extra call from the MAX1X31 channels list definition.

Fixes: 7af5257d8427 ("iio: adc: max1027: Prepare the introduction of different resolutions")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/iio/adc/max1027.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 4a42d140a4b0..b753658bb41e 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
 	MAX1027_V_CHAN(11, depth)
 
 #define MAX1X31_CHANNELS(depth)			\
-	MAX1X27_CHANNELS(depth),		\
 	MAX1X29_CHANNELS(depth),		\
 	MAX1027_V_CHAN(12, depth),		\
 	MAX1027_V_CHAN(13, depth),		\
-- 
2.27.0


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

* RE: [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices
  2021-08-18 11:11 ` [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices Miquel Raynal
@ 2021-08-20  7:02   ` Sa, Nuno
  2021-08-30  9:57     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Sa, Nuno @ 2021-08-20  7:02 UTC (permalink / raw)
  To: Miquel Raynal, Jonathan Cameron, Lars-Peter Clausen
  Cc: Thomas Petazzoni, linux-iio, linux-kernel, stable



> -----Original Message-----
> From: Miquel Raynal <miquel.raynal@bootlin.com>
> Sent: Wednesday, August 18, 2021 1:11 PM
> To: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> <lars@metafoo.de>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; linux-
> iio@vger.kernel.org; linux-kernel@vger.kernel.org; Miquel Raynal
> <miquel.raynal@bootlin.com>; stable@vger.kernel.org
> Subject: [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit
> devices
> 
> [External]
> 
> 10-bit devices must shift the value twice.
> This is not needed anymore on 12-bit devices.
> 
> Fixes: ae47d009b508 ("iio: adc: max1027: Introduce 12-bit devices
> support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/iio/adc/max1027.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 655ab02d03d8..4a42d140a4b0 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of,
> max1027_adc_dt_ids);
>  			.sign = 'u',					\
>  			.realbits = depth,				\
>  			.storagebits = 16,				\
> -			.shift = 2,					\
> +			.shift = (depth == 10) ? 2 : 0,			\
>  			.endianness = IIO_BE,				\
>  		},							\
>  	}
> --
> 2.27.0

Reviewed-by: Nuno Sá <nuno.sa@analog.com>


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

* RE: [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels
  2021-08-18 11:11 ` [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels Miquel Raynal
@ 2021-08-20  7:03   ` Sa, Nuno
  2021-08-30 10:00     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Sa, Nuno @ 2021-08-20  7:03 UTC (permalink / raw)
  To: Miquel Raynal, Jonathan Cameron, Lars-Peter Clausen
  Cc: Thomas Petazzoni, linux-iio, linux-kernel, stable



> -----Original Message-----
> From: Miquel Raynal <miquel.raynal@bootlin.com>
> Sent: Wednesday, August 18, 2021 1:11 PM
> To: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> <lars@metafoo.de>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; linux-
> iio@vger.kernel.org; linux-kernel@vger.kernel.org; Miquel Raynal
> <miquel.raynal@bootlin.com>; stable@vger.kernel.org
> Subject: [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31
> channels
> 
> [External]
> 
> The macro MAX1X29_CHANNELS() already calls
> MAX1X27_CHANNELS().
> Calling MAX1X27_CHANNELS() before MAX1X29_CHANNELS() in the
> definition
> of MAX1X31_CHANNELS() declares the first 8 channels twice. So drop
> this
> extra call from the MAX1X31 channels list definition.
> 
> Fixes: 7af5257d8427 ("iio: adc: max1027: Prepare the introduction of
> different resolutions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/iio/adc/max1027.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 4a42d140a4b0..b753658bb41e 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of,
> max1027_adc_dt_ids);
>  	MAX1027_V_CHAN(11, depth)
> 
>  #define MAX1X31_CHANNELS(depth)			\
> -	MAX1X27_CHANNELS(depth),		\
>  	MAX1X29_CHANNELS(depth),		\
>  	MAX1027_V_CHAN(12, depth),		\
>  	MAX1027_V_CHAN(13, depth),		\
> --
> 2.27.0

Reviewed-by: Nuno Sá <nuno.sa@analog.com>


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

* Re: [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices
  2021-08-20  7:02   ` Sa, Nuno
@ 2021-08-30  9:57     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2021-08-30  9:57 UTC (permalink / raw)
  To: Sa, Nuno
  Cc: Miquel Raynal, Lars-Peter Clausen, Thomas Petazzoni, linux-iio,
	linux-kernel, stable

On Fri, 20 Aug 2021 07:02:54 +0000
"Sa, Nuno" <Nuno.Sa@analog.com> wrote:

> > -----Original Message-----
> > From: Miquel Raynal <miquel.raynal@bootlin.com>
> > Sent: Wednesday, August 18, 2021 1:11 PM
> > To: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> > <lars@metafoo.de>
> > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; linux-
> > iio@vger.kernel.org; linux-kernel@vger.kernel.org; Miquel Raynal
> > <miquel.raynal@bootlin.com>; stable@vger.kernel.org
> > Subject: [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit
> > devices
> > 
> > [External]
> > 
> > 10-bit devices must shift the value twice.
> > This is not needed anymore on 12-bit devices.
> > 
> > Fixes: ae47d009b508 ("iio: adc: max1027: Introduce 12-bit devices
> > support")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/iio/adc/max1027.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> > index 655ab02d03d8..4a42d140a4b0 100644
> > --- a/drivers/iio/adc/max1027.c
> > +++ b/drivers/iio/adc/max1027.c
> > @@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of,
> > max1027_adc_dt_ids);
> >  			.sign = 'u',					\
> >  			.realbits = depth,				\
> >  			.storagebits = 16,				\
> > -			.shift = 2,					\
> > +			.shift = (depth == 10) ? 2 : 0,			\
> >  			.endianness = IIO_BE,				\
> >  		},							\
> >  	}
> > --
> > 2.27.0  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Ouch.  I briefly wondered if we should dot his as 12 - depth, but given we are unlikely
to ever see a 9 or 11 bit device and it doesn't make much sense for anything 8 or less
what you have here is effectively the same.

Applied to the fixes-togreg branch of iio.git

Jonathan

> 


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

* Re: [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels
  2021-08-20  7:03   ` Sa, Nuno
@ 2021-08-30 10:00     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2021-08-30 10:00 UTC (permalink / raw)
  To: Sa, Nuno
  Cc: Miquel Raynal, Lars-Peter Clausen, Thomas Petazzoni, linux-iio,
	linux-kernel, stable

On Fri, 20 Aug 2021 07:03:40 +0000
"Sa, Nuno" <Nuno.Sa@analog.com> wrote:

> > -----Original Message-----
> > From: Miquel Raynal <miquel.raynal@bootlin.com>
> > Sent: Wednesday, August 18, 2021 1:11 PM
> > To: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> > <lars@metafoo.de>
> > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; linux-
> > iio@vger.kernel.org; linux-kernel@vger.kernel.org; Miquel Raynal
> > <miquel.raynal@bootlin.com>; stable@vger.kernel.org
> > Subject: [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31
> > channels
> > 
> > [External]
> > 
> > The macro MAX1X29_CHANNELS() already calls
> > MAX1X27_CHANNELS().
> > Calling MAX1X27_CHANNELS() before MAX1X29_CHANNELS() in the
> > definition
> > of MAX1X31_CHANNELS() declares the first 8 channels twice. So drop
> > this
> > extra call from the MAX1X31 channels list definition.
> > 
> > Fixes: 7af5257d8427 ("iio: adc: max1027: Prepare the introduction of
> > different resolutions")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/iio/adc/max1027.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> > index 4a42d140a4b0..b753658bb41e 100644
> > --- a/drivers/iio/adc/max1027.c
> > +++ b/drivers/iio/adc/max1027.c
> > @@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of,
> > max1027_adc_dt_ids);
> >  	MAX1027_V_CHAN(11, depth)
> > 
> >  #define MAX1X31_CHANNELS(depth)			\
> > -	MAX1X27_CHANNELS(depth),		\
> >  	MAX1X29_CHANNELS(depth),		\
> >  	MAX1027_V_CHAN(12, depth),		\
> >  	MAX1027_V_CHAN(13, depth),		\
> > --
> > 2.27.0  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> 
I guess we don't have many users of these devices as I would have expected
this to blow up spectacularly.  Ah well.  

Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

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

end of thread, other threads:[~2021-08-30  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210818111139.330636-1-miquel.raynal@bootlin.com>
2021-08-18 11:11 ` [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices Miquel Raynal
2021-08-20  7:02   ` Sa, Nuno
2021-08-30  9:57     ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels Miquel Raynal
2021-08-20  7:03   ` Sa, Nuno
2021-08-30 10:00     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).