summaryrefslogtreecommitdiff
path: root/drivers/core/uclass.c
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2021-10-23 17:26:05 -0600
committerSimon Glass <[email protected]>2021-11-28 16:51:51 -0700
commit804431830593820575158aa5c4b098aab59efc88 (patch)
tree8baf7751a924db68b550a409276bde47f7a95ce4 /drivers/core/uclass.c
parentfb933d070eb00274bb7e041cae98e858208961e2 (diff)
dm: core: Fix handling of uclass pre_unbind method
This method is currently called after the platform data has been freed. But the pre_unbind() method may wish to access this, e.g. to free some data structures stored there. Split the unbinding of devices into two pieces, as is done with removal. This corrects the problem. Also tidy a code-style issue in device_remove() while we are here. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'drivers/core/uclass.c')
-rw-r--r--drivers/core/uclass.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index c5a50952fd0..2fede896bfb 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -682,7 +682,7 @@ err:
}
#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
-int uclass_unbind_device(struct udevice *dev)
+int uclass_pre_unbind_device(struct udevice *dev)
{
struct uclass *uc;
int ret;
@@ -694,7 +694,13 @@ int uclass_unbind_device(struct udevice *dev)
return ret;
}
+ return 0;
+}
+
+int uclass_unbind_device(struct udevice *dev)
+{
list_del(&dev->uclass_node);
+
return 0;
}
#endif