mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
Kernel/USB: Replace PortNumber enum with a raw u8
A hub can technically have up to 255 ports, given that bNbrPorts is a u8 and the DeviceRemovable field is a VLA to support up to 255 ports. Source: USB 2.0 Specification Section 11.23.2.1 That means this enum is not going to scale well in terms of size. Replacing it with a raw u8 allows me to remove the two port assumption and a cast.
This commit is contained in:
parent
86ccacf6b5
commit
b6a2bbba3b
3 changed files with 11 additions and 18 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace Kernel::USB {
|
||||
|
||||
KResultOr<NonnullRefPtr<Device>> Device::try_create(USBController const& controller, PortNumber port, DeviceSpeed speed)
|
||||
KResultOr<NonnullRefPtr<Device>> Device::try_create(USBController const& controller, u8 port, DeviceSpeed speed)
|
||||
{
|
||||
auto pipe_or_error = Pipe::try_create_pipe(controller, Pipe::Type::Control, Pipe::Direction::Bidirectional, 0, 8, 0);
|
||||
if (pipe_or_error.is_error())
|
||||
|
@ -33,7 +33,7 @@ KResultOr<NonnullRefPtr<Device>> Device::try_create(USBController const& control
|
|||
return device.release_nonnull();
|
||||
}
|
||||
|
||||
Device::Device(USBController const& controller, PortNumber port, DeviceSpeed speed, NonnullOwnPtr<Pipe> default_pipe)
|
||||
Device::Device(USBController const& controller, u8 port, DeviceSpeed speed, NonnullOwnPtr<Pipe> default_pipe)
|
||||
: m_device_port(port)
|
||||
, m_device_speed(speed)
|
||||
, m_address(0)
|
||||
|
@ -42,7 +42,7 @@ Device::Device(USBController const& controller, PortNumber port, DeviceSpeed spe
|
|||
{
|
||||
}
|
||||
|
||||
Device::Device(NonnullRefPtr<USBController> controller, u8 address, PortNumber port, DeviceSpeed speed, NonnullOwnPtr<Pipe> default_pipe)
|
||||
Device::Device(NonnullRefPtr<USBController> controller, u8 address, u8 port, DeviceSpeed speed, NonnullOwnPtr<Pipe> default_pipe)
|
||||
: m_device_port(port)
|
||||
, m_device_speed(speed)
|
||||
, m_address(address)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue