linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Subject: Re: [PATCH v2] iio/gyro/bmg160: Use millidegrees for temperature scale
Date: Wed, 20 Feb 2019 12:10:42 +0000	[thread overview]
Message-ID: <20190220121042.6459176b@archlinux> (raw)
In-Reply-To: <1550043707-13040-1-git-send-email-mike.looijmans@topic.nl>

On Wed, 13 Feb 2019 08:41:47 +0100
Mike Looijmans <mike.looijmans@topic.nl> wrote:

> Standard unit for temperature is millidegrees Celcius, whereas this driver
> was reporting in degrees. Fix the scale factor in the driver.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan
> ---
> v2: Don't touch val2 when returning IIO_VAL_INT
>     Only touch val when returning a value
> 
>  drivers/iio/gyro/bmg160_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
> index 63ca316..92c07ab 100644
> --- a/drivers/iio/gyro/bmg160_core.c
> +++ b/drivers/iio/gyro/bmg160_core.c
> @@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
>  	case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
>  		return bmg160_get_filter(data, val);
>  	case IIO_CHAN_INFO_SCALE:
> -		*val = 0;
>  		switch (chan->type) {
>  		case IIO_TEMP:
> -			*val2 = 500000;
> -			return IIO_VAL_INT_PLUS_MICRO;
> +			*val = 500;
> +			return IIO_VAL_INT;
>  		case IIO_ANGL_VEL:
>  		{
>  			int i;
> @@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
>  			for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) {
>  				if (bmg160_scale_table[i].dps_range ==
>  							data->dps_range) {
> +					*val = 0;
>  					*val2 = bmg160_scale_table[i].scale;
>  					return IIO_VAL_INT_PLUS_MICRO;
>  				}


      reply	other threads:[~2019-02-20 12:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 14:25 [PATCH] iio/gyro/bmg160: Use millidegrees for temperature scale Mike Looijmans
2019-02-12 17:00 ` Tomasz Duszynski
2019-02-13  6:58   ` Mike Looijmans
2019-02-13  7:41 ` [PATCH v2] " Mike Looijmans
2019-02-20 12:10   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220121042.6459176b@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).