From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] driver: disassociate dev from device_node on unregister_device
Date: Mon, 25 Jul 2022 09:43:00 +0200 [thread overview]
Message-ID: <20220725074259.2651494-1-a.fatoum@pengutronix.de> (raw)
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@pengutronix.de>
---
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
next reply other threads:[~2022-07-25 7:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 7:43 Ahmad Fatoum [this message]
2022-08-08 13:43 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220725074259.2651494-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mfe@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox