hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/kernel/time/clockevents.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
2
- * linux/kernel/time/clockevents.c
3
- *
43 * This file contains functions which manage clock event devices.
54 *
65 * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
76 * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
87 * Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
9
- *
10
- * This code is licenced under the GPL version 2. For details see
11
- * kernel-base/COPYING.
128 */
139
1410 #include <linux/clockchips.h>
....@@ -39,10 +35,8 @@
3935 u64 clc = (u64) latch << evt->shift;
4036 u64 rnd;
4137
42
- if (unlikely(!evt->mult)) {
38
+ if (WARN_ON(!evt->mult))
4339 evt->mult = 1;
44
- WARN_ON(1);
45
- }
4640 rnd = (u64) evt->mult - 1;
4741
4842 /*
....@@ -164,10 +158,8 @@
164158 * on it, so fix it up and emit a warning:
165159 */
166160 if (clockevent_state_oneshot(dev)) {
167
- if (unlikely(!dev->mult)) {
161
+ if (WARN_ON(!dev->mult))
168162 dev->mult = 1;
169
- WARN_ON(1);
170
- }
171163 }
172164 }
173165 }
....@@ -315,10 +307,8 @@
315307 int64_t delta;
316308 int rc;
317309
318
- if (unlikely(expires < 0)) {
319
- WARN_ON_ONCE(1);
310
+ if (WARN_ON_ONCE(expires < 0))
320311 return -ETIME;
321
- }
322312
323313 dev->next_event = expires;
324314
....@@ -621,6 +611,22 @@
621611 }
622612
623613 #ifdef CONFIG_HOTPLUG_CPU
614
+
615
+# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
616
+/**
617
+ * tick_offline_cpu - Take CPU out of the broadcast mechanism
618
+ * @cpu: The outgoing CPU
619
+ *
620
+ * Called on the outgoing CPU after it took itself offline.
621
+ */
622
+void tick_offline_cpu(unsigned int cpu)
623
+{
624
+ raw_spin_lock(&clockevents_lock);
625
+ tick_broadcast_offline(cpu);
626
+ raw_spin_unlock(&clockevents_lock);
627
+}
628
+# endif
629
+
624630 /**
625631 * tick_cleanup_dead_cpu - Cleanup the tick and clockevents of a dead cpu
626632 */
....@@ -631,8 +637,6 @@
631637
632638 raw_spin_lock_irqsave(&clockevents_lock, flags);
633639
634
- tick_shutdown_broadcast_oneshot(cpu);
635
- tick_shutdown_broadcast(cpu);
636640 tick_shutdown(cpu);
637641 /*
638642 * Unregister the clock event devices which were