Kernel/USB: Add new Driver base class

Co-Authored-By: Liav A <liavalb@gmail.com>
Co-Authored-By: Leon Albrecht <leon2002.la@gmail.com>
This commit is contained in:
Jesse Buhagiar 2022-05-17 23:41:25 +10:00 committed by Andrew Kaster
parent 9939b028c6
commit 8883da9586
Notes: sideshowbarker 2024-07-17 02:38:39 +09:00

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2023, Jesse Buhagiar <jesse.buhagiar@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/AtomicRefCounted.h>
#include <AK/Error.h>
#include <AK/NonnullRefPtr.h>
namespace Kernel::USB {
class Device;
struct USBDeviceDescriptor;
class USBInterface;
class Driver : public AtomicRefCounted<Driver> {
public:
Driver(StringView name)
: m_driver_name(name)
{
}
virtual ~Driver() = default;
virtual ErrorOr<void> probe(USB::Device&) = 0;
virtual void detach(USB::Device&) = 0;
StringView name() const { return m_driver_name; }
protected:
StringView const m_driver_name;
};
}