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
579 /* Find devres group with ID @id. If @id is NULL, look for the latest. */
603 * devres_close_group - Close a devres group
604 * @dev: Device to close devres group for
628 * devres_remove_group - Remove a devres group
658 * devres_release_group - Release resources in a devres group
700 * Custom devres actions allow inserting a simple function call
711 struct action_devres *devres = res;
714 return devres->action == target->action &&
715 devres->data == target->data;
720 struct action_devres *devres = res;
722 devres->action(devres->data);
737 struct action_devres *devres;
739 devres = __devres_alloc_node(devm_action_release, sizeof(struct action_devres),
741 if (!devres)
744 devres->data = data;
745 devres->action = action;
747 devres_add(dev, devres);
768 * of the devres API.
776 struct action_devres devres = {
782 &devres);
798 struct action_devres devres = {
804 &devres));
829 * automatically freed on driver detach. Like all other devres
837 struct devres *dr;
868 * change the order in which the release callback for the re-alloc'ed devres
876 struct devres *old_dr, *new_dr;
897 total_old_size = ksize(container_of(ptr, struct devres, data));
914 * for struct devres automatically, so size @new_size user request
945 total_old_size - offsetof(struct devres, data));
947 * Same for releasing the old devres - it's now been removed from the
1113 struct pages_devres *devres = res;
1116 return devres->addr == target->addr;
1121 struct pages_devres *devres = res;
1123 free_pages(devres->addr, devres->order);
1142 struct pages_devres *devres;
1150 devres = devres_alloc(devm_pages_release,
1152 if (unlikely(!devres)) {
1157 devres->addr = addr;
1158 devres->order = order;
1160 devres_add(dev, devres);
1175 struct pages_devres devres = { .addr = addr };
1178 &devres));
1192 struct devres *devr = container_of(data, struct devres, data);