---
name: "bus_release_resource"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/bus_release_resource"
---

# bus\_release\_resource(9)

release resources on a bus

## NAME

**bus\_release\_resource** – release resources on a bus

## SYNOPSIS

**#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*, *int type*, *int rid*, *struct resource \*r*);

## DESCRIPTION

Free a resource allocated by [bus\_alloc\_resource(9)](/bus_alloc_resource/9.md). The resource must not be in use on release, i.e., call an appropriate function before (e.g. [bus\_teardown\_intr(9)](/bus_teardown_intr/9.md) for IRQs).

-

  *dev* is the device that owns the resource.

-

  *type* is the type of resource that is released. It must be of the same type you allocated it as before. See [bus\_alloc\_resource(9)](/bus_alloc_resource/9.md) for valid types.

-

  *rid* is the resource ID of the resource. The *rid* value must be the same as the one returned by [bus\_alloc\_resource(9)](/bus_alloc_resource/9.md).

-

  *r* is the pointer to *struct* *res*, i.e., the resource itself, returned by [bus\_alloc\_resource(9)](/bus_alloc_resource/9.md).

## 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, SYS_RES_IRQ, foosoftc->irqid,
		foosoftc->irqres);
	/* release I/O port resource */
	bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
		foosoftc->portres);
```

## SEE ALSO

[bus\_alloc\_resource(9)](/bus_alloc_resource/9.md), [device(9)](/device/9.md), [driver(9)](/driver/9.md)

## AUTHORS

This manual page was written by Alexander Langer ⟨alex@big.endian.de⟩.
