Skip to content

Commit d8426e6

Browse files
author
Al Viro
committed
switch spufs_calls_{get,put}() to CLASS() use
Signed-off-by: Al Viro <[email protected]>
1 parent 65c8941 commit d8426e6

File tree

1 file changed

+17
-35
lines changed

1 file changed

+17
-35
lines changed

arch/powerpc/platforms/cell/spu_syscalls.c

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ static inline struct spufs_calls *spufs_calls_get(void)
3636

3737
static inline void spufs_calls_put(struct spufs_calls *calls)
3838
{
39+
if (!calls)
40+
return;
41+
3942
BUG_ON(calls != spufs_calls);
4043

4144
/* we don't need to rcu this, as we hold a reference to the module */
@@ -53,35 +56,30 @@ static inline void spufs_calls_put(struct spufs_calls *calls) { }
5356

5457
#endif /* CONFIG_SPU_FS_MODULE */
5558

59+
DEFINE_CLASS(spufs_calls, struct spufs_calls *, spufs_calls_put(_T), spufs_calls_get(), void)
60+
5661
SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
5762
umode_t, mode, int, neighbor_fd)
5863
{
59-
long ret;
60-
struct spufs_calls *calls;
61-
62-
calls = spufs_calls_get();
64+
CLASS(spufs_calls, calls)();
6365
if (!calls)
6466
return -ENOSYS;
6567

6668
if (flags & SPU_CREATE_AFFINITY_SPU) {
6769
CLASS(fd, neighbor)(neighbor_fd);
68-
ret = -EBADF;
69-
if (!fd_empty(neighbor))
70-
ret = calls->create_thread(name, flags, mode, fd_file(neighbor));
71-
} else
72-
ret = calls->create_thread(name, flags, mode, NULL);
73-
74-
spufs_calls_put(calls);
75-
return ret;
70+
if (fd_empty(neighbor))
71+
return -EBADF;
72+
return calls->create_thread(name, flags, mode, fd_file(neighbor));
73+
} else {
74+
return calls->create_thread(name, flags, mode, NULL);
75+
}
7676
}
7777

7878
SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
7979
{
8080
long ret;
8181
struct fd arg;
82-
struct spufs_calls *calls;
83-
84-
calls = spufs_calls_get();
82+
CLASS(spufs_calls, calls)();
8583
if (!calls)
8684
return -ENOSYS;
8785

@@ -91,42 +89,26 @@ SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
9189
ret = calls->spu_run(fd_file(arg), unpc, ustatus);
9290
fdput(arg);
9391
}
94-
95-
spufs_calls_put(calls);
9692
return ret;
9793
}
9894

9995
#ifdef CONFIG_COREDUMP
10096
int elf_coredump_extra_notes_size(void)
10197
{
102-
struct spufs_calls *calls;
103-
int ret;
104-
105-
calls = spufs_calls_get();
98+
CLASS(spufs_calls, calls)();
10699
if (!calls)
107100
return 0;
108101

109-
ret = calls->coredump_extra_notes_size();
110-
111-
spufs_calls_put(calls);
112-
113-
return ret;
102+
return calls->coredump_extra_notes_size();
114103
}
115104

116105
int elf_coredump_extra_notes_write(struct coredump_params *cprm)
117106
{
118-
struct spufs_calls *calls;
119-
int ret;
120-
121-
calls = spufs_calls_get();
107+
CLASS(spufs_calls, calls)();
122108
if (!calls)
123109
return 0;
124110

125-
ret = calls->coredump_extra_notes_write(cprm);
126-
127-
spufs_calls_put(calls);
128-
129-
return ret;
111+
return calls->coredump_extra_notes_write(cprm);
130112
}
131113
#endif
132114

0 commit comments

Comments
 (0)