Commit fe8a29db authored by Akinobu Mita's avatar Akinobu Mita Committed by Arnd Bergmann

[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: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
parent 6cf21792
...@@ -26,19 +26,18 @@ ...@@ -26,19 +26,18 @@
#include <asm/spu.h> #include <asm/spu.h>
static struct spu_coredump_calls spu_coredump_calls; static struct spu_coredump_calls *spu_coredump_calls;
static DEFINE_MUTEX(spu_coredump_mutex); static DEFINE_MUTEX(spu_coredump_mutex);
int arch_notes_size(void) int arch_notes_size(void)
{ {
long ret; long ret;
struct module *owner = spu_coredump_calls.owner;
ret = -ENOSYS; ret = -ENOSYS;
mutex_lock(&spu_coredump_mutex); mutex_lock(&spu_coredump_mutex);
if (owner && try_module_get(owner)) { if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
ret = spu_coredump_calls.arch_notes_size(); ret = spu_coredump_calls->arch_notes_size();
module_put(owner); module_put(spu_coredump_calls->owner);
} }
mutex_unlock(&spu_coredump_mutex); mutex_unlock(&spu_coredump_mutex);
return ret; return ret;
...@@ -46,36 +45,35 @@ int arch_notes_size(void) ...@@ -46,36 +45,35 @@ int arch_notes_size(void)
void arch_write_notes(struct file *file) void arch_write_notes(struct file *file)
{ {
struct module *owner = spu_coredump_calls.owner;
mutex_lock(&spu_coredump_mutex); mutex_lock(&spu_coredump_mutex);
if (owner && try_module_get(owner)) { if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
spu_coredump_calls.arch_write_notes(file); spu_coredump_calls->arch_write_notes(file);
module_put(owner); module_put(spu_coredump_calls->owner);
} }
mutex_unlock(&spu_coredump_mutex); mutex_unlock(&spu_coredump_mutex);
} }
int register_arch_coredump_calls(struct spu_coredump_calls *calls) int register_arch_coredump_calls(struct spu_coredump_calls *calls)
{ {
if (spu_coredump_calls.owner) int ret = 0;
return -EBUSY;
mutex_lock(&spu_coredump_mutex); mutex_lock(&spu_coredump_mutex);
spu_coredump_calls.arch_notes_size = calls->arch_notes_size; if (spu_coredump_calls)
spu_coredump_calls.arch_write_notes = calls->arch_write_notes; ret = -EBUSY;
spu_coredump_calls.owner = calls->owner; else
spu_coredump_calls = calls;
mutex_unlock(&spu_coredump_mutex); mutex_unlock(&spu_coredump_mutex);
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(register_arch_coredump_calls); EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
{ {
BUG_ON(spu_coredump_calls.owner != calls->owner); BUG_ON(spu_coredump_calls != calls);
mutex_lock(&spu_coredump_mutex); mutex_lock(&spu_coredump_mutex);
spu_coredump_calls.owner = NULL; spu_coredump_calls = NULL;
mutex_unlock(&spu_coredump_mutex); mutex_unlock(&spu_coredump_mutex);
} }
EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
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