Commit 0718467c authored by Li Zhong's avatar Li Zhong Committed by Ingo Molnar

x86/nmi: Clean up register_nmi_handler() usage

Implement a cleaner and easier to maintain version for the section
warning fixes implemented in commit eeaaa96a
("x86/nmi: Fix section mismatch warnings on 32-bit").
Signed-off-by: default avatarLi Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: default avatarDon Zickus <dzickus@redhat.com>
Cc: Jan Beulich <JBeulich@suse.com>
Link: http://lkml.kernel.org/r/1340049393-17771-1-git-send-email-dzickus@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 6a991acc
...@@ -44,23 +44,9 @@ struct nmiaction { ...@@ -44,23 +44,9 @@ struct nmiaction {
const char *name; const char *name;
}; };
#define register_nmi_handler(t, fn, fg, n) \ #define register_nmi_handler(t, fn, fg, n, init...) \
({ \ ({ \
static struct nmiaction fn##_na = { \ static struct nmiaction init fn##_na = { \
.handler = (fn), \
.name = (n), \
.flags = (fg), \
}; \
__register_nmi_handler((t), &fn##_na); \
})
/*
* For special handlers that register/unregister in the
* init section only. This should be considered rare.
*/
#define register_nmi_handler_initonly(t, fn, fg, n) \
({ \
static struct nmiaction fn##_na __initdata = { \
.handler = (fn), \ .handler = (fn), \
.name = (n), \ .name = (n), \
.flags = (fg), \ .flags = (fg), \
......
...@@ -42,7 +42,8 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs) ...@@ -42,7 +42,8 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs)
static void __init init_nmi_testsuite(void) static void __init init_nmi_testsuite(void)
{ {
/* trap all the unknown NMIs we may generate */ /* trap all the unknown NMIs we may generate */
register_nmi_handler_initonly(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk",
__initdata);
} }
static void __init cleanup_nmi_testsuite(void) static void __init cleanup_nmi_testsuite(void)
...@@ -64,8 +65,8 @@ static void __init test_nmi_ipi(struct cpumask *mask) ...@@ -64,8 +65,8 @@ static void __init test_nmi_ipi(struct cpumask *mask)
{ {
unsigned long timeout; unsigned long timeout;
if (register_nmi_handler_initonly(NMI_LOCAL, test_nmi_ipi_callback, if (register_nmi_handler(NMI_LOCAL, test_nmi_ipi_callback,
NMI_FLAG_FIRST, "nmi_selftest")) { NMI_FLAG_FIRST, "nmi_selftest", __initdata)) {
nmi_fail = FAILURE; nmi_fail = FAILURE;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment