1ddi_removing_power(9F) Kernel Functions for Drivers ddi_removing_power(9F)
2
3
4
6 ddi_removing_power - check whether DDI_SUSPEND might result in power
7 being removed from a device
8
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13
14
15 int ddi_removing_power(dev_info_t *dip);
16
17
19 Solaris DDI specific (Solaris DDI)
20
22 The ddi_removing_power() function indicates whether a currently pending
23 call into a driver's detach(9E) entry point with a command of DDI_SUS‐
24 PEND is likely to result in power being removed from the device.
25
26
27 ddi_removing_power() can return true and power still not be removed
28 from the device due to a failure to suspend and power off the system.
29
31 The ddi_removing_power() function supports the following parameter:
32
33 dip pointer to the device's dev_info structure
34
35
37 The ddi_removing_power() function returns:
38
39 1 Power might be removed by the framework as a result of the pending
40 DDI_SUSPEND call.
41
42
43 0 Power will not be removed by the framework as a result of the
44 pending DDI_SUSPEND call.
45
46
48 Example 1 Protecting a Tape from Abrupt Power Removal
49
50
51 A tape driver that has hardware that would damage the tape if power is
52 removed might include this code in its detach(9E) code:
53
54
55 int
56 xxdetach(dev_info_t *dip, ddi_detach_cmd_t cmd)
57 {
58
59 ...
60 case DDI_SUSPEND:
61 /*
62 * We do not allow DDI_SUSPEND if power will be removed and
63 * we have a device that damages tape when power is removed
64 * We do support DDI_SUSPEND for Device Reconfiguration,
65 * however.
66 */
67 if (ddi_removing_power(dip) && xxdamages_tape(dip))
68 return (DDI_FAILURE);
69 ...
70
71
73 See attributes(5) for descriptions of the following attributes:
74
75
76
77
78 ┌─────────────────────────────┬─────────────────────────────┐
79 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
80 ├─────────────────────────────┼─────────────────────────────┤
81 │Interface Stability │Committed │
82 └─────────────────────────────┴─────────────────────────────┘
83
85 attributes(5), cpr(7), attach(9E), detach(9E)
86
87
88 Writing Device Drivers
89
90
91
92SunOS 5.11 14 March 2001 ddi_removing_power(9F)