[PATCH v2 1/3] driver core: provide a test-and-clear device flag accessor

From: Bartosz Golaszewski

Date: Fri Oct 23 2026 - 06:14:37 EST


Extend the device flag accessors with a test-and-clear operation.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
include/linux/device.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index 429e39f647cf907d2a9868878d1f89526345c3cd..f31fd62dca9a89c1c9ad565b1cd673b71b740faf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -822,6 +822,10 @@ static inline void dev_assign_##accessor_name(struct device *dev, bool value) \
static inline bool dev_test_and_set_##accessor_name(struct device *dev) \
{ \
return test_and_set_bit(flag_name, dev->flags); \
+} \
+static inline bool dev_test_and_clear_##accessor_name(struct device *dev) \
+{ \
+ return test_and_clear_bit(flag_name, dev->flags); \
}

__create_dev_flag_accessors(ready_to_probe, DEV_FLAG_READY_TO_PROBE);

--
2.47.3