bus_release_resource(9)

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.

  1. 4.1–4.3
  2. 4.4
  3. 4.5–4.11
  4. 5.0–5.2.1
  5. 5.3–5.5
  6. 6.0–6.3
  7. 6.4
  8. 7.0
  9. 7.1
  10. 7.2
  11. 7.3
  12. 7.4
  13. 8.0
  14. 8.1
  15. 8.2
  16. 8.3
  17. 8.4
  18. 9.0
  19. 9.1
  20. 9.2
  21. 9.3
  22. 10.0
  23. 10.1
  24. 10.2
  25. 10.3
  26. 10.4
  27. 11.0
  28. 11.1
  29. 11.2
  30. 11.3
  31. 11.4
  32. 12.0
  33. 12.1
  34. 12.2
  35. 12.3
  36. 12.4
  37. 13.0–13.2
  38. 13.3–14.5
  39. 15.0–16.0

Authors

This manual page was written by Alexander Langer ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.