Lines Matching refs:dev

30 static int device_chld_unbind(struct udevice *dev)  in device_chld_unbind()  argument
35 assert(dev); in device_chld_unbind()
37 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_unbind()
52 static int device_chld_remove(struct udevice *dev, uint flags) in device_chld_remove() argument
57 assert(dev); in device_chld_remove()
59 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_remove()
68 int device_unbind(struct udevice *dev) in device_unbind() argument
73 if (!dev) in device_unbind()
76 if (dev->flags & DM_FLAG_ACTIVATED) in device_unbind()
79 if (!(dev->flags & DM_FLAG_BOUND)) in device_unbind()
82 drv = dev->driver; in device_unbind()
86 ret = drv->unbind(dev); in device_unbind()
91 ret = device_chld_unbind(dev); in device_unbind()
95 if (dev->flags & DM_FLAG_ALLOC_PDATA) { in device_unbind()
96 free(dev->platdata); in device_unbind()
97 dev->platdata = NULL; in device_unbind()
99 if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { in device_unbind()
100 free(dev->uclass_platdata); in device_unbind()
101 dev->uclass_platdata = NULL; in device_unbind()
103 if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { in device_unbind()
104 free(dev->parent_platdata); in device_unbind()
105 dev->parent_platdata = NULL; in device_unbind()
107 ret = uclass_unbind_device(dev); in device_unbind()
111 if (dev->parent) in device_unbind()
112 list_del(&dev->sibling_node); in device_unbind()
114 devres_release_all(dev); in device_unbind()
116 if (dev->flags & DM_FLAG_NAME_ALLOCED) in device_unbind()
117 free((char *)dev->name); in device_unbind()
118 free(dev); in device_unbind()
127 void device_free(struct udevice *dev) in device_free() argument
131 if (dev->driver->priv_auto_alloc_size) { in device_free()
132 free(dev->priv); in device_free()
133 dev->priv = NULL; in device_free()
135 size = dev->uclass->uc_drv->per_device_auto_alloc_size; in device_free()
137 free(dev->uclass_priv); in device_free()
138 dev->uclass_priv = NULL; in device_free()
140 if (dev->parent) { in device_free()
141 size = dev->parent->driver->per_child_auto_alloc_size; in device_free()
143 size = dev->parent->uclass->uc_drv-> in device_free()
147 free(dev->parent_priv); in device_free()
148 dev->parent_priv = NULL; in device_free()
152 devres_release_probe(dev); in device_free()
164 int device_remove(struct udevice *dev, uint flags) in device_remove() argument
169 if (!dev) in device_remove()
172 if (!(dev->flags & DM_FLAG_ACTIVATED)) in device_remove()
175 drv = dev->driver; in device_remove()
178 ret = uclass_pre_remove_device(dev); in device_remove()
182 ret = device_chld_remove(dev, flags); in device_remove()
191 ret = drv->remove(dev); in device_remove()
196 if (dev->parent && dev->parent->driver->child_post_remove) { in device_remove()
197 ret = dev->parent->driver->child_post_remove(dev); in device_remove()
200 __func__, dev->name); in device_remove()
205 device_free(dev); in device_remove()
207 dev->seq = -1; in device_remove()
208 dev->flags &= ~DM_FLAG_ACTIVATED; in device_remove()
216 __func__, dev->name); in device_remove()
218 ret = uclass_post_probe_device(dev); in device_remove()
221 __func__, dev->name); in device_remove()