Re: Question about IoMarkIrpPending

From: Jackal Huang (huangjj_at_hotmail.com)
Date: 02/10/04


Date: Tue, 10 Feb 2004 09:49:33 +0800

Sorry! I am confused for your description here.

In the XPDDK usb bulk samplecode, the power dispatch routine always
calls IoMarkIrpPending first , calls HandleDeviceSetPower() and then return
pending status for the device set power case of IRP_MN_SET_POWER.

HandleDeviceSetPower() set an IoComplete routine(FinishDevPoUpIrp)
for power on case. Therefore, it did has a completion routine for the
pending
Irp here. FinishDevPoUpIrp calls IoMarkIrpPending if Irp->PendingReturned
is set. Here is my question.

Since the power dispatch routine has called IoMarkIrpPending, its stack
location should has been set SL_PENDING_RETURNED. Why does the
IoComplete routine needs to call IoMarkIrpPending again?

Best Regards

Jacakal Huang

"Doron Holan [MS]" <doronh@nospam.microsoft.com> ...
> i think there is a bit of confusion here. if you mark an irp pending and
> then queue it up and then compolete it later, there is no completion
> routine. you are the owner of the irp and you have pended it. in the
> sample, the driver is sending the irp down the stack. in this case, you
need
> to propagate the pending status up the stack. the pending status of the
irp
> is set on a per stack location basis and this is a cooperative effort.
all
> drivers in the stack must play by the rules (verifier helps here). the
only
> case where you don't have to propagate the pending bit when you send an
irp
> down the stack is if you are synchronously waiting for the irp to complete
> and then are completing the irp in the dispatch routine.
>
> d
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Please reply to newsgroups only.
>
> "Jackal Huang" <huangjj@hotmail.com> wrote in message
> news:uCCv93v7DHA.632@TK2MSFTNGP12.phx.gbl...
> > The rule of calling IoMarkIrpPending has suffered me for a long time.
> > After studied Walter's WDM book 2nd, I understand it more now, but
> > still have some questions.
> >
> > If the dispatch routine has called IoMarkIrpPending and return pending
> > status, does the IoComplete routine still need to check Irp->
> > PendingReturned and call IoMarkIrpPending if the flag is set?
> >
> > According to my understanding, it isn't necessary to call
IoMarkIrpPending
> > in the IoComplete routine since SL_PENDING_RETURNED has been set
> > in the stack location when the dispatch routine called IoMarkIrpPending.
> >
> > In the power management of XPDDK usb bulk sample code, it always
> > calls IoMarkIrpPending and returns pending status for
> > IRP_MN_SET_POWER in its power dispatch routine. In the complete
> > routine of power on case (FinishDevPoUpIrp), it calls IoMarkIrpPending
> > if Irp->PendingReturned is set. Is it a redundant code segment??
> >
> > Please tell me if my understanding is wrong.
> >
> > Best Regards
> >
> > Jackal Huang
> >
> >
>
>



Relevant Pages

  • Re: Question about IoMarkIrpPending
    ... you are the owner of the irp and you have pended it. ... to propagate the pending status up the stack. ... and then are completing the irp in the dispatch routine. ... > The rule of calling IoMarkIrpPending has suffered me for a long time. ...
    (microsoft.public.development.device.drivers)
  • Question about IoMarkIrpPending
    ... The rule of calling IoMarkIrpPending has suffered me for a long time. ... If the dispatch routine has called IoMarkIrpPending and return pending ... in the stack location when the dispatch routine called IoMarkIrpPending. ... IRP_MN_SET_POWER in its power dispatch routine. ...
    (microsoft.public.development.device.drivers)
  • Re: DeviceIoControl blocks even in Overlapped I/O mode? How is this possible?
    ... Omitting the IoMarkIrpPending or doing it after the return from the ... STATUS_PENDING from the dispatch routine. ... STATUS_SUCCESS is returned from one and only one place - a DPC that is ...
    (microsoft.public.development.device.drivers)
  • Re: DeviceIoControl blocks even in Overlapped I/O mode? How is this possible?
    ... Omitting the IoMarkIrpPending or doing it after the return from the ... STATUS_PENDING from the dispatch routine. ... STATUS_SUCCESS is returned from one and only one place - a DPC that is ...
    (microsoft.public.development.device.drivers)