aboutsummaryrefslogtreecommitdiff
path: root/drivers/core/device-remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core/device-remove.c')
-rw-r--r--drivers/core/device-remove.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 8a5f95806a0..7e8f3afb2d6 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;