aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/fan.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2008-11-27 12:48:13 -0500
committerLen Brown <len.brown@intel.com>2009-02-20 10:52:37 -0500
commit6503e5df08008b9a47022b5e9ebba658c8fa69af (patch)
tree8ef36d1b85d2a03ac9e61f5074d717b67f9259ba /drivers/acpi/fan.c
parentd2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff)
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.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index eaaee1660bdf..ae41cf3cf4e5 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = {
68}; 68};
69 69
70/* thermal cooling device callbacks */ 70/* thermal cooling device callbacks */
71static int fan_get_max_state(struct thermal_cooling_device *cdev, char *buf) 71static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long
72 *state)
72{ 73{
73 /* ACPI fan device only support two states: ON/OFF */ 74 /* ACPI fan device only support two states: ON/OFF */
74 return sprintf(buf, "1\n"); 75 *state = 1;
76 return 0;
75} 77}
76 78
77static int fan_get_cur_state(struct thermal_cooling_device *cdev, char *buf) 79static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
80 *state)
78{ 81{
79 struct acpi_device *device = cdev->devdata; 82 struct acpi_device *device = cdev->devdata;
80 int state;
81 int result; 83 int result;
84 int acpi_state;
82 85
83 if (!device) 86 if (!device)
84 return -EINVAL; 87 return -EINVAL;
85 88
86 result = acpi_bus_get_power(device->handle, &state); 89 result = acpi_bus_get_power(device->handle, &acpi_state);
87 if (result) 90 if (result)
88 return result; 91 return result;
89 92
90 return sprintf(buf, "%s\n", state == ACPI_STATE_D3 ? "0" : 93 *state = (acpi_state == ACPI_STATE_D3 ? 0 :
91 (state == ACPI_STATE_D0 ? "1" : "unknown")); 94 (acpi_state == ACPI_STATE_D0 ? 1 : -1));
95 return 0;
92} 96}
93 97
94static int 98static int
95fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned int state) 99fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
96{ 100{
97 struct acpi_device *device = cdev->devdata; 101 struct acpi_device *device = cdev->devdata;
98 int result; 102 int result;