xref: /freebsd/share/man/man9/bus_release_resource.9 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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 May 18, 2000
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" "int type" "int rid" "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 type
57is the type of resource that is released.
58It must be of the same type you allocated it as before.
59See
60.Xr bus_alloc_resource 9
61for valid types.
62.It
63.Fa rid
64is the resource ID of the resource.
65The
66.Fa rid
67value must be the same as the one returned by
68.Xr bus_alloc_resource 9 .
69.It
70.Fa r
71is the pointer to
72.Va struct resource ,
73i.e., the resource itself,
74returned by
75.Xr bus_alloc_resource 9 .
76.El
77.Sh RETURN VALUES
78.Er EINVAL
79is returned, if the device
80.Fa dev
81has no parent,
82.Dv 0
83otherwise.
84The kernel will panic, if it cannot release the resource.
85.Sh EXAMPLES
86.Bd -literal
87	/* deactivate IRQ */
88	bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
89
90	/* release IRQ resource */
91	bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
92		foosoftc->irqres);
93
94	/* release I/O port resource */
95	bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
96		foosoftc->portres);
97.Ed
98.Sh SEE ALSO
99.Xr bus_alloc_resource 9 ,
100.Xr device 9 ,
101.Xr driver 9
102.Sh AUTHORS
103This manual page was written by
104.An Alexander Langer Aq Mt alex@big.endian.de .
105