Lines Matching defs:devres
3 * drivers/base/devres.c - device resource management
27 struct devres {
70 * Release functions for devres group. These callbacks are used only
95 if (unlikely(check_add_overflow(sizeof(struct devres),
102 static __always_inline struct devres * alloc_dr(dr_release_t release,
106 struct devres *dr;
115 memset(dr, 0, offsetof(struct devres, data));
141 struct devres *dr;
153 * @release: Release function devres will be associated with
158 * Allocate devres of @size bytes. The allocated area is zeroed, then
163 * Pointer to allocated devres on success, NULL on failure.
167 struct devres *dr;
186 * Call @fn for each devres of @dev which is associated with @release
207 struct devres *dr = container_of(node, struct devres, node);
221 * @res: Pointer to devres data to free
223 * Free devres created with devres_alloc().
228 struct devres *dr = container_of(res, struct devres, data);
241 * Register devres @res to @dev. @res should have been allocated
243 * function will be invoked and devres will be freed automatically.
247 struct devres *dr = container_of(res, struct devres, data);
256 static struct devres *find_dr(struct device *dev, dr_release_t release,
262 struct devres *dr = container_of(node, struct devres, node);
281 * Find the latest devres of @dev which is associated with @release
286 * Pointer to found devres, NULL if not found.
291 struct devres *dr;
305 * devres_get - Find devres, if non-existent, add one atomically
306 * @dev: Device to lookup or add devres for
307 * @new_res: Pointer to new initialized devres to add if not found
311 * Find the latest devres of @dev which has the same release function
316 * Pointer to found or added devres.
321 struct devres *new_dr = container_of(new_res, struct devres, data);
322 struct devres *dr;
346 * Find the latest devres of @dev associated with @release and for
352 * Pointer to removed devres on success, NULL if not found.
357 struct devres *dr;
381 * Find the latest devres of @dev associated with @release and for
386 * only the devres-allocated data will be freed. The caller becomes
390 * 0 if devres is found and freed, -ENOENT if not found.
414 * Find the latest devres of @dev associated with @release and for
420 * 0 if devres is found and freed, -ENOENT if not found.
444 /* First pass - move normal devres entries to @todo and clear
461 /* regular devres entry */
512 struct devres *dr, *tmp;
518 /* Release. Note that both devres and devres_group are
519 * handled as devres in the following loop. This is safe.
550 * devres_open_group - Open a new devres group
551 * @dev: Device to open devres group for
555 * Open a new devres group for @dev with @id. For @id, using a
588 /* Find devres group with ID @id. If @id is NULL, look for the latest. */
612 * devres_close_group - Close a devres group
613 * @dev: Device to close devres group for
637 * devres_remove_group - Remove a devres group
667 * devres_release_group - Release resources in a devres group
705 * Custom devres actions allow inserting a simple function call
716 struct action_devres *devres = res;
719 return devres->action == target->action &&
720 devres->data == target->data;
725 struct action_devres *devres = res;
727 devres->action(devres->data);
741 struct action_devres *devres;
743 devres = devres_alloc(devm_action_release,
745 if (!devres)
748 devres->data = data;
749 devres->action = action;
751 devres_add(dev, devres);
767 struct action_devres devres = {
773 &devres));
789 struct action_devres devres = {
795 &devres));
820 * automatically freed on driver detach. Like all other devres
828 struct devres *dr;
859 * change the order in which the release callback for the re-alloc'ed devres
867 struct devres *old_dr, *new_dr;
888 total_old_size = ksize(container_of(ptr, struct devres, data));
933 total_old_size - offsetof(struct devres, data));
935 * Same for releasing the old devres - it's now been removed from the
1101 struct pages_devres *devres = res;
1104 return devres->addr == target->addr;
1109 struct pages_devres *devres = res;
1111 free_pages(devres->addr, devres->order);
1130 struct pages_devres *devres;
1138 devres = devres_alloc(devm_pages_release,
1140 if (unlikely(!devres)) {
1145 devres->addr = addr;
1146 devres->order = order;
1148 devres_add(dev, devres);
1163 struct pages_devres devres = { .addr = addr };
1166 &devres));
1180 struct devres *devr = container_of(data, struct devres, data);