Messages in this thread | | | Date | Tue, 17 Jun 2008 17:59:54 +0200 | From | Pavel Machek <> | Subject | Re: [PATCH] Clean up thermal API |
| |
On Wed 2008-06-11 11:06:47, Matthew Garrett wrote: > The thermal layer passes temperatures around as strings. This is fine > for sysfs, but makes it hard to use them for other purposes in-kernel. > Change them to longs and do the string conversion in the sysfs-specific > code. > > Signed-off-by: Matthew Garrett <mjg@redhat.com> > > --- > > diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c > index 504385b..28b3782 100644 > --- a/drivers/acpi/thermal.c > +++ b/drivers/acpi/thermal.c > @@ -886,7 +886,8 @@ static void acpi_thermal_check(void *data) > /* sys I/F for generic thermal sysfs support */ > #define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) > > -static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) > +static int thermal_get_temp(struct thermal_zone_device *thermal, > + unsigned long *temp)
Hmm, ulong is really wrong:
1) temperature in celsius can easily go below zero.
2) it can hardly go above 2000000C, so int should be enough.
Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
| |