aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-11-19 02:43:52 -0500
committerZhang Rui <rui.zhang@intel.com>2014-10-10 01:57:12 -0400
commit2bb3a2bf9939f3361e25045f4ef7b136b864c3b8 (patch)
treed4132de91d6589e9c641e52023f90fceee8b8cb6
parent8dd41f78adebb57909cccb0272e74c79e38b5238 (diff)
ACPI / fan: use acpi_device_xxx_power instead of acpi_bus equivelant
When we have the acpi_device pointer, there is no need to pass the device's handle to the acpi_bus_xxx_power functions to get/set/update the device's power state, instead, use the acpi_device_xxx_power functions directly. To make this happen for fan module, export acpi_device_update_power. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/acpi/device_pm.c1
-rw-r--r--drivers/acpi/fan.c10
-rw-r--r--drivers/acpi/internal.h2
-rw-r--r--include/acpi/acpi_bus.h1
4 files changed, 7 insertions, 7 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 67075f800e34..91775475e367 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -343,6 +343,7 @@ int acpi_device_update_power(struct acpi_device *device, int *state_p)
343 343
344 return 0; 344 return 0;
345} 345}
346EXPORT_SYMBOL_GPL(acpi_device_update_power);
346 347
347int acpi_bus_update_power(acpi_handle handle, int *state_p) 348int acpi_bus_update_power(acpi_handle handle, int *state_p)
348{ 349{
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index df861bbc73cc..fff9696bea25 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -92,7 +92,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
92 if (!device) 92 if (!device)
93 return -EINVAL; 93 return -EINVAL;
94 94
95 result = acpi_bus_update_power(device->handle, &acpi_state); 95 result = acpi_device_update_power(device, &acpi_state);
96 if (result) 96 if (result)
97 return result; 97 return result;
98 98
@@ -110,7 +110,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
110 if (!device || (state != 0 && state != 1)) 110 if (!device || (state != 0 && state != 1))
111 return -EINVAL; 111 return -EINVAL;
112 112
113 result = acpi_bus_set_power(device->handle, 113 result = acpi_device_set_power(device,
114 state ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD); 114 state ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD);
115 115
116 return result; 116 return result;
@@ -134,7 +134,7 @@ static int acpi_fan_add(struct acpi_device *device)
134 strcpy(acpi_device_name(device), "Fan"); 134 strcpy(acpi_device_name(device), "Fan");
135 strcpy(acpi_device_class(device), ACPI_FAN_CLASS); 135 strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
136 136
137 result = acpi_bus_update_power(device->handle, NULL); 137 result = acpi_device_update_power(device, NULL);
138 if (result) { 138 if (result) {
139 printk(KERN_ERR PREFIX "Setting initial power state\n"); 139 printk(KERN_ERR PREFIX "Setting initial power state\n");
140 goto end; 140 goto end;
@@ -186,7 +186,7 @@ static int acpi_fan_remove(struct acpi_device *device)
186#ifdef CONFIG_PM_SLEEP 186#ifdef CONFIG_PM_SLEEP
187static int acpi_fan_suspend(struct device *dev) 187static int acpi_fan_suspend(struct device *dev)
188{ 188{
189 acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0); 189 acpi_device_set_power(to_acpi_device(dev), ACPI_STATE_D0);
190 190
191 return AE_OK; 191 return AE_OK;
192} 192}
@@ -195,7 +195,7 @@ static int acpi_fan_resume(struct device *dev)
195{ 195{
196 int result; 196 int result;
197 197
198 result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL); 198 result = acpi_device_update_power(to_acpi_device(dev), NULL);
199 if (result) 199 if (result)
200 printk(KERN_ERR PREFIX "Error updating fan power state\n"); 200 printk(KERN_ERR PREFIX "Error updating fan power state\n");
201 201
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index f221d1eb594a..447f6d679b29 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -104,8 +104,6 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
104int acpi_power_on_resources(struct acpi_device *device, int state); 104int acpi_power_on_resources(struct acpi_device *device, int state);
105int acpi_power_transition(struct acpi_device *device, int state); 105int acpi_power_transition(struct acpi_device *device, int state);
106 106
107int acpi_device_update_power(struct acpi_device *device, int *state_p);
108
109int acpi_wakeup_device_init(void); 107int acpi_wakeup_device_init(void);
110 108
111#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC 109#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bcfd808b1098..6ca32812f3da 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -435,6 +435,7 @@ int acpi_device_set_power(struct acpi_device *device, int state);
435int acpi_bus_init_power(struct acpi_device *device); 435int acpi_bus_init_power(struct acpi_device *device);
436int acpi_device_fix_up_power(struct acpi_device *device); 436int acpi_device_fix_up_power(struct acpi_device *device);
437int acpi_bus_update_power(acpi_handle handle, int *state_p); 437int acpi_bus_update_power(acpi_handle handle, int *state_p);
438int acpi_device_update_power(struct acpi_device *device, int *state_p);
438bool acpi_bus_power_manageable(acpi_handle handle); 439bool acpi_bus_power_manageable(acpi_handle handle);
439 440
440#ifdef CONFIG_PM 441#ifdef CONFIG_PM