Commit 2bb3a2bf authored by Aaron Lu's avatar Aaron Lu Committed by Zhang Rui

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: default avatarAaron Lu <aaron.lu@intel.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 8dd41f78
...@@ -343,6 +343,7 @@ int acpi_device_update_power(struct acpi_device *device, int *state_p) ...@@ -343,6 +343,7 @@ int acpi_device_update_power(struct acpi_device *device, int *state_p)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(acpi_device_update_power);
int acpi_bus_update_power(acpi_handle handle, int *state_p) int acpi_bus_update_power(acpi_handle handle, int *state_p)
{ {
......
...@@ -92,7 +92,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long ...@@ -92,7 +92,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
if (!device) if (!device)
return -EINVAL; return -EINVAL;
result = acpi_bus_update_power(device->handle, &acpi_state); result = acpi_device_update_power(device, &acpi_state);
if (result) if (result)
return result; return result;
...@@ -110,7 +110,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) ...@@ -110,7 +110,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
if (!device || (state != 0 && state != 1)) if (!device || (state != 0 && state != 1))
return -EINVAL; return -EINVAL;
result = acpi_bus_set_power(device->handle, result = acpi_device_set_power(device,
state ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD); state ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD);
return result; return result;
...@@ -134,7 +134,7 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -134,7 +134,7 @@ static int acpi_fan_add(struct acpi_device *device)
strcpy(acpi_device_name(device), "Fan"); strcpy(acpi_device_name(device), "Fan");
strcpy(acpi_device_class(device), ACPI_FAN_CLASS); strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
result = acpi_bus_update_power(device->handle, NULL); result = acpi_device_update_power(device, NULL);
if (result) { if (result) {
printk(KERN_ERR PREFIX "Setting initial power state\n"); printk(KERN_ERR PREFIX "Setting initial power state\n");
goto end; goto end;
...@@ -186,7 +186,7 @@ static int acpi_fan_remove(struct acpi_device *device) ...@@ -186,7 +186,7 @@ static int acpi_fan_remove(struct acpi_device *device)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int acpi_fan_suspend(struct device *dev) static int acpi_fan_suspend(struct device *dev)
{ {
acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0); acpi_device_set_power(to_acpi_device(dev), ACPI_STATE_D0);
return AE_OK; return AE_OK;
} }
...@@ -195,7 +195,7 @@ static int acpi_fan_resume(struct device *dev) ...@@ -195,7 +195,7 @@ static int acpi_fan_resume(struct device *dev)
{ {
int result; int result;
result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL); result = acpi_device_update_power(to_acpi_device(dev), NULL);
if (result) if (result)
printk(KERN_ERR PREFIX "Error updating fan power state\n"); printk(KERN_ERR PREFIX "Error updating fan power state\n");
......
...@@ -104,8 +104,6 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state); ...@@ -104,8 +104,6 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
int acpi_power_on_resources(struct acpi_device *device, int state); int acpi_power_on_resources(struct acpi_device *device, int state);
int acpi_power_transition(struct acpi_device *device, int state); int acpi_power_transition(struct acpi_device *device, int state);
int acpi_device_update_power(struct acpi_device *device, int *state_p);
int acpi_wakeup_device_init(void); int acpi_wakeup_device_init(void);
#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
......
...@@ -435,6 +435,7 @@ int acpi_device_set_power(struct acpi_device *device, int state); ...@@ -435,6 +435,7 @@ int acpi_device_set_power(struct acpi_device *device, int state);
int acpi_bus_init_power(struct acpi_device *device); int acpi_bus_init_power(struct acpi_device *device);
int acpi_device_fix_up_power(struct acpi_device *device); int acpi_device_fix_up_power(struct acpi_device *device);
int acpi_bus_update_power(acpi_handle handle, int *state_p); int acpi_bus_update_power(acpi_handle handle, int *state_p);
int acpi_device_update_power(struct acpi_device *device, int *state_p);
bool acpi_bus_power_manageable(acpi_handle handle); bool acpi_bus_power_manageable(acpi_handle handle);
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment