xref: /freebsd/share/man/man9/bus_release_resource.9 (revision 5b56413d04e608379c9a306373554a8e4d321bc0)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2000 Alexander Langer
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd March 13, 2024
30.Dt BUS_RELEASE_RESOURCE 9
31.Os
32.Sh NAME
33.Nm bus_release_resource
34.Nd release resources on a bus
35.Sh SYNOPSIS
36.In sys/param.h
37.In sys/bus.h
38.Pp
39.In machine/bus.h
40.In sys/rman.h
41.In machine/resource.h
42.Ft int
43.Fn bus_release_resource "device_t dev" "struct resource *r"
44.Sh DESCRIPTION
45Free a resource allocated by
46.Xr bus_alloc_resource 9 .
47The resource must not be in use on release, i.e., call an appropriate function
48before (e.g.\&
49.Xr bus_teardown_intr 9
50for IRQs).
51.Bl -item
52.It
53.Fa dev
54is the device that owns the resource.
55.It
56.Fa r
57is the pointer to
58.Va struct resource ,
59i.e., the resource itself,
60returned by
61.Xr bus_alloc_resource 9 .
62.El
63.Sh RETURN VALUES
64.Er EINVAL
65is returned, if the device
66.Fa dev
67has no parent,
68.Dv 0
69otherwise.
70The kernel will panic, if it cannot release the resource.
71.Sh EXAMPLES
72.Bd -literal
73	/* deactivate IRQ */
74	bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
75
76	/* release IRQ resource */
77	bus_release_resource(dev, foosoftc->irqres);
78
79	/* release I/O port resource */
80	bus_release_resource(dev, foosoftc->portres);
81.Ed
82.Sh SEE ALSO
83.Xr bus_alloc_resource 9 ,
84.Xr device 9 ,
85.Xr driver 9
86.Sh AUTHORS
87This manual page was written by
88.An Alexander Langer Aq Mt alex@big.endian.de .
89