Files
serenity/Kernel/Bus/USB/xHCI/xHCIInterrupter.cpp
Liav A. 0482f4e117 Kernel: Remove passing of register state to IRQ handlers
Linux did the same thing 18 years ago and their reasons for the change
are similar to ours - https://github.com/torvalds/linux/commit/7d12e78

Most interrupt handlers (i.e. IRQ handlers) never used the register
state reference anywhere so there's simply no need of passing it around.
I didn't measure the performance boost but surely this change can't make
things worse anyway.
2024-09-01 21:00:18 +02:00

32 lines
807 B
C++

/*
* Copyright (c) 2024, Idan Horowitz <idan.horowitz@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Bus/USB/xHCI/xHCIInterrupter.h>
namespace Kernel::USB {
ErrorOr<NonnullOwnPtr<xHCIInterrupter>> xHCIInterrupter::create(xHCIController& controller, u16 interrupter_id)
{
auto irq = TRY(controller.allocate_irq(0));
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) xHCIInterrupter(controller, interrupter_id, irq)));
}
xHCIInterrupter::xHCIInterrupter(xHCIController& controller, u16 interrupter_id, u16 irq)
: PCI::IRQHandler(controller, irq)
, m_controller(controller)
, m_interrupter_id(interrupter_id)
{
enable_irq();
}
bool xHCIInterrupter::handle_irq()
{
m_controller.handle_interrupt({}, m_interrupter_id);
return true;
}
}