From ccdc8d9bffdc66f988de20f75c70d2fcb7fca5b6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 12 Jun 2006 04:06:21 +0000 Subject: Add a convenience function rman_init_from_resource for initializing a rman from a resource. Also, include _bus.h since the implementation of bus_space isn't needed here, just the definitions of the types. --- sys/kern/subr_rman.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/kern/subr_rman.c') diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index f5bfd5bc2c70..ce6592ea4d58 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -182,6 +182,16 @@ rman_manage_region(struct rman *rm, u_long start, u_long end) return 0; } +int +rman_init_from_resource(struct rman *rm, struct resource *r) +{ + int rv; + + if ((rv = rman_init(rm)) != 0) + return (rv); + return (rman_manage_region(rm, r->__r_i->r_start, r->__r_i->r_end)); +} + int rman_fini(struct rman *rm) { -- cgit v1.2.3