'\" te .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. .TH ddi_removing_power 9F "14 March 2001" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME ddi_removing_power \- check whether \fBDDI_SUSPEND\fR might result in power being removed from a device .SH SYNOPSIS .LP .nf #include #include \fBint\fR \fBddi_removing_power\fR(\fBdev_info_t\fR \fI*dip\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI) .SH DESCRIPTION .sp .LP The \fBddi_removing_power()\fR function indicates whether a currently pending call into a driver's \fBdetach\fR(9E) entry point with a command of \fBDDI_SUSPEND\fR is likely to result in power being removed from the device. .sp .LP \fBddi_removing_power()\fR can return true and power still not be removed from the device due to a failure to suspend and power off the system. .SH PARAMETERS .sp .LP The \fBddi_removing_power()\fR function supports the following parameter: .sp .ne 2 .mk .na \fB\fIdip\fR\fR .ad .RS 7n .rt pointer to the device's \fBdev_info\fR structure .RE .SH RETURN VALUES .sp .LP The \fBddi_removing_power()\fR function returns: .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .RS 5n .rt Power might be removed by the framework as a result of the pending \fBDDI_SUSPEND\fR call. .RE .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 5n .rt Power will not be removed by the framework as a result of the pending \fBDDI_SUSPEND\fR call. .RE .SH EXAMPLES .LP \fBExample 1 \fRProtecting a Tape from Abrupt Power Removal .sp .LP A tape driver that has hardware that would damage the tape if power is removed might include this code in its \fBdetach\fR(9E) code: .sp .in +2 .nf int xxdetach(dev_info_t *dip, ddi_detach_cmd_t cmd) { ... case DDI_SUSPEND: /* * We do not allow DDI_SUSPEND if power will be removed and * we have a device that damages tape when power is removed * We do support DDI_SUSPEND for Device Reconfiguration, * however. */ if (ddi_removing_power(dip) && xxdamages_tape(dip)) return (DDI_FAILURE); ... .fi .in -2 .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBcpr\fR(7), \fBattach\fR(9E), \fBdetach\fR(9E) .sp .LP \fIWriting Device Drivers\fR