mirror-linux/drivers/base
Bartosz Golaszewski 50030d63b4 driver core: platform: remove software node on release()
If we pass a software node to a newly created device using struct
platform_device_info, it will not be removed when the device is
released. This may happen when a module creating the device is removed
or on failure in platform_device_add().

When we try to reuse that software node in a subsequent call to
platform_device_register_full(), it will fail with -EBUSY.

Provide a wrapper around the existing platform_device_release() that
additionally calls device_remove_software_node() and use it to replace
the former if we end up adding a software node.

While at it: check all three possible situations in which two software
nodes for a single platform device can be created/assigned in
platform_device_register_full() and bail-out early.

Fixes: 0fc434bc2c ("driver core: platform: allow attaching software nodes when creating devices")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260513-swnode-remove-on-dev-unreg-v6-1-f9c58939df27@oss.qualcomm.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-05-14 00:09:09 +02:00
..
firmware_loader Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
power thermal: core: Suspend thermal zones later and resume them earlier 2026-04-08 12:30:31 +02:00
regmap regmap: Fixes for v7.1 2026-04-24 12:11:26 -07:00
test drivers: base: test: Add ...find_device_by...(... NULL) tests 2024-12-24 09:48:09 +01:00
Kconfig driver core: Make deferred_probe_timeout default a Kconfig option 2026-03-30 20:45:27 +02:00
Makefile Revert "revocable: Add Kunit test cases" 2026-02-06 16:08:48 +01:00
arch_numa.c arch_numa: Restore nid checks before registering a memblock with a node 2024-12-01 22:04:52 +02:00
arch_topology.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
attribute_container.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
auxiliary.c ACPI support updates for 7.1-rc1 2026-04-13 19:25:07 -07:00
auxiliary_sysfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
base.h driver core: make software nodes available earlier 2026-04-04 00:33:49 +02:00
bus.c driver core: generalize driver_override in struct device 2026-03-17 20:30:23 +01:00
cacheinfo.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
class.c kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
component.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
container.c driver core: container: make container_subsys const 2023-12-21 13:56:10 +01:00
core.c Driver core fixes for 7.1-rc1 2026-04-19 12:58:08 -07:00
cpu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dd.c Driver core fixes for 7.1-rc1 2026-04-19 12:58:08 -07:00
devcoredump.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
devres.c devres: rename and export set_node_dbginfo() 2026-03-18 00:02:59 +01:00
devtmpfs.c devtmpfs: Replace simple_strtoul with kstrtoint in mount_param 2026-01-16 16:44:43 +01:00
driver.c driver core: Introduce device_iter_t for device iterating APIs 2025-01-10 15:26:12 +01:00
faux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
firmware.c
hypervisor.c
init.c driver core: make software nodes available earlier 2026-04-04 00:33:49 +02:00
isa.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
map.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
memory.c drivers/base/memory: fix stale reference to memory_block_add_nid() 2026-04-05 13:53:36 -07:00
module.c drivers: base: handle module_kobject creation 2025-04-16 15:10:55 +02:00
node.c mm: add gpu active/reclaim per-node stat counters (v2) 2026-04-08 06:52:47 +10:00
physical_location.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
physical_location.h driver core: physical_location.h remove extern from function prototypes 2023-03-24 15:35:48 +01:00
pinctrl.c driver core: make pinctrl_bind_pins() private 2026-01-19 00:34:44 +01:00
platform-msi.c platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() 2025-05-07 17:49:00 +02:00
platform.c driver core: platform: remove software node on release() 2026-05-14 00:09:09 +02:00
property.c Driver core fixes for 7.1-rc1 2026-04-19 12:58:08 -07:00
soc.c base: soc: rename and export soc_device_get_machine() 2026-03-12 16:18:49 +01:00
swnode.c Driver core fixes for 7.1-rc1 2026-04-19 12:58:08 -07:00
syscore.c syscore: Pass context data to callbacks 2025-11-14 10:01:52 +01:00
topology.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
trace.c
trace.h devres: Fix page faults when tracing devres from unloaded modules 2024-10-14 08:21:09 +02:00
transport_class.c SCSI misc on 20260212 2026-02-12 15:43:02 -08:00