diff options
author | Akinobu Mita <mita@fixstars.com> | 2007-04-23 15:08:26 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@klappe.arndb.de> | 2007-04-23 15:18:59 -0400 |
commit | fe8a29db5bce1b5bd1ceb85fd153fac52cdab7b2 (patch) | |
tree | d0f91cbb7c1181d160750a2d93c18575f13ab324 /arch/powerpc | |
parent | 6cf2179202cf706471777ad6ee5d0377d5990ab7 (diff) |
[POWERPC] spufs: enable SPU coredump for kernel-builtin spufs
spu_coredump_calls.owner is NULL in case of a builtin spufs,
so the checks in here break.
Check for the availability of the spu_coredump_calls variable
instead.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spu_coredump.c | 34 |
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 | ||
29 | static struct spu_coredump_calls spu_coredump_calls; | 29 | static struct spu_coredump_calls *spu_coredump_calls; |
30 | static DEFINE_MUTEX(spu_coredump_mutex); | 30 | static DEFINE_MUTEX(spu_coredump_mutex); |
31 | 31 | ||
32 | int arch_notes_size(void) | 32 | int 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 | ||
47 | void arch_write_notes(struct file *file) | 46 | void 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 | ||
59 | int register_arch_coredump_calls(struct spu_coredump_calls *calls) | 56 | int 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 | } |
71 | EXPORT_SYMBOL_GPL(register_arch_coredump_calls); | 69 | EXPORT_SYMBOL_GPL(register_arch_coredump_calls); |
72 | 70 | ||
73 | void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) | 71 | void 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 | } |
81 | EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); | 79 | EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); |