Print this page
4648 detach(9e): Extra space between 'prefix' and 'detach'
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man9e/detach.9e
+++ new/usr/src/man/man9e/detach.9e
1 1 '\" te
2 2 .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
3 3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 -.TH DETACH 9E "Dec 7, 2003"
6 +.TH DETACH 9E "Jul 25, 2015"
7 7 .SH NAME
8 8 detach \- detach or suspend a device
9 9 .SH SYNOPSIS
10 10 .LP
11 11 .nf
12 12 #include <sys/ddi.h>
13 13 #include <sys/sunddi.h>
14 14
15 15
16 16
17 -\fBint prefix\fR \fBdetach\fR(\fBdev_info_t *\fR \fIdip\fR, \fBddi_detach_cmd_t\fR \fIcmd\fR);
17 +\fBint prefix\fR\fBdetach\fR(\fBdev_info_t *\fR \fIdip\fR, \fBddi_detach_cmd_t\fR \fIcmd\fR);
18 18 .fi
19 19
20 20 .SH INTERFACE LEVEL
21 21 .LP
22 22 Solaris DDI specific (Solaris DDI)
23 23 .SH PARAMETERS
24 24 .ne 2
25 25 .na
26 26 \fB\fIdip\fR\fR
27 27 .ad
28 28 .RS 7n
29 29 A pointer to the device's \fBdev_info\fR structure.
30 30 .RE
31 31
32 32 .sp
33 33 .ne 2
34 34 .na
35 35 \fB\fIcmd\fR\fR
36 36 .ad
37 37 .RS 7n
38 38 Type of detach; the driver should return \fBDDI_FAILURE\fR if any value other
39 39 than \fBDDI_DETACH\fR or \fBDDI_SUSPEND\fR is passed to it.
40 40 .RE
41 41
42 42 .SH DESCRIPTION
43 43 .LP
44 44 The \fBdetach()\fR function complements the \fBattach\fR(9E) routine.
45 45 .SS "DDI_DETACH"
46 46 .LP
47 47 If \fIcmd\fR is set to \fBDDI_DETACH\fR, \fBdetach()\fR is used to remove the
48 48 state associated with a given instance of a device node prior to the removal of
49 49 that instance from the system.
50 50 .sp
51 51 .LP
52 52 The \fBdetach()\fR function will be called once for each instance of the device
53 53 for which there has been a successful \fBattach()\fR, once there are no longer
54 54 any opens on the device. An attached instance of a driver can be successfully
55 55 detached only once. The \fBdetach()\fR function should clean up any per
56 56 instance data initialized in \fBattach\fR(9E) and call \fBkmem_free\fR(9F) to
57 57 free any heap allocations. For information on how to unregister interrupt
58 58 handlers, see \fBddi_add_intr\fR(9F). This should also include putting the
59 59 underlying device into a quiescent state so that it will not generate
60 60 interrupts.
61 61 .sp
62 62 .LP
63 63 Drivers that set up \fBtimeout\fR(9F) routines should ensure that they are
64 64 cancelled before returning \fBDDI_SUCCESS\fR from \fBdetach()\fR.
65 65 .sp
66 66 .LP
67 67 If \fBdetach()\fR determines a particular instance of the device cannot be
68 68 removed when requested because of some exceptional condition, \fBdetach()\fR
69 69 must return \fBDDI_FAILURE\fR, which prevents the particular device instance
70 70 from being detached. This also prevents the driver from being unloaded. A
71 71 driver instance failing the detach must ensure that no per instance data or
72 72 state is modified or freed that would compromise the system or subsequent
73 73 driver operation.
74 74 .sp
75 75 .LP
76 76 The system guarantees that the function will only be called for a particular
77 77 \fBdev_info\fR node after (and not concurrently with) a successful
78 78 \fBattach\fR(9E) of that device. The system also guarantees that \fBdetach()\fR
79 79 will only be called when there are no outstanding \fBopen\fR(9E) calls on the
80 80 device.
81 81 .SS "DDI_SUSPEND"
82 82 .LP
83 83 The \fBDDI_SUSPEND\fR \fIcmd\fR is issued when the entire system is being
84 84 suspended and power removed from it or when the system must be made quiescent.
85 85 It will be issued only to devices which have a \fBreg\fR property or which
86 86 export a \fBpm-hardware-state\fR property with the value needs-suspend-resume.
87 87 .sp
88 88 .LP
89 89 If \fIcmd\fR is set to \fBDDI_SUSPEND\fR, \fBdetach()\fR is used to suspend all
90 90 activity of a device before power is (possibly) removed from the device. The
91 91 steps associated with suspension must include putting the underlying device
92 92 into a quiescent state so that it will not generate interrupts or modify or
93 93 access memory. Once quiescence has been obtained, \fBdetach()\fR can be called
94 94 with outstanding \fBopen\fR(9E) requests. It must save the hardware state of
95 95 the device to memory and block incoming or existing requests until
96 96 \fBattach()\fR is called with \fBDDI_RESUME\fR.
97 97 .sp
98 98 .LP
99 99 If the device is used to store file systems, then after \fBDDI_SUSPEND\fR is
100 100 issued, the device should still honor \fBdump\fR(9E) requests as this entry
101 101 point may be used by suspend-resume operation (see \fBcpr\fR(7)) to save state
102 102 file. It must do this, however, without disturbing the saved hardware state of
103 103 the device.
104 104 .sp
105 105 .LP
106 106 If the device driver uses automatic device Power Management interfaces (driver
107 107 exports \fBpm-components\fR(9P) property), it might need to call
108 108 \fBpm_raise_power\fR(9F) if the current power level is lower than required to
109 109 complete the \fBdump\fR(9E) request.
110 110 .sp
111 111 .LP
112 112 Before returning successfully from a call to \fBdetach()\fR with a command of
113 113 \fBDDI_SUSPEND\fR, the driver must cancel any outstanding timeouts and make any
114 114 driver threads quiescent.
115 115 .sp
116 116 .LP
117 117 If \fBDDI_FAILURE\fR is returned for the \fBDDI_SUSPEND\fR \fIcmd\fR, either
118 118 the operation to suspend the system or to make it quiescent will be aborted.
119 119 .SH RETURN VALUES
120 120 .ne 2
121 121 .na
122 122 \fB\fBDDI_SUCCESS\fR\fR
123 123 .ad
124 124 .RS 15n
125 125 For \fBDDI_DETACH\fR, the state associated with the given device was
126 126 successfully removed. For \fBDDI_SUSPEND\fR, the driver was successfully
127 127 suspended.
128 128 .RE
129 129
130 130 .sp
131 131 .ne 2
132 132 .na
133 133 \fB\fBDDI_FAILURE\fR\fR
134 134 .ad
135 135 .RS 15n
136 136 The operation failed or the request was not understood. The associated state is
137 137 unchanged.
138 138 .RE
139 139
140 140 .SH CONTEXT
141 141 .LP
142 142 This function is called from user context only.
143 143 .SH ATTRIBUTES
144 144 .LP
145 145 See \fBattributes\fR(5) for descriptions of the following attributes:
146 146 .sp
147 147
148 148 .sp
149 149 .TS
150 150 box;
151 151 c | c
152 152 l | l .
153 153 ATTRIBUTE TYPE ATTRIBUTE VALUE
154 154 _
155 155 Interface Stability Committed
156 156 .TE
157 157
158 158 .SH SEE ALSO
159 159 .LP
160 160 \fBcpr\fR(7), \fBpm\fR(7D), \fBpm\fR(9P), \fBpm-components\fR(9P),
161 161 \fBattach\fR(9E), \fBdump\fR(9E), \fBopen\fR(9E), \fBpower\fR(9E),
162 162 \fBddi_add_intr\fR(9F), \fBddi_dev_is_needed\fR(9F), \fBddi_map_regs\fR(9F),
163 163 \fBkmem_free\fR(9F), \fBpm_raise_power\fR(9F), \fBtimeout\fR(9F)
164 164 .sp
165 165 .LP
166 166 \fIWriting Device Drivers\fR
↓ open down ↓ |
139 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX