History

[PATCH] remove timer debug field

Remove timer_list.magic and associated debugging code. I originally added this when a spinlock was added to timer_list - this meant that an all-zeroes timer became illegal and init_timer() was required. That spinlock isn't even there any more, although timer.base must now be initialised. I'll keep this debugging code in -mm.

Andrew Morton committed 21 years ago

Commit dfc4f941 parent 89ada673 files · +2 −56Browse files

Unified · Split

3 files
  1. arch/s390/kernel/vtime.c +2 −16
  2. include/linux/timer.h +0 −5
  3. kernel/timer.c +0 −35
arch/s390/kernel/vtime.c+2−16
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <asm/s390_ext.h>
2525 #include <asm/timer.h>
2626
27−#define VTIMER_MAGIC (TIMER_MAGIC + 1)
2827 static ext_int_info_t ext_int_info_timer;
2928 DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
3029
@@ -277,20 +276,12 @@ static void do_cpu_timer_interrupt(struct pt_regs *regs, __u16 error_code) · 246 unmodified lines
277276
278277 void init_virt_timer(struct vtimer_list *timer)
279278 {
280− timer->magic = VTIMER_MAGIC;
281279 timer->function = NULL;
282280 INIT_LIST_HEAD(&timer->entry);
283281 spin_lock_init(&timer->lock);
284282 }
285283 EXPORT_SYMBOL(init_virt_timer);
286284
287−static inline int check_vtimer(struct vtimer_list *timer)
288−{
289− if (timer->magic != VTIMER_MAGIC)
290− return -EINVAL;
291− return 0;
292−}
293−
294285 static inline int vtimer_pending(struct vtimer_list *timer)
295286 {
296287 return (!list_empty(&timer->entry));
@@ -346,7 +337,7 @@ static void internal_add_vtimer(struct vtimer_list *timer) · 49 unmodified lines
346337
347338 static inline int prepare_vtimer(struct vtimer_list *timer)
348339 {
349− if (check_vtimer(timer) || !timer->function) {
340+ if (!timer->function) {
350341 printk("add_virt_timer: uninitialized timer\n");
351342 return -EINVAL;
352343 }
@@ -414,7 +405,7 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires) · 61 unmodified lines
414405 unsigned long flags;
415406 int cpu;
416407
417− if (check_vtimer(timer) || !timer->function) {
408+ if (!timer->function) {
418409 printk("mod_virt_timer: uninitialized timer\n");
419410 return -EINVAL;
420411 }
@@ -481,11 +472,6 @@ int del_virt_timer(struct vtimer_list *timer) · 60 unmodified lines
481472 unsigned long flags;
482473 struct vtimer_queue *vt_list;
483474
484− if (check_vtimer(timer)) {
485− printk("del_virt_timer: timer not initialized\n");
486− return -EINVAL;
487− }
488−
489475 /* check if timer is pending */
490476 if (!vtimer_pending(timer))
491477 return 0;
include/linux/timer.h+0−5
@@ -12,16 +12,12 @@ struct timer_list { · 11 unmodified lines
1212 struct list_head entry;
1313 unsigned long expires;
1414
15− unsigned long magic;
16−
1715 void (*function)(unsigned long);
1816 unsigned long data;
1917
2018 struct timer_base_s *base;
2119 };
2220
23−#define TIMER_MAGIC 0x4b87ad6e
24−
2521 extern struct timer_base_s __init_timer_base;
2622
2723 #define TIMER_INITIALIZER(_function, _expires, _data) { \
@@ -29,7 +25,6 @@ extern struct timer_base_s __init_timer_base; · 1 unmodified line
2925 .expires = (_expires), \
3026 .data = (_data), \
3127 .base = &__init_timer_base, \
32− .magic = TIMER_MAGIC, \
3328 }
3429
3530 #define DEFINE_TIMER(_name, _function, _expires, _data) \
kernel/timer.c+0−35
@@ -91,30 +91,6 @@ static inline void set_running_timer(tvec_base_t *base, · 90 unmodified lines
9191 #endif
9292 }
9393
94−static void check_timer_failed(struct timer_list *timer)
95−{
96− static int whine_count;
97− if (whine_count < 16) {
98− whine_count++;
99− printk("Uninitialised timer!\n");
100− printk("This is just a warning. Your computer is OK\n");
101− printk("function=0x%p, data=0x%lx\n",
102− timer->function, timer->data);
103− dump_stack();
104− }
105− /*
106− * Now fix it up
107− */
108− timer->magic = TIMER_MAGIC;
109−}
110−
111−static inline void check_timer(struct timer_list *timer)
112−{
113− if (timer->magic != TIMER_MAGIC)
114− check_timer_failed(timer);
115−}
116−
117−
11894 static void internal_add_timer(tvec_base_t *base, struct timer_list *timer)
11995 {
12096 unsigned long expires = timer->expires;
@@ -177,7 +153,6 @@ void fastcall init_timer(struct timer_list *timer) · 56 unmodified lines
177153 {
178154 timer->entry.next = NULL;
179155 timer->base = &per_cpu(tvec_bases, raw_smp_processor_id()).t_base;
180− timer->magic = TIMER_MAGIC;
181156 }
182157 EXPORT_SYMBOL(init_timer);
183158
@@ -230,7 +205,6 @@ int __mod_timer(struct timer_list *timer, unsigned long expires) · 46 unmodified lines
230205 int ret = 0;
231206
232207 BUG_ON(!timer->function);
233− check_timer(timer);
234208
235209 base = lock_timer_base(timer, &flags);
236210
@@ -283,9 +257,6 @@ void add_timer_on(struct timer_list *timer, int cpu) · 46 unmodified lines
283257 unsigned long flags;
284258
285259 BUG_ON(timer_pending(timer) || !timer->function);
286−
287− check_timer(timer);
288−
289260 spin_lock_irqsave(&base->t_base.lock, flags);
290261 timer->base = &base->t_base;
291262 internal_add_timer(base, timer);
@@ -316,8 +287,6 @@ int mod_timer(struct timer_list *timer, unsigned long expires) · 24 unmodified lines
316287 {
317288 BUG_ON(!timer->function);
318289
319− check_timer(timer);
320−
321290 /*
322291 * This is a common optimization triggered by the
323292 * networking code - if the timer is re-modified
@@ -348,8 +317,6 @@ int del_timer(struct timer_list *timer) · 24 unmodified lines
348317 unsigned long flags;
349318 int ret = 0;
350319
351− check_timer(timer);
352−
353320 if (timer_pending(timer)) {
354321 base = lock_timer_base(timer, &flags);
355322 if (timer_pending(timer)) {
@@ -412,8 +379,6 @@ out: · 56 unmodified lines
412379 */
413380 int del_timer_sync(struct timer_list *timer)
414381 {
415− check_timer(timer);
416−
417382 for (;;) {
418383 int ret = try_to_del_timer_sync(timer);
419384 if (ret >= 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t