iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting
diff mbox series

Message ID 20191121203932.17249-1-chris.lesiak@licor.com
State New
Headers show
Series
  • iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting
Related show

Commit Message

Chris Lesiak Nov. 21, 2019, 8:39 p.m. UTC
The IIO_HUMIDITYRELATIVE channel was being incorrectly reported back
as percent when it should have been milli percent. This is via an
incorrect scale value being returned to userspace.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
---
 drivers/iio/humidity/hdc100x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matt Ranostay Nov. 22, 2019, 3:25 a.m. UTC | #1
On Thu, Nov 21, 2019 at 12:39 PM Chris Lesiak <chris.lesiak@licor.com> wrote:
>
> The IIO_HUMIDITYRELATIVE channel was being incorrectly reported back
> as percent when it should have been milli percent. This is via an
> incorrect scale value being returned to userspace.
>

 **sigh** another failure by me to follow the iio ABI.

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
> ---
>  drivers/iio/humidity/hdc100x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
> index 066e05f92081..ff6666ac5d68 100644
> --- a/drivers/iio/humidity/hdc100x.c
> +++ b/drivers/iio/humidity/hdc100x.c
> @@ -229,7 +229,7 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
>                         *val2 = 65536;
>                         return IIO_VAL_FRACTIONAL;
>                 } else {
> -                       *val = 100;
> +                       *val = 100000;
>                         *val2 = 65536;
>                         return IIO_VAL_FRACTIONAL;
>                 }
> --
> 2.21.0
>
Jonathan Cameron Nov. 23, 2019, 4:47 p.m. UTC | #2
On Thu, 21 Nov 2019 18:52:26 -0800
Matt Ranostay <mranostay@gmail.com> wrote:

> On Thu, Nov 21, 2019 at 12:39 PM Chris Lesiak <chris.lesiak@licor.com>
> wrote:
> 
> > The IIO_HUMIDITYRELATIVE channel was being incorrectly reported back
> > as percent when it should have been milli percent. This is via an
> > incorrect scale value being returned to userspace.
> >
> >  
> **sigh** another failure by me to follow the iio ABI.
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> 
> 
> > Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
> > ---
> >  drivers/iio/humidity/hdc100x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/humidity/hdc100x.c
> > b/drivers/iio/humidity/hdc100x.c
> > index 066e05f92081..ff6666ac5d68 100644
> > --- a/drivers/iio/humidity/hdc100x.c
> > +++ b/drivers/iio/humidity/hdc100x.c
> > @@ -229,7 +229,7 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
> >                         *val2 = 65536;
> >                         return IIO_VAL_FRACTIONAL;
> >                 } else {
> > -                       *val = 100;
> > +                       *val = 100000;
> >                         *val2 = 65536;
> >                         return IIO_VAL_FRACTIONAL;
> >                 }
> > --
> > 2.21.0
> >
> >

Patch
diff mbox series

diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index 066e05f92081..ff6666ac5d68 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -229,7 +229,7 @@  static int hdc100x_read_raw(struct iio_dev *indio_dev,
 			*val2 = 65536;
 			return IIO_VAL_FRACTIONAL;
 		} else {
-			*val = 100;
+			*val = 100000;
 			*val2 = 65536;
 			return IIO_VAL_FRACTIONAL;
 		}