Lines Matching defs:devres

3  * drivers/base/devres.c - device resource management
26 struct devres {
33 * alignment for struct devres when allocated by kmalloc().
75 * Release functions for devres group. These callbacks are used only
100 if (unlikely(check_add_overflow(sizeof(struct devres),
110 static __always_inline struct devres * alloc_dr(dr_release_t release,
114 struct devres *dr;
125 memset(dr, 0, offsetof(struct devres, data));
149 * @release: Release function devres will be associated with
155 * Allocate devres of @size bytes. The allocated area is zeroed, then
160 * Pointer to allocated devres on success, NULL on failure.
165 struct devres *dr;
184 * Call @fn for each devres of @dev which is associated with @release
205 struct devres *dr = container_of(node, struct devres, node);
219 * @res: Pointer to devres data to free
221 * Free devres created with devres_alloc().
226 struct devres *dr = container_of(res, struct devres, data);
239 * Register devres @res to @dev. @res should have been allocated
241 * function will be invoked and devres will be freed automatically.
245 struct devres *dr = container_of(res, struct devres, data);
254 static struct devres *find_dr(struct device *dev, dr_release_t release,
260 struct devres *dr = container_of(node, struct devres, node);
279 * Find the latest devres of @dev which is associated with @release
284 * Pointer to found devres, NULL if not found.
289 struct devres *dr;
303 * devres_get - Find devres, if non-existent, add one atomically
304 * @dev: Device to lookup or add devres for
305 * @new_res: Pointer to new initialized devres to add if not found
309 * Find the latest devres of @dev which has the same release function
314 * Pointer to found or added devres.
319 struct devres *new_dr = container_of(new_res, struct devres, data);
320 struct devres *dr;
344 * Find the latest devres of @dev associated with @release and for
350 * Pointer to removed devres on success, NULL if not found.
355 struct devres *dr;
379 * Find the latest devres of @dev associated with @release and for
384 * only the devres-allocated data will be freed. The caller becomes
388 * 0 if devres is found and freed, -ENOENT if not found.
412 * Find the latest devres of @dev associated with @release and for
418 * 0 if devres is found and freed, -ENOENT if not found.
442 /* First pass - move normal devres entries to @todo and clear
455 /* regular devres entry */
498 struct devres *dr, *tmp;
500 /* Release. Note that both devres and devres_group are
501 * handled as devres in the following loop. This is safe.
540 * devres_open_group - Open a new devres group
541 * @dev: Device to open devres group for
545 * Open a new devres group for @dev with @id. For @id, using a
578 /* Find devres group with ID @id. If @id is NULL, look for the latest. */
602 * devres_close_group - Close a devres group
603 * @dev: Device to close devres group for
627 * devres_remove_group - Remove a devres group
657 * devres_release_group - Release resources in a devres group
699 * Custom devres actions allow inserting a simple function call
710 struct action_devres *devres = res;
713 return devres->action == target->action &&
714 devres->data == target->data;
719 struct action_devres *devres = res;
721 devres->action(devres->data);
736 struct action_devres *devres;
738 devres = __devres_alloc_node(devm_action_release, sizeof(struct action_devres),
740 if (!devres)
743 devres->data = data;
744 devres->action = action;
746 devres_add(dev, devres);
762 struct action_devres devres = {
768 &devres));
784 struct action_devres devres = {
790 &devres));
815 * automatically freed on driver detach. Like all other devres
823 struct devres *dr;
854 * change the order in which the release callback for the re-alloc'ed devres
862 struct devres *old_dr, *new_dr;
883 total_old_size = ksize(container_of(ptr, struct devres, data));
928 total_old_size - offsetof(struct devres, data));
930 * Same for releasing the old devres - it's now been removed from the
1096 struct pages_devres *devres = res;
1099 return devres->addr == target->addr;
1104 struct pages_devres *devres = res;
1106 free_pages(devres->addr, devres->order);
1125 struct pages_devres *devres;
1133 devres = devres_alloc(devm_pages_release,
1135 if (unlikely(!devres)) {
1140 devres->addr = addr;
1141 devres->order = order;
1143 devres_add(dev, devres);
1158 struct pages_devres devres = { .addr = addr };
1161 &devres));
1175 struct devres *devr = container_of(data, struct devres, data);