aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/fan.c
diff options
context:
space:
mode:
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;