mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] driver: disassociate dev from device_node on unregister_device
@ 2022-07-25  7:43 Ahmad Fatoum
  2022-08-08 13:43 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2022-07-25  7:43 UTC (permalink / raw)
  To: barebox; +Cc: mfe, Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH master] driver: disassociate dev from device_node on unregister_device
  2022-07-25  7:43 [PATCH master] driver: disassociate dev from device_node on unregister_device Ahmad Fatoum
@ 2022-08-08 13:43 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-08-08 13:43 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, mfe

On Mon, Jul 25, 2022 at 09:43:00AM +0200, Ahmad Fatoum wrote:
> 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(+)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-08 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25  7:43 [PATCH master] driver: disassociate dev from device_node on unregister_device Ahmad Fatoum
2022-08-08 13:43 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox