bus_release_resource9
Release resources on a bus
Usage
#include <sys/param.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
int
bus_release_resource(device_t dev, struct resource *r);
Overview
Free a resource allocated by bus_alloc_resource(9). The resource must not be in use on release, i.e., call an appropriate function before (e.g. bus_teardown_intr(9) for IRQs).
-
dev is the device that owns the resource.
-
r is the pointer to struct resource, i.e., the resource itself, returned by bus_alloc_resource(9).
Return values
EINVAL is returned, if the device dev has no parent, 0 otherwise. The kernel will panic, if it cannot release the resource.
Examples
/* deactivate IRQ */ bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid); /* release IRQ resource */ bus_release_resource(dev, foosoftc->irqres); /* release I/O port resource */ bus_release_resource(dev, foosoftc->portres);
Releases
69 releases since FreeBSD 4.1-RELEASE; the text changed 38 times.