Lines Matching full:dev
26 * @dev: The device that is to be stripped of its children
29 static int device_chld_unbind(struct udevice *dev) in device_chld_unbind() argument
34 assert(dev); in device_chld_unbind()
36 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_unbind()
47 * @dev: The device whose children are to be removed
51 static int device_chld_remove(struct udevice *dev, uint flags) in device_chld_remove() argument
56 assert(dev); in device_chld_remove()
58 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_remove()
67 int device_unbind(struct udevice *dev) in device_unbind() argument
72 if (!dev) in device_unbind()
75 if (dev->flags & DM_FLAG_ACTIVATED) in device_unbind()
78 if (!(dev->flags & DM_FLAG_BOUND)) in device_unbind()
81 drv = dev->driver; in device_unbind()
85 ret = drv->unbind(dev); in device_unbind()
90 ret = device_chld_unbind(dev); in device_unbind()
94 if (dev->flags & DM_FLAG_ALLOC_PDATA) { in device_unbind()
95 free(dev->platdata); in device_unbind()
96 dev->platdata = NULL; in device_unbind()
98 if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { in device_unbind()
99 free(dev->uclass_platdata); in device_unbind()
100 dev->uclass_platdata = NULL; in device_unbind()
102 if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { in device_unbind()
103 free(dev->parent_platdata); in device_unbind()
104 dev->parent_platdata = NULL; in device_unbind()
106 ret = uclass_unbind_device(dev); in device_unbind()
110 if (dev->parent) in device_unbind()
111 list_del(&dev->sibling_node); in device_unbind()
113 devres_release_all(dev); in device_unbind()
115 if (dev->flags & DM_FLAG_NAME_ALLOCED) in device_unbind()
116 free((char *)dev->name); in device_unbind()
117 free(dev); in device_unbind()
124 * @dev: Device that is to be started
126 void device_free(struct udevice *dev) in device_free() argument
130 if (dev->driver->priv_auto_alloc_size) { in device_free()
131 free(dev->priv); in device_free()
132 dev->priv = NULL; in device_free()
134 size = dev->uclass->uc_drv->per_device_auto_alloc_size; in device_free()
136 free(dev->uclass_priv); in device_free()
137 dev->uclass_priv = NULL; in device_free()
139 if (dev->parent) { in device_free()
140 size = dev->parent->driver->per_child_auto_alloc_size; in device_free()
142 size = dev->parent->uclass->uc_drv-> in device_free()
146 free(dev->parent_priv); in device_free()
147 dev->parent_priv = NULL; in device_free()
151 devres_release_probe(dev); in device_free()
163 int device_remove(struct udevice *dev, uint flags) in device_remove() argument
168 if (!dev) in device_remove()
171 if (!(dev->flags & DM_FLAG_ACTIVATED)) in device_remove()
174 drv = dev->driver; in device_remove()
177 ret = uclass_pre_remove_device(dev); in device_remove()
181 ret = device_chld_remove(dev, flags); in device_remove()
190 ret = drv->remove(dev); in device_remove()
195 if (dev->parent && dev->parent->driver->child_post_remove) { in device_remove()
196 ret = dev->parent->driver->child_post_remove(dev); in device_remove()
199 __func__, dev->name); in device_remove()
204 device_free(dev); in device_remove()
206 dev->seq = -1; in device_remove()
207 dev->flags &= ~DM_FLAG_ACTIVATED; in device_remove()
215 __func__, dev->name); in device_remove()
217 ret = uclass_post_probe_device(dev); in device_remove()
220 __func__, dev->name); in device_remove()