xref: /freebsd/share/man/man9/bus_release_resource.9 (revision 1c05a6ea6b849ff95e539c31adea887c644a6a01)
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.\" $FreeBSD$
30.\"
31.Dd May 18, 2000
32.Dt BUS_RELEASE_RESOURCE 9
33.Os
34.Sh NAME
35.Nm bus_release_resource
36.Nd release resources on a bus
37.Sh SYNOPSIS
38.In sys/param.h
39.In sys/bus.h
40.Pp
41.In machine/bus.h
42.In sys/rman.h
43.In machine/resource.h
44.Ft int
45.Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r"
46.Sh DESCRIPTION
47Free a resource allocated by
48.Xr bus_alloc_resource 9 .
49The resource must not be in use on release, i.e., call an appropriate function
50before (e.g.\&
51.Xr bus_teardown_intr 9
52for IRQs).
53.Bl -item
54.It
55.Fa dev
56is the device that owns the resource.
57.It
58.Fa type
59is the type of resource that is released.
60It must be of the same type you allocated it as before.
61See
62.Xr bus_alloc_resource 9
63for valid types.
64.It
65.Fa rid
66is the resource ID of the resource.
67The
68.Fa rid
69value must be the same as the one returned by
70.Xr bus_alloc_resource 9 .
71.It
72.Fa r
73is the pointer to
74.Va struct resource ,
75i.e., the resource itself,
76returned by
77.Xr bus_alloc_resource 9 .
78.El
79.Sh RETURN VALUES
80.Er EINVAL
81is returned, if the device
82.Fa dev
83has no parent,
84.Dv 0
85otherwise.
86The kernel will panic, if it cannot release the resource.
87.Sh EXAMPLES
88.Bd -literal
89	/* deactivate IRQ */
90	bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
91
92	/* release IRQ resource */
93	bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
94		foosoftc->irqres);
95
96	/* release I/O port resource */
97	bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
98		foosoftc->portres);
99.Ed
100.Sh SEE ALSO
101.Xr bus_alloc_resource 9 ,
102.Xr device 9 ,
103.Xr driver 9
104.Sh AUTHORS
105This manual page was written by
106.An Alexander Langer Aq Mt alex@big.endian.de .
107