mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-14 19:06:55 +02:00
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.
32 lines
807 B
C++
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;
|
|
}
|
|
|
|
}
|