[PATCH] hardirq.h clean up

From: Steven Rostedt
Date: Fri Oct 31 2008 - 00:17:21 EST



This patch converts the CPP macros of __irq_enter, __irq_exit,
nmi_enter, and nmi_exit into static inlines.

Signed-off-by: Steven Rostedt <srostedt@xxxxxxxxxx>
---
include/linux/hardirq.h | 53 ++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 26 deletions(-)

Index: linux-tip.git/include/linux/hardirq.h
===================================================================
--- linux-tip.git.orig/include/linux/hardirq.h 2008-10-30 10:27:09.000000000 -0400
+++ linux-tip.git/include/linux/hardirq.h 2008-10-31 00:07:46.000000000 -0400
@@ -133,13 +133,13 @@ extern void rcu_irq_exit(void);
* always balanced, so the interrupted value of ->hardirq_context
* will always be restored.
*/
-#define __irq_enter() \
- do { \
- rcu_irq_enter(); \
- account_system_vtime(current); \
- add_preempt_count(HARDIRQ_OFFSET); \
- trace_hardirq_enter(); \
- } while (0)
+static inline void __irq_enter(void)
+{
+ rcu_irq_enter();
+ account_system_vtime(current);
+ add_preempt_count(HARDIRQ_OFFSET);
+ trace_hardirq_enter();
+}

/*
* Enter irq context (on NO_HZ, update jiffies):
@@ -149,30 +149,31 @@ extern void irq_enter(void);
/*
* Exit irq context without processing softirqs:
*/
-#define __irq_exit() \
- do { \
- trace_hardirq_exit(); \
- account_system_vtime(current); \
- sub_preempt_count(HARDIRQ_OFFSET); \
- rcu_irq_exit(); \
- } while (0)
+static inline void __irq_exit(void)
+{
+ trace_hardirq_exit();
+ account_system_vtime(current);
+ sub_preempt_count(HARDIRQ_OFFSET);
+ rcu_irq_exit();
+}

/*
* Exit irq context and process softirqs if needed:
*/
extern void irq_exit(void);

-#define nmi_enter() \
- do { \
- ftrace_nmi_enter(); \
- lockdep_off(); \
- __irq_enter(); \
- } while (0)
-#define nmi_exit() \
- do { \
- __irq_exit(); \
- lockdep_on(); \
- ftrace_nmi_exit(); \
- } while (0)
+static inline void nmi_enter(void)
+{
+ ftrace_nmi_enter();
+ lockdep_off();
+ __irq_enter();
+}
+
+static inline void nmi_exit(void)
+{
+ __irq_exit();
+ lockdep_on();
+ ftrace_nmi_exit();
+}

#endif /* LINUX_HARDIRQ_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/