Re: [PATCH] iio: pressure: bmp280: fix relative humidity unit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 3 Jun 2018 15:41:54 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Mon, 28 May 2018 17:38:59 +0200
> Tomasz Duszynski <tduszyns@xxxxxxxxx> wrote:
> 
> > According to IIO ABI relative humidity reading should be
> > returned in milli percent.
> > 
> > This patch addresses that by applying proper scaling and
> > returning integer instead of fractional format type specifier.
> > 
> > Signed-off-by: Tomasz Duszynski <tduszyns@xxxxxxxxx>  
> 
> I'll be wanting input from Linus on this as he seems to be the last person
> to have taken particular interest in the driver.

Sorry, my email had 'stalled' for some reason so I didn't see the rest of
the thread.

Please ignore.

J
> 
> > ---
> >  drivers/iio/pressure/bmp280-core.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > index 5ec3e41b65f2..fe87d27779d9 100644
> > --- a/drivers/iio/pressure/bmp280-core.c
> > +++ b/drivers/iio/pressure/bmp280-core.c
> > @@ -415,10 +415,9 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2)
> >  	}
> >  	comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
> >  
> > -	*val = comp_humidity;
> > -	*val2 = 1024;
> > +	*val = comp_humidity * 1000 / 1024;  
> 
> Why not just *val = *val * 1000 and leave the rest alone?
> 
> >  
> > -	return IIO_VAL_FRACTIONAL;
> > +	return IIO_VAL_INT;
> >  }
> >  
> >  static int bmp280_read_raw(struct iio_dev *indio_dev,  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux