diff options
Diffstat (limited to 'drivers/acpi/device_pm.c')
| -rw-r--r-- | drivers/acpi/device_pm.c | 64 | 
1 files changed, 5 insertions, 59 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 59d3202f6b36..d42b2fb5a7e9 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -118,9 +118,10 @@ int acpi_device_get_power(struct acpi_device *device, int *state)  	/*  	 * If we were unsure about the device parent's power state up to this  	 * point, the fact that the device is in D0 implies that the parent has -	 * to be in D0 too. +	 * to be in D0 too, except if ignore_parent is set.  	 */ -	if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN +	if (!device->power.flags.ignore_parent && device->parent +	    && device->parent->power.state == ACPI_STATE_UNKNOWN  	    && result == ACPI_STATE_D0)  		device->parent->power.state = ACPI_STATE_D0; @@ -177,7 +178,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)  			 acpi_power_state_string(state));  		return -ENODEV;  	} -	if (device->parent && (state < device->parent->power.state)) { +	if (!device->power.flags.ignore_parent && +	    device->parent && (state < device->parent->power.state)) {  		dev_warn(&device->dev,  			 "Cannot transition to power state %s for parent in %s\n",  			 acpi_power_state_string(state), @@ -1025,60 +1027,4 @@ void acpi_dev_pm_detach(struct device *dev, bool power_off)  	}  }  EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); - -/** - * acpi_dev_pm_add_dependent - Add physical device depending for PM. - * @handle: Handle of ACPI device node. - * @depdev: Device depending on that node for PM. - */ -void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev) -{ -	struct acpi_device_physical_node *dep; -	struct acpi_device *adev; - -	if (!depdev || acpi_bus_get_device(handle, &adev)) -		return; - -	mutex_lock(&adev->physical_node_lock); - -	list_for_each_entry(dep, &adev->power_dependent, node) -		if (dep->dev == depdev) -			goto out; - -	dep = kzalloc(sizeof(*dep), GFP_KERNEL); -	if (dep) { -		dep->dev = depdev; -		list_add_tail(&dep->node, &adev->power_dependent); -	} - - out: -	mutex_unlock(&adev->physical_node_lock); -} -EXPORT_SYMBOL_GPL(acpi_dev_pm_add_dependent); - -/** - * acpi_dev_pm_remove_dependent - Remove physical device depending for PM. - * @handle: Handle of ACPI device node. - * @depdev: Device depending on that node for PM. - */ -void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev) -{ -	struct acpi_device_physical_node *dep; -	struct acpi_device *adev; - -	if (!depdev || acpi_bus_get_device(handle, &adev)) -		return; - -	mutex_lock(&adev->physical_node_lock); - -	list_for_each_entry(dep, &adev->power_dependent, node) -		if (dep->dev == depdev) { -			list_del(&dep->node); -			kfree(dep); -			break; -		} - -	mutex_unlock(&adev->physical_node_lock); -} -EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent);  #endif /* CONFIG_PM */  |