Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6889222imb; Sat, 9 Mar 2019 09:06:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzZ3OkgRIl8tpJBIawDgUGOkU2PVEWMtTLayBes1v2nEwM3dEnNQ3MQBb44SPEWQtBbSwy7 X-Received: by 2002:a63:5d48:: with SMTP id o8mr22445662pgm.297.1552151211649; Sat, 09 Mar 2019 09:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552151211; cv=none; d=google.com; s=arc-20160816; b=tnAQf9d57sWfqtsmDpbLl21fK98V59LryBrMLlZRvr4tQwFUsP9TyLONm/tvQ/fcqj ERl5tSHsEmI8F7ED+eNe3xWWYgaBU02q8sawZmctTtVSSr6qfpHNjGBL1yBl1/IqFxjy LQqeNvwa84swniNcLTEoCfsTVkW8HXRHKUpD3uP21bvsfxtE4PSIZYspamjcFFb48OHu 564zEgpvniVdvk3a3fFXtYDCUXSJq3ZCi/93KekV6xxfLMFn6sE4kJCMGmGxBDnbzp63 Rye/vqYJ183I1XUq9nRje8Kk8dTlj8OHbJpi3FOhdizsOwJgLMrtsJjdJ142nMTRy7FD Ipgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yT2gcFHo3EiIESqGMfKvRLHu2HIY7/Z7tLUDh7LvOhA=; b=muf5vXUGhmtxGwy47FuJsM4fAxtc7UOSlZsnSzZfUpiKq6hke6Sp9V6tciVutZULrS 6UgGfhz/zfGGxl7THiNqKU6Eo6+Ql/jl/EcxdeUuhu1DZV9bUANNGJVZ50yLZR7mwT2R DF1mAAs3xyYOljpwZ8V1zkdyj33qW8nCyoaCsqRO+Cl/9MKJrj3fVB3B5WtUGPLDItuN a1h0tx47/Ty7Zw+ViV2/0Lm1VSduox6VH1fsTFkyXVlG5D6BSTBHX4YIAZr21SEBDDbD JX5qmYrC1v51bkcU7Hsewn6T0FYe1p1ll/IEma9W92NNvxXJyLp6w0ESThIZX+y1NuYw AQtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Doct0kQz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d40si895799pla.114.2019.03.09.09.06.35; Sat, 09 Mar 2019 09:06:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Doct0kQz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726402AbfCIRGC (ORCPT + 99 others); Sat, 9 Mar 2019 12:06:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:59208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbfCIRGC (ORCPT ); Sat, 9 Mar 2019 12:06:02 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 171C520815; Sat, 9 Mar 2019 17:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552151161; bh=pEuSfNN9C65N9vAmSvligHXic92oXGyw1M8kGzz5m14=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Doct0kQz+TzLHSyd4zN4yMSfuZ09BnEPx5nE8kqxXYFM7meNByuYCJQgE2eRIqAnX K/SBXqW1TncsG4E/NUvX/vEH+nzSR2itL5h872wckHMBgQXnu3cZrB1F9X1NyC/RLn hpAgGK3IxB94RwQrjIhZXoxvF5WzEKF0jlLZs97Q= Date: Sat, 9 Mar 2019 17:05:55 +0000 From: Jonathan Cameron To: Mike Looijmans Cc: linux-iio@vger.kernel.org, himanshujha199640@gmail.com, linux-kernel@vger.kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, dpfrey@gmail.com, colin.king@canonical.com Subject: Re: [PATCH v3 1/2] iio/chemical/bme680: Report temperature in millidegrees Message-ID: <20190309170555.4982543d@archlinux> In-Reply-To: <1551857508-4254-1-git-send-email-mike.looijmans@topic.nl> References: <1550238475-25698-1-git-send-email-mike.looijmans@topic.nl> <1551857508-4254-1-git-send-email-mike.looijmans@topic.nl> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Mar 2019 08:31:47 +0100 Mike Looijmans wrote: > The standard unit for temperature is millidegrees Celcius. Adapt the > driver to report in millidegrees instead of degrees. > > Signed-off-by: Mike Looijmans I tweaked the patch title to make it obvious this was a fix (added the word fix ;) Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan > --- > v2: Remove unused 'addr7' variable > v3: Split patch into temperature and SPI > > drivers/iio/chemical/bme680_core.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c > index 70c1fe4..fefe32b 100644 > --- a/drivers/iio/chemical/bme680_core.c > +++ b/drivers/iio/chemical/bme680_core.c > @@ -583,8 +583,7 @@ static int bme680_gas_config(struct bme680_data *data) > return ret; > } > > -static int bme680_read_temp(struct bme680_data *data, > - int *val, int *val2) > +static int bme680_read_temp(struct bme680_data *data, int *val) > { > struct device *dev = regmap_get_device(data->regmap); > int ret; > @@ -617,10 +616,9 @@ static int bme680_read_temp(struct bme680_data *data, > * compensate_press/compensate_humid to get compensated > * pressure/humidity readings. > */ > - if (val && val2) { > - *val = comp_temp; > - *val2 = 100; > - return IIO_VAL_FRACTIONAL; > + if (val) { > + *val = comp_temp * 10; /* Centidegrees to millidegrees */ > + return IIO_VAL_INT; > } > > return ret; > @@ -635,7 +633,7 @@ static int bme680_read_press(struct bme680_data *data, > s32 adc_press; > > /* Read and compensate temperature to get a reading of t_fine */ > - ret = bme680_read_temp(data, NULL, NULL); > + ret = bme680_read_temp(data, NULL); > if (ret < 0) > return ret; > > @@ -668,7 +666,7 @@ static int bme680_read_humid(struct bme680_data *data, > u32 comp_humidity; > > /* Read and compensate temperature to get a reading of t_fine */ > - ret = bme680_read_temp(data, NULL, NULL); > + ret = bme680_read_temp(data, NULL); > if (ret < 0) > return ret; > > @@ -761,7 +759,7 @@ static int bme680_read_raw(struct iio_dev *indio_dev, > case IIO_CHAN_INFO_PROCESSED: > switch (chan->type) { > case IIO_TEMP: > - return bme680_read_temp(data, val, val2); > + return bme680_read_temp(data, val); > case IIO_PRESSURE: > return bme680_read_press(data, val, val2); > case IIO_HUMIDITYRELATIVE: