Linux-IIO Archive on lore.kernel.org
 help / Atom feed
* [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius
@ 2018-12-31  3:07 Matt Ranostay
  2019-01-05 16:34 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Ranostay @ 2018-12-31  3:07 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Matt Ranostay

IIO_TEMP scale value for temperature was incorrect and not in millicelsius
as required by the ABI documentation.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/chemical/atlas-ph-sensor.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
index a406ad31b096..3a20cb5d9bff 100644
--- a/drivers/iio/chemical/atlas-ph-sensor.c
+++ b/drivers/iio/chemical/atlas-ph-sensor.c
@@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
 	case IIO_CHAN_INFO_SCALE:
 		switch (chan->type) {
 		case IIO_TEMP:
-			*val = 1; /* 0.01 */
-			*val2 = 100;
-			break;
+			*val = 10;
+			return IIO_VAL_INT;
 		case IIO_PH:
 			*val = 1; /* 0.001 */
 			*val2 = 1000;
@@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev,
 			   int val, int val2, long mask)
 {
 	struct atlas_data *data = iio_priv(indio_dev);
-	__be32 reg = cpu_to_be32(val);
+	__be32 reg = cpu_to_be32(val / 10);
 
 	if (val2 != 0 || val < 0 || val > 20000)
 		return -EINVAL;
-- 
2.17.1


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

* Re: [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius
  2018-12-31  3:07 [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius Matt Ranostay
@ 2019-01-05 16:34 ` Jonathan Cameron
  2019-01-05 22:44   ` Matt Ranostay
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2019-01-05 16:34 UTC (permalink / raw)
  To: Matt Ranostay; +Cc: linux-iio

On Sun, 30 Dec 2018 19:07:01 -0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> IIO_TEMP scale value for temperature was incorrect and not in millicelsius
> as required by the ABI documentation.
> 
> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Ideally would have had a fixes tag.  Looks superficially like this
goes back a long way but always nice to confirm how far :)

Anyhow, given we are in the merge window, I'll pick this up once rc1
is out and mark it for stable etc.

Give me a poke if I seem to have lost it in a week or so.

Thanks,

Jonathan

> ---
>  drivers/iio/chemical/atlas-ph-sensor.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
> index a406ad31b096..3a20cb5d9bff 100644
> --- a/drivers/iio/chemical/atlas-ph-sensor.c
> +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> @@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
>  	case IIO_CHAN_INFO_SCALE:
>  		switch (chan->type) {
>  		case IIO_TEMP:
> -			*val = 1; /* 0.01 */
> -			*val2 = 100;
> -			break;
> +			*val = 10;
> +			return IIO_VAL_INT;
>  		case IIO_PH:
>  			*val = 1; /* 0.001 */
>  			*val2 = 1000;
> @@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev,
>  			   int val, int val2, long mask)
>  {
>  	struct atlas_data *data = iio_priv(indio_dev);
> -	__be32 reg = cpu_to_be32(val);
> +	__be32 reg = cpu_to_be32(val / 10);
>  
>  	if (val2 != 0 || val < 0 || val > 20000)
>  		return -EINVAL;


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

* Re: [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius
  2019-01-05 16:34 ` Jonathan Cameron
@ 2019-01-05 22:44   ` Matt Ranostay
  2019-01-12 17:07     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Ranostay @ 2019-01-05 22:44 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

On Sat, Jan 5, 2019 at 8:34 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sun, 30 Dec 2018 19:07:01 -0800
> Matt Ranostay <matt.ranostay@konsulko.com> wrote:
>
> > IIO_TEMP scale value for temperature was incorrect and not in millicelsius
> > as required by the ABI documentation.
> >
> > Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
> Ideally would have had a fixes tag.  Looks superficially like this
> goes back a long way but always nice to confirm how far :)
>

Fixes: 27dec00ecf2d (iio: chemical: add Atlas pH-SM sensor support)

And yes it goes back a far way..., and guess this happens when one
doesn't use the libiio for userspace development :).

> Anyhow, given we are in the merge window, I'll pick this up once rc1
> is out and mark it for stable etc.
>
> Give me a poke if I seem to have lost it in a week or so.
>
> Thanks,
>
> Jonathan
>
> > ---
> >  drivers/iio/chemical/atlas-ph-sensor.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
> > index a406ad31b096..3a20cb5d9bff 100644
> > --- a/drivers/iio/chemical/atlas-ph-sensor.c
> > +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> > @@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
> >       case IIO_CHAN_INFO_SCALE:
> >               switch (chan->type) {
> >               case IIO_TEMP:
> > -                     *val = 1; /* 0.01 */
> > -                     *val2 = 100;
> > -                     break;
> > +                     *val = 10;
> > +                     return IIO_VAL_INT;
> >               case IIO_PH:
> >                       *val = 1; /* 0.001 */
> >                       *val2 = 1000;
> > @@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev,
> >                          int val, int val2, long mask)
> >  {
> >       struct atlas_data *data = iio_priv(indio_dev);
> > -     __be32 reg = cpu_to_be32(val);
> > +     __be32 reg = cpu_to_be32(val / 10);
> >
> >       if (val2 != 0 || val < 0 || val > 20000)
> >               return -EINVAL;
>

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

* Re: [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius
  2019-01-05 22:44   ` Matt Ranostay
@ 2019-01-12 17:07     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2019-01-12 17:07 UTC (permalink / raw)
  To: Matt Ranostay; +Cc: linux-iio

On Sat, 5 Jan 2019 14:44:18 -0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sat, Jan 5, 2019 at 8:34 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Sun, 30 Dec 2018 19:07:01 -0800
> > Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> >  
> > > IIO_TEMP scale value for temperature was incorrect and not in millicelsius
> > > as required by the ABI documentation.
> > >
> > > Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>  
> > Ideally would have had a fixes tag.  Looks superficially like this
> > goes back a long way but always nice to confirm how far :)
> >  
> 
> Fixes: 27dec00ecf2d (iio: chemical: add Atlas pH-SM sensor support)
> 
> And yes it goes back a far way..., and guess this happens when one
> doesn't use the libiio for userspace development :).

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks for chasing down that tag for me.

Jonathan

> 
> > Anyhow, given we are in the merge window, I'll pick this up once rc1
> > is out and mark it for stable etc.
> >
> > Give me a poke if I seem to have lost it in a week or so.
> >
> > Thanks,
> >
> > Jonathan
> >  
> > > ---
> > >  drivers/iio/chemical/atlas-ph-sensor.c | 7 +++----
> > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
> > > index a406ad31b096..3a20cb5d9bff 100644
> > > --- a/drivers/iio/chemical/atlas-ph-sensor.c
> > > +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> > > @@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
> > >       case IIO_CHAN_INFO_SCALE:
> > >               switch (chan->type) {
> > >               case IIO_TEMP:
> > > -                     *val = 1; /* 0.01 */
> > > -                     *val2 = 100;
> > > -                     break;
> > > +                     *val = 10;
> > > +                     return IIO_VAL_INT;
> > >               case IIO_PH:
> > >                       *val = 1; /* 0.001 */
> > >                       *val2 = 1000;
> > > @@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev,
> > >                          int val, int val2, long mask)
> > >  {
> > >       struct atlas_data *data = iio_priv(indio_dev);
> > > -     __be32 reg = cpu_to_be32(val);
> > > +     __be32 reg = cpu_to_be32(val / 10);
> > >
> > >       if (val2 != 0 || val < 0 || val > 20000)
> > >               return -EINVAL;  
> >  


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-31  3:07 [PATCH] iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius Matt Ranostay
2019-01-05 16:34 ` Jonathan Cameron
2019-01-05 22:44   ` Matt Ranostay
2019-01-12 17:07     ` 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 linux-iio@archiver.kernel.org
	public-inbox-index linux-iio


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