Message ID | 1576075099-3441-4-git-send-email-akinobu.mita@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | add header file for kelvin to/from Celsius conversion helpers | expand |
On Wed, Dec 11, 2019 at 4:39 PM Akinobu Mita <akinobu.mita@gmail.com> wrote: > > The asus-wmi driver doesn't implement the thermal device functionality > directly, so including <linux/thermal.h> just for DECI_KELVIN_TO_CELSIUS() > is a bit odd. > > This switches the asus-wmi driver to use deci_kelvin_to_millicelsius() in > <linux/units.h>. > @@ -33,7 +33,7 @@ > #include <linux/seq_file.h> > #include <linux/platform_data/x86/asus-wmi.h> > #include <linux/platform_device.h> > -#include <linux/thermal.h> > +#include <linux/units.h> > #include <linux/acpi.h> > #include <linux/dmi.h> Similar comment about ordering. Can we move it to the end after dmi.h? > - return sprintf(buf, "%d\n", value); > + return sprintf(buf, "%ld\n", %d -> %ld must be explained in the commit message (e.g. "due to function returned type). > + deci_kelvin_to_millicelsius(value & 0xFFFF)); I prefer to have this in one line.
2019年12月12日(木) 0:32 Andy Shevchenko <andy.shevchenko@gmail.com>: > > On Wed, Dec 11, 2019 at 4:39 PM Akinobu Mita <akinobu.mita@gmail.com> wrote: > > > > The asus-wmi driver doesn't implement the thermal device functionality > > directly, so including <linux/thermal.h> just for DECI_KELVIN_TO_CELSIUS() > > is a bit odd. > > > > This switches the asus-wmi driver to use deci_kelvin_to_millicelsius() in > > <linux/units.h>. > > > @@ -33,7 +33,7 @@ > > #include <linux/seq_file.h> > > #include <linux/platform_data/x86/asus-wmi.h> > > #include <linux/platform_device.h> > > -#include <linux/thermal.h> > > +#include <linux/units.h> > > #include <linux/acpi.h> > > #include <linux/dmi.h> > > Similar comment about ordering. Can we move it to the end after dmi.h? OK. > > - return sprintf(buf, "%d\n", value); > > > + return sprintf(buf, "%ld\n", > > %d -> %ld must be explained in the commit message (e.g. "due to > function returned type). OK. > > + deci_kelvin_to_millicelsius(value & 0xFFFF)); > > I prefer to have this in one line. It causes line over 80 characters. We had the same conversation in v1 :)
On Fri, Dec 13, 2019 at 6:06 AM Akinobu Mita <akinobu.mita@gmail.com> wrote: > 2019年12月12日(木) 0:32 Andy Shevchenko <andy.shevchenko@gmail.com>: > > On Wed, Dec 11, 2019 at 4:39 PM Akinobu Mita <akinobu.mita@gmail.com> wrote: > > > + return sprintf(buf, "%ld\n", > > > > %d -> %ld must be explained in the commit message (e.g. "due to > > function returned type). > > OK. > > > > + deci_kelvin_to_millicelsius(value & 0xFFFF)); > > > > I prefer to have this in one line. > > It causes line over 80 characters. > We had the same conversation in v1 :) And I really don't care about this.
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 821b08e..ed74c0d 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -33,7 +33,7 @@ #include <linux/seq_file.h> #include <linux/platform_data/x86/asus-wmi.h> #include <linux/platform_device.h> -#include <linux/thermal.h> +#include <linux/units.h> #include <linux/acpi.h> #include <linux/dmi.h> @@ -1512,9 +1512,8 @@ static ssize_t asus_hwmon_temp1(struct device *dev, if (err < 0) return err; - value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000; - - return sprintf(buf, "%d\n", value); + return sprintf(buf, "%ld\n", + deci_kelvin_to_millicelsius(value & 0xFFFF)); } /* Fan1 */