From 9758b6cc8767cdfbc2a92dd6247c9af3370c2756 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 23 Jan 2012 00:50:25 +0000 Subject: [PATCH] [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 --- ntoskrnl/io/pnpmgr/pnpmgr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/pnpmgr.c b/ntoskrnl/io/pnpmgr/pnpmgr.c index 8a7df5827ec..9d20b971ff0 100644 --- a/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -1824,14 +1824,11 @@ IopHandleDeviceRemoval( } } - if (!Found) + if (!Found && !(Child->Flags & DNF_WILL_BE_REMOVED)) { /* Send removal IRPs to all of its children */ IopPrepareDeviceForRemoval(Child->PhysicalDeviceObject, TRUE); - /* Set the flag */ - Child->Flags |= DNF_WILL_BE_REMOVED; - /* Send the surprise removal IRP */ IopSendSurpriseRemoval(Child->PhysicalDeviceObject); @@ -4166,6 +4163,7 @@ IopPrepareDeviceForRemoval(IN PDEVICE_OBJECT DeviceObject, BOOLEAN Force) return Status; } + DeviceNode->Flags |= DNF_WILL_BE_REMOVED; if (DeviceRelations) IopSendRemoveDeviceRelations(DeviceRelations); IopSendRemoveChildDevices(DeviceNode); @@ -4186,7 +4184,6 @@ IopRemoveDevice(PDEVICE_NODE DeviceNode) IopSendRemoveDevice(DeviceNode->PhysicalDeviceObject); IopQueueTargetDeviceEvent(&GUID_DEVICE_SAFE_REMOVAL, &DeviceNode->InstancePath); - DeviceNode->Flags |= DNF_WILL_BE_REMOVED; return STATUS_SUCCESS; } -- 2.17.1