Messages in this thread Patch in this message | | | From | Akinobu Mita <> | Subject | [PATCH v2 4/8] platform/x86: intel_menlow: switch to use <linux/temperature.h> helpers | Date | Thu, 28 Nov 2019 23:54:35 +0900 |
| |
This switches the intel_menlow driver to use deci_kelvin_to_celsius() and celsius_to_deci_kelvin() in <linux/temperature.h> instead of helpers in <linux/thermal.h>.
This is preparation for centralizing the kelvin to/from Celsius conversion helpers in <linux/temperature.h>.
This also removes a trailing space, while we're at it.
Cc: Sujith Thomas <sujith.thomas@intel.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Amit Kucheria <amit.kucheria@verdurent.com> Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Keith Busch <kbusch@kernel.org> Cc: Jens Axboe <axboe@fb.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> --- * v2 - include <linux/temperature.h> explicitly from thermal drivers - fix s/temprature/temperature/ typo in commit log - don't mix up another fix (format string for cellsius value)
drivers/platform/x86/intel_menlow.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index b102f6d..12c1094 100644 --- a/drivers/platform/x86/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c @@ -20,6 +20,7 @@ #include <linux/pci.h> #include <linux/pm.h> #include <linux/slab.h> +#include <linux/temperature.h> #include <linux/thermal.h> #include <linux/types.h> @@ -302,8 +303,10 @@ static ssize_t aux_show(struct device *dev, struct device_attribute *dev_attr, int result; result = sensor_get_auxtrip(attr->handle, idx, &value); + if (result) + return result; - return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value)); + return sprintf(buf, "%lu", deci_kelvin_to_celsius(value)); } static ssize_t aux0_show(struct device *dev, @@ -332,8 +335,8 @@ static ssize_t aux_store(struct device *dev, struct device_attribute *dev_attr, if (value < 0) return -EINVAL; - result = sensor_set_auxtrip(attr->handle, idx, - CELSIUS_TO_DECI_KELVIN(value)); + result = sensor_set_auxtrip(attr->handle, idx, + celsius_to_deci_kelvin(value)); return result ? result : count; } -- 2.7.4
| |