Skip to content
Snippets Groups Projects
device_pm.c 29.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • 	return 0;
    }
    EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
    
    /**
     * 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.
     */
    
    void acpi_dev_pm_detach(struct device *dev, bool power_off)
    
    {
    	struct acpi_device *adev = acpi_dev_pm_get_node(dev);
    
    	if (adev && dev->pm_domain == &acpi_general_pm_domain) {
    		dev->pm_domain = NULL;
    		acpi_remove_pm_notifier(adev, acpi_wakeup_device);
    
    		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_run_wake(adev, false);
    			acpi_dev_pm_low_power(dev, adev, ACPI_STATE_S0);
    		}
    
    	}
    }
    EXPORT_SYMBOL_GPL(acpi_dev_pm_detach);