]> err.no Git - linux-2.6/commitdiff
[POWERPC] spufs: enable SPU coredump for kernel-builtin spufs
authorAkinobu Mita <mita@fixstars.com>
Mon, 23 Apr 2007 19:08:26 +0000 (21:08 +0200)
committerArnd Bergmann <arnd@klappe.arndb.de>
Mon, 23 Apr 2007 19:18:59 +0000 (21:18 +0200)
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>
arch/powerpc/platforms/cell/spu_coredump.c

index 6915b418ee73aa00df1c90248529f938529117f7..4fd37ff1e210c29c17eff7c22966d7b05052ac0b 100644 (file)
 
 #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);
 
 int arch_notes_size(void)
 {
        long ret;
-       struct module *owner = spu_coredump_calls.owner;
 
        ret = -ENOSYS;
        mutex_lock(&spu_coredump_mutex);
-       if (owner && try_module_get(owner)) {
-               ret = spu_coredump_calls.arch_notes_size();
-               module_put(owner);
+       if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
+               ret = spu_coredump_calls->arch_notes_size();
+               module_put(spu_coredump_calls->owner);
        }
        mutex_unlock(&spu_coredump_mutex);
        return ret;
@@ -46,36 +45,35 @@ int arch_notes_size(void)
 
 void arch_write_notes(struct file *file)
 {
-       struct module *owner = spu_coredump_calls.owner;
-
        mutex_lock(&spu_coredump_mutex);
-       if (owner && try_module_get(owner)) {
-               spu_coredump_calls.arch_write_notes(file);
-               module_put(owner);
+       if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
+               spu_coredump_calls->arch_write_notes(file);
+               module_put(spu_coredump_calls->owner);
        }
        mutex_unlock(&spu_coredump_mutex);
 }
 
 int register_arch_coredump_calls(struct spu_coredump_calls *calls)
 {
-       if (spu_coredump_calls.owner)
-               return -EBUSY;
+       int ret = 0;
+
 
        mutex_lock(&spu_coredump_mutex);
-       spu_coredump_calls.arch_notes_size = calls->arch_notes_size;
-       spu_coredump_calls.arch_write_notes = calls->arch_write_notes;
-       spu_coredump_calls.owner = calls->owner;
+       if (spu_coredump_calls)
+               ret = -EBUSY;
+       else
+               spu_coredump_calls = calls;
        mutex_unlock(&spu_coredump_mutex);
-       return 0;
+       return ret;
 }
 EXPORT_SYMBOL_GPL(register_arch_coredump_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);
-       spu_coredump_calls.owner = NULL;
+       spu_coredump_calls = NULL;
        mutex_unlock(&spu_coredump_mutex);
 }
 EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);