resource_list_purge: release the resources in this list, and purge the

elements of this list (eg, reset it).

Man page to follow
This commit is contained in:
Warner Losh 2005-04-12 15:20:36 +00:00
parent be9ede4a45
commit 2bd5d8147a
2 changed files with 22 additions and 0 deletions

View File

@ -2804,6 +2804,27 @@ resource_list_print_type(struct resource_list *rl, const char *name, int type,
return (retval);
}
/**
* @brief Releases all the resources in a list.
*
* @param rl The resource list to purge.
*
* @returns nothing
*/
void
resource_list_purge(struct resource_list *rl)
{
struct resource_list_entry *rle;
STAILQ_FOREACH(rle, rl, link) {
if (rle->res)
bus_release_resource(rman_get_device(rle->res),
rle->type, rle->rid, rle->res);
STAILQ_REMOVE_HEAD(rl, link);
free(rle, M_BUS);
}
}
/**
* @brief Helper function for implementing DEVICE_PROBE()
*

View File

@ -227,6 +227,7 @@ struct resource *
int resource_list_release(struct resource_list *rl,
device_t bus, device_t child,
int type, int rid, struct resource *res);
void resource_list_purge(struct resource_list *rl);
int resource_list_print_type(struct resource_list *rl,
const char *name, int type,
const char *format);