Return the resource created/found in resource_list_add to avoid an extra

resouce_list_find in some places.

Suggested by: sam
Found by: Coventry Analysis tool.
This commit is contained in:
Warner Losh 2005-04-12 04:22:17 +00:00
parent 7a4cd8d366
commit cdf7c848cf
2 changed files with 5 additions and 3 deletions

View File

@ -2562,7 +2562,7 @@ resource_list_add_next(struct resource_list *rl, int type, u_long start,
* If an existing entry exists with the same type and rid, it will be
* modified using the given values of @p start, @p end and @p
* count. If no entry exists, a new one will be created using the
* given values.
* given values. The resource list entry that matches is then returned.
*
* @param rl the resource list to edit
* @param type the resource entry type (e.g. SYS_RES_MEMORY)
@ -2571,7 +2571,7 @@ resource_list_add_next(struct resource_list *rl, int type, u_long start,
* @param end the end address of the resource
* @param count XXX end-start+1
*/
void
struct resource_list_entry *
resource_list_add(struct resource_list *rl, int type, int rid,
u_long start, u_long end, u_long count)
{
@ -2595,6 +2595,7 @@ resource_list_add(struct resource_list *rl, int type, int rid,
rle->start = start;
rle->end = end;
rle->count = count;
return (rle);
}
/**

View File

@ -206,7 +206,8 @@ STAILQ_HEAD(resource_list, resource_list_entry);
void resource_list_init(struct resource_list *rl);
void resource_list_free(struct resource_list *rl);
void resource_list_add(struct resource_list *rl,
struct resource_list_entry *
resource_list_add(struct resource_list *rl,
int type, int rid,
u_long start, u_long end, u_long count);
int resource_list_add_next(struct resource_list *rl,