1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-19 07:37:34 +00:00

Kernel/USB: Tighten up USBManagement enumeration code a bit

This commit is contained in:
Liav A 2021-08-09 23:16:24 +03:00 committed by Andreas Kling
parent 1479ee3f3e
commit d16d116b65

View file

@ -22,9 +22,12 @@ UNMAP_AFTER_INIT USBManagement::USBManagement()
UNMAP_AFTER_INIT void USBManagement::enumerate_controllers() UNMAP_AFTER_INIT void USBManagement::enumerate_controllers()
{ {
if (!kernel_command_line().disable_usb()) { if (kernel_command_line().disable_usb())
return;
PCI::enumerate([this](PCI::Address const& address, PCI::ID) { PCI::enumerate([this](PCI::Address const& address, PCI::ID) {
if (PCI::get_class(address) == 0xc && PCI::get_subclass(address) == 0x3) { if (!(PCI::get_class(address) == 0xc && PCI::get_subclass(address) == 0x3))
return;
if (PCI::get_programming_interface(address) == 0x0) { if (PCI::get_programming_interface(address) == 0x0) {
if (kernel_command_line().disable_uhci_controller()) if (kernel_command_line().disable_uhci_controller())
return; return;
@ -51,9 +54,7 @@ UNMAP_AFTER_INIT void USBManagement::enumerate_controllers()
} }
dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", address, PCI::get_programming_interface(address)); dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", address, PCI::get_programming_interface(address));
}
}); });
}
} }
bool USBManagement::initialized() bool USBManagement::initialized()