USB: Put the default pipe's USB ID and cancel its transfers earlier during teardown.

This way, any endpoints or interfaces which are currently using the
default pipe for SetFeature/.../etc. will return immediately and
become unbusy.

Should fix the remaining KDLs in #16794 and #16969.

Change-Id: I6615fc03394a0c50eae1ca7da2fb43f243841613
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4490
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2021-09-20 16:28:03 +00:00
committed by waddlesplash
parent 2ce316ccc8
commit faae5dd726
@@ -326,6 +326,13 @@ Device::Device(Object* parent, int8 hubAddress, uint8 hubPort,
Device::~Device()
{
// Cancel transfers on the default pipe and put its USBID to prevent
// further transfers from being queued.
if (fDefaultPipe != NULL) {
fDefaultPipe->PutUSBID();
fDefaultPipe->CancelQueuedTransfers(true);
}
// Destroy open endpoints. Do not send a device request to unconfigure
// though, since we may be deleted because the device was unplugged already.
Unconfigure(false);
@@ -355,8 +362,6 @@ Device::~Device()
}
// Remove ourselves from the stack before deleting public structures.
if (fDefaultPipe != NULL)
fDefaultPipe->PutUSBID();
PutUSBID();
delete fDefaultPipe;