| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: timer.h,v 1.4 2014/07/16 20:56:25 riastradh Exp $ */ | | 1 | /* $NetBSD: timer.h,v 1.4.2.1 2014/09/21 17:48:40 snj Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -73,32 +73,46 @@ mod_timer(struct timer_list *timer, unsi | | | @@ -73,32 +73,46 @@ mod_timer(struct timer_list *timer, unsi |
73 | | | 73 | |
74 | callout_schedule(&timer->tl_callout, (now < then? (then - now) : 0)); | | 74 | callout_schedule(&timer->tl_callout, (now < then? (then - now) : 0)); |
75 | } | | 75 | } |
76 | | | 76 | |
77 | static inline void | | 77 | static inline void |
78 | mod_timer_pinned(struct timer_list *timer, unsigned long then) | | 78 | mod_timer_pinned(struct timer_list *timer, unsigned long then) |
79 | { | | 79 | { |
80 | | | 80 | |
81 | /* XXX Stay on the same CPU it was originally on... */ | | 81 | /* XXX Stay on the same CPU it was originally on... */ |
82 | mod_timer(timer, then); | | 82 | mod_timer(timer, then); |
83 | } | | 83 | } |
84 | | | 84 | |
85 | static inline void | | 85 | static inline void |
| | | 86 | del_timer(struct timer_list *timer) |
| | | 87 | { |
| | | 88 | |
| | | 89 | callout_stop(&timer->tl_callout); |
| | | 90 | } |
| | | 91 | |
| | | 92 | static inline void |
86 | del_timer_sync(struct timer_list *timer) | | 93 | del_timer_sync(struct timer_list *timer) |
87 | { | | 94 | { |
88 | | | 95 | |
89 | callout_halt(&timer->tl_callout, NULL); | | 96 | callout_halt(&timer->tl_callout, NULL); |
90 | } | | 97 | } |
91 | | | 98 | |
| | | 99 | static inline bool |
| | | 100 | timer_pending(struct timer_list *timer) |
| | | 101 | { |
| | | 102 | |
| | | 103 | return callout_pending(&timer->tl_callout); |
| | | 104 | } |
| | | 105 | |
92 | /* | | 106 | /* |
93 | * XXX This is bogus -- the Linux version does various machinations to | | 107 | * XXX This is bogus -- the Linux version does various machinations to |
94 | * give some jitter so that stuff doesn't wake up all at once. | | 108 | * give some jitter so that stuff doesn't wake up all at once. |
95 | */ | | 109 | */ |
96 | | | 110 | |
97 | static inline unsigned long | | 111 | static inline unsigned long |
98 | round_jiffies_up(unsigned long j) | | 112 | round_jiffies_up(unsigned long j) |
99 | { | | 113 | { |
100 | return roundup(j, hz); | | 114 | return roundup(j, hz); |
101 | } | | 115 | } |
102 | | | 116 | |
103 | static inline unsigned long | | 117 | static inline unsigned long |
104 | round_jiffies_up_relative(unsigned long j) | | 118 | round_jiffies_up_relative(unsigned long j) |