[PATCH master] driver: disassociate dev from device_node on unregister_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reusing the same device node with of_platform_device_create
after unregistering an old device doesn't work, because the device_node
-> device_d association added along with deep probe isn't cleared.
Resolve this.

Fixes: 46afd4bf8fa6 ("of: platform: Keep track of populated platform devices")
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/base/driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 4898e0114d56..e7288f6a61cc 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -265,6 +265,8 @@ int unregister_device(struct device_d *old_dev)
 	/* remove device from parents child list */
 	if (old_dev->parent)
 		list_del(&old_dev->sibling);
+	if (dev_of_node(old_dev))
+		old_dev->device_node->dev = NULL;
 
 	return 0;
 }
-- 
2.30.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux