[USB-BRINGUP-TRUNK]

- Don't send removal IRPs to device nodes already pending removal
- USB device removal and reinsertion works now

svn path=/branches/usb-bringup-trunk/; revision=55087
This commit is contained in:
Cameron Gutman 2012-01-23 00:50:25 +00:00
parent 3de4023a19
commit 9758b6cc87

View file

@ -1824,14 +1824,11 @@ IopHandleDeviceRemoval(
} }
} }
if (!Found) if (!Found && !(Child->Flags & DNF_WILL_BE_REMOVED))
{ {
/* Send removal IRPs to all of its children */ /* Send removal IRPs to all of its children */
IopPrepareDeviceForRemoval(Child->PhysicalDeviceObject, TRUE); IopPrepareDeviceForRemoval(Child->PhysicalDeviceObject, TRUE);
/* Set the flag */
Child->Flags |= DNF_WILL_BE_REMOVED;
/* Send the surprise removal IRP */ /* Send the surprise removal IRP */
IopSendSurpriseRemoval(Child->PhysicalDeviceObject); IopSendSurpriseRemoval(Child->PhysicalDeviceObject);
@ -4166,6 +4163,7 @@ IopPrepareDeviceForRemoval(IN PDEVICE_OBJECT DeviceObject, BOOLEAN Force)
return Status; return Status;
} }
DeviceNode->Flags |= DNF_WILL_BE_REMOVED;
if (DeviceRelations) if (DeviceRelations)
IopSendRemoveDeviceRelations(DeviceRelations); IopSendRemoveDeviceRelations(DeviceRelations);
IopSendRemoveChildDevices(DeviceNode); IopSendRemoveChildDevices(DeviceNode);
@ -4186,7 +4184,6 @@ IopRemoveDevice(PDEVICE_NODE DeviceNode)
IopSendRemoveDevice(DeviceNode->PhysicalDeviceObject); IopSendRemoveDevice(DeviceNode->PhysicalDeviceObject);
IopQueueTargetDeviceEvent(&GUID_DEVICE_SAFE_REMOVAL, IopQueueTargetDeviceEvent(&GUID_DEVICE_SAFE_REMOVAL,
&DeviceNode->InstancePath); &DeviceNode->InstancePath);
DeviceNode->Flags |= DNF_WILL_BE_REMOVED;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }