aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2005-04-12 04:22:17 +0000
committerWarner Losh <imp@FreeBSD.org>2005-04-12 04:22:17 +0000
commitcdf7c848cfd89e3130426dc7003fce04ba330692 (patch)
tree51e3519b7059a92f85cdd70846d46aada036d31b
parent7a4cd8d366f73caa3a5f3aed0435291fe3379d2b (diff)
downloadsrc-cdf7c848cfd89e3130426dc7003fce04ba330692.tar.gz
src-cdf7c848cfd89e3130426dc7003fce04ba330692.zip
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.
Notes
Notes: svn path=/head/; revision=144926
-rw-r--r--sys/kern/subr_bus.c5
-rw-r--r--sys/sys/bus.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 438209fde3d9..c08d66b6f64f 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -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);
}
/**
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 99c867056bcc..6a54a728fc87 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -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,