clockevents: Implement unbind functionality
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / time / tick-common.c
index c340216..5edfb48 100644 (file)
@@ -205,6 +205,17 @@ static void tick_setup_device(struct tick_device *td,
                tick_setup_oneshot(newdev, handler, next_event);
 }
 
+void tick_install_replacement(struct clock_event_device *newdev)
+{
+       struct tick_device *td = &__get_cpu_var(tick_cpu_device);
+       int cpu = smp_processor_id();
+
+       clockevents_exchange_device(td->evtdev, newdev);
+       tick_setup_device(td, newdev, cpu, cpumask_of(cpu));
+       if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
+               tick_oneshot_notify();
+}
+
 static bool tick_check_percpu(struct clock_event_device *curdev,
                              struct clock_event_device *newdev, int cpu)
 {
@@ -237,6 +248,19 @@ static bool tick_check_preferred(struct clock_event_device *curdev,
 }
 
 /*
+ * Check whether the new device is a better fit than curdev. curdev
+ * can be NULL !
+ */
+bool tick_check_replacement(struct clock_event_device *curdev,
+                           struct clock_event_device *newdev)
+{
+       if (tick_check_percpu(curdev, newdev, smp_processor_id()))
+               return false;
+
+       return tick_check_preferred(curdev, newdev);
+}
+
+/*
  * Check, if the new registered device should be used. Called with
  * clockevents_lock held and interrupts disabled.
  */