[PATCH 1/3] driver core: provide a test-and-clear device flag accessor
From: Bartosz Golaszewski
Date: Thu Oct 15 2026 - 11:07:36 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 879eb758b5eec3f634d4fee0e4a57433fb537801..c8de370d877f978dd4a160f0094812a1d8441078 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -817,6 +817,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