[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080617155954.GB4891@ucw.cz>
Date: Tue, 17 Jun 2008 17:59:54 +0200
From: Pavel Machek <pavel@...e.cz>
To: Matthew Garrett <mjg59@...f.ucam.org>
Cc: rui.zhang@...el.com, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
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@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists