提交 fe8a29db 编写于 作者: A Akinobu Mita 提交者: 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: NArnd Bergmann <arnd.bergmann@de.ibm.com>
上级 6cf21792
......@@ -26,19 +26,18 @@
#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);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册