From 4a464d3b435ff2839d13677f2d2b9e73a3f2cc92 Mon Sep 17 00:00:00 2001 From: imp Date: Wed, 19 Jan 2005 06:52:19 +0000 Subject: [PATCH] Introduce bus_free_resource. It is a convenience function which wraps bus_release_resource by grabbing the rid from the resource. --- sys/kern/subr_bus.c | 8 ++++++++ sys/sys/bus.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index be02279c0082..182f63767d7d 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -4017,3 +4017,11 @@ bus_data_generation_update(void) { bus_data_generation++; } + +int +bus_free_resource(device_t dev, int type, struct resource *r) +{ + if (r == NULL) + return (0); + return (bus_release_resource(dev, type, rman_get_rid(r), r)); +} diff --git a/sys/sys/bus.h b/sys/sys/bus.h index f360b39d45a7..c73b65faf610 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -301,6 +301,7 @@ int bus_deactivate_resource(device_t dev, int type, int rid, struct resource *r); int bus_release_resource(device_t dev, int type, int rid, struct resource *r); +int bus_free_resource(device_t dev, int type, struct resource *r); int bus_setup_intr(device_t dev, struct resource *r, int flags, driver_intr_t handler, void *arg, void **cookiep); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie);