mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
dm: core: Add dm_remove_devices_flags() and hook it into device_remove()
The new function dm_remove_devices_flags() is intented for driver specific last-stage cleanup operations before the OS is started. This patch adds this functionality and hooks it into the common device_remove() function. Drivers wanting to use this feature for some last-stage removal calls, need to add one of the DM_REMOVE_xx flags to their driver .flags. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:

committed by
Simon Glass

parent
706865afe5
commit
bc85aa4030
@ -174,7 +174,13 @@ int device_remove(struct udevice *dev, uint flags)
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (drv->remove) {
|
||||
/*
|
||||
* Remove the device if called with the "normal" remove flag set,
|
||||
* or if the remove flag matches any of the drivers remove flags
|
||||
*/
|
||||
if (drv->remove &&
|
||||
((flags & DM_REMOVE_NORMAL) ||
|
||||
(flags & (drv->flags & DM_FLAG_ACTIVE_DMA)))) {
|
||||
ret = drv->remove(dev);
|
||||
if (ret)
|
||||
goto err_remove;
|
||||
@ -188,10 +194,13 @@ int device_remove(struct udevice *dev, uint flags)
|
||||
}
|
||||
}
|
||||
|
||||
device_free(dev);
|
||||
if ((flags & DM_REMOVE_NORMAL) ||
|
||||
(flags & (drv->flags & DM_FLAG_ACTIVE_DMA))) {
|
||||
device_free(dev);
|
||||
|
||||
dev->seq = -1;
|
||||
dev->flags &= ~DM_FLAG_ACTIVATED;
|
||||
dev->seq = -1;
|
||||
dev->flags &= ~DM_FLAG_ACTIVATED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
|
Reference in New Issue
Block a user