summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2017-03-20 11:51:48 (GMT)
committerSimon Glass <sjg@chromium.org>2017-04-05 02:15:10 (GMT)
commit706865afe54eee83c1f3d7e9ea2f51db8e986d7b (patch)
treee5be7f7819dc9218c850d26d0551b6eedb88f198 /drivers/core
parent11db152246607868f0e74db958947fbf79f28119 (diff)
downloadu-boot-706865afe54eee83c1f3d7e9ea2f51db8e986d7b.tar.xz
dm: core: Add flags parameter to device_remove()
This patch adds the flags parameter to device_remove() and changes all calls to this function to provide the default value of DM_REMOVE_NORMAL for "normal" device removal. This is in preparation for the driver specific pre-OS (e.g. DMA cancelling) remove support. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/device-remove.c9
-rw-r--r--drivers/core/device.c2
-rw-r--r--drivers/core/root.c2
-rw-r--r--drivers/core/uclass.c2
4 files changed, 8 insertions, 7 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index a7f77b4..b80bf52 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -46,9 +46,10 @@ static int device_chld_unbind(struct udevice *dev)
/**
* device_chld_remove() - Stop all device's children
* @dev: The device whose children are to be removed
+ * @pre_os_remove: Flag, if this functions is called in the pre-OS stage
* @return 0 on success, -ve on error
*/
-static int device_chld_remove(struct udevice *dev)
+static int device_chld_remove(struct udevice *dev, uint flags)
{
struct udevice *pos, *n;
int ret;
@@ -56,7 +57,7 @@ static int device_chld_remove(struct udevice *dev)
assert(dev);
list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) {
- ret = device_remove(pos);
+ ret = device_remove(pos, flags);
if (ret)
return ret;
}
@@ -151,7 +152,7 @@ void device_free(struct udevice *dev)
devres_release_probe(dev);
}
-int device_remove(struct udevice *dev)
+int device_remove(struct udevice *dev, uint flags)
{
const struct driver *drv;
int ret;
@@ -169,7 +170,7 @@ int device_remove(struct udevice *dev)
if (ret)
return ret;
- ret = device_chld_remove(dev);
+ ret = device_chld_remove(dev, flags);
if (ret)
goto err;
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 70fcfc2..e1b0ebf 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -378,7 +378,7 @@ int device_probe(struct udevice *dev)
return 0;
fail_uclass:
- if (device_remove(dev)) {
+ if (device_remove(dev, DM_REMOVE_NORMAL)) {
dm_warn("%s: Device '%s' failed to remove on error path\n",
__func__, dev->name);
}
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 33cfde6..d8c51fb 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -178,7 +178,7 @@ int dm_init(void)
int dm_uninit(void)
{
- device_remove(dm_root());
+ device_remove(dm_root(), DM_REMOVE_NORMAL);
device_unbind(dm_root());
return 0;
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 7de3706..d94d43a 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -116,7 +116,7 @@ int uclass_destroy(struct uclass *uc)
while (!list_empty(&uc->dev_head)) {
dev = list_first_entry(&uc->dev_head, struct udevice,
uclass_node);
- ret = device_remove(dev);
+ ret = device_remove(dev, DM_REMOVE_NORMAL);
if (ret)
return ret;
ret = device_unbind(dev);