Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / share / man / man9 / bus_release_resource.9
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: src/share/man/man9/bus_release_resource.9,v 1.2.2.5 2001/12/17 11:30:18 ru Exp $
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
47 Free a resource allocated by
48 .Xr bus_alloc_resource 9 .
49 The resource must not be in use on release, i.e. call an appropriate function
50 before (e.g.\&
51 .Xr bus_teardown_intr 9
52 for IRQs).
53 .Bl -item
54 .It
55 .Fa dev
56 is the device that owns the resource.
57 .It
58 .Fa type
59 is the type of resource that is released.
60 It must be of the same type you allocated it as before.
61 See
62 .Xr bus_alloc_resource 9
63 for valid types.
64 .It
65 .Fa rid
66 is the resource ID of the resource.
67 The
68 .Fa rid
69 value must be the same as the one returned by
70 .Xr bus_alloc_resource 9 .
71 .It
72 .Fa r
73 is the pointer to
74 .Va struct res ,
75 i.e. the resource itself,
76 returned by
77 .Xr bus_alloc_resource 9 .
78 .El
79 .Sh RETURN VALUES
80 .Er EINVAL
81 is returned, if the device
82 .Fa dev
83 has no parent,
84 .Dv 0
85 otherwise.
86 The kernel will panic, if it can't 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
105 This man page was written by
106 .An Alexander Langer Aq alex@big.endian.de .