summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-05-11 01:26:20 +0400
committerMatthew Garrett <mjg@redhat.com>2010-08-03 17:48:45 +0400
commit8cadd2831bf3abc94f4530e7fdbab7bb39b6b27d (patch)
tree4027798914cc3213692a4865797898a5ae0a0b49 /include/linux
parent81f61484f16decba0fb68400fe0036b337b4cdc7 (diff)
downloadlinux-8cadd2831bf3abc94f4530e7fdbab7bb39b6b27d.tar.xz
timer: add on-stack deferrable timer interfaces
In some cases (for instance with kernel threads) it may be desireable to use on-stack deferrable timers to get their power saving benefits. Add interfaces to support this for the IPS driver. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/timer.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h
index ea965b857a50..38cf093ef62c 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -100,6 +100,13 @@ void init_timer_deferrable_key(struct timer_list *timer,
setup_timer_on_stack_key((timer), #timer, &__key, \
(fn), (data)); \
} while (0)
+#define setup_deferrable_timer_on_stack(timer, fn, data) \
+ do { \
+ static struct lock_class_key __key; \
+ setup_deferrable_timer_on_stack_key((timer), #timer, \
+ &__key, (fn), \
+ (data)); \
+ } while (0)
#else
#define init_timer(timer)\
init_timer_key((timer), NULL, NULL)
@@ -111,6 +118,8 @@ void init_timer_deferrable_key(struct timer_list *timer,
setup_timer_key((timer), NULL, NULL, (fn), (data))
#define setup_timer_on_stack(timer, fn, data)\
setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
+#define setup_deferrable_timer_on_stack(timer, fn, data)\
+ setup_deferrable_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
#endif
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
@@ -150,6 +159,12 @@ static inline void setup_timer_on_stack_key(struct timer_list *timer,
init_timer_on_stack_key(timer, name, key);
}
+extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
+ const char *name,
+ struct lock_class_key *key,
+ void (*function)(unsigned long),
+ unsigned long data);
+
/**
* timer_pending - is a timer pending?
* @timer: the timer in question