summaryrefslogtreecommitdiff
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2025-06-16 20:16:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-17 10:57:56 +0200
commitb29929b819f35503024c6a7e6ad442f6e36c68a0 (patch)
tree60ed78485969fef2a470c87f3d901cbe3d618ca9 /include/linux/device.h
parentfb506e31b3d52f7faaec00352c2732ce31c1f930 (diff)
driver core: Add device_link_test() for testing device link flags
To avoid coding mistakes like the one fixed by commit 3860cbe23963 ("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>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 4940db137fff..afdd4f7c0d94 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1162,6 +1162,11 @@ void device_links_supplier_sync_state_pause(void);
void device_links_supplier_sync_state_resume(void);
void device_link_wait_removal(void);
+static inline bool device_link_test(const struct device_link *link, u32 flags)
+{
+ return !!(link->flags & flags);
+}
+
/* Create alias, so I can be autoloaded. */
#define MODULE_ALIAS_CHARDEV(major,minor) \
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))