Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/bus_release_resource.9
| Show All 34 Lines | |||||
| .Sh SYNOPSIS | .Sh SYNOPSIS | ||||
| .In sys/param.h | .In sys/param.h | ||||
| .In sys/bus.h | .In sys/bus.h | ||||
| .Pp | .Pp | ||||
| .In machine/bus.h | .In machine/bus.h | ||||
| .In sys/rman.h | .In sys/rman.h | ||||
| .In machine/resource.h | .In machine/resource.h | ||||
| .Ft int | .Ft int | ||||
| .Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r" | .Fn bus_release_resource "device_t dev" "struct resource *r" | ||||
| .Sh DESCRIPTION | .Sh DESCRIPTION | ||||
| Free a resource allocated by | Free a resource allocated by | ||||
| .Xr bus_alloc_resource 9 . | .Xr bus_alloc_resource 9 . | ||||
| The resource must not be in use on release, i.e., call an appropriate function | The resource must not be in use on release, i.e., call an appropriate function | ||||
| before (e.g.\& | before (e.g.\& | ||||
| .Xr bus_teardown_intr 9 | .Xr bus_teardown_intr 9 | ||||
| for IRQs). | for IRQs). | ||||
| .Bl -item | .Bl -item | ||||
| .It | .It | ||||
| .Fa dev | .Fa dev | ||||
| is the device that owns the resource. | is the device that owns the resource. | ||||
| .It | .It | ||||
| .Fa type | |||||
| is the type of resource that is released. | |||||
| It must be of the same type you allocated it as before. | |||||
| See | |||||
| .Xr bus_alloc_resource 9 | |||||
| for valid types. | |||||
| .It | |||||
| .Fa rid | |||||
| is the resource ID of the resource. | |||||
| The | |||||
| .Fa rid | |||||
| value must be the same as the one returned by | |||||
| .Xr bus_alloc_resource 9 . | |||||
| .It | |||||
| .Fa r | .Fa r | ||||
| is the pointer to | is the pointer to | ||||
| .Va struct resource , | .Va struct resource , | ||||
| i.e., the resource itself, | i.e., the resource itself, | ||||
| returned by | returned by | ||||
| .Xr bus_alloc_resource 9 . | .Xr bus_alloc_resource 9 . | ||||
| .El | .El | ||||
| .Sh RETURN VALUES | .Sh RETURN VALUES | ||||
| .Er EINVAL | .Er EINVAL | ||||
| is returned, if the device | is returned, if the device | ||||
| .Fa dev | .Fa dev | ||||
| has no parent, | has no parent, | ||||
| .Dv 0 | .Dv 0 | ||||
| otherwise. | otherwise. | ||||
| The kernel will panic, if it cannot release the resource. | The kernel will panic, if it cannot release the resource. | ||||
| .Sh EXAMPLES | .Sh EXAMPLES | ||||
| .Bd -literal | .Bd -literal | ||||
| /* deactivate IRQ */ | /* deactivate IRQ */ | ||||
| bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid); | bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid); | ||||
| /* release IRQ resource */ | /* release IRQ resource */ | ||||
| bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid, | bus_release_resource(dev, foosoftc->irqres); | ||||
| foosoftc->irqres); | |||||
| /* release I/O port resource */ | /* release I/O port resource */ | ||||
| bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid, | bus_release_resource(dev, foosoftc->portres); | ||||
| foosoftc->portres); | |||||
| .Ed | .Ed | ||||
| .Sh SEE ALSO | .Sh SEE ALSO | ||||
| .Xr bus_alloc_resource 9 , | .Xr bus_alloc_resource 9 , | ||||
| .Xr device 9 , | .Xr device 9 , | ||||
| .Xr driver 9 | .Xr driver 9 | ||||
| .Sh AUTHORS | .Sh AUTHORS | ||||
| This manual page was written by | This manual page was written by | ||||
| .An Alexander Langer Aq Mt alex@big.endian.de . | .An Alexander Langer Aq Mt alex@big.endian.de . | ||||