device_pm.c (712e960f0ee9337f3473ba3de2bcfc7e87b7c5a4) device_pm.c (71b65445f0ed04c2afe3660f829779fddb2890c1)
1/*
2 * drivers/acpi/device_pm.c - ACPI device power management routines.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 217 unchanged lines hidden (view full) ---

226 result = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0);
227 }
228
229 end:
230 if (result) {
231 dev_warn(&device->dev, "Failed to change power state to %s\n",
232 acpi_power_state_string(state));
233 } else {
1/*
2 * drivers/acpi/device_pm.c - ACPI device power management routines.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 217 unchanged lines hidden (view full) ---

226 result = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0);
227 }
228
229 end:
230 if (result) {
231 dev_warn(&device->dev, "Failed to change power state to %s\n",
232 acpi_power_state_string(state));
233 } else {
234 device->power.state = state;
234 device->power.state = target_state;
235 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
236 "Device [%s] transitioned to %s\n",
237 device->pnp.bus_id,
238 acpi_power_state_string(state)));
239 }
240
241 return result;
242}

--- 875 unchanged lines hidden (view full) ---

1118 struct acpi_device *adev = ACPI_COMPANION(dev);
1119
1120 if (!adev)
1121 return -ENODEV;
1122
1123 if (dev->pm_domain)
1124 return -EEXIST;
1125
235 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
236 "Device [%s] transitioned to %s\n",
237 device->pnp.bus_id,
238 acpi_power_state_string(state)));
239 }
240
241 return result;
242}

--- 875 unchanged lines hidden (view full) ---

1118 struct acpi_device *adev = ACPI_COMPANION(dev);
1119
1120 if (!adev)
1121 return -ENODEV;
1122
1123 if (dev->pm_domain)
1124 return -EEXIST;
1125
1126 /*
1127 * Only attach the power domain to the first device if the
1128 * companion is shared by multiple. This is to prevent doing power
1129 * management twice.
1130 */
1131 if (!acpi_device_is_first_physical_node(adev, dev))
1132 return -EBUSY;
1133
1134 acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func);
1135 dev->pm_domain = &acpi_general_pm_domain;
1136 if (power_on) {
1137 acpi_dev_pm_full_power(adev);
1138 acpi_device_wakeup(adev, ACPI_STATE_S0, false);
1139 }
1140
1141 dev->pm_domain->detach = acpi_dev_pm_detach;
1142 return 0;
1143}
1144EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
1145#endif /* CONFIG_PM */
1126 acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func);
1127 dev->pm_domain = &acpi_general_pm_domain;
1128 if (power_on) {
1129 acpi_dev_pm_full_power(adev);
1130 acpi_device_wakeup(adev, ACPI_STATE_S0, false);
1131 }
1132
1133 dev->pm_domain->detach = acpi_dev_pm_detach;
1134 return 0;
1135}
1136EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
1137#endif /* CONFIG_PM */