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