[PCI]
[reactos.git] / drivers / bus / pci / fdo.c
index 8a81d7b..28153ec 100644 (file)
@@ -96,7 +96,6 @@ FdoEnumerateDevices(
 {
   PFDO_DEVICE_EXTENSION DeviceExtension;
   PCI_COMMON_CONFIG PciConfig;
-  PLIST_ENTRY CurrentEntry;
   PPCI_DEVICE Device;
   PCI_SLOT_NUMBER SlotNumber;
   ULONG DeviceNumber;
@@ -108,15 +107,6 @@ FdoEnumerateDevices(
 
   DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
-  /* Mark all devices to be removed. If we don't discover them again during
-     enumeration, assume that they have been surprise removed */
-  CurrentEntry = DeviceExtension->DeviceListHead.Flink;
-  while (CurrentEntry != &DeviceExtension->DeviceListHead) {
-    Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
-    Device->RemovePending = TRUE;
-    CurrentEntry = CurrentEntry->Flink;
-  }
-
   DeviceExtension->DeviceListCount = 0;
 
   /* Enumerate devices on the PCI bus */
@@ -190,9 +180,6 @@ FdoEnumerateDevices(
           &DeviceExtension->DeviceListLock);
       }
 
-      /* Don't remove this device */
-      Device->RemovePending = FALSE;
-
       DeviceExtension->DeviceListCount++;
 
       /* Skip to next device if the current one is not a multifunction device */
@@ -354,15 +341,13 @@ FdoQueryBusRelations(
       }
     }
 
-    if (!Device->RemovePending) {
-      /* Reference the physical device object. The PnP manager
-         will dereference it again when it is no longer needed */
-      ObReferenceObject(Device->Pdo);
+    /* Reference the physical device object. The PnP manager
+       will dereference it again when it is no longer needed */
+    ObReferenceObject(Device->Pdo);
 
-      Relations->Objects[i] = Device->Pdo;
+    Relations->Objects[i] = Device->Pdo;
 
-      i++;
-    }
+    i++;
 
     CurrentEntry = CurrentEntry->Flink;
   }
@@ -469,15 +454,12 @@ FdoSetPower(
   IN PIRP Irp,
   PIO_STACK_LOCATION IrpSp)
 {
-  PFDO_DEVICE_EXTENSION DeviceExtension;
   NTSTATUS Status;
 
   UNREFERENCED_PARAMETER(Irp);
 
   DPRINT("Called\n");
 
-  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
   if (IrpSp->Parameters.Power.Type == DevicePowerState) {
     /* FIXME: Set device power state for the device */
     Status = STATUS_UNSUCCESSFUL;
@@ -547,10 +529,6 @@ FdoPnpControl(
   case IRP_MN_QUERY_REMOVE_DEVICE:
     Status = STATUS_NOT_IMPLEMENTED;
     break;
-
-  case IRP_MN_QUERY_STOP_DEVICE:
-    Status = STATUS_NOT_IMPLEMENTED;
-    break;
 #endif
   case IRP_MN_START_DEVICE:
     DPRINT("IRP_MN_START_DEVICE received\n");
@@ -561,12 +539,17 @@ FdoPnpControl(
     Irp->IoStatus.Status = Status;
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
     return Status;
-  case IRP_MN_STOP_DEVICE:
-    /* Currently not supported */
+
+  case IRP_MN_QUERY_STOP_DEVICE:
+    /* We don't support stopping yet */
     Status = STATUS_UNSUCCESSFUL;
     Irp->IoStatus.Status = Status;
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
     return Status;
+    
+  case IRP_MN_STOP_DEVICE:
+    /* We can't fail this one so we fail the QUERY_STOP request that precedes it */
+    break;
 #if 0
   case IRP_MN_SURPRISE_REMOVAL:
     Status = STATUS_NOT_IMPLEMENTED;