diff options
author | Matthew Garrett <mjg59@srcf.ucam.org> | 2008-11-27 17:48:13 +0000 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-02-20 10:52:37 -0500 |
commit | 6503e5df08008b9a47022b5e9ebba658c8fa69af (patch) | |
tree | 8ef36d1b85d2a03ac9e61f5074d717b67f9259ba /drivers/acpi/fan.c | |
parent | d2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff) | |
download | op-kernel-dev-6503e5df08008b9a47022b5e9ebba658c8fa69af.zip op-kernel-dev-6503e5df08008b9a47022b5e9ebba658c8fa69af.tar.gz |
thermal: use integers rather than strings for thermal values
The thermal API currently uses strings to pass values to userspace. This
makes it difficult to use from within the kernel. Change the interface
to use integers and fix up the consumers.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/fan.c')
-rw-r--r-- | drivers/acpi/fan.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index eaaee16..ae41cf3 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = { }; /* thermal cooling device callbacks */ -static int fan_get_max_state(struct thermal_cooling_device *cdev, char *buf) +static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long + *state) { /* ACPI fan device only support two states: ON/OFF */ - return sprintf(buf, "1\n"); + *state = 1; + return 0; } -static int fan_get_cur_state(struct thermal_cooling_device *cdev, char *buf) +static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long + *state) { struct acpi_device *device = cdev->devdata; - int state; int result; + int acpi_state; if (!device) return -EINVAL; - result = acpi_bus_get_power(device->handle, &state); + result = acpi_bus_get_power(device->handle, &acpi_state); if (result) return result; - return sprintf(buf, "%s\n", state == ACPI_STATE_D3 ? "0" : - (state == ACPI_STATE_D0 ? "1" : "unknown")); + *state = (acpi_state == ACPI_STATE_D3 ? 0 : + (acpi_state == ACPI_STATE_D0 ? 1 : -1)); + return 0; } static int -fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned int state) +fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { struct acpi_device *device = cdev->devdata; int result; |