Another way of doing this (stylistically) would be:
switch (Type)
{
case NdisWorkItemRequest:
if (Adapter->NdisMiniportBlock.PendingRequest ||
MiniGetFirstWorkItem(Adapter, NdisWorkItemRequest))
Busy = TRUE;
break
case ...:
}
On Nov 29, 2008, at 4:51 AM, cgutman(a)svn.reactos.org wrote:
Author: cgutman
Date: Fri Nov 28 19:51:19 2008
New Revision: 37713
+BOOLEAN
+MiniIsBusy(
+ PLOGICAL_ADAPTER Adapter,
+ NDIS_WORK_ITEM_TYPE Type)
+{
+ BOOLEAN Busy = FALSE;
+ KIRQL OldIrql;
+
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
+
+ if (Type == NdisWorkItemRequest &&
+ (Adapter->NdisMiniportBlock.PendingRequest ||
MiniGetFirstWorkItem(Adapter, NdisWorkItemRequest)))
+ {
+ Busy = TRUE;
+ }
+ else if (Type == NdisWorkItemSend &&
+ (Adapter->NdisMiniportBlock.FirstPendingPacket ||
MiniGetFirstWorkItem(Adapter, NdisWorkItemSend)))
+ {
+ Busy = TRUE;
+ }
+ else if (Type == NdisWorkItemResetRequested &&
+ (Adapter->NdisMiniportBlock.ResetStatus ==
NDIS_STATUS_PENDING || MiniGetFirstWorkItem(Adapter,
NdisWorkItemResetRequested)))
+ {
+ Busy = TRUE;
+ }
+
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
+
+ return Busy;
+}