ACPI / PM: Convert acpi_dev_pm_detach() into a static function
Ulf Hansson [Fri, 19 Sep 2014 18:27:44 +0000 (20:27 +0200)]
The ->detach() callback for the PM domain has now been fully adopted,
thus there no users left of the acpi_dev_pm_detach() API. This allow us
to convert it into a static function.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Conflicts:

drivers/acpi/device_pm.c

Change-Id: I6e74d25139f76bc2504b3b561edb645faf2805e9
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-on: http://git-master/r/660542
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/acpi/device_pm.c
include/linux/acpi.h

index 3e865d2..3332ddb 100644 (file)
@@ -934,6 +934,40 @@ static struct dev_pm_domain acpi_general_pm_domain = {
 };
 
 /**
+ * acpi_dev_pm_detach - Remove ACPI power management from the device.
+ * @dev: Device to take care of.
+ * @power_off: Whether or not to try to remove power from the device.
+ *
+ * Remove the device from the general ACPI PM domain and remove its wakeup
+ * notifier.  If @power_off is set, additionally remove power from the device if
+ * possible.
+ *
+ * Callers must ensure proper synchronization of this function with power
+ * management callbacks.
+ */
+static void acpi_dev_pm_detach(struct device *dev, bool power_off)
+{
+       struct acpi_device *adev = ACPI_COMPANION(dev);
+
+       if (adev && dev->pm_domain == &acpi_general_pm_domain) {
+               dev->pm_domain = NULL;
+               acpi_remove_pm_notifier(adev);
+               if (power_off) {
+                       /*
+                        * If the device's PM QoS resume latency limit or flags
+                        * have been exposed to user space, they have to be
+                        * hidden at this point, so that they don't affect the
+                        * choice of the low-power state to put the device into.
+                        */
+                       dev_pm_qos_hide_latency_limit(dev);
+                       dev_pm_qos_hide_flags(dev);
+                       acpi_device_wakeup(adev, ACPI_STATE_S0, false);
+                       acpi_dev_pm_low_power(dev, adev, ACPI_STATE_S0);
+               }
+       }
+}
+
+/**
  * acpi_dev_pm_attach - Prepare device for ACPI power management.
  * @dev: Device to prepare.
  * @power_on: Whether or not to power on the device.
index 17b5b59..07df4e1 100644 (file)
@@ -523,7 +523,6 @@ static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM)
 struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
 int acpi_dev_pm_attach(struct device *dev, bool power_on);
-void acpi_dev_pm_detach(struct device *dev, bool power_off);
 #else
 static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
 {
@@ -533,7 +532,6 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
 {
        return -ENODEV;
 }
-static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
 #endif
 
 #ifdef CONFIG_ACPI