[PATCH 2/3] driver core: provide new device flag - DEV_FLAG_SWNODE_NOTIFIER

From: Bartosz Golaszewski

Date: Thu Oct 15 2026 - 11:01:42 EST


Extend the set of device flags with one that indicates to driver core
that this device was passed as argument to software_node_notify() and
took a reference to this device's software node.

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

diff --git a/include/linux/device.h b/include/linux/device.h
index c8de370d877f978dd4a160f0094812a1d8441078..b8f12d053cd704b12febc41035aaa44afe286351 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -599,6 +599,10 @@ struct device_physical_location {
* ancestor device.
* @DEV_FLAG_OFFLINE_DISABLED: If set, the device is permanently online.
* @DEV_FLAG_OFFLINE: Set after successful invocation of bus type's .offline().
+ * @DEV_FLAG_SWNODE_NOTIFIER: Set if software_node_notify() was called for this
+ * device and took a reference to the device's software node.
+ * Indicates to software_node_notify_remove() that it should drop
+ * the reference.
* @DEV_FLAG_COUNT: Number of defined struct_device_flags.
*/
enum struct_device_flags {
@@ -612,6 +616,7 @@ enum struct_device_flags {
DEV_FLAG_OF_NODE_REUSED = 7,
DEV_FLAG_OFFLINE_DISABLED = 8,
DEV_FLAG_OFFLINE = 9,
+ DEV_FLAG_SWNODE_NOTIFIED = 10,

DEV_FLAG_COUNT
};
@@ -833,6 +838,7 @@ __create_dev_flag_accessors(dma_coherent, DEV_FLAG_DMA_COHERENT);
__create_dev_flag_accessors(of_node_reused, DEV_FLAG_OF_NODE_REUSED);
__create_dev_flag_accessors(offline_disabled, DEV_FLAG_OFFLINE_DISABLED);
__create_dev_flag_accessors(offline, DEV_FLAG_OFFLINE);
+__create_dev_flag_accessors(swnode_notified, DEV_FLAG_SWNODE_NOTIFIED);

#undef __create_dev_flag_accessors


--
2.47.3