ACPI: PM: Unexport acpi_device_get_power()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 3 Jul 2019 23:02:49 +0000 (01:02 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Jul 2019 08:49:57 +0000 (10:49 +0200)
Using acpi_device_get_power() outside of ACPI device initialization
and ACPI sysfs is problematic due to the way in which power resources
are handled by it, so unexport it and add a paragraph explaining the
pitfalls to its kerneldoc comment.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/device_pm.c
drivers/acpi/internal.h
include/acpi/acpi_bus.h

index e54956ae93d3d4e6e63c00a727fff77a80fe2353..81eb15a0cc4204cd9c1dc8bd9b25ed4f4d62e65c 100644 (file)
@@ -53,6 +53,11 @@ const char *acpi_power_state_string(int state)
  * This function does not update the device's power.state field, but it may
  * update its parent's power.state field (when the parent's power state is
  * unknown and the device's power state turns out to be D0).
+ *
+ * Also, it does not update power resource reference counters to ensure that
+ * the power state returned by it will be persistent and it may return a power
+ * state shallower than previously set by acpi_device_set_power() for @device
+ * (if that power state depends on any power resources).
  */
 int acpi_device_get_power(struct acpi_device *device, int *state)
 {
@@ -118,7 +123,6 @@ int acpi_device_get_power(struct acpi_device *device, int *state)
 
        return 0;
 }
-EXPORT_SYMBOL(acpi_device_get_power);
 
 static int acpi_dev_pm_explicit_set(struct acpi_device *adev, int state)
 {
index f6157d4d637a2c60bb649dbcef6bdf26d12a09f5..f4c2fe6be4f2d8a9bfe48fb880755771bbe823cd 100644 (file)
@@ -139,8 +139,15 @@ 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_transition(struct acpi_device *device, int state);
 
+/* --------------------------------------------------------------------------
+                              Device Power Management
+   -------------------------------------------------------------------------- */
+int acpi_device_get_power(struct acpi_device *device, int *state);
 int acpi_wakeup_device_init(void);
 
+/* --------------------------------------------------------------------------
+                                  Processor
+   -------------------------------------------------------------------------- */
 #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
 void acpi_early_processor_set_pdc(void);
 #else
index 4752ff0a9d9b55f8737d4111fc43470aaafaab2b..e85dc78f6875f0db68dd7f2c71e470dfa5104618 100644 (file)
@@ -506,7 +506,6 @@ int acpi_bus_get_status(struct acpi_device *device);
 
 int acpi_bus_set_power(acpi_handle handle, int state);
 const char *acpi_power_state_string(int state);
-int acpi_device_get_power(struct acpi_device *device, int *state);
 int acpi_device_set_power(struct acpi_device *device, int state);
 int acpi_bus_init_power(struct acpi_device *device);
 int acpi_device_fix_up_power(struct acpi_device *device);