aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-04-30 03:55:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:53 -0400
commitc6f3a97f86a5c97be0ca255976110bb9c3cfe669 (patch)
tree95a7bf3c928a85b26aed128786fc09e18bc5dcfc /include
parent691cc54c7d28542434d2b3ee4ddbad6a99312dec (diff)
debugobjects: add timer specific object debugging code
Add calls to the generic object debugging infrastructure and provide fixup functions which allow to keep the system alive when recoverable problems have been detected by the object debugging core code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Greg KH <greg@kroah.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/poison.h7
-rw-r--r--include/linux/timer.h23
2 files changed, 29 insertions, 1 deletions
diff --git a/include/linux/poison.h b/include/linux/poison.h
index a9c31be7052c..9f31683728fd 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -10,6 +10,13 @@
10#define LIST_POISON1 ((void *) 0x00100100) 10#define LIST_POISON1 ((void *) 0x00100100)
11#define LIST_POISON2 ((void *) 0x00200200) 11#define LIST_POISON2 ((void *) 0x00200200)
12 12
13/********** include/linux/timer.h **********/
14/*
15 * Magic number "tsta" to indicate a static timer initializer
16 * for the object debugging code.
17 */
18#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
19
13/********** mm/slab.c **********/ 20/********** mm/slab.c **********/
14/* 21/*
15 * Magic nums for obj red zoning. 22 * Magic nums for obj red zoning.
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 979fefdeb862..d4ba79248a27 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/debugobjects.h>
7 8
8struct tvec_base; 9struct tvec_base;
9 10
@@ -25,6 +26,7 @@ struct timer_list {
25extern struct tvec_base boot_tvec_bases; 26extern struct tvec_base boot_tvec_bases;
26 27
27#define TIMER_INITIALIZER(_function, _expires, _data) { \ 28#define TIMER_INITIALIZER(_function, _expires, _data) { \
29 .entry = { .prev = TIMER_ENTRY_STATIC }, \
28 .function = (_function), \ 30 .function = (_function), \
29 .expires = (_expires), \ 31 .expires = (_expires), \
30 .data = (_data), \ 32 .data = (_data), \
@@ -38,6 +40,17 @@ extern struct tvec_base boot_tvec_bases;
38void init_timer(struct timer_list *timer); 40void init_timer(struct timer_list *timer);
39void init_timer_deferrable(struct timer_list *timer); 41void init_timer_deferrable(struct timer_list *timer);
40 42
43#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
44extern void init_timer_on_stack(struct timer_list *timer);
45extern void destroy_timer_on_stack(struct timer_list *timer);
46#else
47static inline void destroy_timer_on_stack(struct timer_list *timer) { }
48static inline void init_timer_on_stack(struct timer_list *timer)
49{
50 init_timer(timer);
51}
52#endif
53
41static inline void setup_timer(struct timer_list * timer, 54static inline void setup_timer(struct timer_list * timer,
42 void (*function)(unsigned long), 55 void (*function)(unsigned long),
43 unsigned long data) 56 unsigned long data)
@@ -47,6 +60,15 @@ static inline void setup_timer(struct timer_list * timer,
47 init_timer(timer); 60 init_timer(timer);
48} 61}
49 62
63static inline void setup_timer_on_stack(struct timer_list *timer,
64 void (*function)(unsigned long),
65 unsigned long data)
66{
67 timer->function = function;
68 timer->data = data;
69 init_timer_on_stack(timer);
70}
71
50/** 72/**
51 * timer_pending - is a timer pending? 73 * timer_pending - is a timer pending?
52 * @timer: the timer in question 74 * @timer: the timer in question
@@ -164,5 +186,4 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu);
164unsigned long round_jiffies(unsigned long j); 186unsigned long round_jiffies(unsigned long j);
165unsigned long round_jiffies_relative(unsigned long j); 187unsigned long round_jiffies_relative(unsigned long j);
166 188
167
168#endif 189#endif