1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 17:25:07 +00:00
serenity/Kernel/Bus/USB/UHCI/UHCIRootHub.h
Andreas Kling 79fa9765ca Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.

Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
2021-11-08 01:10:53 +01:00

39 lines
865 B
C++

/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <Kernel/Bus/USB/USBHub.h>
#include <Kernel/Bus/USB/USBTransfer.h>
namespace Kernel::USB {
class UHCIController;
class UHCIRootHub {
public:
static ErrorOr<NonnullOwnPtr<UHCIRootHub>> try_create(NonnullRefPtr<UHCIController>);
UHCIRootHub(NonnullRefPtr<UHCIController>);
~UHCIRootHub() = default;
ErrorOr<void> setup(Badge<UHCIController>);
u8 device_address() const { return m_hub->address(); }
ErrorOr<size_t> handle_control_transfer(Transfer& transfer);
void check_for_port_updates() { m_hub->check_for_port_updates(); }
private:
NonnullRefPtr<UHCIController> m_uhci_controller;
RefPtr<Hub> m_hub;
};
}