USB: Properly assign IDs to USB Bus Managers (HCI drivers).
Previously they would just get -1, as the BusManager class would request their ID before they had been added to the Stack. Now we add them to the stack inside ::Start(), rather than letting the individual drivers do that just after ::Start(), and then assign the ID there directly.
This commit is contained in:
parent
d6f3954f39
commit
a182f19364
@ -14,7 +14,7 @@ BusManager::BusManager(Stack *stack)
|
|||||||
: fInitOK(false),
|
: fInitOK(false),
|
||||||
fStack(stack),
|
fStack(stack),
|
||||||
fRootHub(NULL),
|
fRootHub(NULL),
|
||||||
fUSBID(fStack->IndexOfBusManager(this))
|
fUSBID((uint32)-1)
|
||||||
{
|
{
|
||||||
mutex_init(&fLock, "usb busmanager lock");
|
mutex_init(&fLock, "usb busmanager lock");
|
||||||
|
|
||||||
@ -253,6 +253,8 @@ BusManager::FreeDevice(Device *device)
|
|||||||
status_t
|
status_t
|
||||||
BusManager::Start()
|
BusManager::Start()
|
||||||
{
|
{
|
||||||
|
fStack->AddBusManager(this);
|
||||||
|
fUSBID = fStack->IndexOfBusManager(this);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,8 +1216,10 @@ EHCI::AddTo(Stack *stack)
|
|||||||
// the bus took it away
|
// the bus took it away
|
||||||
item = new(std::nothrow) pci_info;
|
item = new(std::nothrow) pci_info;
|
||||||
|
|
||||||
bus->Start();
|
if (bus->Start() != B_OK) {
|
||||||
stack->AddBusManager(bus);
|
delete bus;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,8 +647,10 @@ OHCI::AddTo(Stack *stack)
|
|||||||
// the bus took it away
|
// the bus took it away
|
||||||
item = new(std::nothrow) pci_info;
|
item = new(std::nothrow) pci_info;
|
||||||
|
|
||||||
bus->Start();
|
if (bus->Start() != B_OK) {
|
||||||
stack->AddBusManager(bus);
|
delete bus;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1923,8 +1923,10 @@ UHCI::AddTo(Stack *stack)
|
|||||||
// the bus took it away
|
// the bus took it away
|
||||||
item = new(std::nothrow) pci_info;
|
item = new(std::nothrow) pci_info;
|
||||||
|
|
||||||
bus->Start();
|
if (bus->Start() != B_OK) {
|
||||||
stack->AddBusManager(bus);
|
delete bus;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,8 +864,10 @@ XHCI::AddTo(Stack *stack)
|
|||||||
// the bus took it away
|
// the bus took it away
|
||||||
item = new(std::nothrow) pci_info;
|
item = new(std::nothrow) pci_info;
|
||||||
|
|
||||||
bus->Start();
|
if (bus->Start() != B_OK) {
|
||||||
stack->AddBusManager(bus);
|
delete bus;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user