| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * linux/kernel/time/clockevents.c |
|---|
| 3 | | - * |
|---|
| 4 | 3 | * This file contains functions which manage clock event devices. |
|---|
| 5 | 4 | * |
|---|
| 6 | 5 | * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de> |
|---|
| 7 | 6 | * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar |
|---|
| 8 | 7 | * 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. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/clockchips.h> |
|---|
| .. | .. |
|---|
| 39 | 35 | u64 clc = (u64) latch << evt->shift; |
|---|
| 40 | 36 | u64 rnd; |
|---|
| 41 | 37 | |
|---|
| 42 | | - if (unlikely(!evt->mult)) { |
|---|
| 38 | + if (WARN_ON(!evt->mult)) |
|---|
| 43 | 39 | evt->mult = 1; |
|---|
| 44 | | - WARN_ON(1); |
|---|
| 45 | | - } |
|---|
| 46 | 40 | rnd = (u64) evt->mult - 1; |
|---|
| 47 | 41 | |
|---|
| 48 | 42 | /* |
|---|
| .. | .. |
|---|
| 164 | 158 | * on it, so fix it up and emit a warning: |
|---|
| 165 | 159 | */ |
|---|
| 166 | 160 | if (clockevent_state_oneshot(dev)) { |
|---|
| 167 | | - if (unlikely(!dev->mult)) { |
|---|
| 161 | + if (WARN_ON(!dev->mult)) |
|---|
| 168 | 162 | dev->mult = 1; |
|---|
| 169 | | - WARN_ON(1); |
|---|
| 170 | | - } |
|---|
| 171 | 163 | } |
|---|
| 172 | 164 | } |
|---|
| 173 | 165 | } |
|---|
| .. | .. |
|---|
| 315 | 307 | int64_t delta; |
|---|
| 316 | 308 | int rc; |
|---|
| 317 | 309 | |
|---|
| 318 | | - if (unlikely(expires < 0)) { |
|---|
| 319 | | - WARN_ON_ONCE(1); |
|---|
| 310 | + if (WARN_ON_ONCE(expires < 0)) |
|---|
| 320 | 311 | return -ETIME; |
|---|
| 321 | | - } |
|---|
| 322 | 312 | |
|---|
| 323 | 313 | dev->next_event = expires; |
|---|
| 324 | 314 | |
|---|
| .. | .. |
|---|
| 621 | 611 | } |
|---|
| 622 | 612 | |
|---|
| 623 | 613 | #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 | + |
|---|
| 624 | 630 | /** |
|---|
| 625 | 631 | * tick_cleanup_dead_cpu - Cleanup the tick and clockevents of a dead cpu |
|---|
| 626 | 632 | */ |
|---|
| .. | .. |
|---|
| 631 | 637 | |
|---|
| 632 | 638 | raw_spin_lock_irqsave(&clockevents_lock, flags); |
|---|
| 633 | 639 | |
|---|
| 634 | | - tick_shutdown_broadcast_oneshot(cpu); |
|---|
| 635 | | - tick_shutdown_broadcast(cpu); |
|---|
| 636 | 640 | tick_shutdown(cpu); |
|---|
| 637 | 641 | /* |
|---|
| 638 | 642 | * Unregister the clock event devices which were |
|---|