summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2026-02-14 05:52:44 +0300
committerDanilo Krummrich <dakr@kernel.org>2026-03-02 14:13:43 +0300
commit0fc434bc2c45fceb9356f2138911db0f454b8ca6 (patch)
treea901a96a37ba4ee855ab54027f4d305e31e2b308 /include/linux
parent94798081732abfb5748471d5c3cced6ff187fa36 (diff)
downloadlinux-0fc434bc2c45fceb9356f2138911db0f454b8ca6.tar.xz
driver core: platform: allow attaching software nodes when creating devices
Extend platform_device_info structure with an optional pointer to a software node to be used as a secondary firmware node for the device being created. If software node has not been registered yet it will be automatically registered. This reduces boilerplate needed when switching legacy board code to static device properties/GPIO references. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Link: https://patch.msgid.link/20260214025246.2095239-3-dmitry.torokhov@gmail.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/platform_device.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5f54217930e1..754e4bf2771a 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -136,10 +136,14 @@ extern int platform_add_devices(struct platform_device **, int);
* @data: device-specific data for this platform device.
* @size_data: size of device-specific data.
* @dma_mask: DMA mask for the device.
+ * @swnode: a secondary software node to be attached to the device. The node
+ * will be automatically registered and its lifetime tied to the platform
+ * device if it is not registered yet.
* @properties: a set of software properties for the device. If provided,
* a managed software node will be automatically created and
* assigned to the device. The properties array must be terminated
- * with a sentinel entry.
+ * with a sentinel entry. Specifying both @properties and @swnode is not
+ * allowed.
*
* This structure is used to hold information needed to create and register
* a platform device using platform_device_register_full().
@@ -164,6 +168,7 @@ struct platform_device_info {
size_t size_data;
u64 dma_mask;
+ const struct software_node *swnode;
const struct property_entry *properties;
};
extern struct platform_device *platform_device_register_full(