Lines Matching refs:dev

25 int device_chld_unbind(struct udevice *dev, struct driver *drv)  in device_chld_unbind()  argument
30 assert(dev); in device_chld_unbind()
32 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_unbind()
47 int device_chld_remove(struct udevice *dev, struct driver *drv, in device_chld_remove() argument
53 assert(dev); in device_chld_remove()
55 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_remove()
71 int device_unbind(struct udevice *dev) in device_unbind() argument
76 if (!dev) in device_unbind()
79 if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) in device_unbind()
82 if (!(dev_get_flags(dev) & DM_FLAG_BOUND)) in device_unbind()
85 drv = dev->driver; in device_unbind()
89 ret = drv->unbind(dev); in device_unbind()
94 ret = device_chld_unbind(dev, NULL); in device_unbind()
98 if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) { in device_unbind()
99 free(dev_get_plat(dev)); in device_unbind()
100 dev_set_plat(dev, NULL); in device_unbind()
102 if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) { in device_unbind()
103 free(dev_get_uclass_plat(dev)); in device_unbind()
104 dev_set_uclass_plat(dev, NULL); in device_unbind()
106 if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) { in device_unbind()
107 free(dev_get_parent_plat(dev)); in device_unbind()
108 dev_set_parent_plat(dev, NULL); in device_unbind()
110 ret = uclass_unbind_device(dev); in device_unbind()
114 if (dev->parent) in device_unbind()
115 list_del(&dev->sibling_node); in device_unbind()
117 devres_release_all(dev); in device_unbind()
119 if (dev_get_flags(dev) & DM_FLAG_NAME_ALLOCED) in device_unbind()
120 free((char *)dev->name); in device_unbind()
121 free(dev); in device_unbind()
130 void device_free(struct udevice *dev) in device_free() argument
134 if (dev->driver->priv_auto) { in device_free()
135 free(dev_get_priv(dev)); in device_free()
136 dev_set_priv(dev, NULL); in device_free()
138 size = dev->uclass->uc_drv->per_device_auto; in device_free()
140 free(dev_get_uclass_priv(dev)); in device_free()
141 dev_set_uclass_priv(dev, NULL); in device_free()
143 if (dev->parent) { in device_free()
144 size = dev->parent->driver->per_child_auto; in device_free()
146 size = dev->parent->uclass->uc_drv-> in device_free()
150 free(dev_get_parent_priv(dev)); in device_free()
151 dev_set_parent_priv(dev, NULL); in device_free()
154 dev_bic_flags(dev, DM_FLAG_PLATDATA_VALID); in device_free()
156 devres_release_probe(dev); in device_free()
198 int device_remove(struct udevice *dev, uint flags) in device_remove() argument
203 if (!dev) in device_remove()
206 if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED)) in device_remove()
213 ret = device_chld_remove(dev, NULL, flags); in device_remove()
221 drv = dev->driver; in device_remove()
226 dev->name, flags, drv->flags, ret); in device_remove()
230 ret = uclass_pre_remove_device(dev); in device_remove()
235 ret = drv->remove(dev); in device_remove()
240 if (dev->parent && dev->parent->driver->child_post_remove) { in device_remove()
241 ret = dev->parent->driver->child_post_remove(dev); in device_remove()
244 __func__, dev->name); in device_remove()
251 dev != gd->cur_serial_dev) in device_remove()
252 dev_power_domain_off(dev); in device_remove()
254 device_free(dev); in device_remove()
256 dev_bic_flags(dev, DM_FLAG_ACTIVATED); in device_remove()
263 __func__, dev->name); in device_remove()