Browse Source

Kernel: Remove an unnecessary indirection between timer and scheduler

We don't need a wrapper Function object that just forwards the timer
callback to the scheduler tick function. It already has the same
signature, so we can just plug it in directly. :^)

Same with the clock updating function.
Andreas Kling 5 years ago
parent
commit
1e89f7d64e
2 changed files with 4 additions and 18 deletions
  1. 4 13
      Kernel/Time/TimeManagement.cpp
  2. 0 5
      Kernel/Time/TimeManagement.h

+ 4 - 13
Kernel/Time/TimeManagement.cpp

@@ -194,10 +194,10 @@ bool TimeManagement::probe_and_set_non_legacy_hardware_timers()
         }
     }
 
-    m_system_timer->change_function([](const RegisterState& regs) { update_scheduler_ticks(regs); });
+    m_system_timer->change_function(Scheduler::timer_tick);
     dbg() << "Reset timers";
     m_system_timer->try_to_set_frequency(m_system_timer->calculate_nearest_possible_frequency(1024));
-    m_time_keeper_timer->change_function([](const RegisterState& regs) { update_time(regs); });
+    m_time_keeper_timer->change_function(TimeManagement::update_time);
     m_time_keeper_timer->try_to_set_frequency(OPTIMAL_TICKS_PER_SECOND_RATE);
 
     return true;
@@ -214,8 +214,8 @@ bool TimeManagement::probe_and_set_legacy_hardware_timers()
         }
     }
 
-    m_hardware_timers.append(PIT::initialize([](const RegisterState& regs) { update_time(regs); }));
-    m_hardware_timers.append(RealTimeClock::create([](const RegisterState& regs) { update_scheduler_ticks(regs); }));
+    m_hardware_timers.append(PIT::initialize(TimeManagement::update_time));
+    m_hardware_timers.append(RealTimeClock::create(Scheduler::timer_tick));
     m_time_keeper_timer = m_hardware_timers[0];
     m_system_timer = m_hardware_timers[1];
     return true;
@@ -237,13 +237,4 @@ void TimeManagement::increment_time_since_boot(const RegisterState&)
     }
 }
 
-void TimeManagement::update_scheduler_ticks(const RegisterState& regs)
-{
-    TimeManagement::the().update_ticks(regs);
-}
-
-void TimeManagement::update_ticks(const RegisterState& regs)
-{
-    Scheduler::timer_tick(regs);
-}
 }

+ 0 - 5
Kernel/Time/TimeManagement.h

@@ -57,9 +57,6 @@ public:
     static void update_time(const RegisterState&);
     void increment_time_since_boot(const RegisterState&);
 
-    static void update_scheduler_ticks(const RegisterState& regs);
-    void update_ticks(const RegisterState&);
-
     static void stale_function(const RegisterState&);
     static bool is_hpet_periodic_mode_allowed();
 
@@ -76,8 +73,6 @@ private:
     time_t m_epoch_time { 0 };
     RefPtr<HardwareTimer> m_system_timer;
     RefPtr<HardwareTimer> m_time_keeper_timer;
-    Function<void(RegisterState&)> m_scheduler_ticking { update_time };
-    Function<void(RegisterState&)> m_stale_method { stale_function };
 };
 
 }