diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:25:59 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:25:59 -0400 |
commit | 4483b159168d3db41458925512523e44d0d49cd4 (patch) | |
tree | 9f03be0279218b7eebf6e339d3c81940df74ea87 /arch | |
parent | ea7a8463be6b5dd824bdf42b8f2af1d34f157877 (diff) |
MIPS: Provide more elevant interface cu2_notifier for CP2 extensions.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Patchwork: https://patchwork.linux-mips.org/patch/1504/
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/cavium-octeon/cpu.c | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/cop2.h | 12 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 7 |
3 files changed, 14 insertions, 11 deletions
diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c index b6df5387e855..c664c8cc2b42 100644 --- a/arch/mips/cavium-octeon/cpu.c +++ b/arch/mips/cavium-octeon/cpu.c | |||
@@ -41,12 +41,8 @@ static int cnmips_cu2_call(struct notifier_block *nfb, unsigned long action, | |||
41 | return NOTIFY_OK; /* Let default notifier send signals */ | 41 | return NOTIFY_OK; /* Let default notifier send signals */ |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct notifier_block cnmips_cu2_notifier = { | ||
45 | .notifier_call = cnmips_cu2_call, | ||
46 | }; | ||
47 | |||
48 | static int cnmips_cu2_setup(void) | 44 | static int cnmips_cu2_setup(void) |
49 | { | 45 | { |
50 | return register_cu2_notifier(&cnmips_cu2_notifier); | 46 | return cu2_notifier(cnmips_cu2_call, 0); |
51 | } | 47 | } |
52 | early_initcall(cnmips_cu2_setup); | 48 | early_initcall(cnmips_cu2_setup); |
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h index 6b04c98b7fad..2cb2f0c2c4f8 100644 --- a/arch/mips/include/asm/cop2.h +++ b/arch/mips/include/asm/cop2.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef __ASM_COP2_H | 9 | #ifndef __ASM_COP2_H |
10 | #define __ASM_COP2_H | 10 | #define __ASM_COP2_H |
11 | 11 | ||
12 | #include <linux/notifier.h> | ||
13 | |||
12 | enum cu2_ops { | 14 | enum cu2_ops { |
13 | CU2_EXCEPTION, | 15 | CU2_EXCEPTION, |
14 | CU2_LWC2_OP, | 16 | CU2_LWC2_OP, |
@@ -20,4 +22,14 @@ enum cu2_ops { | |||
20 | extern int register_cu2_notifier(struct notifier_block *nb); | 22 | extern int register_cu2_notifier(struct notifier_block *nb); |
21 | extern int cu2_notifier_call_chain(unsigned long val, void *v); | 23 | extern int cu2_notifier_call_chain(unsigned long val, void *v); |
22 | 24 | ||
25 | #define cu2_notifier(fn, pri) \ | ||
26 | ({ \ | ||
27 | static struct notifier_block fn##_nb __cpuinitdata = { \ | ||
28 | .notifier_call = fn, \ | ||
29 | .priority = pri \ | ||
30 | }; \ | ||
31 | \ | ||
32 | register_cu2_notifier(&fn##_nb); \ | ||
33 | }) | ||
34 | |||
23 | #endif /* __ASM_COP2_H */ | 35 | #endif /* __ASM_COP2_H */ |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 852780868fb4..1515b673179d 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -907,11 +907,6 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action, | |||
907 | return NOTIFY_OK; | 907 | return NOTIFY_OK; |
908 | } | 908 | } |
909 | 909 | ||
910 | static struct notifier_block default_cu2_notifier = { | ||
911 | .notifier_call = default_cu2_call, | ||
912 | .priority = 0x80000000, /* Run last */ | ||
913 | }; | ||
914 | |||
915 | asmlinkage void do_cpu(struct pt_regs *regs) | 910 | asmlinkage void do_cpu(struct pt_regs *regs) |
916 | { | 911 | { |
917 | unsigned int __user *epc; | 912 | unsigned int __user *epc; |
@@ -1734,5 +1729,5 @@ void __init trap_init(void) | |||
1734 | 1729 | ||
1735 | sort_extable(__start___dbe_table, __stop___dbe_table); | 1730 | sort_extable(__start___dbe_table, __stop___dbe_table); |
1736 | 1731 | ||
1737 | register_cu2_notifier(&default_cu2_notifier); | 1732 | cu2_notifier(default_cu2_call, 0x80000000); /* Run last */ |
1738 | } | 1733 | } |