<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY dir=ltr>
<DIV><FONT face=Arial size=2><SPAN class=883194311-07062006>Hi
Fab,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=883194311-07062006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=883194311-07062006>DDK states in <FONT
face="Times New Roman">IoSkipCurrentIrpStackLocation()
description</FONT>:</SPAN></FONT></DIV>
<DIV><FONT><SPAN class=883194311-07062006>
<P><FONT face=Arial size=2>If your driver calls
<B>IoSkipCurrentIrpStackLocation,</B> be careful not to modify the
IO_STACK_LOCATION structure in a way that could inadvertently affect the lower
driver or the system's behavior with respect to that driver. Examples include
modifying the IO_STACK_LOCATION structure's <B>Parameters</B> union or calling
</FONT><A
href="mk:@MSITStore:C:\WINDDK\3790.1830\help\kmarch.chm::/hh/kmarch/k104_478903ab-e597-4df6-a66e-e0c1fbea49d9.xml.htm"><B><FONT
face=Arial size=2>IoMarkIrpPending</FONT></B></A><FONT face=Arial
size=2>.</FONT></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>Look at
hca_set_power(), case DevicePowerState:</FONT></SPAN></P>
<P><SPAN class=883194311-07062006> <FONT face=Arial size=2>we
call IoMarkIrpPending(), then </FONT></SPAN><SPAN
class=883194311-07062006><FONT face=Arial size=2>IoQueueWorkItem( ..,
__PowerDownCb, ..);</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>Then __PowerDownCb
calls IoSkipCurrentIrpStackLocation() and PoCallDriver().</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>Looks like it's a
wrong behaviour.</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>But what's the right
one ?</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>What do you think
about such idea ?</FONT></SPAN></P>
<P><SPAN class=883194311-07062006> <FONT face=Arial size=2>--
set a completion routine in __PowerDownCb();</FONT></SPAN></P>
<P><SPAN class=883194311-07062006> <FONT face=Arial size=2>--
call PoStartNextPowerIrp() in te completion routine.</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>I.e., something like
the following:</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>static void
__PowerDownCb(<BR> IN DEVICE_OBJECT* p_dev_obj,<BR> IN void* context
)<BR>{</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial
size=2> ... // current
stuff<BR></FONT></SPAN><SPAN class=883194311-07062006><FONT face=Arial
size=2> mthca_remove_one( p_ext );</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial
size=2> IoCopyCurrentIrpStackLocationToNext( p_irp
);<BR> IoSetCompletionRoutine( p_irp,
__DevicePowerCbCompletion, NULL, TRUE, TRUE, TRUE
);<BR> PoCallDriver( p_ext->cl_ext.p_next_do, p_irp
);<BR> IoReleaseRemoveLock(
&p_ext->cl_ext.remove_lock, p_irp );</FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial
size=2>}<BR></FONT></SPAN></P>
<P><SPAN class=883194311-07062006><FONT face=Arial size=2>static NTSTATUS
__DevicePowerCbCompletion(<BR> IN DEVICE_OBJECT *p_dev_obj,<BR> IN IRP *p_irp,<BR> IN void *context
)<BR>{<BR> hca_dev_ext_t *p_ext </FONT></SPAN><SPAN
class=883194311-07062006><FONT face=Arial size=2> =
(hca_dev_ext_t*)p_dev_obj->DeviceExtension;<BR></FONT></SPAN><SPAN
class=883194311-07062006><FONT face=Arial
size=2> PoStartNextPowerIrp( p_irp
);<BR> IoCompleteRequest( p_irp, IO_NO_INCREMENT
);<BR> IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp
);<BR> return STATUS_SUCCESS;<BR></FONT></SPAN><SPAN
class=883194311-07062006><FONT face=Arial
size=2>}<BR></P></FONT></SPAN></SPAN></FONT></DIV></BODY></HTML>