diff options
author | Tom Rini <trini@konsulko.com> | 2021-01-06 06:34:43 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-06 06:34:43 +0300 |
commit | b11f634b1c1be6ab419758c6596c673445e5ac70 (patch) | |
tree | 2329e1ff53c6c543e01d84b7901c53621ad8b7f9 /drivers/core/device-remove.c | |
parent | 720620e6916ba40b9a173bb07706d2c73f3c23e7 (diff) | |
parent | 970349a96dac3ad46c33851b1a773bfe3f1d4b33 (diff) | |
download | u-boot-b11f634b1c1be6ab419758c6596c673445e5ac70.tar.xz |
Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into next
Driver model: make some udevice fields private
Driver model: Rename U_BOOT_DEVICE et al.
dtoc: Tidy up and add more tests
ns16550 code clean-up
x86 and sandbox minor fixes for of-platdata
dtoc prepration for adding build-time instantiation
Diffstat (limited to 'drivers/core/device-remove.c')
-rw-r--r-- | drivers/core/device-remove.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 8a5f95806a..7e8f3afb2d 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -69,10 +69,10 @@ int device_unbind(struct udevice *dev) if (!dev) return log_msg_ret("dev", -EINVAL); - if (dev->flags & DM_FLAG_ACTIVATED) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return log_msg_ret("active", -EINVAL); - if (!(dev->flags & DM_FLAG_BOUND)) + if (!(dev_get_flags(dev) & DM_FLAG_BOUND)) return log_msg_ret("not-bound", -EINVAL); drv = dev->driver; @@ -88,17 +88,17 @@ int device_unbind(struct udevice *dev) if (ret) return log_msg_ret("child unbind", ret); - if (dev->flags & DM_FLAG_ALLOC_PDATA) { - free(dev->plat); - dev->plat = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) { + free(dev_get_plat(dev)); + dev_set_plat(dev, NULL); } - if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { - free(dev->uclass_plat); - dev->uclass_plat = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) { + free(dev_get_uclass_plat(dev)); + dev_set_uclass_plat(dev, NULL); } - if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { - free(dev->parent_plat); - dev->parent_plat = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) { + free(dev_get_parent_plat(dev)); + dev_set_parent_plat(dev, NULL); } ret = uclass_unbind_device(dev); if (ret) @@ -109,7 +109,7 @@ int device_unbind(struct udevice *dev) devres_release_all(dev); - if (dev->flags & DM_FLAG_NAME_ALLOCED) + if (dev_get_flags(dev) & DM_FLAG_NAME_ALLOCED) free((char *)dev->name); free(dev); @@ -125,13 +125,13 @@ void device_free(struct udevice *dev) int size; if (dev->driver->priv_auto) { - free(dev->priv); - dev->priv = NULL; + free(dev_get_priv(dev)); + dev_set_priv(dev, NULL); } size = dev->uclass->uc_drv->per_device_auto; if (size) { - free(dev->uclass_priv); - dev->uclass_priv = NULL; + free(dev_get_uclass_priv(dev)); + dev_set_uclass_priv(dev, NULL); } if (dev->parent) { size = dev->parent->driver->per_child_auto; @@ -140,11 +140,11 @@ void device_free(struct udevice *dev) per_child_auto; } if (size) { - free(dev->parent_priv); - dev->parent_priv = NULL; + free(dev_get_parent_priv(dev)); + dev_set_parent_priv(dev, NULL); } } - dev->flags &= ~DM_FLAG_PLATDATA_VALID; + dev_bic_flags(dev, DM_FLAG_PLATDATA_VALID); devres_release_probe(dev); } @@ -166,7 +166,7 @@ int device_remove(struct udevice *dev, uint flags) if (!dev) return -EINVAL; - if (!(dev->flags & DM_FLAG_ACTIVATED)) + if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED)) return 0; drv = dev->driver; @@ -207,7 +207,7 @@ int device_remove(struct udevice *dev, uint flags) if (flags_remove(flags, drv->flags)) { device_free(dev); - dev->flags &= ~DM_FLAG_ACTIVATED; + dev_bic_flags(dev, DM_FLAG_ACTIVATED); } return ret; |