mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-05-02 18:15:03 -04:00
driver core: Add device_link_test() for testing device link flags
To avoid coding mistakes like the one fixed by commit 3860cbe239 ("PM:
sleep: Fix bit masking operation"), introduce device_link_test() for
testing device link flags and use it where applicable.
No intentional functional impact.
Signed-off-by: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/2793309.mvXUDI8C0e@rjwysocki.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fb506e31b3
commit
b29929b819
@@ -290,7 +290,7 @@ static int rpm_get_suppliers(struct device *dev)
|
||||
device_links_read_lock_held()) {
|
||||
int retval;
|
||||
|
||||
if (!(link->flags & DL_FLAG_PM_RUNTIME))
|
||||
if (!device_link_test(link, DL_FLAG_PM_RUNTIME))
|
||||
continue;
|
||||
|
||||
retval = pm_runtime_get_sync(link->supplier);
|
||||
@@ -1879,7 +1879,7 @@ void pm_runtime_get_suppliers(struct device *dev)
|
||||
|
||||
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
|
||||
device_links_read_lock_held())
|
||||
if (link->flags & DL_FLAG_PM_RUNTIME) {
|
||||
if (device_link_test(link, DL_FLAG_PM_RUNTIME)) {
|
||||
link->supplier_preactivated = true;
|
||||
pm_runtime_get_sync(link->supplier);
|
||||
}
|
||||
@@ -1933,7 +1933,7 @@ static void pm_runtime_drop_link_count(struct device *dev)
|
||||
*/
|
||||
void pm_runtime_drop_link(struct device_link *link)
|
||||
{
|
||||
if (!(link->flags & DL_FLAG_PM_RUNTIME))
|
||||
if (!device_link_test(link, DL_FLAG_PM_RUNTIME))
|
||||
return;
|
||||
|
||||
pm_runtime_drop_link_count(link->consumer);
|
||||
|
||||
Reference in New Issue
Block a user