diff options
author | Tom Rini <trini@konsulko.com> | 2017-05-17 14:13:16 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-05-17 14:13:16 -0400 |
commit | ae1b939930b0fffc062bb99196ec22e19afcc7e8 (patch) | |
tree | cc8d8c87b15932f82d5ed3c4e26bb118de949aff /drivers/core/device-remove.c | |
parent | a9f47426ced2e5057930990f3cd602b8ab936f69 (diff) | |
parent | c2f17939f4b429c90a453e26927a7c578e5456b5 (diff) |
Merge git://git.denx.de/u-boot-x86
Diffstat (limited to 'drivers/core/device-remove.c')
-rw-r--r-- | drivers/core/device-remove.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index cc0043b990..3c6ab42f7d 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -152,6 +152,15 @@ void device_free(struct udevice *dev) devres_release_probe(dev); } +static bool flags_remove(uint flags, uint drv_flags) +{ + if ((flags & DM_REMOVE_NORMAL) || + (flags & (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE)))) + return true; + + return false; +} + int device_remove(struct udevice *dev, uint flags) { const struct driver *drv; @@ -178,9 +187,7 @@ int device_remove(struct udevice *dev, uint flags) * 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)))) { + if (drv->remove && flags_remove(flags, drv->flags)) { ret = drv->remove(dev); if (ret) goto err_remove; @@ -194,8 +201,7 @@ int device_remove(struct udevice *dev, uint flags) } } - if ((flags & DM_REMOVE_NORMAL) || - (flags & (drv->flags & DM_FLAG_ACTIVE_DMA))) { + if (flags_remove(flags, drv->flags)) { device_free(dev); dev->seq = -1; |