提交 c23bd387 编写于 作者: U Ulf Hansson 提交者: Rafael J. Wysocki

PM / core: Re-structure code for clearing the direct_complete flag

To make the code more consistent, let's clear the parent's direct_complete
flag along with clearing it for suppliers, instead of as currently, when
propagating the wakeup_path flag to parents.

While changing this, let's take the opportunity to rename the affected
internal functions, to make them self-explanatory. Like this:

dpm_clear_suppliers_direct_complete -> dpm_clear_superiors_direct_complete
dpm_propagate_to_parent -> dpm_propagate_wakeup_to_parent
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 02e45646
...@@ -1660,7 +1660,7 @@ static int legacy_suspend(struct device *dev, pm_message_t state, ...@@ -1660,7 +1660,7 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
return error; return error;
} }
static void dpm_propagate_to_parent(struct device *dev) static void dpm_propagate_wakeup_to_parent(struct device *dev)
{ {
struct device *parent = dev->parent; struct device *parent = dev->parent;
...@@ -1669,18 +1669,23 @@ static void dpm_propagate_to_parent(struct device *dev) ...@@ -1669,18 +1669,23 @@ static void dpm_propagate_to_parent(struct device *dev)
spin_lock_irq(&parent->power.lock); spin_lock_irq(&parent->power.lock);
parent->power.direct_complete = false;
if (dev->power.wakeup_path && !parent->power.ignore_children) if (dev->power.wakeup_path && !parent->power.ignore_children)
parent->power.wakeup_path = true; parent->power.wakeup_path = true;
spin_unlock_irq(&parent->power.lock); spin_unlock_irq(&parent->power.lock);
} }
static void dpm_clear_suppliers_direct_complete(struct device *dev) static void dpm_clear_superiors_direct_complete(struct device *dev)
{ {
struct device_link *link; struct device_link *link;
int idx; int idx;
if (dev->parent) {
spin_lock_irq(&dev->parent->power.lock);
dev->parent->power.direct_complete = false;
spin_unlock_irq(&dev->parent->power.lock);
}
idx = device_links_read_lock(); idx = device_links_read_lock();
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) { list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) {
...@@ -1791,8 +1796,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) ...@@ -1791,8 +1796,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
dev->power.wakeup_path = true; dev->power.wakeup_path = true;
dpm_propagate_to_parent(dev); dpm_propagate_wakeup_to_parent(dev);
dpm_clear_suppliers_direct_complete(dev); dpm_clear_superiors_direct_complete(dev);
} }
device_unlock(dev); device_unlock(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册