Kernel: Remove "stale callback" concept from time management

If a hardware timer doesn't have a callback registered, it's now simply
represented by a null m_callback.
This commit is contained in:
Andreas Kling 2020-04-16 18:20:27 +02:00
parent 4b1f056e3a
commit b035267afa
Notes: sideshowbarker 2024-07-19 07:32:42 +09:00
6 changed files with 7 additions and 11 deletions

View file

@ -34,11 +34,11 @@ namespace Kernel {
NonnullRefPtr<HPETComparator> HPETComparator::create(u8 number, u8 irq, bool periodic_capable)
{
return adopt(*new HPETComparator(number, irq, periodic_capable, [](const RegisterState& regs) { TimeManagement::stale_function(regs); }));
return adopt(*new HPETComparator(number, irq, periodic_capable));
}
HPETComparator::HPETComparator(u8 number, u8 irq, bool periodic_capable, Function<void(const RegisterState&)> callback)
: HardwareTimer(irq, move(callback))
HPETComparator::HPETComparator(u8 number, u8 irq, bool periodic_capable)
: HardwareTimer(irq)
, m_periodic(false)
, m_periodic_capable(periodic_capable)
, m_comparator_number(number)

View file

@ -58,7 +58,7 @@ public:
private:
void set_new_countdown();
virtual void handle_irq(const RegisterState&) override;
HPETComparator(u8 number, u8 irq, bool periodic_capable, Function<void(const RegisterState&)> callback);
HPETComparator(u8 number, u8 irq, bool periodic_capable);
bool m_periodic : 1;
bool m_periodic_capable : 1;
bool m_edge_triggered : 1;

View file

@ -37,7 +37,8 @@ HardwareTimer::HardwareTimer(u8 irq_number, Function<void(const RegisterState&)>
void HardwareTimer::handle_irq(const RegisterState& regs)
{
m_callback(regs);
if (!m_callback)
m_callback(regs);
}
const char* HardwareTimer::purpose() const

View file

@ -62,7 +62,7 @@ public:
virtual size_t calculate_nearest_possible_frequency(size_t frequency) const = 0;
protected:
HardwareTimer(u8 irq_number, Function<void(const RegisterState&)>);
HardwareTimer(u8 irq_number, Function<void(const RegisterState&)> = nullptr);
//^IRQHandler
virtual void handle_irq(const RegisterState&) override;
u64 m_frequency { OPTIMAL_TICKS_PER_SECOND_RATE };

View file

@ -90,10 +90,6 @@ time_t TimeManagement::boot_time() const
return RTC::boot_time();
}
void TimeManagement::stale_function(const RegisterState&)
{
}
TimeManagement::TimeManagement(bool probe_non_legacy_hardware_timers)
{
if (ACPI::is_enabled()) {

View file

@ -57,7 +57,6 @@ public:
static void update_time(const RegisterState&);
void increment_time_since_boot(const RegisterState&);
static void stale_function(const RegisterState&);
static bool is_hpet_periodic_mode_allowed();
private: