mirror of https://github.com/torvalds/linux.git
PM: core: Annotate loops walking device links as _srcu
Since SRCU is used for the protection of device link lists, the loops over device link lists in multiple places in drivers/base/power/main.c and in pm_runtime_get_suppliers() should be annotated as _srcu rather than as _rcu which is the case currently. Change the annotations accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2393512.ElGaqSPkdT@rafael.j.wysocki
This commit is contained in:
parent
b320789d68
commit
fdd9ae23bb
|
|
@ -40,8 +40,8 @@
|
||||||
|
|
||||||
typedef int (*pm_callback_t)(struct device *);
|
typedef int (*pm_callback_t)(struct device *);
|
||||||
|
|
||||||
#define list_for_each_entry_rcu_locked(pos, head, member) \
|
#define list_for_each_entry_srcu_locked(pos, head, member) \
|
||||||
list_for_each_entry_rcu(pos, head, member, \
|
list_for_each_entry_srcu(pos, head, member, \
|
||||||
device_links_read_lock_held())
|
device_links_read_lock_held())
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -281,7 +281,7 @@ static void dpm_wait_for_suppliers(struct device *dev, bool async)
|
||||||
* callbacks freeing the link objects for the links in the list we're
|
* callbacks freeing the link objects for the links in the list we're
|
||||||
* walking.
|
* walking.
|
||||||
*/
|
*/
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
|
list_for_each_entry_srcu_locked(link, &dev->links.suppliers, c_node)
|
||||||
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
||||||
dpm_wait(link->supplier, async);
|
dpm_wait(link->supplier, async);
|
||||||
|
|
||||||
|
|
@ -338,7 +338,7 @@ static void dpm_wait_for_consumers(struct device *dev, bool async)
|
||||||
* continue instead of trying to continue in parallel with its
|
* continue instead of trying to continue in parallel with its
|
||||||
* unregistration).
|
* unregistration).
|
||||||
*/
|
*/
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.consumers, s_node)
|
list_for_each_entry_srcu_locked(link, &dev->links.consumers, s_node)
|
||||||
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
||||||
dpm_wait(link->consumer, async);
|
dpm_wait(link->consumer, async);
|
||||||
|
|
||||||
|
|
@ -675,7 +675,7 @@ static void dpm_async_resume_subordinate(struct device *dev, async_func_t func)
|
||||||
idx = device_links_read_lock();
|
idx = device_links_read_lock();
|
||||||
|
|
||||||
/* Start processing the device's "async" consumers. */
|
/* Start processing the device's "async" consumers. */
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.consumers, s_node)
|
list_for_each_entry_srcu_locked(link, &dev->links.consumers, s_node)
|
||||||
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
||||||
dpm_async_with_cleanup(link->consumer, func);
|
dpm_async_with_cleanup(link->consumer, func);
|
||||||
|
|
||||||
|
|
@ -1330,7 +1330,7 @@ static void dpm_async_suspend_superior(struct device *dev, async_func_t func)
|
||||||
idx = device_links_read_lock();
|
idx = device_links_read_lock();
|
||||||
|
|
||||||
/* Start processing the device's "async" suppliers. */
|
/* Start processing the device's "async" suppliers. */
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
|
list_for_each_entry_srcu_locked(link, &dev->links.suppliers, c_node)
|
||||||
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
if (READ_ONCE(link->status) != DL_STATE_DORMANT)
|
||||||
dpm_async_with_cleanup(link->supplier, func);
|
dpm_async_with_cleanup(link->supplier, func);
|
||||||
|
|
||||||
|
|
@ -1384,7 +1384,7 @@ static void dpm_superior_set_must_resume(struct device *dev)
|
||||||
|
|
||||||
idx = device_links_read_lock();
|
idx = device_links_read_lock();
|
||||||
|
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
|
list_for_each_entry_srcu_locked(link, &dev->links.suppliers, c_node)
|
||||||
link->supplier->power.must_resume = true;
|
link->supplier->power.must_resume = true;
|
||||||
|
|
||||||
device_links_read_unlock(idx);
|
device_links_read_unlock(idx);
|
||||||
|
|
@ -1813,7 +1813,7 @@ static void dpm_clear_superiors_direct_complete(struct device *dev)
|
||||||
|
|
||||||
idx = device_links_read_lock();
|
idx = device_links_read_lock();
|
||||||
|
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
|
list_for_each_entry_srcu_locked(link, &dev->links.suppliers, c_node) {
|
||||||
spin_lock_irq(&link->supplier->power.lock);
|
spin_lock_irq(&link->supplier->power.lock);
|
||||||
link->supplier->power.direct_complete = false;
|
link->supplier->power.direct_complete = false;
|
||||||
spin_unlock_irq(&link->supplier->power.lock);
|
spin_unlock_irq(&link->supplier->power.lock);
|
||||||
|
|
@ -2065,7 +2065,7 @@ static bool device_prepare_smart_suspend(struct device *dev)
|
||||||
|
|
||||||
idx = device_links_read_lock();
|
idx = device_links_read_lock();
|
||||||
|
|
||||||
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
|
list_for_each_entry_srcu_locked(link, &dev->links.suppliers, c_node) {
|
||||||
if (!device_link_test(link, DL_FLAG_PM_RUNTIME))
|
if (!device_link_test(link, DL_FLAG_PM_RUNTIME))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1903,8 +1903,8 @@ void pm_runtime_get_suppliers(struct device *dev)
|
||||||
|
|
||||||
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_srcu(link, &dev->links.suppliers, c_node,
|
||||||
device_links_read_lock_held())
|
device_links_read_lock_held())
|
||||||
if (device_link_test(link, DL_FLAG_PM_RUNTIME)) {
|
if (device_link_test(link, DL_FLAG_PM_RUNTIME)) {
|
||||||
link->supplier_preactivated = true;
|
link->supplier_preactivated = true;
|
||||||
pm_runtime_get_sync(link->supplier);
|
pm_runtime_get_sync(link->supplier);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue