aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/spu_coredump.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c b/arch/powerpc/platforms/cell/spu_coredump.c
index 6915b418ee73..4fd37ff1e210 100644
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ b/arch/powerpc/platforms/cell/spu_coredump.c
@@ -26,19 +26,18 @@
26 26
27#include <asm/spu.h> 27#include <asm/spu.h>
28 28
29static struct spu_coredump_calls spu_coredump_calls; 29static struct spu_coredump_calls *spu_coredump_calls;
30static DEFINE_MUTEX(spu_coredump_mutex); 30static DEFINE_MUTEX(spu_coredump_mutex);
31 31
32int arch_notes_size(void) 32int arch_notes_size(void)
33{ 33{
34 long ret; 34 long ret;
35 struct module *owner = spu_coredump_calls.owner;
36 35
37 ret = -ENOSYS; 36 ret = -ENOSYS;
38 mutex_lock(&spu_coredump_mutex); 37 mutex_lock(&spu_coredump_mutex);
39 if (owner && try_module_get(owner)) { 38 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
40 ret = spu_coredump_calls.arch_notes_size(); 39 ret = spu_coredump_calls->arch_notes_size();
41 module_put(owner); 40 module_put(spu_coredump_calls->owner);
42 } 41 }
43 mutex_unlock(&spu_coredump_mutex); 42 mutex_unlock(&spu_coredump_mutex);
44 return ret; 43 return ret;
@@ -46,36 +45,35 @@ int arch_notes_size(void)
46 45
47void arch_write_notes(struct file *file) 46void arch_write_notes(struct file *file)
48{ 47{
49 struct module *owner = spu_coredump_calls.owner;
50
51 mutex_lock(&spu_coredump_mutex); 48 mutex_lock(&spu_coredump_mutex);
52 if (owner && try_module_get(owner)) { 49 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
53 spu_coredump_calls.arch_write_notes(file); 50 spu_coredump_calls->arch_write_notes(file);
54 module_put(owner); 51 module_put(spu_coredump_calls->owner);
55 } 52 }
56 mutex_unlock(&spu_coredump_mutex); 53 mutex_unlock(&spu_coredump_mutex);
57} 54}
58 55
59int register_arch_coredump_calls(struct spu_coredump_calls *calls) 56int register_arch_coredump_calls(struct spu_coredump_calls *calls)
60{ 57{
61 if (spu_coredump_calls.owner) 58 int ret = 0;
62 return -EBUSY; 59
63 60
64 mutex_lock(&spu_coredump_mutex); 61 mutex_lock(&spu_coredump_mutex);
65 spu_coredump_calls.arch_notes_size = calls->arch_notes_size; 62 if (spu_coredump_calls)
66 spu_coredump_calls.arch_write_notes = calls->arch_write_notes; 63 ret = -EBUSY;
67 spu_coredump_calls.owner = calls->owner; 64 else
65 spu_coredump_calls = calls;
68 mutex_unlock(&spu_coredump_mutex); 66 mutex_unlock(&spu_coredump_mutex);
69 return 0; 67 return ret;
70} 68}
71EXPORT_SYMBOL_GPL(register_arch_coredump_calls); 69EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
72 70
73void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) 71void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
74{ 72{
75 BUG_ON(spu_coredump_calls.owner != calls->owner); 73 BUG_ON(spu_coredump_calls != calls);
76 74
77 mutex_lock(&spu_coredump_mutex); 75 mutex_lock(&spu_coredump_mutex);
78 spu_coredump_calls.owner = NULL; 76 spu_coredump_calls = NULL;
79 mutex_unlock(&spu_coredump_mutex); 77 mutex_unlock(&spu_coredump_mutex);
80} 78}
81EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); 79EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);