linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-nvme@lists.infradead.org, linux-hwmon@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>
Subject: [PATCH v4 12/12] iio: adc: qcom-vadc-common: use <linux/units.h> helpers
Date: Sun, 15 Dec 2019 14:16:15 +0900	[thread overview]
Message-ID: <1576386975-7941-13-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1576386975-7941-1-git-send-email-akinobu.mita@gmail.com>

This switches the qcom-vadc-common to use milli_kelvin_to_millicelsius()
in <linux/units.h>.

Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
* v4
- add Reviewed-by tag

 drivers/iio/adc/qcom-vadc-common.c | 6 +++---
 drivers/iio/adc/qcom-vadc-common.h | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/qcom-vadc-common.c b/drivers/iio/adc/qcom-vadc-common.c
index dcd7fb5..2bb78d1 100644
--- a/drivers/iio/adc/qcom-vadc-common.c
+++ b/drivers/iio/adc/qcom-vadc-common.c
@@ -6,6 +6,7 @@
 #include <linux/log2.h>
 #include <linux/err.h>
 #include <linux/module.h>
+#include <linux/units.h>
 
 #include "qcom-vadc-common.h"
 
@@ -236,8 +237,7 @@ static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph,
 		voltage = 0;
 	}
 
-	voltage -= KELVINMIL_CELSIUSMIL;
-	*result_mdec = voltage;
+	*result_mdec = milli_kelvin_to_millicelsius(voltage);
 
 	return 0;
 }
@@ -325,7 +325,7 @@ static int qcom_vadc_scale_hw_calib_die_temp(
 {
 	*result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code,
 				prescale, data, 2);
-	*result_mdec -= KELVINMIL_CELSIUSMIL;
+	*result_mdec = milli_kelvin_to_millicelsius(*result_mdec);
 
 	return 0;
 }
diff --git a/drivers/iio/adc/qcom-vadc-common.h b/drivers/iio/adc/qcom-vadc-common.h
index bbb1fa0..e074902a 100644
--- a/drivers/iio/adc/qcom-vadc-common.h
+++ b/drivers/iio/adc/qcom-vadc-common.h
@@ -38,7 +38,6 @@
 #define VADC_AVG_SAMPLES_MAX			512
 #define ADC5_AVG_SAMPLES_MAX			16
 
-#define KELVINMIL_CELSIUSMIL			273150
 #define PMIC5_CHG_TEMP_SCALE_FACTOR		377500
 #define PMIC5_SMB_TEMP_CONSTANT			419400
 #define PMIC5_SMB_TEMP_SCALE_FACTOR		356
-- 
2.7.4


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2019-12-15  5:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15  5:16 [PATCH v4 00/12] add header file for kelvin to/from Celsius conversion helpers Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 01/12] add helpers for kelvin to/from Celsius conversion Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 02/12] ACPI: thermal: switch to use <linux/units.h> helpers Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 03/12] platform/x86: asus-wmi: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 04/12] platform/x86: intel_menlow: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 05/12] thermal: int340x: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 06/12] thermal: intel_pch: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 07/12] nvme: hwmon: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 08/12] thermal: remove kelvin to/from Celsius conversion helpers from <linux/thermal.h> Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 09/12] iwlegacy: use <linux/units.h> helpers Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 10/12] iwlwifi: " Akinobu Mita
2019-12-15  5:16 ` [PATCH v4 11/12] thermal: armada: remove unused TO_MCELSIUS macro Akinobu Mita
2019-12-15  5:16 ` Akinobu Mita [this message]
2019-12-15 12:29   ` [PATCH v4 12/12] iio: adc: qcom-vadc-common: use <linux/units.h> helpers Jonathan Cameron
2019-12-23 13:07 ` [PATCH v4 00/12] add header file for kelvin to/from Celsius conversion helpers Akinobu Mita

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=1576386975-7941-13-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --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).