Lines Matching refs:dev

20 int device_chld_unbind(struct udevice *dev, struct driver *drv)  in device_chld_unbind()  argument
25 assert(dev); in device_chld_unbind()
27 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_unbind()
39 int device_chld_remove(struct udevice *dev, struct driver *drv, in device_chld_remove() argument
45 assert(dev); in device_chld_remove()
47 list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { in device_chld_remove()
59 int device_unbind(struct udevice *dev) in device_unbind() argument
64 if (!dev) in device_unbind()
67 if (dev->flags & DM_FLAG_ACTIVATED) in device_unbind()
70 if (!(dev->flags & DM_FLAG_BOUND)) in device_unbind()
73 drv = dev->driver; in device_unbind()
77 ret = drv->unbind(dev); in device_unbind()
82 ret = device_chld_unbind(dev, NULL); in device_unbind()
86 if (dev->flags & DM_FLAG_ALLOC_PDATA) { in device_unbind()
87 free(dev->platdata); in device_unbind()
88 dev->platdata = NULL; in device_unbind()
90 if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { in device_unbind()
91 free(dev->uclass_platdata); in device_unbind()
92 dev->uclass_platdata = NULL; in device_unbind()
94 if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { in device_unbind()
95 free(dev->parent_platdata); in device_unbind()
96 dev->parent_platdata = NULL; in device_unbind()
98 ret = uclass_unbind_device(dev); in device_unbind()
102 if (dev->parent) in device_unbind()
103 list_del(&dev->sibling_node); in device_unbind()
105 devres_release_all(dev); in device_unbind()
107 if (dev->flags & DM_FLAG_NAME_ALLOCED) in device_unbind()
108 free((char *)dev->name); in device_unbind()
109 free(dev); in device_unbind()
118 void device_free(struct udevice *dev) in device_free() argument
122 if (dev->driver->priv_auto_alloc_size) { in device_free()
123 free(dev->priv); in device_free()
124 dev->priv = NULL; in device_free()
126 size = dev->uclass->uc_drv->per_device_auto_alloc_size; in device_free()
128 free(dev->uclass_priv); in device_free()
129 dev->uclass_priv = NULL; in device_free()
131 if (dev->parent) { in device_free()
132 size = dev->parent->driver->per_child_auto_alloc_size; in device_free()
134 size = dev->parent->uclass->uc_drv-> in device_free()
138 free(dev->parent_priv); in device_free()
139 dev->parent_priv = NULL; in device_free()
143 devres_release_probe(dev); in device_free()
155 int device_remove(struct udevice *dev, uint flags) in device_remove() argument
160 if (!dev) in device_remove()
163 if (!(dev->flags & DM_FLAG_ACTIVATED)) in device_remove()
166 drv = dev->driver; in device_remove()
169 ret = uclass_pre_remove_device(dev); in device_remove()
173 ret = device_chld_remove(dev, NULL, flags); in device_remove()
182 ret = drv->remove(dev); in device_remove()
187 if (dev->parent && dev->parent->driver->child_post_remove) { in device_remove()
188 ret = dev->parent->driver->child_post_remove(dev); in device_remove()
191 __func__, dev->name); in device_remove()
196 device_free(dev); in device_remove()
198 dev->seq = -1; in device_remove()
199 dev->flags &= ~DM_FLAG_ACTIVATED; in device_remove()
207 __func__, dev->name); in device_remove()
209 ret = uclass_post_probe_device(dev); in device_remove()
212 __func__, dev->name); in device_remove()