]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.kernel.org/patch-2.6.27.11-12
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.kernel.org / patch-2.6.27.11-12
1 From: Greg Kroah-Hartman <gregkh@suse.de>
2 Subject: Linux 2.6.27.12
3
4 Upstream 2.6.27.12 release from kernel.org
5
6 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
7
8 diff --git a/Makefile b/Makefile
9 index 240d376..f0f8cdf 100644
10 --- a/Makefile
11 +++ b/Makefile
12 @@ -1,7 +1,7 @@
13 VERSION = 2
14 PATCHLEVEL = 6
15 SUBLEVEL = 27
16 -EXTRAVERSION = .11
17 +EXTRAVERSION = .12
18 NAME = Trembling Tortoise
19
20 # *DOCUMENTATION*
21 diff --git a/arch/Kconfig b/arch/Kconfig
22 index 364c6da..1d07625 100644
23 --- a/arch/Kconfig
24 +++ b/arch/Kconfig
25 @@ -46,6 +46,9 @@ config HAVE_EFFICIENT_UNALIGNED_ACCESS
26 See Documentation/unaligned-memory-access.txt for more
27 information on the topic of unaligned memory accesses.
28
29 +config HAVE_SYSCALL_WRAPPERS
30 + bool
31 +
32 config KRETPROBES
33 def_bool y
34 depends on KPROBES && HAVE_KRETPROBES
35 diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
36 index 5fc61e2..36a93f8 100644
37 --- a/arch/alpha/kernel/entry.S
38 +++ b/arch/alpha/kernel/entry.S
39 @@ -894,9 +894,9 @@ sys_getxpid:
40 .end sys_getxpid
41
42 .align 4
43 - .globl sys_pipe
44 - .ent sys_pipe
45 -sys_pipe:
46 + .globl sys_alpha_pipe
47 + .ent sys_alpha_pipe
48 +sys_alpha_pipe:
49 lda $sp, -16($sp)
50 stq $26, 0($sp)
51 .prologue 0
52 @@ -914,7 +914,7 @@ sys_pipe:
53 stq $1, 80+16($sp)
54 1: lda $sp, 16($sp)
55 ret
56 -.end sys_pipe
57 +.end sys_alpha_pipe
58
59 .align 4
60 .globl sys_execve
61 diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
62 index ba914af..9d9e3a9 100644
63 --- a/arch/alpha/kernel/systbls.S
64 +++ b/arch/alpha/kernel/systbls.S
65 @@ -52,7 +52,7 @@ sys_call_table:
66 .quad sys_setpgid
67 .quad alpha_ni_syscall /* 40 */
68 .quad sys_dup
69 - .quad sys_pipe
70 + .quad sys_alpha_pipe
71 .quad osf_set_program_attributes
72 .quad alpha_ni_syscall
73 .quad sys_open /* 45 */
74 diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
75 index 09a061c..9ca8d13 100644
76 --- a/arch/arm/kernel/calls.S
77 +++ b/arch/arm/kernel/calls.S
78 @@ -98,7 +98,7 @@
79 CALL(sys_uselib)
80 CALL(sys_swapon)
81 CALL(sys_reboot)
82 - CALL(OBSOLETE(old_readdir)) /* used by libc4 */
83 + CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */
84 /* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */
85 CALL(sys_munmap)
86 CALL(sys_truncate)
87 diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
88 index 3a65f32..2485b3e 100644
89 --- a/arch/cris/arch-v10/kernel/entry.S
90 +++ b/arch/cris/arch-v10/kernel/entry.S
91 @@ -691,7 +691,7 @@ sys_call_table:
92 .long sys_uselib
93 .long sys_swapon
94 .long sys_reboot
95 - .long old_readdir
96 + .long sys_old_readdir
97 .long old_mmap /* 90 */
98 .long sys_munmap
99 .long sys_truncate
100 diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
101 index eebbaba..149430c 100644
102 --- a/arch/cris/arch-v32/kernel/entry.S
103 +++ b/arch/cris/arch-v32/kernel/entry.S
104 @@ -614,7 +614,7 @@ sys_call_table:
105 .long sys_uselib
106 .long sys_swapon
107 .long sys_reboot
108 - .long old_readdir
109 + .long sys_old_readdir
110 .long old_mmap /* 90 */
111 .long sys_munmap
112 .long sys_truncate
113 diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
114 index 54e21c3..4eb67fa 100644
115 --- a/arch/h8300/kernel/syscalls.S
116 +++ b/arch/h8300/kernel/syscalls.S
117 @@ -103,7 +103,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
118 .long SYMBOL_NAME(sys_uselib)
119 .long SYMBOL_NAME(sys_swapon)
120 .long SYMBOL_NAME(sys_reboot)
121 - .long SYMBOL_NAME(old_readdir)
122 + .long SYMBOL_NAME(sys_old_readdir)
123 .long SYMBOL_NAME(old_mmap) /* 90 */
124 .long SYMBOL_NAME(sys_munmap)
125 .long SYMBOL_NAME(sys_truncate)
126 diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
127 index ff88c48..0a67464 100644
128 --- a/arch/ia64/ia32/ia32_entry.S
129 +++ b/arch/ia64/ia32/ia32_entry.S
130 @@ -215,7 +215,7 @@ ia32_syscall_table:
131 data8 sys_mkdir
132 data8 sys_rmdir /* 40 */
133 data8 sys_dup
134 - data8 sys32_pipe
135 + data8 sys_ia64_pipe
136 data8 compat_sys_times
137 data8 sys_ni_syscall /* old prof syscall holder */
138 data8 sys32_brk /* 45 */
139 diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
140 index d535833..206d5d8 100644
141 --- a/arch/ia64/include/asm/unistd.h
142 +++ b/arch/ia64/include/asm/unistd.h
143 @@ -363,7 +363,7 @@ struct pt_regs;
144 struct sigaction;
145 long sys_execve(char __user *filename, char __user * __user *argv,
146 char __user * __user *envp, struct pt_regs *regs);
147 -asmlinkage long sys_pipe(void);
148 +asmlinkage long sys_ia64_pipe(void);
149 asmlinkage long sys_rt_sigaction(int sig,
150 const struct sigaction __user *act,
151 struct sigaction __user *oact,
152 diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
153 index 0dd6c14..f6e8b63 100644
154 --- a/arch/ia64/kernel/entry.S
155 +++ b/arch/ia64/kernel/entry.S
156 @@ -1436,7 +1436,7 @@ sys_call_table:
157 data8 sys_mkdir // 1055
158 data8 sys_rmdir
159 data8 sys_dup
160 - data8 sys_pipe
161 + data8 sys_ia64_pipe
162 data8 sys_times
163 data8 ia64_brk // 1060
164 data8 sys_setgid
165 diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
166 index bcbb6d8..92ed83f 100644
167 --- a/arch/ia64/kernel/sys_ia64.c
168 +++ b/arch/ia64/kernel/sys_ia64.c
169 @@ -154,7 +154,7 @@ out:
170 * and r9) as this is faster than doing a copy_to_user().
171 */
172 asmlinkage long
173 -sys_pipe (void)
174 +sys_ia64_pipe (void)
175 {
176 struct pt_regs *regs = task_pt_regs(current);
177 int fd[2];
178 diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
179 index f28404d..25b2176 100644
180 --- a/arch/m68k/kernel/entry.S
181 +++ b/arch/m68k/kernel/entry.S
182 @@ -513,7 +513,7 @@ sys_call_table:
183 .long sys_uselib
184 .long sys_swapon
185 .long sys_reboot
186 - .long old_readdir
187 + .long sys_old_readdir
188 .long old_mmap /* 90 */
189 .long sys_munmap
190 .long sys_truncate
191 diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
192 index 812f8d8..5c3e3f6 100644
193 --- a/arch/m68knommu/kernel/syscalltable.S
194 +++ b/arch/m68knommu/kernel/syscalltable.S
195 @@ -107,7 +107,7 @@ ENTRY(sys_call_table)
196 .long sys_uselib
197 .long sys_ni_syscall /* sys_swapon */
198 .long sys_reboot
199 - .long old_readdir
200 + .long sys_old_readdir
201 .long old_mmap /* 90 */
202 .long sys_munmap
203 .long sys_truncate
204 diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
205 index 5e75a31..61906f6 100644
206 --- a/arch/mips/kernel/scall32-o32.S
207 +++ b/arch/mips/kernel/scall32-o32.S
208 @@ -401,7 +401,7 @@ einval: li v0, -EINVAL
209 sys sys_uselib 1
210 sys sys_swapon 2
211 sys sys_reboot 3
212 - sys old_readdir 3
213 + sys sys_old_readdir 3
214 sys old_mmap 6 /* 4090 */
215 sys sys_munmap 2
216 sys sys_truncate 2
217 diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
218 index b7cbb14..7fc6aba 100644
219 --- a/arch/mn10300/kernel/entry.S
220 +++ b/arch/mn10300/kernel/entry.S
221 @@ -477,7 +477,7 @@ ENTRY(sys_call_table)
222 .long sys_uselib
223 .long sys_swapon
224 .long sys_reboot
225 - .long old_readdir
226 + .long sys_old_readdir
227 .long old_mmap /* 90 */
228 .long sys_munmap
229 .long sys_truncate
230 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
231 index 587da5e..a2b228f 100644
232 --- a/arch/powerpc/Kconfig
233 +++ b/arch/powerpc/Kconfig
234 @@ -122,6 +122,7 @@ config PPC
235 select HAVE_DMA_ATTRS if PPC64
236 select USE_GENERIC_SMP_HELPERS if SMP
237 select HAVE_OPROFILE
238 + select HAVE_SYSCALL_WRAPPERS if PPC64
239
240 config EARLY_PRINTK
241 bool
242 diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
243 index f6cc7a4..180d5ea 100644
244 --- a/arch/powerpc/include/asm/systbl.h
245 +++ b/arch/powerpc/include/asm/systbl.h
246 @@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink)
247 SYSCALL(uselib)
248 SYSCALL(swapon)
249 SYSCALL(reboot)
250 -SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir)
251 +SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir)
252 SYSCALL_SPU(mmap)
253 SYSCALL_SPU(munmap)
254 SYSCALL_SPU(truncate)
255 diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
256 index 97619fd..ddc2a30 100644
257 --- a/arch/powerpc/platforms/pseries/Kconfig
258 +++ b/arch/powerpc/platforms/pseries/Kconfig
259 @@ -54,7 +54,7 @@ config PPC_SMLPAR
260
261 config CMM
262 tristate "Collaborative memory management"
263 - depends on PPC_SMLPAR
264 + depends on PPC_SMLPAR && !CRASH_DUMP
265 default y
266 help
267 Select this option, if you want to enable the kernel interface
268 diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
269 index 8d41908..f9b3dcd 100644
270 --- a/arch/s390/Kconfig
271 +++ b/arch/s390/Kconfig
272 @@ -70,6 +70,7 @@ mainmenu "Linux Kernel Configuration"
273
274 config S390
275 def_bool y
276 + select HAVE_SYSCALL_WRAPPERS
277 select HAVE_OPROFILE
278 select HAVE_KPROBES
279 select HAVE_KRETPROBES
280 diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
281 index 328a20e..93a5c96 100644
282 --- a/arch/s390/kernel/compat_wrapper.S
283 +++ b/arch/s390/kernel/compat_wrapper.S
284 @@ -549,7 +549,7 @@ sys32_setdomainname_wrapper:
285 .globl sys32_newuname_wrapper
286 sys32_newuname_wrapper:
287 llgtr %r2,%r2 # struct new_utsname *
288 - jg s390x_newuname # branch to system call
289 + jg sys_s390_newuname # branch to system call
290
291 .globl compat_sys_adjtimex_wrapper
292 compat_sys_adjtimex_wrapper:
293 @@ -617,7 +617,7 @@ sys32_sysfs_wrapper:
294 .globl sys32_personality_wrapper
295 sys32_personality_wrapper:
296 llgfr %r2,%r2 # unsigned long
297 - jg s390x_personality # branch to system call
298 + jg sys_s390_personality # branch to system call
299
300 .globl sys32_setfsuid16_wrapper
301 sys32_setfsuid16_wrapper:
302 diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
303 index 6b18963..df0a813 100644
304 --- a/arch/s390/kernel/entry.h
305 +++ b/arch/s390/kernel/entry.h
306 @@ -30,23 +30,23 @@ struct fadvise64_64_args;
307 struct old_sigaction;
308 struct sel_arg_struct;
309
310 -long sys_pipe(unsigned long __user *fildes);
311 long sys_mmap2(struct mmap_arg_struct __user *arg);
312 -long old_mmap(struct mmap_arg_struct __user *arg);
313 +long sys_s390_old_mmap(struct mmap_arg_struct __user *arg);
314 long sys_ipc(uint call, int first, unsigned long second,
315 unsigned long third, void __user *ptr);
316 -long s390x_newuname(struct new_utsname __user *name);
317 -long s390x_personality(unsigned long personality);
318 -long s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
319 +long sys_s390_newuname(struct new_utsname __user *name);
320 +long sys_s390_personality(unsigned long personality);
321 +long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
322 size_t len, int advice);
323 -long s390_fadvise64_64(struct fadvise64_64_args __user *args);
324 -long s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, u32 len_low);
325 +long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
326 +long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
327 + u32 len_low);
328 long sys_fork(void);
329 long sys_clone(void);
330 long sys_vfork(void);
331 void execve_tail(void);
332 long sys_execve(void);
333 -int sys_sigsuspend(int history0, int history1, old_sigset_t mask);
334 +long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
335 long sys_sigaction(int sig, const struct old_sigaction __user *act,
336 struct old_sigaction __user *oact);
337 long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
338 diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
339 index 3e2c05c..c8cb494 100644
340 --- a/arch/s390/kernel/process.c
341 +++ b/arch/s390/kernel/process.c
342 @@ -38,6 +38,7 @@
343 #include <linux/utsname.h>
344 #include <linux/tick.h>
345 #include <linux/elfcore.h>
346 +#include <linux/syscalls.h>
347 #include <asm/uaccess.h>
348 #include <asm/pgtable.h>
349 #include <asm/system.h>
350 @@ -257,13 +258,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
351 return 0;
352 }
353
354 -asmlinkage long sys_fork(void)
355 +SYSCALL_DEFINE0(fork)
356 {
357 struct pt_regs *regs = task_pt_regs(current);
358 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
359 }
360
361 -asmlinkage long sys_clone(void)
362 +SYSCALL_DEFINE0(clone)
363 {
364 struct pt_regs *regs = task_pt_regs(current);
365 unsigned long clone_flags;
366 @@ -290,7 +291,7 @@ asmlinkage long sys_clone(void)
367 * do not have enough call-clobbered registers to hold all
368 * the information you need.
369 */
370 -asmlinkage long sys_vfork(void)
371 +SYSCALL_DEFINE0(vfork)
372 {
373 struct pt_regs *regs = task_pt_regs(current);
374 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
375 @@ -310,7 +311,7 @@ asmlinkage void execve_tail(void)
376 /*
377 * sys_execve() executes a new program.
378 */
379 -asmlinkage long sys_execve(void)
380 +SYSCALL_DEFINE0(execve)
381 {
382 struct pt_regs *regs = task_pt_regs(current);
383 char *filename;
384 diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
385 index b976820..68c61da 100644
386 --- a/arch/s390/kernel/signal.c
387 +++ b/arch/s390/kernel/signal.c
388 @@ -24,6 +24,7 @@
389 #include <linux/tty.h>
390 #include <linux/personality.h>
391 #include <linux/binfmts.h>
392 +#include <linux/syscalls.h>
393 #include <asm/ucontext.h>
394 #include <asm/uaccess.h>
395 #include <asm/lowcore.h>
396 @@ -52,8 +53,7 @@ typedef struct
397 /*
398 * Atomically swap in the new signal mask, and wait for a signal.
399 */
400 -asmlinkage int
401 -sys_sigsuspend(int history0, int history1, old_sigset_t mask)
402 +SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
403 {
404 mask &= _BLOCKABLE;
405 spin_lock_irq(&current->sighand->siglock);
406 @@ -69,9 +69,8 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask)
407 return -ERESTARTNOHAND;
408 }
409
410 -asmlinkage long
411 -sys_sigaction(int sig, const struct old_sigaction __user *act,
412 - struct old_sigaction __user *oact)
413 +SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
414 + struct old_sigaction __user *, oact)
415 {
416 struct k_sigaction new_ka, old_ka;
417 int ret;
418 @@ -101,15 +100,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
419 return ret;
420 }
421
422 -asmlinkage long
423 -sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
424 +SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
425 + stack_t __user *, uoss)
426 {
427 struct pt_regs *regs = task_pt_regs(current);
428 return do_sigaltstack(uss, uoss, regs->gprs[15]);
429 }
430
431 -
432 -
433 /* Returns non-zero on fault. */
434 static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
435 {
436 @@ -163,7 +160,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
437 return 0;
438 }
439
440 -asmlinkage long sys_sigreturn(void)
441 +SYSCALL_DEFINE0(sigreturn)
442 {
443 struct pt_regs *regs = task_pt_regs(current);
444 sigframe __user *frame = (sigframe __user *)regs->gprs[15];
445 @@ -190,7 +187,7 @@ badframe:
446 return 0;
447 }
448
449 -asmlinkage long sys_rt_sigreturn(void)
450 +SYSCALL_DEFINE0(rt_sigreturn)
451 {
452 struct pt_regs *regs = task_pt_regs(current);
453 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
454 diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
455 index 5fdb799..e001ac1 100644
456 --- a/arch/s390/kernel/sys_s390.c
457 +++ b/arch/s390/kernel/sys_s390.c
458 @@ -29,6 +29,7 @@
459 #include <linux/personality.h>
460 #include <linux/unistd.h>
461 #include <linux/ipc.h>
462 +#include <linux/syscalls.h>
463 #include <asm/uaccess.h>
464 #include "entry.h"
465
466 @@ -74,7 +75,7 @@ struct mmap_arg_struct {
467 unsigned long offset;
468 };
469
470 -asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg)
471 +SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
472 {
473 struct mmap_arg_struct a;
474 int error = -EFAULT;
475 @@ -86,7 +87,7 @@ out:
476 return error;
477 }
478
479 -asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
480 +SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
481 {
482 struct mmap_arg_struct a;
483 long error = -EFAULT;
484 @@ -127,8 +128,8 @@ asmlinkage long old_select(struct sel_arg_struct __user *arg)
485 *
486 * This is really horribly ugly.
487 */
488 -asmlinkage long sys_ipc(uint call, int first, unsigned long second,
489 - unsigned long third, void __user *ptr)
490 +SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
491 + unsigned long, third, void __user *, ptr)
492 {
493 struct ipc_kludge tmp;
494 int ret;
495 @@ -194,7 +195,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second,
496 }
497
498 #ifdef CONFIG_64BIT
499 -asmlinkage long s390x_newuname(struct new_utsname __user *name)
500 +SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
501 {
502 int ret = sys_newuname(name);
503
504 @@ -205,7 +206,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name)
505 return ret;
506 }
507
508 -asmlinkage long s390x_personality(unsigned long personality)
509 +SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
510 {
511 int ret;
512
513 @@ -224,15 +225,13 @@ asmlinkage long s390x_personality(unsigned long personality)
514 */
515 #ifndef CONFIG_64BIT
516
517 -asmlinkage long
518 -s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice)
519 +SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
520 + size_t, len, int, advice)
521 {
522 return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
523 len, advice);
524 }
525
526 -#endif
527 -
528 struct fadvise64_64_args {
529 int fd;
530 long long offset;
531 @@ -240,8 +239,7 @@ struct fadvise64_64_args {
532 int advice;
533 };
534
535 -asmlinkage long
536 -s390_fadvise64_64(struct fadvise64_64_args __user *args)
537 +SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
538 {
539 struct fadvise64_64_args a;
540
541 @@ -250,7 +248,6 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
542 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
543 }
544
545 -#ifndef CONFIG_64BIT
546 /*
547 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
548 * 64 bit argument "len" is split into the upper and lower 32 bits. The
549 @@ -263,9 +260,19 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
550 * to
551 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
552 */
553 -asmlinkage long s390_fallocate(int fd, int mode, loff_t offset,
554 +SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
555 u32 len_high, u32 len_low)
556 {
557 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
558 }
559 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
560 +asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
561 + long len_high, long len_low)
562 +{
563 + return SYSC_s390_fallocate((int) fd, (int) mode, offset,
564 + (u32) len_high, (u32) len_low);
565 +}
566 +SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
567 +#endif
568 +
569 #endif
570 diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
571 index c66d35e..2a3abd4 100644
572 --- a/arch/s390/kernel/syscalls.S
573 +++ b/arch/s390/kernel/syscalls.S
574 @@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
575 SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
576 SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
577 SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
578 -SYSCALL(old_mmap,old_mmap,old32_mmap_wrapper) /* 90 */
579 +SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */
580 SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
581 SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
582 SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
583 @@ -130,7 +130,7 @@ SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
584 SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
585 SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */
586 SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
587 -SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper)
588 +SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper)
589 NI_SYSCALL /* modify_ldt for i386 */
590 SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
591 SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
592 @@ -144,7 +144,7 @@ SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper)
593 SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper)
594 SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper)
595 SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */
596 -SYSCALL(sys_personality,s390x_personality,sys32_personality_wrapper)
597 +SYSCALL(sys_personality,sys_s390_personality,sys32_personality_wrapper)
598 NI_SYSCALL /* for afs_syscall */
599 SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */
600 SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */
601 @@ -261,7 +261,7 @@ SYSCALL(sys_epoll_create,sys_epoll_create,sys_epoll_create_wrapper)
602 SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */
603 SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper)
604 SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper)
605 -SYSCALL(s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper)
606 +SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper)
607 SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper)
608 SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */
609 SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper)
610 @@ -272,7 +272,7 @@ SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260
611 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
612 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
613 NI_SYSCALL /* reserved for vserver */
614 -SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
615 +SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
616 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
617 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
618 SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper)
619 @@ -322,7 +322,7 @@ NI_SYSCALL /* 310 sys_move_pages */
620 SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
621 SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper)
622 SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
623 -SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
624 +SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
625 SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
626 SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper)
627 NI_SYSCALL /* 317 old sys_timer_fd */
628 diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
629 index f0aa5c3..c907f8c 100644
630 --- a/arch/sh/kernel/sys_sh32.c
631 +++ b/arch/sh/kernel/sys_sh32.c
632 @@ -21,7 +21,7 @@
633 * sys_pipe() is the normal C calling standard for creating
634 * a pipe. It's not the way Unix traditionally does this, though.
635 */
636 -asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
637 +asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5,
638 unsigned long r6, unsigned long r7,
639 struct pt_regs __regs)
640 {
641 diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
642 index 0af693e..e67c173 100644
643 --- a/arch/sh/kernel/syscalls_32.S
644 +++ b/arch/sh/kernel/syscalls_32.S
645 @@ -58,7 +58,7 @@ ENTRY(sys_call_table)
646 .long sys_mkdir
647 .long sys_rmdir /* 40 */
648 .long sys_dup
649 - .long sys_pipe
650 + .long sys_sh_pipe
651 .long sys_times
652 .long sys_ni_syscall /* old prof syscall holder */
653 .long sys_brk /* 45 */
654 @@ -105,7 +105,7 @@ ENTRY(sys_call_table)
655 .long sys_uselib
656 .long sys_swapon
657 .long sys_reboot
658 - .long old_readdir
659 + .long sys_old_readdir
660 .long old_mmap /* 90 */
661 .long sys_munmap
662 .long sys_truncate
663 diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
664 index 0b436aa..557cb91 100644
665 --- a/arch/sh/kernel/syscalls_64.S
666 +++ b/arch/sh/kernel/syscalls_64.S
667 @@ -109,7 +109,7 @@ sys_call_table:
668 .long sys_uselib
669 .long sys_swapon
670 .long sys_reboot
671 - .long old_readdir
672 + .long sys_old_readdir
673 .long old_mmap /* 90 */
674 .long sys_munmap
675 .long sys_truncate
676 diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
677 index e8cdf71..e3b7ed0 100644
678 --- a/arch/sparc/kernel/entry.S
679 +++ b/arch/sparc/kernel/entry.S
680 @@ -1142,8 +1142,8 @@ sunos_execv:
681 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
682
683 .align 4
684 - .globl sys_pipe
685 -sys_pipe:
686 + .globl sys_sparc_pipe
687 +sys_sparc_pipe:
688 mov %o7, %l5
689 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
690 call sparc_pipe
691 diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
692 index e1b9233..6a62545 100644
693 --- a/arch/sparc/kernel/systbls.S
694 +++ b/arch/sparc/kernel/systbls.S
695 @@ -24,7 +24,7 @@ sys_call_table:
696 /*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
697 /*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
698 /*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile
699 -/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid
700 +/*40*/ .long sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_getuid
701 /*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
702 /*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl
703 /*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
704 @@ -56,7 +56,7 @@ sys_call_table:
705 /*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
706 /*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
707 /*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask
708 -/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir
709 +/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir
710 /*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
711 /*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
712 /*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex
713 diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc64/kernel/syscalls.S
714 index a2f2427..cd2d333 100644
715 --- a/arch/sparc64/kernel/syscalls.S
716 +++ b/arch/sparc64/kernel/syscalls.S
717 @@ -20,7 +20,7 @@ execve_merge:
718 add %sp, PTREGS_OFF, %o0
719
720 .align 32
721 -sys_pipe:
722 +sys_sparc_pipe:
723 ba,pt %xcc, sparc_pipe
724 add %sp, PTREGS_OFF, %o0
725 sys_nis_syscall:
726 diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
727 index 0fdbf3b..26b39de 100644
728 --- a/arch/sparc64/kernel/systbls.S
729 +++ b/arch/sparc64/kernel/systbls.S
730 @@ -26,7 +26,7 @@ sys_call_table32:
731 /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
732 /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
733 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
734 -/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
735 +/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
736 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16
737 /*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
738 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
739 @@ -100,7 +100,7 @@ sys_call_table:
740 /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
741 /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
742 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
743 -/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall
744 +/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall
745 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
746 /*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
747 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
748 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
749 index 552d2b7..388bae2 100644
750 --- a/arch/x86/Kconfig
751 +++ b/arch/x86/Kconfig
752 @@ -567,7 +567,7 @@ config AMD_IOMMU
753
754 # need this always selected by IOMMU for the VIA workaround
755 config SWIOTLB
756 - bool
757 + def_bool y if X86_64
758 help
759 Support for software bounce buffers used on x86-64 systems
760 which don't have a hardware IOMMU (e.g. the current generation
761 diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
762 index 9bfc4d7..290cb54 100644
763 --- a/arch/x86/kernel/head64.c
764 +++ b/arch/x86/kernel/head64.c
765 @@ -26,7 +26,7 @@
766 #include <asm/bios_ebda.h>
767
768 /* boot cpu pda */
769 -static struct x8664_pda _boot_cpu_pda __read_mostly;
770 +static struct x8664_pda _boot_cpu_pda;
771
772 #ifdef CONFIG_SMP
773 /*
774 diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
775 index db3280a..872d9d0 100644
776 --- a/arch/x86/kernel/head_64.S
777 +++ b/arch/x86/kernel/head_64.S
778 @@ -305,7 +305,7 @@ ENTRY(early_idt_handler)
779 call dump_stack
780 #ifdef CONFIG_KALLSYMS
781 leaq early_idt_ripmsg(%rip),%rdi
782 - movq 8(%rsp),%rsi # get rip again
783 + movq 0(%rsp),%rsi # get rip again
784 call __print_symbol
785 #endif
786 #endif /* EARLY_PRINTK */
787 diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
788 index d44395f..e2e86a0 100644
789 --- a/arch/x86/kernel/syscall_table_32.S
790 +++ b/arch/x86/kernel/syscall_table_32.S
791 @@ -88,7 +88,7 @@ ENTRY(sys_call_table)
792 .long sys_uselib
793 .long sys_swapon
794 .long sys_reboot
795 - .long old_readdir
796 + .long sys_old_readdir
797 .long old_mmap /* 90 */
798 .long sys_munmap
799 .long sys_truncate
800 diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
801 index 8b8c0d6..2fc8b6a 100644
802 --- a/arch/x86/kernel/tlb_uv.c
803 +++ b/arch/x86/kernel/tlb_uv.c
804 @@ -586,7 +586,6 @@ static int __init uv_ptc_init(void)
805 static struct bau_control * __init uv_table_bases_init(int blade, int node)
806 {
807 int i;
808 - int *ip;
809 struct bau_msg_status *msp;
810 struct bau_control *bau_tabp;
811
812 @@ -603,13 +602,6 @@ static struct bau_control * __init uv_table_bases_init(int blade, int node)
813 bau_cpubits_clear(&msp->seen_by, (int)
814 uv_blade_nr_possible_cpus(blade));
815
816 - bau_tabp->watching =
817 - kmalloc_node(sizeof(int) * DEST_NUM_RESOURCES, GFP_KERNEL, node);
818 - BUG_ON(!bau_tabp->watching);
819 -
820 - for (i = 0, ip = bau_tabp->watching; i < DEST_Q_SIZE; i++, ip++)
821 - *ip = 0;
822 -
823 uv_bau_table_bases[blade] = bau_tabp;
824
825 return bau_tabp;
826 @@ -632,7 +624,6 @@ uv_table_bases_finish(int blade, int node, int cur_cpu,
827 bcp->bau_msg_head = bau_tablesp->va_queue_first;
828 bcp->va_queue_first = bau_tablesp->va_queue_first;
829 bcp->va_queue_last = bau_tablesp->va_queue_last;
830 - bcp->watching = bau_tablesp->watching;
831 bcp->msg_statuses = bau_tablesp->msg_statuses;
832 bcp->descriptor_base = adp;
833 }
834 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
835 index 455f3fe..da1973b 100644
836 --- a/arch/x86/mm/fault.c
837 +++ b/arch/x86/mm/fault.c
838 @@ -534,7 +534,7 @@ static int vmalloc_fault(unsigned long address)
839 happen within a race in page table update. In the later
840 case just flush. */
841
842 - pgd = pgd_offset(current->mm ?: &init_mm, address);
843 + pgd = pgd_offset(current->active_mm, address);
844 pgd_ref = pgd_offset_k(address);
845 if (pgd_none(*pgd_ref))
846 return -1;
847 diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
848 index 60ec1d0..62dc07c 100644
849 --- a/arch/x86/mm/init_32.c
850 +++ b/arch/x86/mm/init_32.c
851 @@ -718,7 +718,7 @@ void __init setup_bootmem_allocator(void)
852 after_init_bootmem = 1;
853 }
854
855 -static void __init find_early_table_space(unsigned long end)
856 +static void __init find_early_table_space(unsigned long end, int use_pse)
857 {
858 unsigned long puds, pmds, ptes, tables, start;
859
860 @@ -728,7 +728,7 @@ static void __init find_early_table_space(unsigned long end)
861 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
862 tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
863
864 - if (cpu_has_pse) {
865 + if (use_pse) {
866 unsigned long extra;
867
868 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
869 @@ -768,12 +768,22 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
870 pgd_t *pgd_base = swapper_pg_dir;
871 unsigned long start_pfn, end_pfn;
872 unsigned long big_page_start;
873 +#ifdef CONFIG_DEBUG_PAGEALLOC
874 + /*
875 + * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
876 + * This will simplify cpa(), which otherwise needs to support splitting
877 + * large pages into small in interrupt context, etc.
878 + */
879 + int use_pse = 0;
880 +#else
881 + int use_pse = cpu_has_pse;
882 +#endif
883
884 /*
885 * Find space for the kernel direct mapping tables.
886 */
887 if (!after_init_bootmem)
888 - find_early_table_space(end);
889 + find_early_table_space(end, use_pse);
890
891 #ifdef CONFIG_X86_PAE
892 set_nx();
893 @@ -819,7 +829,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
894 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
895 if (start_pfn < end_pfn)
896 kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
897 - cpu_has_pse);
898 + use_pse);
899
900 /* tail is not big page alignment ? */
901 start_pfn = end_pfn;
902 diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
903 index 1adbb3e..753ea12 100644
904 --- a/arch/x86/mm/init_64.c
905 +++ b/arch/x86/mm/init_64.c
906 @@ -446,13 +446,14 @@ phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end,
907 return phys_pud_init(pud, addr, end, page_size_mask);
908 }
909
910 -static void __init find_early_table_space(unsigned long end)
911 +static void __init find_early_table_space(unsigned long end, int use_pse,
912 + int use_gbpages)
913 {
914 unsigned long puds, pmds, ptes, tables, start;
915
916 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
917 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE);
918 - if (direct_gbpages) {
919 + if (use_gbpages) {
920 unsigned long extra;
921 extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
922 pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
923 @@ -460,7 +461,7 @@ static void __init find_early_table_space(unsigned long end)
924 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
925 tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
926
927 - if (cpu_has_pse) {
928 + if (use_pse) {
929 unsigned long extra;
930 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
931 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
932 @@ -571,6 +572,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
933
934 struct map_range mr[NR_RANGE_MR];
935 int nr_range, i;
936 + int use_pse, use_gbpages;
937
938 printk(KERN_INFO "init_memory_mapping\n");
939
940 @@ -584,9 +586,21 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
941 if (!after_bootmem)
942 init_gbpages();
943
944 - if (direct_gbpages)
945 +#ifdef CONFIG_DEBUG_PAGEALLOC
946 + /*
947 + * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
948 + * This will simplify cpa(), which otherwise needs to support splitting
949 + * large pages into small in interrupt context, etc.
950 + */
951 + use_pse = use_gbpages = 0;
952 +#else
953 + use_pse = cpu_has_pse;
954 + use_gbpages = direct_gbpages;
955 +#endif
956 +
957 + if (use_gbpages)
958 page_size_mask |= 1 << PG_LEVEL_1G;
959 - if (cpu_has_pse)
960 + if (use_pse)
961 page_size_mask |= 1 << PG_LEVEL_2M;
962
963 memset(mr, 0, sizeof(mr));
964 @@ -647,7 +661,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
965 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
966
967 if (!after_bootmem)
968 - find_early_table_space(end);
969 + find_early_table_space(end, use_pse, use_gbpages);
970
971 for (i = 0; i < nr_range; i++)
972 last_map_addr = kernel_physical_mapping_init(
973 diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
974 index 56790f8..d62311f 100644
975 --- a/drivers/dma/ioat_dma.c
976 +++ b/drivers/dma/ioat_dma.c
977 @@ -1337,12 +1337,11 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
978 */
979 #define IOAT_TEST_SIZE 2000
980
981 -DECLARE_COMPLETION(test_completion);
982 static void ioat_dma_test_callback(void *dma_async_param)
983 {
984 - printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
985 - dma_async_param);
986 - complete(&test_completion);
987 + struct completion *cmp = dma_async_param;
988 +
989 + complete(cmp);
990 }
991
992 /**
993 @@ -1359,6 +1358,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
994 dma_addr_t dma_dest, dma_src;
995 dma_cookie_t cookie;
996 int err = 0;
997 + struct completion cmp;
998
999 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
1000 if (!src)
1001 @@ -1398,8 +1398,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1002 }
1003
1004 async_tx_ack(tx);
1005 + init_completion(&cmp);
1006 tx->callback = ioat_dma_test_callback;
1007 - tx->callback_param = (void *)0x8086;
1008 + tx->callback_param = &cmp;
1009 cookie = tx->tx_submit(tx);
1010 if (cookie < 0) {
1011 dev_err(&device->pdev->dev,
1012 @@ -1409,7 +1410,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1013 }
1014 device->common.device_issue_pending(dma_chan);
1015
1016 - wait_for_completion_timeout(&test_completion, msecs_to_jiffies(3000));
1017 + wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
1018
1019 if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL)
1020 != DMA_SUCCESS) {
1021 diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
1022 index ab7c8e4..666b7ba 100644
1023 --- a/drivers/md/bitmap.c
1024 +++ b/drivers/md/bitmap.c
1025 @@ -964,9 +964,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
1026 */
1027 page = bitmap->sb_page;
1028 offset = sizeof(bitmap_super_t);
1029 - read_sb_page(bitmap->mddev, bitmap->offset,
1030 - page,
1031 - index, count);
1032 + if (!file)
1033 + read_sb_page(bitmap->mddev,
1034 + bitmap->offset,
1035 + page,
1036 + index, count);
1037 } else if (file) {
1038 page = read_page(file, index, bitmap, count);
1039 offset = 0;
1040 diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
1041 index 5b48478..73b5ec1 100644
1042 --- a/drivers/md/dm-log.c
1043 +++ b/drivers/md/dm-log.c
1044 @@ -467,6 +467,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
1045 lc->disk_header = vmalloc(buf_size);
1046 if (!lc->disk_header) {
1047 DMWARN("couldn't allocate disk log buffer");
1048 + dm_io_client_destroy(lc->io_req.client);
1049 kfree(lc);
1050 return -ENOMEM;
1051 }
1052 @@ -482,6 +483,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
1053 DMWARN("couldn't allocate sync bitset");
1054 if (!dev)
1055 vfree(lc->clean_bits);
1056 + else
1057 + dm_io_client_destroy(lc->io_req.client);
1058 vfree(lc->disk_header);
1059 kfree(lc);
1060 return -ENOMEM;
1061 @@ -495,6 +498,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
1062 vfree(lc->sync_bits);
1063 if (!dev)
1064 vfree(lc->clean_bits);
1065 + else
1066 + dm_io_client_destroy(lc->io_req.client);
1067 vfree(lc->disk_header);
1068 kfree(lc);
1069 return -ENOMEM;
1070 diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
1071 index 97ef945..8fe418b 100644
1072 --- a/drivers/md/dm-raid1.c
1073 +++ b/drivers/md/dm-raid1.c
1074 @@ -727,9 +727,6 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type)
1075 struct mirror_set *ms = m->ms;
1076 struct mirror *new;
1077
1078 - if (!errors_handled(ms))
1079 - return;
1080 -
1081 /*
1082 * error_count is used for nothing more than a
1083 * simple way to tell if a device has encountered
1084 @@ -740,6 +737,9 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type)
1085 if (test_and_set_bit(error_type, &m->error_type))
1086 return;
1087
1088 + if (!errors_handled(ms))
1089 + return;
1090 +
1091 if (m != get_default_mirror(ms))
1092 goto out;
1093
1094 diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
1095 index 5ea6b60..4ee3d97 100644
1096 --- a/drivers/net/e1000e/e1000.h
1097 +++ b/drivers/net/e1000e/e1000.h
1098 @@ -283,6 +283,7 @@ struct e1000_adapter {
1099 unsigned long led_status;
1100
1101 unsigned int flags;
1102 + unsigned int flags2;
1103 struct work_struct downshift_task;
1104 struct work_struct update_phy_task;
1105 };
1106 @@ -290,6 +291,7 @@ struct e1000_adapter {
1107 struct e1000_info {
1108 enum e1000_mac_type mac;
1109 unsigned int flags;
1110 + unsigned int flags2;
1111 u32 pba;
1112 s32 (*get_variants)(struct e1000_adapter *);
1113 struct e1000_mac_operations *mac_ops;
1114 @@ -330,6 +332,9 @@ struct e1000_info {
1115 #define FLAG_RX_RESTART_NOW (1 << 30)
1116 #define FLAG_MSI_TEST_FAILED (1 << 31)
1117
1118 +/* CRC Stripping defines */
1119 +#define FLAG2_CRC_STRIPPING (1 << 0)
1120 +
1121 #define E1000_RX_DESC_PS(R, i) \
1122 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
1123 #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
1124 diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
1125 index 660c85a..c476982 100644
1126 --- a/drivers/net/e1000e/netdev.c
1127 +++ b/drivers/net/e1000e/netdev.c
1128 @@ -497,6 +497,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
1129 goto next_desc;
1130 }
1131
1132 + /* adjust length to remove Ethernet CRC */
1133 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
1134 + length -= 4;
1135 +
1136 total_rx_bytes += length;
1137 total_rx_packets++;
1138
1139 @@ -802,6 +806,10 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
1140 pci_dma_sync_single_for_device(pdev, ps_page->dma,
1141 PAGE_SIZE, PCI_DMA_FROMDEVICE);
1142
1143 + /* remove the CRC */
1144 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
1145 + l1 -= 4;
1146 +
1147 skb_put(skb, l1);
1148 goto copydone;
1149 } /* if */
1150 @@ -823,6 +831,12 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
1151 skb->truesize += length;
1152 }
1153
1154 + /* strip the ethernet crc, problem is we're using pages now so
1155 + * this whole operation can get a little cpu intensive
1156 + */
1157 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
1158 + pskb_trim(skb, skb->len - 4);
1159 +
1160 copydone:
1161 total_rx_bytes += skb->len;
1162 total_rx_packets++;
1163 @@ -1987,8 +2001,12 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1164 else
1165 rctl |= E1000_RCTL_LPE;
1166
1167 - /* Enable hardware CRC frame stripping */
1168 - rctl |= E1000_RCTL_SECRC;
1169 + /* Some systems expect that the CRC is included in SMBUS traffic. The
1170 + * hardware strips the CRC before sending to both SMBUS (BMC) and to
1171 + * host memory when this is enabled
1172 + */
1173 + if (adapter->flags2 & FLAG2_CRC_STRIPPING)
1174 + rctl |= E1000_RCTL_SECRC;
1175
1176 /* Setup buffer sizes */
1177 rctl &= ~E1000_RCTL_SZ_4096;
1178 @@ -4412,6 +4430,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1179 adapter->ei = ei;
1180 adapter->pba = ei->pba;
1181 adapter->flags = ei->flags;
1182 + adapter->flags2 = ei->flags2;
1183 adapter->hw.adapter = adapter;
1184 adapter->hw.mac.type = ei->mac;
1185 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
1186 diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
1187 index d91dbf7..a7c8b99 100644
1188 --- a/drivers/net/e1000e/param.c
1189 +++ b/drivers/net/e1000e/param.c
1190 @@ -142,6 +142,16 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
1191 */
1192 E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
1193
1194 +/*
1195 + * Enable CRC Stripping
1196 + *
1197 + * Valid Range: 0, 1
1198 + *
1199 + * Default Value: 1 (enabled)
1200 + */
1201 +E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \
1202 + "the CRC");
1203 +
1204 struct e1000_option {
1205 enum { enable_option, range_option, list_option } type;
1206 const char *name;
1207 @@ -377,6 +387,21 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
1208 adapter->flags |= FLAG_SMART_POWER_DOWN;
1209 }
1210 }
1211 + { /* CRC Stripping */
1212 + const struct e1000_option opt = {
1213 + .type = enable_option,
1214 + .name = "CRC Stripping",
1215 + .err = "defaulting to enabled",
1216 + .def = OPTION_ENABLED
1217 + };
1218 +
1219 + if (num_CrcStripping > bd) {
1220 + unsigned int crc_stripping = CrcStripping[bd];
1221 + e1000_validate_option(&crc_stripping, &opt, adapter);
1222 + if (crc_stripping == OPTION_ENABLED)
1223 + adapter->flags2 |= FLAG2_CRC_STRIPPING;
1224 + }
1225 + }
1226 { /* Kumeran Lock Loss Workaround */
1227 const struct e1000_option opt = {
1228 .type = enable_option,
1229 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
1230 index 79b7ae3..20ab0fd 100644
1231 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
1232 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
1233 @@ -1334,16 +1334,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
1234 priv->cfg->ops->lib->rx_handler_setup(priv);
1235 }
1236
1237 -/*
1238 - * this should be called while priv->lock is locked
1239 -*/
1240 -static void __iwl_rx_replenish(struct iwl_priv *priv)
1241 -{
1242 - iwl_rx_allocate(priv);
1243 - iwl_rx_queue_restock(priv);
1244 -}
1245 -
1246 -
1247 /**
1248 * iwl_rx_handle - Main entry function for receiving responses from uCode
1249 *
1250 @@ -1449,7 +1439,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
1251 count++;
1252 if (count >= 8) {
1253 priv->rxq.read = i;
1254 - __iwl_rx_replenish(priv);
1255 + iwl_rx_queue_restock(priv);
1256 count = 0;
1257 }
1258 }
1259 diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
1260 index ce25379..36391ef 100644
1261 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c
1262 +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
1263 @@ -245,25 +245,31 @@ void iwl_rx_allocate(struct iwl_priv *priv)
1264 struct list_head *element;
1265 struct iwl_rx_mem_buffer *rxb;
1266 unsigned long flags;
1267 - spin_lock_irqsave(&rxq->lock, flags);
1268 - while (!list_empty(&rxq->rx_used)) {
1269 +
1270 + while (1) {
1271 + spin_lock_irqsave(&rxq->lock, flags);
1272 +
1273 + if (list_empty(&rxq->rx_used)) {
1274 + spin_unlock_irqrestore(&rxq->lock, flags);
1275 + return;
1276 + }
1277 element = rxq->rx_used.next;
1278 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1279 + list_del(element);
1280 +
1281 + spin_unlock_irqrestore(&rxq->lock, flags);
1282
1283 /* Alloc a new receive buffer */
1284 rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
1285 - __GFP_NOWARN | GFP_ATOMIC);
1286 + GFP_KERNEL);
1287 if (!rxb->skb) {
1288 - if (net_ratelimit())
1289 - printk(KERN_CRIT DRV_NAME
1290 - ": Can not allocate SKB buffers\n");
1291 + printk(KERN_CRIT DRV_NAME
1292 + "Can not allocate SKB buffers\n");
1293 /* We don't reschedule replenish work here -- we will
1294 * call the restock method and if it still needs
1295 * more buffers it will schedule replenish */
1296 break;
1297 }
1298 - priv->alloc_rxb_skb++;
1299 - list_del(element);
1300
1301 /* Get physical address of RB/SKB */
1302 rxb->real_dma_addr = pci_map_single(
1303 @@ -277,12 +283,15 @@ void iwl_rx_allocate(struct iwl_priv *priv)
1304 rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256);
1305 skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr);
1306
1307 + spin_lock_irqsave(&rxq->lock, flags);
1308 +
1309 list_add_tail(&rxb->list, &rxq->rx_free);
1310 rxq->free_count++;
1311 + priv->alloc_rxb_skb++;
1312 +
1313 + spin_unlock_irqrestore(&rxq->lock, flags);
1314 }
1315 - spin_unlock_irqrestore(&rxq->lock, flags);
1316 }
1317 -EXPORT_SYMBOL(iwl_rx_allocate);
1318
1319 void iwl_rx_replenish(struct iwl_priv *priv)
1320 {
1321 diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
1322 index a13f534..2d04b28 100644
1323 --- a/drivers/pci/pci-driver.c
1324 +++ b/drivers/pci/pci-driver.c
1325 @@ -287,6 +287,14 @@ static void pci_device_shutdown(struct device *dev)
1326
1327 #ifdef CONFIG_PM_SLEEP
1328
1329 +static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
1330 +{
1331 + struct pci_driver *drv = pci_dev->driver;
1332 +
1333 + return drv && (drv->suspend || drv->suspend_late || drv->resume
1334 + || drv->resume_early);
1335 +}
1336 +
1337 /*
1338 * Default "suspend" method for devices that have no driver provided suspend,
1339 * or not even a driver at all.
1340 @@ -304,14 +312,22 @@ static void pci_default_pm_suspend(struct pci_dev *pci_dev)
1341
1342 /*
1343 * Default "resume" method for devices that have no driver provided resume,
1344 - * or not even a driver at all.
1345 + * or not even a driver at all (first part).
1346 */
1347 -static int pci_default_pm_resume(struct pci_dev *pci_dev)
1348 +static void pci_default_pm_resume_early(struct pci_dev *pci_dev)
1349 {
1350 - int retval = 0;
1351 -
1352 /* restore the PCI config space */
1353 pci_restore_state(pci_dev);
1354 +}
1355 +
1356 +/*
1357 + * Default "resume" method for devices that have no driver provided resume,
1358 + * or not even a driver at all (second part).
1359 + */
1360 +static int pci_default_pm_resume_late(struct pci_dev *pci_dev)
1361 +{
1362 + int retval;
1363 +
1364 /* if the device was enabled before suspend, reenable */
1365 retval = pci_reenable_device(pci_dev);
1366 /*
1367 @@ -358,10 +374,12 @@ static int pci_legacy_resume(struct device *dev)
1368 struct pci_dev * pci_dev = to_pci_dev(dev);
1369 struct pci_driver * drv = pci_dev->driver;
1370
1371 - if (drv && drv->resume)
1372 + if (drv && drv->resume) {
1373 error = drv->resume(pci_dev);
1374 - else
1375 - error = pci_default_pm_resume(pci_dev);
1376 + } else {
1377 + pci_default_pm_resume_early(pci_dev);
1378 + error = pci_default_pm_resume_late(pci_dev);
1379 + }
1380 return error;
1381 }
1382
1383 @@ -407,10 +425,8 @@ static int pci_pm_suspend(struct device *dev)
1384 if (drv->pm->suspend) {
1385 error = drv->pm->suspend(dev);
1386 suspend_report_result(drv->pm->suspend, error);
1387 - } else {
1388 - pci_default_pm_suspend(pci_dev);
1389 }
1390 - } else {
1391 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1392 error = pci_legacy_suspend(dev, PMSG_SUSPEND);
1393 }
1394 pci_fixup_device(pci_fixup_suspend, pci_dev);
1395 @@ -429,8 +445,10 @@ static int pci_pm_suspend_noirq(struct device *dev)
1396 error = drv->pm->suspend_noirq(dev);
1397 suspend_report_result(drv->pm->suspend_noirq, error);
1398 }
1399 - } else {
1400 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1401 error = pci_legacy_suspend_late(dev, PMSG_SUSPEND);
1402 + } else {
1403 + pci_default_pm_suspend(pci_dev);
1404 }
1405
1406 return error;
1407 @@ -440,15 +458,17 @@ static int pci_pm_resume(struct device *dev)
1408 {
1409 struct pci_dev *pci_dev = to_pci_dev(dev);
1410 struct device_driver *drv = dev->driver;
1411 - int error;
1412 + int error = 0;
1413
1414 pci_fixup_device(pci_fixup_resume, pci_dev);
1415
1416 if (drv && drv->pm) {
1417 - error = drv->pm->resume ? drv->pm->resume(dev) :
1418 - pci_default_pm_resume(pci_dev);
1419 - } else {
1420 + if (drv->pm->resume)
1421 + error = drv->pm->resume(dev);
1422 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1423 error = pci_legacy_resume(dev);
1424 + } else {
1425 + error = pci_default_pm_resume_late(pci_dev);
1426 }
1427
1428 return error;
1429 @@ -465,8 +485,10 @@ static int pci_pm_resume_noirq(struct device *dev)
1430 if (drv && drv->pm) {
1431 if (drv->pm->resume_noirq)
1432 error = drv->pm->resume_noirq(dev);
1433 - } else {
1434 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1435 error = pci_legacy_resume_early(dev);
1436 + } else {
1437 + pci_default_pm_resume_early(pci_dev);
1438 }
1439
1440 return error;
1441 @@ -493,10 +515,8 @@ static int pci_pm_freeze(struct device *dev)
1442 if (drv->pm->freeze) {
1443 error = drv->pm->freeze(dev);
1444 suspend_report_result(drv->pm->freeze, error);
1445 - } else {
1446 - pci_default_pm_suspend(pci_dev);
1447 }
1448 - } else {
1449 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1450 error = pci_legacy_suspend(dev, PMSG_FREEZE);
1451 pci_fixup_device(pci_fixup_suspend, pci_dev);
1452 }
1453 @@ -515,8 +535,10 @@ static int pci_pm_freeze_noirq(struct device *dev)
1454 error = drv->pm->freeze_noirq(dev);
1455 suspend_report_result(drv->pm->freeze_noirq, error);
1456 }
1457 - } else {
1458 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1459 error = pci_legacy_suspend_late(dev, PMSG_FREEZE);
1460 + } else {
1461 + pci_default_pm_suspend(pci_dev);
1462 }
1463
1464 return error;
1465 @@ -524,14 +546,15 @@ static int pci_pm_freeze_noirq(struct device *dev)
1466
1467 static int pci_pm_thaw(struct device *dev)
1468 {
1469 + struct pci_dev *pci_dev = to_pci_dev(dev);
1470 struct device_driver *drv = dev->driver;
1471 int error = 0;
1472
1473 if (drv && drv->pm) {
1474 if (drv->pm->thaw)
1475 error = drv->pm->thaw(dev);
1476 - } else {
1477 - pci_fixup_device(pci_fixup_resume, to_pci_dev(dev));
1478 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1479 + pci_fixup_device(pci_fixup_resume, pci_dev);
1480 error = pci_legacy_resume(dev);
1481 }
1482
1483 @@ -547,7 +570,7 @@ static int pci_pm_thaw_noirq(struct device *dev)
1484 if (drv && drv->pm) {
1485 if (drv->pm->thaw_noirq)
1486 error = drv->pm->thaw_noirq(dev);
1487 - } else {
1488 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1489 pci_fixup_device(pci_fixup_resume_early, pci_dev);
1490 error = pci_legacy_resume_early(dev);
1491 }
1492 @@ -557,17 +580,18 @@ static int pci_pm_thaw_noirq(struct device *dev)
1493
1494 static int pci_pm_poweroff(struct device *dev)
1495 {
1496 + struct pci_dev *pci_dev = to_pci_dev(dev);
1497 struct device_driver *drv = dev->driver;
1498 int error = 0;
1499
1500 - pci_fixup_device(pci_fixup_suspend, to_pci_dev(dev));
1501 + pci_fixup_device(pci_fixup_suspend, pci_dev);
1502
1503 if (drv && drv->pm) {
1504 if (drv->pm->poweroff) {
1505 error = drv->pm->poweroff(dev);
1506 suspend_report_result(drv->pm->poweroff, error);
1507 }
1508 - } else {
1509 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1510 error = pci_legacy_suspend(dev, PMSG_HIBERNATE);
1511 }
1512
1513 @@ -585,7 +609,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
1514 error = drv->pm->poweroff_noirq(dev);
1515 suspend_report_result(drv->pm->poweroff_noirq, error);
1516 }
1517 - } else {
1518 + } else if (pci_has_legacy_pm_support(to_pci_dev(dev))) {
1519 error = pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
1520 }
1521
1522 @@ -596,13 +620,15 @@ static int pci_pm_restore(struct device *dev)
1523 {
1524 struct pci_dev *pci_dev = to_pci_dev(dev);
1525 struct device_driver *drv = dev->driver;
1526 - int error;
1527 + int error = 0;
1528
1529 if (drv && drv->pm) {
1530 - error = drv->pm->restore ? drv->pm->restore(dev) :
1531 - pci_default_pm_resume(pci_dev);
1532 - } else {
1533 + if (drv->pm->restore)
1534 + error = drv->pm->restore(dev);
1535 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1536 error = pci_legacy_resume(dev);
1537 + } else {
1538 + error = pci_default_pm_resume_late(pci_dev);
1539 }
1540 pci_fixup_device(pci_fixup_resume, pci_dev);
1541
1542 @@ -620,8 +646,10 @@ static int pci_pm_restore_noirq(struct device *dev)
1543 if (drv && drv->pm) {
1544 if (drv->pm->restore_noirq)
1545 error = drv->pm->restore_noirq(dev);
1546 - } else {
1547 + } else if (pci_has_legacy_pm_support(pci_dev)) {
1548 error = pci_legacy_resume_early(dev);
1549 + } else {
1550 + pci_default_pm_resume_early(pci_dev);
1551 }
1552 pci_fixup_device(pci_fixup_resume_early, pci_dev);
1553
1554 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1555 index c9884bb..409e00e 100644
1556 --- a/drivers/pci/pci.c
1557 +++ b/drivers/pci/pci.c
1558 @@ -636,19 +636,14 @@ static int pci_save_pcie_state(struct pci_dev *dev)
1559 int pos, i = 0;
1560 struct pci_cap_saved_state *save_state;
1561 u16 *cap;
1562 - int found = 0;
1563
1564 pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
1565 if (pos <= 0)
1566 return 0;
1567
1568 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
1569 - if (!save_state)
1570 - save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 4, GFP_KERNEL);
1571 - else
1572 - found = 1;
1573 if (!save_state) {
1574 - dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
1575 + dev_err(&dev->dev, "buffer not found in %s\n", __FUNCTION__);
1576 return -ENOMEM;
1577 }
1578 cap = (u16 *)&save_state->data[0];
1579 @@ -657,9 +652,7 @@ static int pci_save_pcie_state(struct pci_dev *dev)
1580 pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]);
1581 pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]);
1582 pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]);
1583 - save_state->cap_nr = PCI_CAP_ID_EXP;
1584 - if (!found)
1585 - pci_add_saved_cap(dev, save_state);
1586 +
1587 return 0;
1588 }
1589
1590 @@ -684,30 +677,21 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
1591
1592 static int pci_save_pcix_state(struct pci_dev *dev)
1593 {
1594 - int pos, i = 0;
1595 + int pos;
1596 struct pci_cap_saved_state *save_state;
1597 - u16 *cap;
1598 - int found = 0;
1599
1600 pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1601 if (pos <= 0)
1602 return 0;
1603
1604 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
1605 - if (!save_state)
1606 - save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL);
1607 - else
1608 - found = 1;
1609 if (!save_state) {
1610 - dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
1611 + dev_err(&dev->dev, "buffer not found in %s\n", __FUNCTION__);
1612 return -ENOMEM;
1613 }
1614 - cap = (u16 *)&save_state->data[0];
1615
1616 - pci_read_config_word(dev, pos + PCI_X_CMD, &cap[i++]);
1617 - save_state->cap_nr = PCI_CAP_ID_PCIX;
1618 - if (!found)
1619 - pci_add_saved_cap(dev, save_state);
1620 + pci_read_config_word(dev, pos + PCI_X_CMD, (u16 *)save_state->data);
1621 +
1622 return 0;
1623 }
1624
1625 @@ -726,6 +710,50 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
1626 pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
1627 }
1628
1629 + /**
1630 + * pci_add_save_buffer - allocate buffer for saving given capability registers
1631 + * @dev: the PCI device
1632 + * @cap: the capability to allocate the buffer for
1633 + * @size: requested size of the buffer
1634 + */
1635 +static int pci_add_cap_save_buffer(
1636 + struct pci_dev *dev, char cap, unsigned int size)
1637 +{
1638 + int pos;
1639 + struct pci_cap_saved_state *save_state;
1640 +
1641 + pos = pci_find_capability(dev, cap);
1642 + if (pos <= 0)
1643 + return 0;
1644 +
1645 + save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL);
1646 + if (!save_state)
1647 + return -ENOMEM;
1648 +
1649 + save_state->cap_nr = cap;
1650 + pci_add_saved_cap(dev, save_state);
1651 +
1652 + return 0;
1653 +}
1654 +
1655 +/**
1656 + * pci_allocate_cap_save_buffers - allocate buffers for saving capabilities
1657 + * @dev: the PCI device
1658 + */
1659 +void pci_allocate_cap_save_buffers(struct pci_dev *dev)
1660 +{
1661 + int error;
1662 +
1663 + error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, 4 * sizeof(u16));
1664 + if (error)
1665 + dev_err(&dev->dev,
1666 + "unable to preallocate PCI Express save buffer\n");
1667 +
1668 + error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_PCIX, sizeof(u16));
1669 + if (error)
1670 + dev_err(&dev->dev,
1671 + "unable to preallocate PCI-X save buffer\n");
1672 +}
1673
1674 /**
1675 * pci_save_state - save the PCI configuration space of a device before suspending
1676 diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
1677 index d807cd7..7b1efe9 100644
1678 --- a/drivers/pci/pci.h
1679 +++ b/drivers/pci/pci.h
1680 @@ -35,6 +35,7 @@ struct pci_platform_pm_ops {
1681
1682 extern int pci_set_platform_pm(struct pci_platform_pm_ops *ops);
1683 extern void pci_pm_init(struct pci_dev *dev);
1684 +extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
1685
1686 extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);
1687 extern int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val);
1688 diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
1689 index 367c9c2..6abfafc 100644
1690 --- a/drivers/pci/pcie/portdrv_pci.c
1691 +++ b/drivers/pci/pcie/portdrv_pci.c
1692 @@ -41,7 +41,6 @@ static int pcie_portdrv_restore_config(struct pci_dev *dev)
1693 {
1694 int retval;
1695
1696 - pci_restore_state(dev);
1697 retval = pci_enable_device(dev);
1698 if (retval)
1699 return retval;
1700 @@ -52,11 +51,18 @@ static int pcie_portdrv_restore_config(struct pci_dev *dev)
1701 #ifdef CONFIG_PM
1702 static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state)
1703 {
1704 - int ret = pcie_port_device_suspend(dev, state);
1705 + return pcie_port_device_suspend(dev, state);
1706
1707 - if (!ret)
1708 - ret = pcie_portdrv_save_config(dev);
1709 - return ret;
1710 +}
1711 +
1712 +static int pcie_portdrv_suspend_late(struct pci_dev *dev, pm_message_t state)
1713 +{
1714 + return pci_save_state(dev);
1715 +}
1716 +
1717 +static int pcie_portdrv_resume_early(struct pci_dev *dev)
1718 +{
1719 + return pci_restore_state(dev);
1720 }
1721
1722 static int pcie_portdrv_resume(struct pci_dev *dev)
1723 @@ -66,6 +72,8 @@ static int pcie_portdrv_resume(struct pci_dev *dev)
1724 }
1725 #else
1726 #define pcie_portdrv_suspend NULL
1727 +#define pcie_portdrv_suspend_late NULL
1728 +#define pcie_portdrv_resume_early NULL
1729 #define pcie_portdrv_resume NULL
1730 #endif
1731
1732 @@ -221,6 +229,7 @@ static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
1733
1734 /* If fatal, restore cfg space for possible link reset at upstream */
1735 if (dev->error_state == pci_channel_io_frozen) {
1736 + pci_restore_state(dev);
1737 pcie_portdrv_restore_config(dev);
1738 pci_enable_pcie_error_reporting(dev);
1739 }
1740 @@ -283,6 +292,8 @@ static struct pci_driver pcie_portdriver = {
1741 .remove = pcie_portdrv_remove,
1742
1743 .suspend = pcie_portdrv_suspend,
1744 + .suspend_late = pcie_portdrv_suspend_late,
1745 + .resume_early = pcie_portdrv_resume_early,
1746 .resume = pcie_portdrv_resume,
1747
1748 .err_handler = &pcie_portdrv_err_handler,
1749 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
1750 index bcafbd6..eb6c8d1 100644
1751 --- a/drivers/pci/probe.c
1752 +++ b/drivers/pci/probe.c
1753 @@ -1028,6 +1028,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1754 /* Fix up broken headers */
1755 pci_fixup_device(pci_fixup_header, dev);
1756
1757 + /* Buffers for saving PCIe and PCI-X capabilities */
1758 + pci_allocate_cap_save_buffers(dev);
1759 +
1760 /* Initialize power management of the device */
1761 pci_pm_init(dev);
1762
1763 diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
1764 index 645d7a6..ec22284 100644
1765 --- a/drivers/pci/syscall.c
1766 +++ b/drivers/pci/syscall.c
1767 @@ -14,10 +14,8 @@
1768 #include <asm/uaccess.h>
1769 #include "pci.h"
1770
1771 -asmlinkage long
1772 -sys_pciconfig_read(unsigned long bus, unsigned long dfn,
1773 - unsigned long off, unsigned long len,
1774 - void __user *buf)
1775 +SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
1776 + unsigned long, off, unsigned long, len, void __user *, buf)
1777 {
1778 struct pci_dev *dev;
1779 u8 byte;
1780 @@ -86,10 +84,8 @@ error:
1781 return err;
1782 }
1783
1784 -asmlinkage long
1785 -sys_pciconfig_write(unsigned long bus, unsigned long dfn,
1786 - unsigned long off, unsigned long len,
1787 - void __user *buf)
1788 +SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
1789 + unsigned long, off, unsigned long, len, void __user *, buf)
1790 {
1791 struct pci_dev *dev;
1792 u8 byte;
1793 diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
1794 index a73a6bb..976cdd5 100644
1795 --- a/drivers/scsi/eata.c
1796 +++ b/drivers/scsi/eata.c
1797 @@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha)
1798
1799 cpp->sense_len = SCSI_SENSE_BUFFERSIZE;
1800
1801 - count = scsi_dma_map(SCpnt);
1802 - BUG_ON(count < 0);
1803 + if (!scsi_sg_count(SCpnt)) {
1804 + cpp->data_len = 0;
1805 + return;
1806 + }
1807 +
1808 + count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
1809 + pci_dir);
1810 + BUG_ON(!count);
1811 +
1812 scsi_for_each_sg(SCpnt, sg, count, k) {
1813 cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
1814 cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
1815 @@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha)
1816 pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr),
1817 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
1818
1819 - scsi_dma_unmap(SCpnt);
1820 + if (scsi_sg_count(SCpnt))
1821 + pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
1822 + pci_dir);
1823
1824 if (!DEV2H(cpp->data_len))
1825 pci_dir = PCI_DMA_BIDIRECTIONAL;
1826 diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
1827 index 4e0b7c8..2f114b4 100644
1828 --- a/drivers/scsi/ibmvscsi/ibmvfc.c
1829 +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
1830 @@ -566,7 +566,7 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin)
1831 struct ibmvfc_target *tgt;
1832
1833 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
1834 - if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
1835 + if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
1836 dev_err(vhost->dev,
1837 "Host initialization retries exceeded. Taking adapter offline\n");
1838 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
1839 @@ -847,11 +847,12 @@ static void ibmvfc_reset_host(struct ibmvfc_host *vhost)
1840 static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost)
1841 {
1842 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
1843 - if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
1844 + vhost->delay_init = 1;
1845 + if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
1846 dev_err(vhost->dev,
1847 "Host initialization retries exceeded. Taking adapter offline\n");
1848 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
1849 - } else if (vhost->init_retries == IBMVFC_MAX_INIT_RETRIES)
1850 + } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES)
1851 __ibmvfc_reset_host(vhost);
1852 else
1853 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT);
1854 @@ -2091,15 +2092,17 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
1855 case IBMVFC_AE_LINK_UP:
1856 case IBMVFC_AE_RESUME:
1857 vhost->events_to_log |= IBMVFC_AE_LINKUP;
1858 - ibmvfc_init_host(vhost, 1);
1859 + vhost->delay_init = 1;
1860 + __ibmvfc_reset_host(vhost);
1861 break;
1862 case IBMVFC_AE_SCN_FABRIC:
1863 + case IBMVFC_AE_SCN_DOMAIN:
1864 vhost->events_to_log |= IBMVFC_AE_RSCN;
1865 - ibmvfc_init_host(vhost, 1);
1866 + vhost->delay_init = 1;
1867 + __ibmvfc_reset_host(vhost);
1868 break;
1869 case IBMVFC_AE_SCN_NPORT:
1870 case IBMVFC_AE_SCN_GROUP:
1871 - case IBMVFC_AE_SCN_DOMAIN:
1872 vhost->events_to_log |= IBMVFC_AE_RSCN;
1873 case IBMVFC_AE_ELS_LOGO:
1874 case IBMVFC_AE_ELS_PRLO:
1875 @@ -2671,7 +2674,7 @@ static void ibmvfc_init_tgt(struct ibmvfc_target *tgt,
1876 static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt,
1877 void (*job_step) (struct ibmvfc_target *))
1878 {
1879 - if (++tgt->init_retries > IBMVFC_MAX_INIT_RETRIES) {
1880 + if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) {
1881 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
1882 wake_up(&tgt->vhost->work_wait_q);
1883 } else
1884 @@ -3521,7 +3524,13 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
1885 break;
1886 case IBMVFC_HOST_ACTION_INIT:
1887 BUG_ON(vhost->state != IBMVFC_INITIALIZING);
1888 - vhost->job_step(vhost);
1889 + if (vhost->delay_init) {
1890 + vhost->delay_init = 0;
1891 + spin_unlock_irqrestore(vhost->host->host_lock, flags);
1892 + ssleep(15);
1893 + return;
1894 + } else
1895 + vhost->job_step(vhost);
1896 break;
1897 case IBMVFC_HOST_ACTION_QUERY:
1898 list_for_each_entry(tgt, &vhost->targets, queue)
1899 diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
1900 index fb3177a..d0e76d5 100644
1901 --- a/drivers/scsi/ibmvscsi/ibmvfc.h
1902 +++ b/drivers/scsi/ibmvscsi/ibmvfc.h
1903 @@ -33,7 +33,7 @@
1904 #define IBMVFC_DRIVER_DATE "(August 14, 2008)"
1905
1906 #define IBMVFC_DEFAULT_TIMEOUT 15
1907 -#define IBMVFC_INIT_TIMEOUT 30
1908 +#define IBMVFC_INIT_TIMEOUT 120
1909 #define IBMVFC_MAX_REQUESTS_DEFAULT 100
1910
1911 #define IBMVFC_DEBUG 0
1912 @@ -43,7 +43,8 @@
1913 #define IBMVFC_MAX_DISC_THREADS 4
1914 #define IBMVFC_TGT_MEMPOOL_SZ 64
1915 #define IBMVFC_MAX_CMDS_PER_LUN 64
1916 -#define IBMVFC_MAX_INIT_RETRIES 3
1917 +#define IBMVFC_MAX_HOST_INIT_RETRIES 6
1918 +#define IBMVFC_MAX_TGT_INIT_RETRIES 3
1919 #define IBMVFC_DEV_LOSS_TMO (5 * 60)
1920 #define IBMVFC_DEFAULT_LOG_LEVEL 2
1921 #define IBMVFC_MAX_CDB_LEN 16
1922 @@ -671,6 +672,7 @@ struct ibmvfc_host {
1923 int discovery_threads;
1924 int client_migrated;
1925 int reinit;
1926 + int delay_init;
1927 int events_to_log;
1928 #define IBMVFC_AE_LINKUP 0x0001
1929 #define IBMVFC_AE_LINKDOWN 0x0002
1930 diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c
1931 index 1dd70d7..23e5a87 100644
1932 --- a/drivers/scsi/mvsas.c
1933 +++ b/drivers/scsi/mvsas.c
1934 @@ -2959,7 +2959,7 @@ static int __devinit mvs_hw_init(struct mvs_info *mvi)
1935
1936 /* enable auto port detection */
1937 mw32(GBL_PORT_TYPE, MODE_AUTO_DET_EN);
1938 - msleep(100);
1939 + msleep(1100);
1940 /* init and reset phys */
1941 for (i = 0; i < mvi->chip->n_phy; i++) {
1942 u32 lo = be32_to_cpu(*(u32 *)&mvi->sas_addr[4]);
1943 diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
1944 index 2dd0dc9..c2e2de3 100644
1945 --- a/drivers/scsi/pcmcia/aha152x_stub.c
1946 +++ b/drivers/scsi/pcmcia/aha152x_stub.c
1947 @@ -114,7 +114,7 @@ static int aha152x_probe(struct pcmcia_device *link)
1948 link->io.NumPorts1 = 0x20;
1949 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1950 link->io.IOAddrLines = 10;
1951 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
1952 + link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
1953 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
1954 link->conf.Attributes = CONF_ENABLE_IRQ;
1955 link->conf.IntType = INT_MEMORY_AND_IO;
1956 diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
1957 index 78b8aaa..d8b0ba5 100644
1958 --- a/drivers/usb/host/isp1760-if.c
1959 +++ b/drivers/usb/host/isp1760-if.c
1960 @@ -267,12 +267,16 @@ static void isp1761_pci_shutdown(struct pci_dev *dev)
1961 printk(KERN_ERR "ips1761_pci_shutdown\n");
1962 }
1963
1964 -static const struct pci_device_id isp1760_plx [] = { {
1965 - /* handle any USB 2.0 EHCI controller */
1966 - PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_OTHER << 8) | (0x06 << 16)), ~0),
1967 - .driver_data = 0,
1968 -},
1969 -{ /* end: all zeroes */ }
1970 +static const struct pci_device_id isp1760_plx [] = {
1971 + {
1972 + .class = PCI_CLASS_BRIDGE_OTHER << 8,
1973 + .class_mask = ~0,
1974 + .vendor = PCI_VENDOR_ID_PLX,
1975 + .device = 0x5406,
1976 + .subvendor = PCI_VENDOR_ID_PLX,
1977 + .subdevice = 0x9054,
1978 + },
1979 + { }
1980 };
1981 MODULE_DEVICE_TABLE(pci, isp1760_plx);
1982
1983 diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
1984 index 4b994a0..5cae8fd 100644
1985 --- a/drivers/usb/misc/emi26.c
1986 +++ b/drivers/usb/misc/emi26.c
1987 @@ -157,7 +157,7 @@ static int emi26_load_firmware (struct usb_device *dev)
1988 err("%s - error loading firmware: error = %d", __func__, err);
1989 goto wraperr;
1990 }
1991 - } while (i > 0);
1992 + } while (rec);
1993
1994 /* Assert reset (stop the CPU in the EMI) */
1995 err = emi26_set_reset(dev,1);
1996 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1997 index e16d547..476da5d 100644
1998 --- a/drivers/usb/storage/unusual_devs.h
1999 +++ b/drivers/usb/storage/unusual_devs.h
2000 @@ -246,6 +246,13 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
2001 US_SC_DEVICE, US_PR_DEVICE, NULL,
2002 US_FL_FIX_CAPACITY ),
2003
2004 +/* Reported by Paulo Fessel <pfessel@gmail.com> */
2005 +UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999,
2006 + "Nokia",
2007 + "5200",
2008 + US_SC_DEVICE, US_PR_DEVICE, NULL,
2009 + US_FL_FIX_CAPACITY ),
2010 +
2011 /* Reported by Richard Nauber <RichardNauber@web.de> */
2012 UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
2013 "Nokia",
2014 @@ -1040,7 +1047,7 @@ UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0100,
2015 US_FL_FIX_CAPACITY | US_FL_GO_SLOW ),
2016
2017 /* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */
2018 -UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001,
2019 +UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0101,
2020 "Prolific Technology Inc.",
2021 "ATAPI-6 Bridge Controller",
2022 US_SC_DEVICE, US_PR_DEVICE, NULL,
2023 @@ -1320,6 +1327,13 @@ UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0001,
2024 US_SC_DEVICE, US_PR_DEVICE, NULL,
2025 US_FL_FIX_CAPACITY),
2026
2027 +/* Reported and patched by Nguyen Anh Quynh <aquynh@gmail.com> */
2028 +UNUSUAL_DEV( 0x0840, 0x0084, 0x0001, 0x0001,
2029 + "Argosy",
2030 + "Storage",
2031 + US_SC_DEVICE, US_PR_DEVICE, NULL,
2032 + US_FL_FIX_CAPACITY),
2033 +
2034 /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
2035 * Flag will support Bulk devices which use a standards-violating 32-byte
2036 * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with
2037 @@ -1425,6 +1439,13 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
2038 US_SC_DEVICE, US_PR_DEVICE, NULL,
2039 US_FL_FIX_INQUIRY ),
2040
2041 +/* Reported by Jaak Ristioja <Ristioja@gmail.com> */
2042 +UNUSUAL_DEV( 0x0a17, 0x006e, 0x0100, 0x0100,
2043 + "Pentax",
2044 + "K10D",
2045 + US_SC_DEVICE, US_PR_DEVICE, NULL,
2046 + US_FL_FIX_CAPACITY ),
2047 +
2048 /* These are virtual windows driver CDs, which the zd1211rw driver
2049 * automatically converts into WLAN devices. */
2050 UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
2051 diff --git a/fs/affs/file.c b/fs/affs/file.c
2052 index 1377b12..9246cb4 100644
2053 --- a/fs/affs/file.c
2054 +++ b/fs/affs/file.c
2055 @@ -628,7 +628,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
2056 }
2057
2058 index = pos >> PAGE_CACHE_SHIFT;
2059 - page = __grab_cache_page(mapping, index);
2060 + page = grab_cache_page_write_begin(mapping, index, flags);
2061 if (!page)
2062 return -ENOMEM;
2063 *pagep = page;
2064 diff --git a/fs/aio.c b/fs/aio.c
2065 index f658441..048648d 100644
2066 --- a/fs/aio.c
2067 +++ b/fs/aio.c
2068 @@ -1258,7 +1258,7 @@ static void io_destroy(struct kioctx *ioctx)
2069 * pointer is passed for ctxp. Will fail with -ENOSYS if not
2070 * implemented.
2071 */
2072 -asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
2073 +SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
2074 {
2075 struct kioctx *ioctx = NULL;
2076 unsigned long ctx;
2077 @@ -1296,7 +1296,7 @@ out:
2078 * implemented. May fail with -EFAULT if the context pointed to
2079 * is invalid.
2080 */
2081 -asmlinkage long sys_io_destroy(aio_context_t ctx)
2082 +SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
2083 {
2084 struct kioctx *ioctx = lookup_ioctx(ctx);
2085 if (likely(NULL != ioctx)) {
2086 @@ -1650,8 +1650,8 @@ out_put_req:
2087 * are available to queue any iocbs. Will return 0 if nr is 0. Will
2088 * fail with -ENOSYS if not implemented.
2089 */
2090 -asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
2091 - struct iocb __user * __user *iocbpp)
2092 +SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
2093 + struct iocb __user * __user *, iocbpp)
2094 {
2095 struct kioctx *ctx;
2096 long ret = 0;
2097 @@ -1725,8 +1725,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
2098 * invalid. May fail with -EAGAIN if the iocb specified was not
2099 * cancelled. Will fail with -ENOSYS if not implemented.
2100 */
2101 -asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
2102 - struct io_event __user *result)
2103 +SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
2104 + struct io_event __user *, result)
2105 {
2106 int (*cancel)(struct kiocb *iocb, struct io_event *res);
2107 struct kioctx *ctx;
2108 @@ -1787,11 +1787,11 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
2109 * will be updated if not NULL and the operation blocks. Will fail
2110 * with -ENOSYS if not implemented.
2111 */
2112 -asmlinkage long sys_io_getevents(aio_context_t ctx_id,
2113 - long min_nr,
2114 - long nr,
2115 - struct io_event __user *events,
2116 - struct timespec __user *timeout)
2117 +SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
2118 + long, min_nr,
2119 + long, nr,
2120 + struct io_event __user *, events,
2121 + struct timespec __user *, timeout)
2122 {
2123 struct kioctx *ioctx = lookup_ioctx(ctx_id);
2124 long ret = -EINVAL;
2125 diff --git a/fs/buffer.c b/fs/buffer.c
2126 index ac78d4c..a542f97 100644
2127 --- a/fs/buffer.c
2128 +++ b/fs/buffer.c
2129 @@ -1988,7 +1988,7 @@ int block_write_begin(struct file *file, struct address_space *mapping,
2130 page = *pagep;
2131 if (page == NULL) {
2132 ownpage = 1;
2133 - page = __grab_cache_page(mapping, index);
2134 + page = grab_cache_page_write_begin(mapping, index, flags);
2135 if (!page) {
2136 status = -ENOMEM;
2137 goto out;
2138 @@ -2494,7 +2494,7 @@ int nobh_write_begin(struct file *file, struct address_space *mapping,
2139 from = pos & (PAGE_CACHE_SIZE - 1);
2140 to = from + len;
2141
2142 - page = __grab_cache_page(mapping, index);
2143 + page = grab_cache_page_write_begin(mapping, index, flags);
2144 if (!page)
2145 return -ENOMEM;
2146 *pagep = page;
2147 @@ -3177,7 +3177,7 @@ void block_sync_page(struct page *page)
2148 * Use of bdflush() is deprecated and will be removed in a future kernel.
2149 * The `pdflush' kernel threads fully replace bdflush daemons and this call.
2150 */
2151 -asmlinkage long sys_bdflush(int func, long data)
2152 +SYSCALL_DEFINE2(bdflush, int, func, long, data)
2153 {
2154 static int msg_count;
2155
2156 diff --git a/fs/compat.c b/fs/compat.c
2157 index 075d050..a76455b 100644
2158 --- a/fs/compat.c
2159 +++ b/fs/compat.c
2160 @@ -1640,7 +1640,7 @@ sticky:
2161 }
2162
2163 #ifdef HAVE_SET_RESTORE_SIGMASK
2164 -asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
2165 +static long do_compat_pselect(int n, compat_ulong_t __user *inp,
2166 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
2167 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
2168 compat_size_t sigsetsize)
2169 @@ -1748,8 +1748,8 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
2170 (compat_size_t __user *)(sig+sizeof(up))))
2171 return -EFAULT;
2172 }
2173 - return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up),
2174 - sigsetsize);
2175 + return do_compat_pselect(n, inp, outp, exp, tsp, compat_ptr(up),
2176 + sigsetsize);
2177 }
2178
2179 asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
2180 diff --git a/fs/dcache.c b/fs/dcache.c
2181 index e7a1a99..1c12fcc 100644
2182 --- a/fs/dcache.c
2183 +++ b/fs/dcache.c
2184 @@ -1615,8 +1615,11 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
2185 */
2186 memcpy(dentry->d_iname, target->d_name.name,
2187 target->d_name.len + 1);
2188 + dentry->d_name.len = target->d_name.len;
2189 + return;
2190 }
2191 }
2192 + do_switch(dentry->d_name.len, target->d_name.len);
2193 }
2194
2195 /*
2196 @@ -1676,7 +1679,6 @@ already_unhashed:
2197
2198 /* Switch the names.. */
2199 switch_names(dentry, target);
2200 - do_switch(dentry->d_name.len, target->d_name.len);
2201 do_switch(dentry->d_name.hash, target->d_name.hash);
2202
2203 /* ... and switch the parents */
2204 @@ -1781,7 +1783,6 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2205 struct dentry *dparent, *aparent;
2206
2207 switch_names(dentry, anon);
2208 - do_switch(dentry->d_name.len, anon->d_name.len);
2209 do_switch(dentry->d_name.hash, anon->d_name.hash);
2210
2211 dparent = dentry->d_parent;
2212 @@ -2085,7 +2086,7 @@ Elong:
2213 * return NULL;
2214 * }
2215 */
2216 -asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
2217 +SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
2218 {
2219 int error;
2220 struct path pwd, root;
2221 diff --git a/fs/dcookies.c b/fs/dcookies.c
2222 index 855d4b1..f0da95b 100644
2223 --- a/fs/dcookies.c
2224 +++ b/fs/dcookies.c
2225 @@ -140,7 +140,7 @@ out:
2226 /* And here is where the userspace process can look up the cookie value
2227 * to retrieve the path.
2228 */
2229 -asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len)
2230 +SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
2231 {
2232 unsigned long cookie = (unsigned long)cookie64;
2233 int err = -EINVAL;
2234 @@ -193,7 +193,13 @@ out:
2235 mutex_unlock(&dcookie_mutex);
2236 return err;
2237 }
2238 -
2239 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
2240 +asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len)
2241 +{
2242 + return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len);
2243 +}
2244 +SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie);
2245 +#endif
2246
2247 static int dcookie_init(void)
2248 {
2249 diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
2250 index 89209f0..5e78fc1 100644
2251 --- a/fs/ecryptfs/inode.c
2252 +++ b/fs/ecryptfs/inode.c
2253 @@ -673,10 +673,11 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
2254 ecryptfs_printk(KERN_DEBUG, "Calling readlink w/ "
2255 "dentry->d_name.name = [%s]\n", dentry->d_name.name);
2256 rc = dentry->d_inode->i_op->readlink(dentry, (char __user *)buf, len);
2257 - buf[rc] = '\0';
2258 set_fs(old_fs);
2259 if (rc < 0)
2260 goto out_free;
2261 + else
2262 + buf[rc] = '\0';
2263 rc = 0;
2264 nd_set_link(nd, buf);
2265 goto out;
2266 diff --git a/fs/eventfd.c b/fs/eventfd.c
2267 index 08bf558..5de2c2d 100644
2268 --- a/fs/eventfd.c
2269 +++ b/fs/eventfd.c
2270 @@ -198,7 +198,7 @@ struct file *eventfd_fget(int fd)
2271 return file;
2272 }
2273
2274 -asmlinkage long sys_eventfd2(unsigned int count, int flags)
2275 +SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
2276 {
2277 int fd;
2278 struct eventfd_ctx *ctx;
2279 @@ -228,8 +228,7 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
2280 return fd;
2281 }
2282
2283 -asmlinkage long sys_eventfd(unsigned int count)
2284 +SYSCALL_DEFINE1(eventfd, unsigned int, count)
2285 {
2286 return sys_eventfd2(count, 0);
2287 }
2288 -
2289 diff --git a/fs/eventpoll.c b/fs/eventpoll.c
2290 index c8cec49..cb60f92 100644
2291 --- a/fs/eventpoll.c
2292 +++ b/fs/eventpoll.c
2293 @@ -1106,7 +1106,7 @@ retry:
2294 /*
2295 * Open an eventpoll file descriptor.
2296 */
2297 -asmlinkage long sys_epoll_create1(int flags)
2298 +SYSCALL_DEFINE1(epoll_create1, int, flags)
2299 {
2300 int error, fd = -1;
2301 struct eventpoll *ep;
2302 @@ -1146,7 +1146,7 @@ error_return:
2303 return fd;
2304 }
2305
2306 -asmlinkage long sys_epoll_create(int size)
2307 +SYSCALL_DEFINE1(epoll_create, int, size)
2308 {
2309 if (size < 0)
2310 return -EINVAL;
2311 @@ -1159,8 +1159,8 @@ asmlinkage long sys_epoll_create(int size)
2312 * the eventpoll file that enables the insertion/removal/change of
2313 * file descriptors inside the interest set.
2314 */
2315 -asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
2316 - struct epoll_event __user *event)
2317 +SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
2318 + struct epoll_event __user *, event)
2319 {
2320 int error;
2321 struct file *file, *tfile;
2322 @@ -1257,8 +1257,8 @@ error_return:
2323 * Implement the event wait interface for the eventpoll file. It is the kernel
2324 * part of the user space epoll_wait(2).
2325 */
2326 -asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
2327 - int maxevents, int timeout)
2328 +SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events,
2329 + int, maxevents, int, timeout)
2330 {
2331 int error;
2332 struct file *file;
2333 @@ -1315,9 +1315,9 @@ error_return:
2334 * Implement the event wait interface for the eventpoll file. It is the kernel
2335 * part of the user space epoll_pwait(2).
2336 */
2337 -asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
2338 - int maxevents, int timeout, const sigset_t __user *sigmask,
2339 - size_t sigsetsize)
2340 +SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
2341 + int, maxevents, int, timeout, const sigset_t __user *, sigmask,
2342 + size_t, sigsetsize)
2343 {
2344 int error;
2345 sigset_t ksigmask, sigsaved;
2346 diff --git a/fs/exec.c b/fs/exec.c
2347 index b266ace..5027d01 100644
2348 --- a/fs/exec.c
2349 +++ b/fs/exec.c
2350 @@ -105,7 +105,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
2351 *
2352 * Also note that we take the address to load from from the file itself.
2353 */
2354 -asmlinkage long sys_uselib(const char __user * library)
2355 +SYSCALL_DEFINE1(uselib, const char __user *, library)
2356 {
2357 struct file *file;
2358 struct nameidata nd;
2359 diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
2360 index 507d868..c5f40a0 100644
2361 --- a/fs/ext3/inode.c
2362 +++ b/fs/ext3/inode.c
2363 @@ -1152,7 +1152,7 @@ static int ext3_write_begin(struct file *file, struct address_space *mapping,
2364 to = from + len;
2365
2366 retry:
2367 - page = __grab_cache_page(mapping, index);
2368 + page = grab_cache_page_write_begin(mapping, index, flags);
2369 if (!page)
2370 return -ENOMEM;
2371 *pagep = page;
2372 diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
2373 index de13e91..1f55382 100644
2374 --- a/fs/ext3/namei.c
2375 +++ b/fs/ext3/namei.c
2376 @@ -2187,8 +2187,7 @@ retry:
2377 * We have a transaction open. All is sweetness. It also sets
2378 * i_size in generic_commit_write().
2379 */
2380 - err = __page_symlink(inode, symname, l,
2381 - mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
2382 + err = __page_symlink(inode, symname, l, 1);
2383 if (err) {
2384 drop_nlink(inode);
2385 ext3_mark_inode_dirty(handle, inode);
2386 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2387 index 846a790..d77f674 100644
2388 --- a/fs/ext4/inode.c
2389 +++ b/fs/ext4/inode.c
2390 @@ -1370,7 +1370,7 @@ retry:
2391 goto out;
2392 }
2393
2394 - page = __grab_cache_page(mapping, index);
2395 + page = grab_cache_page_write_begin(mapping, index, flags);
2396 if (!page) {
2397 ext4_journal_stop(handle);
2398 ret = -ENOMEM;
2399 @@ -2421,7 +2421,7 @@ retry:
2400 goto out;
2401 }
2402
2403 - page = __grab_cache_page(mapping, index);
2404 + page = grab_cache_page_write_begin(mapping, index, flags);
2405 if (!page) {
2406 ext4_journal_stop(handle);
2407 ret = -ENOMEM;
2408 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
2409 index 387ad98..d626533 100644
2410 --- a/fs/ext4/namei.c
2411 +++ b/fs/ext4/namei.c
2412 @@ -2216,8 +2216,7 @@ retry:
2413 * We have a transaction open. All is sweetness. It also sets
2414 * i_size in generic_commit_write().
2415 */
2416 - err = __page_symlink(inode, symname, l,
2417 - mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
2418 + err = __page_symlink(inode, symname, l, 1);
2419 if (err) {
2420 clear_nlink(inode);
2421 ext4_mark_inode_dirty(handle, inode);
2422 diff --git a/fs/fcntl.c b/fs/fcntl.c
2423 index 549daf8..08a109b 100644
2424 --- a/fs/fcntl.c
2425 +++ b/fs/fcntl.c
2426 @@ -50,7 +50,7 @@ static int get_close_on_exec(unsigned int fd)
2427 return res;
2428 }
2429
2430 -asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
2431 +SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
2432 {
2433 int err = -EBADF;
2434 struct file * file, *tofree;
2435 @@ -113,7 +113,7 @@ out_unlock:
2436 return err;
2437 }
2438
2439 -asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
2440 +SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
2441 {
2442 if (unlikely(newfd == oldfd)) { /* corner case */
2443 struct files_struct *files = current->files;
2444 @@ -126,7 +126,7 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
2445 return sys_dup3(oldfd, newfd, 0);
2446 }
2447
2448 -asmlinkage long sys_dup(unsigned int fildes)
2449 +SYSCALL_DEFINE1(dup, unsigned int, fildes)
2450 {
2451 int ret = -EBADF;
2452 struct file *file = fget(fildes);
2453 @@ -334,7 +334,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
2454 return err;
2455 }
2456
2457 -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
2458 +SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
2459 {
2460 struct file *filp;
2461 long err = -EBADF;
2462 @@ -357,7 +357,8 @@ out:
2463 }
2464
2465 #if BITS_PER_LONG == 32
2466 -asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
2467 +SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
2468 + unsigned long, arg)
2469 {
2470 struct file * filp;
2471 long err;
2472 diff --git a/fs/filesystems.c b/fs/filesystems.c
2473 index f37f872..25f5b6a 100644
2474 --- a/fs/filesystems.c
2475 +++ b/fs/filesystems.c
2476 @@ -177,7 +177,7 @@ static int fs_maxindex(void)
2477 /*
2478 * Whee.. Weird sysv syscall.
2479 */
2480 -asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2)
2481 +SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
2482 {
2483 int retval = -EINVAL;
2484
2485 diff --git a/fs/fuse/file.c b/fs/fuse/file.c
2486 index 2bada6b..c8206db 100644
2487 --- a/fs/fuse/file.c
2488 +++ b/fs/fuse/file.c
2489 @@ -644,7 +644,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,
2490 {
2491 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
2492
2493 - *pagep = __grab_cache_page(mapping, index);
2494 + *pagep = grab_cache_page_write_begin(mapping, index, flags);
2495 if (!*pagep)
2496 return -ENOMEM;
2497 return 0;
2498 @@ -777,7 +777,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
2499 break;
2500
2501 err = -ENOMEM;
2502 - page = __grab_cache_page(mapping, index);
2503 + page = grab_cache_page_write_begin(mapping, index, 0);
2504 if (!page)
2505 break;
2506
2507 diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
2508 index e64a1b0..c75df06 100644
2509 --- a/fs/gfs2/ops_address.c
2510 +++ b/fs/gfs2/ops_address.c
2511 @@ -675,7 +675,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
2512 goto out_trans_fail;
2513
2514 error = -ENOMEM;
2515 - page = __grab_cache_page(mapping, index);
2516 + page = grab_cache_page_write_begin(mapping, index, flags);
2517 *pagep = page;
2518 if (unlikely(!page))
2519 goto out_endtrans;
2520 diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
2521 index d6ecabf..5e17cae 100644
2522 --- a/fs/hostfs/hostfs_kern.c
2523 +++ b/fs/hostfs/hostfs_kern.c
2524 @@ -500,7 +500,7 @@ int hostfs_write_begin(struct file *file, struct address_space *mapping,
2525 {
2526 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
2527
2528 - *pagep = __grab_cache_page(mapping, index);
2529 + *pagep = grab_cache_page_write_begin(mapping, index, flags);
2530 if (!*pagep)
2531 return -ENOMEM;
2532 return 0;
2533 diff --git a/fs/inotify_user.c b/fs/inotify_user.c
2534 index d85c7d9..a13f487 100644
2535 --- a/fs/inotify_user.c
2536 +++ b/fs/inotify_user.c
2537 @@ -579,7 +579,7 @@ static const struct inotify_operations inotify_user_ops = {
2538 .destroy_watch = free_inotify_user_watch,
2539 };
2540
2541 -asmlinkage long sys_inotify_init1(int flags)
2542 +SYSCALL_DEFINE1(inotify_init1, int, flags)
2543 {
2544 struct inotify_device *dev;
2545 struct inotify_handle *ih;
2546 @@ -658,12 +658,13 @@ out_put_fd:
2547 return ret;
2548 }
2549
2550 -asmlinkage long sys_inotify_init(void)
2551 +SYSCALL_DEFINE0(inotify_init)
2552 {
2553 return sys_inotify_init1(0);
2554 }
2555
2556 -asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask)
2557 +SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
2558 + u32, mask)
2559 {
2560 struct inode *inode;
2561 struct inotify_device *dev;
2562 @@ -707,7 +708,7 @@ fput_and_out:
2563 return ret;
2564 }
2565
2566 -asmlinkage long sys_inotify_rm_watch(int fd, u32 wd)
2567 +SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
2568 {
2569 struct file *filp;
2570 struct inotify_device *dev;
2571 diff --git a/fs/ioctl.c b/fs/ioctl.c
2572 index 612e0b2..b9a59a4 100644
2573 --- a/fs/ioctl.c
2574 +++ b/fs/ioctl.c
2575 @@ -195,7 +195,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2576 return error;
2577 }
2578
2579 -asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
2580 +SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
2581 {
2582 struct file *filp;
2583 int error = -EBADF;
2584 diff --git a/fs/ioprio.c b/fs/ioprio.c
2585 index da3cc46..3715d7d 100644
2586 --- a/fs/ioprio.c
2587 +++ b/fs/ioprio.c
2588 @@ -65,7 +65,7 @@ static int set_task_ioprio(struct task_struct *task, int ioprio)
2589 return err;
2590 }
2591
2592 -asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
2593 +SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
2594 {
2595 int class = IOPRIO_PRIO_CLASS(ioprio);
2596 int data = IOPRIO_PRIO_DATA(ioprio);
2597 @@ -181,7 +181,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
2598 return aprio;
2599 }
2600
2601 -asmlinkage long sys_ioprio_get(int which, int who)
2602 +SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
2603 {
2604 struct task_struct *g, *p;
2605 struct user_struct *user;
2606 @@ -245,4 +245,3 @@ asmlinkage long sys_ioprio_get(int which, int who)
2607 read_unlock(&tasklist_lock);
2608 return ret;
2609 }
2610 -
2611 diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
2612 index 5a98aa8..5edc2bf 100644
2613 --- a/fs/jffs2/file.c
2614 +++ b/fs/jffs2/file.c
2615 @@ -132,7 +132,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
2616 uint32_t pageofs = index << PAGE_CACHE_SHIFT;
2617 int ret = 0;
2618
2619 - pg = __grab_cache_page(mapping, index);
2620 + pg = grab_cache_page_write_begin(mapping, index, flags);
2621 if (!pg)
2622 return -ENOMEM;
2623 *pagep = pg;
2624 diff --git a/fs/libfs.c b/fs/libfs.c
2625 index 1add676..8fc2407 100644
2626 --- a/fs/libfs.c
2627 +++ b/fs/libfs.c
2628 @@ -360,7 +360,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping,
2629 index = pos >> PAGE_CACHE_SHIFT;
2630 from = pos & (PAGE_CACHE_SIZE - 1);
2631
2632 - page = __grab_cache_page(mapping, index);
2633 + page = grab_cache_page_write_begin(mapping, index, flags);
2634 if (!page)
2635 return -ENOMEM;
2636
2637 diff --git a/fs/locks.c b/fs/locks.c
2638 index 5eb259e..5d39a43 100644
2639 --- a/fs/locks.c
2640 +++ b/fs/locks.c
2641 @@ -1564,7 +1564,7 @@ EXPORT_SYMBOL(flock_lock_file_wait);
2642 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other
2643 * processes read and write access respectively.
2644 */
2645 -asmlinkage long sys_flock(unsigned int fd, unsigned int cmd)
2646 +SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
2647 {
2648 struct file *filp;
2649 struct file_lock *lock;
2650 diff --git a/fs/minix/dir.c b/fs/minix/dir.c
2651 index f704338..d4946c4 100644
2652 --- a/fs/minix/dir.c
2653 +++ b/fs/minix/dir.c
2654 @@ -280,7 +280,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
2655 return -EINVAL;
2656
2657 got_it:
2658 - pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page);
2659 + pos = page_offset(page) + p - (char *)page_address(page);
2660 err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize,
2661 AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
2662 if (err)
2663 diff --git a/fs/namei.c b/fs/namei.c
2664 index 4ea63ed..2259d21 100644
2665 --- a/fs/namei.c
2666 +++ b/fs/namei.c
2667 @@ -1990,8 +1990,8 @@ static int may_mknod(mode_t mode)
2668 }
2669 }
2670
2671 -asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
2672 - unsigned dev)
2673 +SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
2674 + unsigned, dev)
2675 {
2676 int error;
2677 char *tmp;
2678 @@ -2041,7 +2041,7 @@ out_unlock:
2679 return error;
2680 }
2681
2682 -asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev)
2683 +SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev)
2684 {
2685 return sys_mknodat(AT_FDCWD, filename, mode, dev);
2686 }
2687 @@ -2068,7 +2068,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2688 return error;
2689 }
2690
2691 -asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
2692 +SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
2693 {
2694 int error = 0;
2695 char * tmp;
2696 @@ -2101,7 +2101,7 @@ out_err:
2697 return error;
2698 }
2699
2700 -asmlinkage long sys_mkdir(const char __user *pathname, int mode)
2701 +SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
2702 {
2703 return sys_mkdirat(AT_FDCWD, pathname, mode);
2704 }
2705 @@ -2208,7 +2208,7 @@ exit1:
2706 return error;
2707 }
2708
2709 -asmlinkage long sys_rmdir(const char __user *pathname)
2710 +SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
2711 {
2712 return do_rmdir(AT_FDCWD, pathname);
2713 }
2714 @@ -2297,7 +2297,7 @@ slashes:
2715 goto exit2;
2716 }
2717
2718 -asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
2719 +SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
2720 {
2721 if ((flag & ~AT_REMOVEDIR) != 0)
2722 return -EINVAL;
2723 @@ -2308,7 +2308,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
2724 return do_unlinkat(dfd, pathname);
2725 }
2726
2727 -asmlinkage long sys_unlink(const char __user *pathname)
2728 +SYSCALL_DEFINE1(unlink, const char __user *, pathname)
2729 {
2730 return do_unlinkat(AT_FDCWD, pathname);
2731 }
2732 @@ -2334,8 +2334,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2733 return error;
2734 }
2735
2736 -asmlinkage long sys_symlinkat(const char __user *oldname,
2737 - int newdfd, const char __user *newname)
2738 +SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
2739 + int, newdfd, const char __user *, newname)
2740 {
2741 int error;
2742 char *from;
2743 @@ -2372,7 +2372,7 @@ out_putname:
2744 return error;
2745 }
2746
2747 -asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname)
2748 +SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
2749 {
2750 return sys_symlinkat(oldname, AT_FDCWD, newname);
2751 }
2752 @@ -2424,9 +2424,8 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2753 * with linux 2.0, and to avoid hard-linking to directories
2754 * and other special files. --ADM
2755 */
2756 -asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2757 - int newdfd, const char __user *newname,
2758 - int flags)
2759 +SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
2760 + int, newdfd, const char __user *, newname, int, flags)
2761 {
2762 struct dentry *new_dentry;
2763 struct nameidata nd;
2764 @@ -2471,7 +2470,7 @@ out:
2765 return error;
2766 }
2767
2768 -asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
2769 +SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
2770 {
2771 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2772 }
2773 @@ -2622,8 +2621,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2774 return error;
2775 }
2776
2777 -asmlinkage long sys_renameat(int olddfd, const char __user *oldname,
2778 - int newdfd, const char __user *newname)
2779 +SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
2780 + int, newdfd, const char __user *, newname)
2781 {
2782 struct dentry *old_dir, *new_dir;
2783 struct dentry *old_dentry, *new_dentry;
2784 @@ -2707,7 +2706,7 @@ exit:
2785 return error;
2786 }
2787
2788 -asmlinkage long sys_rename(const char __user *oldname, const char __user *newname)
2789 +SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
2790 {
2791 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
2792 }
2793 @@ -2797,18 +2796,23 @@ void page_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
2794 }
2795 }
2796
2797 -int __page_symlink(struct inode *inode, const char *symname, int len,
2798 - gfp_t gfp_mask)
2799 +/*
2800 + * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS
2801 + */
2802 +int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
2803 {
2804 struct address_space *mapping = inode->i_mapping;
2805 struct page *page;
2806 void *fsdata;
2807 int err;
2808 char *kaddr;
2809 + unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE;
2810 + if (nofs)
2811 + flags |= AOP_FLAG_NOFS;
2812
2813 retry:
2814 err = pagecache_write_begin(NULL, mapping, 0, len-1,
2815 - AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
2816 + flags, &page, &fsdata);
2817 if (err)
2818 goto fail;
2819
2820 @@ -2832,7 +2836,7 @@ fail:
2821 int page_symlink(struct inode *inode, const char *symname, int len)
2822 {
2823 return __page_symlink(inode, symname, len,
2824 - mapping_gfp_mask(inode->i_mapping));
2825 + !(mapping_gfp_mask(inode->i_mapping) & __GFP_FS));
2826 }
2827
2828 const struct inode_operations page_symlink_inode_operations = {
2829 diff --git a/fs/namespace.c b/fs/namespace.c
2830 index 1bd5ba2..efe0251 100644
2831 --- a/fs/namespace.c
2832 +++ b/fs/namespace.c
2833 @@ -1128,7 +1128,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
2834 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
2835 */
2836
2837 -asmlinkage long sys_umount(char __user * name, int flags)
2838 +SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
2839 {
2840 struct path path;
2841 int retval;
2842 @@ -1160,7 +1160,7 @@ out:
2843 /*
2844 * The 2.0 compatible umount. No flags.
2845 */
2846 -asmlinkage long sys_oldumount(char __user * name)
2847 +SYSCALL_DEFINE1(oldumount, char __user *, name)
2848 {
2849 return sys_umount(name, 0);
2850 }
2851 @@ -2053,9 +2053,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2852 return new_ns;
2853 }
2854
2855 -asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name,
2856 - char __user * type, unsigned long flags,
2857 - void __user * data)
2858 +SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
2859 + char __user *, type, unsigned long, flags, void __user *, data)
2860 {
2861 int retval;
2862 unsigned long data_page;
2863 @@ -2180,8 +2179,8 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root)
2864 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
2865 * first.
2866 */
2867 -asmlinkage long sys_pivot_root(const char __user * new_root,
2868 - const char __user * put_old)
2869 +SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2870 + const char __user *, put_old)
2871 {
2872 struct vfsmount *tmp;
2873 struct path new, old, parent_path, root_parent, root;
2874 diff --git a/fs/nfs/file.c b/fs/nfs/file.c
2875 index 7846065..30541f0 100644
2876 --- a/fs/nfs/file.c
2877 +++ b/fs/nfs/file.c
2878 @@ -351,7 +351,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,
2879 file->f_path.dentry->d_name.name,
2880 mapping->host->i_ino, len, (long long) pos);
2881
2882 - page = __grab_cache_page(mapping, index);
2883 + page = grab_cache_page_write_begin(mapping, index, flags);
2884 if (!page)
2885 return -ENOMEM;
2886 *pagep = page;
2887 diff --git a/fs/nfs/read.c b/fs/nfs/read.c
2888 index 40d1798..f856004 100644
2889 --- a/fs/nfs/read.c
2890 +++ b/fs/nfs/read.c
2891 @@ -533,12 +533,6 @@ readpage_async_filler(void *data, struct page *page)
2892 unsigned int len;
2893 int error;
2894
2895 - error = nfs_wb_page(inode, page);
2896 - if (error)
2897 - goto out_unlock;
2898 - if (PageUptodate(page))
2899 - goto out_unlock;
2900 -
2901 len = nfs_page_length(page);
2902 if (len == 0)
2903 return nfs_return_empty_page(page);
2904 diff --git a/fs/nfsctl.c b/fs/nfsctl.c
2905 index aed8145..bf2cbd9 100644
2906 --- a/fs/nfsctl.c
2907 +++ b/fs/nfsctl.c
2908 @@ -82,8 +82,8 @@ static struct {
2909 },
2910 };
2911
2912 -long
2913 -asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res)
2914 +SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
2915 + void __user *, res)
2916 {
2917 struct file *file;
2918 void __user *p = &arg->u;
2919 diff --git a/fs/open.c b/fs/open.c
2920 index 07da935..975ce3e 100644
2921 --- a/fs/open.c
2922 +++ b/fs/open.c
2923 @@ -122,7 +122,7 @@ static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
2924 return 0;
2925 }
2926
2927 -asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf)
2928 +SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
2929 {
2930 struct path path;
2931 int error;
2932 @@ -138,8 +138,7 @@ asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * b
2933 return error;
2934 }
2935
2936 -
2937 -asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf)
2938 +SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
2939 {
2940 struct path path;
2941 long error;
2942 @@ -157,8 +156,7 @@ asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct stat
2943 return error;
2944 }
2945
2946 -
2947 -asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
2948 +SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf)
2949 {
2950 struct file * file;
2951 struct statfs tmp;
2952 @@ -176,7 +174,7 @@ out:
2953 return error;
2954 }
2955
2956 -asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf)
2957 +SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf)
2958 {
2959 struct file * file;
2960 struct statfs64 tmp;
2961 @@ -287,7 +285,7 @@ out:
2962 return error;
2963 }
2964
2965 -asmlinkage long sys_truncate(const char __user * path, unsigned long length)
2966 +SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length)
2967 {
2968 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
2969 return do_sys_truncate(path, (long)length);
2970 @@ -336,7 +334,7 @@ out:
2971 return error;
2972 }
2973
2974 -asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
2975 +SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
2976 {
2977 long ret = do_sys_ftruncate(fd, length, 1);
2978 /* avoid REGPARM breakage on x86: */
2979 @@ -346,21 +344,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
2980
2981 /* LFS versions of truncate are only needed on 32 bit machines */
2982 #if BITS_PER_LONG == 32
2983 -asmlinkage long sys_truncate64(const char __user * path, loff_t length)
2984 +SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
2985 {
2986 return do_sys_truncate(path, length);
2987 }
2988 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
2989 +asmlinkage long SyS_truncate64(long path, loff_t length)
2990 +{
2991 + return SYSC_truncate64((const char __user *) path, length);
2992 +}
2993 +SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
2994 +#endif
2995
2996 -asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
2997 +SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
2998 {
2999 long ret = do_sys_ftruncate(fd, length, 0);
3000 /* avoid REGPARM breakage on x86: */
3001 asmlinkage_protect(2, ret, fd, length);
3002 return ret;
3003 }
3004 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3005 +asmlinkage long SyS_ftruncate64(long fd, loff_t length)
3006 +{
3007 + return SYSC_ftruncate64((unsigned int) fd, length);
3008 +}
3009 +SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
3010 #endif
3011 +#endif /* BITS_PER_LONG == 32 */
3012
3013 -asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
3014 +SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
3015 {
3016 struct file *file;
3017 struct inode *inode;
3018 @@ -417,13 +429,20 @@ out_fput:
3019 out:
3020 return ret;
3021 }
3022 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3023 +asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
3024 +{
3025 + return SYSC_fallocate((int)fd, (int)mode, offset, len);
3026 +}
3027 +SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
3028 +#endif
3029
3030 /*
3031 * access() needs to use the real uid/gid, not the effective uid/gid.
3032 * We do this by temporarily clearing all FS-related capabilities and
3033 * switching the fsuid/fsgid around to the real ones.
3034 */
3035 -asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
3036 +SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
3037 {
3038 struct path path;
3039 struct inode *inode;
3040 @@ -503,12 +522,12 @@ out:
3041 return res;
3042 }
3043
3044 -asmlinkage long sys_access(const char __user *filename, int mode)
3045 +SYSCALL_DEFINE2(access, const char __user *, filename, int, mode)
3046 {
3047 return sys_faccessat(AT_FDCWD, filename, mode);
3048 }
3049
3050 -asmlinkage long sys_chdir(const char __user * filename)
3051 +SYSCALL_DEFINE1(chdir, const char __user *, filename)
3052 {
3053 struct path path;
3054 int error;
3055 @@ -529,7 +548,7 @@ out:
3056 return error;
3057 }
3058
3059 -asmlinkage long sys_fchdir(unsigned int fd)
3060 +SYSCALL_DEFINE1(fchdir, unsigned int, fd)
3061 {
3062 struct file *file;
3063 struct inode *inode;
3064 @@ -555,7 +574,7 @@ out:
3065 return error;
3066 }
3067
3068 -asmlinkage long sys_chroot(const char __user * filename)
3069 +SYSCALL_DEFINE1(chroot, const char __user *, filename)
3070 {
3071 struct path path;
3072 int error;
3073 @@ -580,7 +599,7 @@ out:
3074 return error;
3075 }
3076
3077 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
3078 +SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
3079 {
3080 struct inode * inode;
3081 struct dentry * dentry;
3082 @@ -614,8 +633,7 @@ out:
3083 return err;
3084 }
3085
3086 -asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
3087 - mode_t mode)
3088 +SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode)
3089 {
3090 struct path path;
3091 struct inode *inode;
3092 @@ -644,7 +662,7 @@ out:
3093 return error;
3094 }
3095
3096 -asmlinkage long sys_chmod(const char __user *filename, mode_t mode)
3097 +SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode)
3098 {
3099 return sys_fchmodat(AT_FDCWD, filename, mode);
3100 }
3101 @@ -674,7 +692,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
3102 return error;
3103 }
3104
3105 -asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
3106 +SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
3107 {
3108 struct path path;
3109 int error;
3110 @@ -693,8 +711,8 @@ out:
3111 return error;
3112 }
3113
3114 -asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
3115 - gid_t group, int flag)
3116 +SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
3117 + gid_t, group, int, flag)
3118 {
3119 struct path path;
3120 int error = -EINVAL;
3121 @@ -718,7 +736,7 @@ out:
3122 return error;
3123 }
3124
3125 -asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group)
3126 +SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
3127 {
3128 struct path path;
3129 int error;
3130 @@ -737,8 +755,7 @@ out:
3131 return error;
3132 }
3133
3134 -
3135 -asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
3136 +SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
3137 {
3138 struct file * file;
3139 int error = -EBADF;
3140 @@ -1029,7 +1046,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
3141 return fd;
3142 }
3143
3144 -asmlinkage long sys_open(const char __user *filename, int flags, int mode)
3145 +SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
3146 {
3147 long ret;
3148
3149 @@ -1042,8 +1059,8 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
3150 return ret;
3151 }
3152
3153 -asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
3154 - int mode)
3155 +SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
3156 + int, mode)
3157 {
3158 long ret;
3159
3160 @@ -1062,7 +1079,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
3161 * For backward compatibility? Maybe this should be moved
3162 * into arch/i386 instead?
3163 */
3164 -asmlinkage long sys_creat(const char __user * pathname, int mode)
3165 +SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode)
3166 {
3167 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
3168 }
3169 @@ -1098,7 +1115,7 @@ EXPORT_SYMBOL(filp_close);
3170 * releasing the fd. This ensures that one clone task can't release
3171 * an fd while another clone is opening it.
3172 */
3173 -asmlinkage long sys_close(unsigned int fd)
3174 +SYSCALL_DEFINE1(close, unsigned int, fd)
3175 {
3176 struct file * filp;
3177 struct files_struct *files = current->files;
3178 @@ -1131,14 +1148,13 @@ out_unlock:
3179 spin_unlock(&files->file_lock);
3180 return -EBADF;
3181 }
3182 -
3183 EXPORT_SYMBOL(sys_close);
3184
3185 /*
3186 * This routine simulates a hangup on the tty, to arrange that users
3187 * are given clean terminals at login time.
3188 */
3189 -asmlinkage long sys_vhangup(void)
3190 +SYSCALL_DEFINE0(vhangup)
3191 {
3192 if (capable(CAP_SYS_TTY_CONFIG)) {
3193 /* XXX: this needs locking */
3194 diff --git a/fs/pipe.c b/fs/pipe.c
3195 index fcba654..35d2cbb 100644
3196 --- a/fs/pipe.c
3197 +++ b/fs/pipe.c
3198 @@ -1051,7 +1051,7 @@ int do_pipe(int *fd)
3199 * sys_pipe() is the normal C calling standard for creating
3200 * a pipe. It's not the way Unix traditionally does this, though.
3201 */
3202 -asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
3203 +SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
3204 {
3205 int fd[2];
3206 int error;
3207 @@ -1067,7 +1067,7 @@ asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
3208 return error;
3209 }
3210
3211 -asmlinkage long __weak sys_pipe(int __user *fildes)
3212 +SYSCALL_DEFINE1(pipe, int __user *, fildes)
3213 {
3214 return sys_pipe2(fildes, 0);
3215 }
3216 diff --git a/fs/quota.c b/fs/quota.c
3217 index 7f4386e..e9851af 100644
3218 --- a/fs/quota.c
3219 +++ b/fs/quota.c
3220 @@ -368,7 +368,8 @@ static inline struct super_block *quotactl_block(const char __user *special)
3221 * calls. Maybe we need to add the process quotas etc. in the future,
3222 * but we probably should use rlimits for that.
3223 */
3224 -asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr)
3225 +SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
3226 + qid_t, id, void __user *, addr)
3227 {
3228 uint cmds, type;
3229 struct super_block *sb = NULL;
3230 diff --git a/fs/read_write.c b/fs/read_write.c
3231 index 9ba495d..0619b2a 100644
3232 --- a/fs/read_write.c
3233 +++ b/fs/read_write.c
3234 @@ -112,7 +112,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
3235 }
3236 EXPORT_SYMBOL(vfs_llseek);
3237
3238 -asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
3239 +SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
3240 {
3241 off_t retval;
3242 struct file * file;
3243 @@ -136,9 +136,9 @@ bad:
3244 }
3245
3246 #ifdef __ARCH_WANT_SYS_LLSEEK
3247 -asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
3248 - unsigned long offset_low, loff_t __user * result,
3249 - unsigned int origin)
3250 +SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
3251 + unsigned long, offset_low, loff_t __user *, result,
3252 + unsigned int, origin)
3253 {
3254 int retval;
3255 struct file * file;
3256 @@ -334,7 +334,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
3257 file->f_pos = pos;
3258 }
3259
3260 -asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
3261 +SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
3262 {
3263 struct file *file;
3264 ssize_t ret = -EBADF;
3265 @@ -351,7 +351,8 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
3266 return ret;
3267 }
3268
3269 -asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count)
3270 +SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
3271 + size_t, count)
3272 {
3273 struct file *file;
3274 ssize_t ret = -EBADF;
3275 @@ -368,8 +369,8 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
3276 return ret;
3277 }
3278
3279 -asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
3280 - size_t count, loff_t pos)
3281 +SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
3282 + size_t count, loff_t pos)
3283 {
3284 struct file *file;
3285 ssize_t ret = -EBADF;
3286 @@ -388,9 +389,17 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
3287
3288 return ret;
3289 }
3290 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3291 +asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
3292 +{
3293 + return SYSC_pread64((unsigned int) fd, (char __user *) buf,
3294 + (size_t) count, pos);
3295 +}
3296 +SYSCALL_ALIAS(sys_pread64, SyS_pread64);
3297 +#endif
3298
3299 -asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
3300 - size_t count, loff_t pos)
3301 +SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
3302 + size_t count, loff_t pos)
3303 {
3304 struct file *file;
3305 ssize_t ret = -EBADF;
3306 @@ -409,6 +418,14 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
3307
3308 return ret;
3309 }
3310 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3311 +asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
3312 +{
3313 + return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
3314 + (size_t) count, pos);
3315 +}
3316 +SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
3317 +#endif
3318
3319 /*
3320 * Reduce an iovec's length in-place. Return the resulting number of segments
3321 @@ -637,8 +654,8 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
3322
3323 EXPORT_SYMBOL(vfs_writev);
3324
3325 -asmlinkage ssize_t
3326 -sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
3327 +SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec,
3328 + unsigned long, vlen)
3329 {
3330 struct file *file;
3331 ssize_t ret = -EBADF;
3332 @@ -658,8 +675,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
3333 return ret;
3334 }
3335
3336 -asmlinkage ssize_t
3337 -sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
3338 +SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
3339 + unsigned long, vlen)
3340 {
3341 struct file *file;
3342 ssize_t ret = -EBADF;
3343 @@ -777,7 +794,7 @@ out:
3344 return retval;
3345 }
3346
3347 -asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count)
3348 +SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
3349 {
3350 loff_t pos;
3351 off_t off;
3352 @@ -796,7 +813,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz
3353 return do_sendfile(out_fd, in_fd, NULL, count, 0);
3354 }
3355
3356 -asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count)
3357 +SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count)
3358 {
3359 loff_t pos;
3360 ssize_t ret;
3361 diff --git a/fs/readdir.c b/fs/readdir.c
3362 index 93a7559..d68ea47 100644
3363 --- a/fs/readdir.c
3364 +++ b/fs/readdir.c
3365 @@ -102,7 +102,8 @@ efault:
3366 return -EFAULT;
3367 }
3368
3369 -asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * dirent, unsigned int count)
3370 +SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
3371 + struct old_linux_dirent __user *, dirent, unsigned int, count)
3372 {
3373 int error;
3374 struct file * file;
3375 @@ -187,7 +188,8 @@ efault:
3376 return -EFAULT;
3377 }
3378
3379 -asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count)
3380 +SYSCALL_DEFINE3(getdents, unsigned int, fd,
3381 + struct linux_dirent __user *, dirent, unsigned int, count)
3382 {
3383 struct file * file;
3384 struct linux_dirent __user * lastdirent;
3385 @@ -271,7 +273,8 @@ efault:
3386 return -EFAULT;
3387 }
3388
3389 -asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count)
3390 +SYSCALL_DEFINE3(getdents64, unsigned int, fd,
3391 + struct linux_dirent64 __user *, dirent, unsigned int, count)
3392 {
3393 struct file * file;
3394 struct linux_dirent64 __user * lastdirent;
3395 diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
3396 index 5699171..8c2615e 100644
3397 --- a/fs/reiserfs/inode.c
3398 +++ b/fs/reiserfs/inode.c
3399 @@ -2565,7 +2565,7 @@ static int reiserfs_write_begin(struct file *file,
3400 }
3401
3402 index = pos >> PAGE_CACHE_SHIFT;
3403 - page = __grab_cache_page(mapping, index);
3404 + page = grab_cache_page_write_begin(mapping, index, flags);
3405 if (!page)
3406 return -ENOMEM;
3407 *pagep = page;
3408 diff --git a/fs/select.c b/fs/select.c
3409 index da0e882..d575e4f 100644
3410 --- a/fs/select.c
3411 +++ b/fs/select.c
3412 @@ -374,8 +374,8 @@ out_nofds:
3413 return ret;
3414 }
3415
3416 -asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
3417 - fd_set __user *exp, struct timeval __user *tvp)
3418 +SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
3419 + fd_set __user *, exp, struct timeval __user *, tvp)
3420 {
3421 s64 timeout = -1;
3422 struct timeval tv;
3423 @@ -427,9 +427,9 @@ sticky:
3424 }
3425
3426 #ifdef HAVE_SET_RESTORE_SIGMASK
3427 -asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
3428 - fd_set __user *exp, struct timespec __user *tsp,
3429 - const sigset_t __user *sigmask, size_t sigsetsize)
3430 +static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp,
3431 + fd_set __user *exp, struct timespec __user *tsp,
3432 + const sigset_t __user *sigmask, size_t sigsetsize)
3433 {
3434 s64 timeout = MAX_SCHEDULE_TIMEOUT;
3435 sigset_t ksigmask, sigsaved;
3436 @@ -513,8 +513,9 @@ sticky:
3437 * which has a pointer to the sigset_t itself followed by a size_t containing
3438 * the sigset size.
3439 */
3440 -asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
3441 - fd_set __user *exp, struct timespec __user *tsp, void __user *sig)
3442 +SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
3443 + fd_set __user *, exp, struct timespec __user *, tsp,
3444 + void __user *, sig)
3445 {
3446 size_t sigsetsize = 0;
3447 sigset_t __user *up = NULL;
3448 @@ -527,7 +528,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
3449 return -EFAULT;
3450 }
3451
3452 - return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize);
3453 + return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize);
3454 }
3455 #endif /* HAVE_SET_RESTORE_SIGMASK */
3456
3457 @@ -727,8 +728,8 @@ static long do_restart_poll(struct restart_block *restart_block)
3458 return ret;
3459 }
3460
3461 -asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
3462 - long timeout_msecs)
3463 +SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
3464 + long, timeout_msecs)
3465 {
3466 s64 timeout_jiffies;
3467 int ret;
3468 @@ -761,9 +762,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
3469 }
3470
3471 #ifdef HAVE_SET_RESTORE_SIGMASK
3472 -asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
3473 - struct timespec __user *tsp, const sigset_t __user *sigmask,
3474 - size_t sigsetsize)
3475 +SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds,
3476 + struct timespec __user *, tsp, const sigset_t __user *, sigmask,
3477 + size_t, sigsetsize)
3478 {
3479 sigset_t ksigmask, sigsaved;
3480 struct timespec ts;
3481 diff --git a/fs/signalfd.c b/fs/signalfd.c
3482 index 9c39bc7..b07565c 100644
3483 --- a/fs/signalfd.c
3484 +++ b/fs/signalfd.c
3485 @@ -205,8 +205,8 @@ static const struct file_operations signalfd_fops = {
3486 .read = signalfd_read,
3487 };
3488
3489 -asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
3490 - size_t sizemask, int flags)
3491 +SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
3492 + size_t, sizemask, int, flags)
3493 {
3494 sigset_t sigmask;
3495 struct signalfd_ctx *ctx;
3496 @@ -259,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
3497 return ufd;
3498 }
3499
3500 -asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask,
3501 - size_t sizemask)
3502 +SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
3503 + size_t, sizemask)
3504 {
3505 return sys_signalfd4(ufd, user_mask, sizemask, 0);
3506 }
3507 diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
3508 index e4f8d51..92d5e8f 100644
3509 --- a/fs/smbfs/file.c
3510 +++ b/fs/smbfs/file.c
3511 @@ -297,7 +297,7 @@ static int smb_write_begin(struct file *file, struct address_space *mapping,
3512 struct page **pagep, void **fsdata)
3513 {
3514 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
3515 - *pagep = __grab_cache_page(mapping, index);
3516 + *pagep = grab_cache_page_write_begin(mapping, index, flags);
3517 if (!*pagep)
3518 return -ENOMEM;
3519 return 0;
3520 diff --git a/fs/splice.c b/fs/splice.c
3521 index a1e701c..6d310c7 100644
3522 --- a/fs/splice.c
3523 +++ b/fs/splice.c
3524 @@ -1434,8 +1434,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
3525 * Currently we punt and implement it as a normal copy, see pipe_to_user().
3526 *
3527 */
3528 -asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
3529 - unsigned long nr_segs, unsigned int flags)
3530 +SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
3531 + unsigned long, nr_segs, unsigned int, flags)
3532 {
3533 struct file *file;
3534 long error;
3535 @@ -1460,9 +1460,9 @@ asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
3536 return error;
3537 }
3538
3539 -asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
3540 - int fd_out, loff_t __user *off_out,
3541 - size_t len, unsigned int flags)
3542 +SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
3543 + int, fd_out, loff_t __user *, off_out,
3544 + size_t, len, unsigned int, flags)
3545 {
3546 long error;
3547 struct file *in, *out;
3548 @@ -1684,7 +1684,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
3549 return ret;
3550 }
3551
3552 -asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags)
3553 +SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
3554 {
3555 struct file *in;
3556 int error, fput_in;
3557 diff --git a/fs/stat.c b/fs/stat.c
3558 index 7c46fbe..4bd85da 100644
3559 --- a/fs/stat.c
3560 +++ b/fs/stat.c
3561 @@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
3562 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
3563 }
3564
3565 -asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf)
3566 +SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
3567 {
3568 struct kstat stat;
3569 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
3570 @@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user
3571
3572 return error;
3573 }
3574 -asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf)
3575 +
3576 +SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
3577 {
3578 struct kstat stat;
3579 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
3580 @@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use
3581
3582 return error;
3583 }
3584 -asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf)
3585 +
3586 +SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
3587 {
3588 struct kstat stat;
3589 int error = vfs_fstat(fd, &stat);
3590 @@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
3591 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
3592 }
3593
3594 -asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf)
3595 +SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
3596 {
3597 struct kstat stat;
3598 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
3599 @@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf)
3600 return error;
3601 }
3602
3603 -asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
3604 +SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
3605 {
3606 struct kstat stat;
3607 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
3608 @@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
3609 }
3610
3611 #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
3612 -asmlinkage long sys_newfstatat(int dfd, char __user *filename,
3613 - struct stat __user *statbuf, int flag)
3614 +SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
3615 + struct stat __user *, statbuf, int, flag)
3616 {
3617 struct kstat stat;
3618 int error = -EINVAL;
3619 @@ -280,7 +282,7 @@ out:
3620 }
3621 #endif
3622
3623 -asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
3624 +SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
3625 {
3626 struct kstat stat;
3627 int error = vfs_fstat(fd, &stat);
3628 @@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
3629 return error;
3630 }
3631
3632 -asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
3633 - char __user *buf, int bufsiz)
3634 +SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
3635 + char __user *, buf, int, bufsiz)
3636 {
3637 struct path path;
3638 int error;
3639 @@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
3640 return error;
3641 }
3642
3643 -asmlinkage long sys_readlink(const char __user *path, char __user *buf,
3644 - int bufsiz)
3645 +SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
3646 + int, bufsiz)
3647 {
3648 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz);
3649 }
3650 @@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
3651 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
3652 }
3653
3654 -asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf)
3655 +SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf)
3656 {
3657 struct kstat stat;
3658 int error = vfs_stat(filename, &stat);
3659 @@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu
3660
3661 return error;
3662 }
3663 -asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf)
3664 +
3665 +SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf)
3666 {
3667 struct kstat stat;
3668 int error = vfs_lstat(filename, &stat);
3669 @@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb
3670
3671 return error;
3672 }
3673 -asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
3674 +
3675 +SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
3676 {
3677 struct kstat stat;
3678 int error = vfs_fstat(fd, &stat);
3679 @@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
3680 return error;
3681 }
3682
3683 -asmlinkage long sys_fstatat64(int dfd, char __user *filename,
3684 - struct stat64 __user *statbuf, int flag)
3685 +SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
3686 + struct stat64 __user *, statbuf, int, flag)
3687 {
3688 struct kstat stat;
3689 int error = -EINVAL;
3690 diff --git a/fs/super.c b/fs/super.c
3691 index e931ae9..909fcb4 100644
3692 --- a/fs/super.c
3693 +++ b/fs/super.c
3694 @@ -534,7 +534,7 @@ rescan:
3695 return NULL;
3696 }
3697
3698 -asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf)
3699 +SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
3700 {
3701 struct super_block *s;
3702 struct ustat tmp;
3703 diff --git a/fs/sync.c b/fs/sync.c
3704 index 2967562..6cc8cb4 100644
3705 --- a/fs/sync.c
3706 +++ b/fs/sync.c
3707 @@ -36,7 +36,7 @@ static void do_sync(unsigned long wait)
3708 laptop_sync_completion();
3709 }
3710
3711 -asmlinkage long sys_sync(void)
3712 +SYSCALL_DEFINE0(sync)
3713 {
3714 do_sync(1);
3715 return 0;
3716 @@ -118,12 +118,12 @@ static long __do_fsync(unsigned int fd, int datasync)
3717 return ret;
3718 }
3719
3720 -asmlinkage long sys_fsync(unsigned int fd)
3721 +SYSCALL_DEFINE1(fsync, unsigned int, fd)
3722 {
3723 return __do_fsync(fd, 0);
3724 }
3725
3726 -asmlinkage long sys_fdatasync(unsigned int fd)
3727 +SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
3728 {
3729 return __do_fsync(fd, 1);
3730 }
3731 @@ -175,8 +175,8 @@ asmlinkage long sys_fdatasync(unsigned int fd)
3732 * already-instantiated disk blocks, there are no guarantees here that the data
3733 * will be available after a crash.
3734 */
3735 -asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
3736 - unsigned int flags)
3737 +SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
3738 + unsigned int flags)
3739 {
3740 int ret;
3741 struct file *file;
3742 @@ -236,14 +236,32 @@ out_put:
3743 out:
3744 return ret;
3745 }
3746 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3747 +asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
3748 + long flags)
3749 +{
3750 + return SYSC_sync_file_range((int) fd, offset, nbytes,
3751 + (unsigned int) flags);
3752 +}
3753 +SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
3754 +#endif
3755
3756 /* It would be nice if people remember that not all the world's an i386
3757 when they introduce new system calls */
3758 -asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
3759 - loff_t offset, loff_t nbytes)
3760 +SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
3761 + loff_t offset, loff_t nbytes)
3762 {
3763 return sys_sync_file_range(fd, offset, nbytes, flags);
3764 }
3765 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
3766 +asmlinkage long SyS_sync_file_range2(long fd, long flags,
3767 + loff_t offset, loff_t nbytes)
3768 +{
3769 + return SYSC_sync_file_range2((int) fd, (unsigned int) flags,
3770 + offset, nbytes);
3771 +}
3772 +SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
3773 +#endif
3774
3775 /*
3776 * `endbyte' is inclusive
3777 diff --git a/fs/timerfd.c b/fs/timerfd.c
3778 index c502c60..ee211df 100644
3779 --- a/fs/timerfd.c
3780 +++ b/fs/timerfd.c
3781 @@ -179,7 +179,7 @@ static struct file *timerfd_fget(int fd)
3782 return file;
3783 }
3784
3785 -asmlinkage long sys_timerfd_create(int clockid, int flags)
3786 +SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
3787 {
3788 int ufd;
3789 struct timerfd_ctx *ctx;
3790 @@ -210,9 +210,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
3791 return ufd;
3792 }
3793
3794 -asmlinkage long sys_timerfd_settime(int ufd, int flags,
3795 - const struct itimerspec __user *utmr,
3796 - struct itimerspec __user *otmr)
3797 +SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
3798 + const struct itimerspec __user *, utmr,
3799 + struct itimerspec __user *, otmr)
3800 {
3801 struct file *file;
3802 struct timerfd_ctx *ctx;
3803 @@ -267,7 +267,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
3804 return 0;
3805 }
3806
3807 -asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr)
3808 +SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
3809 {
3810 struct file *file;
3811 struct timerfd_ctx *ctx;
3812 diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
3813 index 3d698e2..40033dc 100644
3814 --- a/fs/ubifs/file.c
3815 +++ b/fs/ubifs/file.c
3816 @@ -213,7 +213,8 @@ static void release_existing_page_budget(struct ubifs_info *c)
3817 }
3818
3819 static int write_begin_slow(struct address_space *mapping,
3820 - loff_t pos, unsigned len, struct page **pagep)
3821 + loff_t pos, unsigned len, struct page **pagep,
3822 + unsigned flags)
3823 {
3824 struct inode *inode = mapping->host;
3825 struct ubifs_info *c = inode->i_sb->s_fs_info;
3826 @@ -241,7 +242,7 @@ static int write_begin_slow(struct address_space *mapping,
3827 if (unlikely(err))
3828 return err;
3829
3830 - page = __grab_cache_page(mapping, index);
3831 + page = grab_cache_page_write_begin(mapping, index, flags);
3832 if (unlikely(!page)) {
3833 ubifs_release_budget(c, &req);
3834 return -ENOMEM;
3835 @@ -432,7 +433,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
3836 return -EROFS;
3837
3838 /* Try out the fast-path part first */
3839 - page = __grab_cache_page(mapping, index);
3840 + page = grab_cache_page_write_begin(mapping, index, flags);
3841 if (unlikely(!page))
3842 return -ENOMEM;
3843
3844 @@ -477,7 +478,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
3845 unlock_page(page);
3846 page_cache_release(page);
3847
3848 - return write_begin_slow(mapping, pos, len, pagep);
3849 + return write_begin_slow(mapping, pos, len, pagep, flags);
3850 }
3851
3852 /*
3853 diff --git a/fs/utimes.c b/fs/utimes.c
3854 index 6929e3e..e4c75db 100644
3855 --- a/fs/utimes.c
3856 +++ b/fs/utimes.c
3857 @@ -24,7 +24,7 @@
3858 * must be owner or have write permission.
3859 * Else, update from *times, must be owner or super user.
3860 */
3861 -asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
3862 +SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
3863 {
3864 struct timespec tv[2];
3865
3866 @@ -170,7 +170,8 @@ out:
3867 return error;
3868 }
3869
3870 -asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags)
3871 +SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename,
3872 + struct timespec __user *, utimes, int, flags)
3873 {
3874 struct timespec tstimes[2];
3875
3876 @@ -187,7 +188,8 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
3877 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
3878 }
3879
3880 -asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes)
3881 +SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename,
3882 + struct timeval __user *, utimes)
3883 {
3884 struct timeval times[2];
3885 struct timespec tstimes[2];
3886 @@ -214,7 +216,8 @@ asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __u
3887 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0);
3888 }
3889
3890 -asmlinkage long sys_utimes(char __user *filename, struct timeval __user *utimes)
3891 +SYSCALL_DEFINE2(utimes, char __user *, filename,
3892 + struct timeval __user *, utimes)
3893 {
3894 return sys_futimesat(AT_FDCWD, filename, utimes);
3895 }
3896 diff --git a/fs/xattr.c b/fs/xattr.c
3897 index 468377e..086db06 100644
3898 --- a/fs/xattr.c
3899 +++ b/fs/xattr.c
3900 @@ -251,9 +251,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
3901 return error;
3902 }
3903
3904 -asmlinkage long
3905 -sys_setxattr(const char __user *pathname, const char __user *name,
3906 - const void __user *value, size_t size, int flags)
3907 +SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
3908 + const char __user *, name, const void __user *, value,
3909 + size_t, size, int, flags)
3910 {
3911 struct path path;
3912 int error;
3913 @@ -270,9 +270,9 @@ sys_setxattr(const char __user *pathname, const char __user *name,
3914 return error;
3915 }
3916
3917 -asmlinkage long
3918 -sys_lsetxattr(const char __user *pathname, const char __user *name,
3919 - const void __user *value, size_t size, int flags)
3920 +SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname,
3921 + const char __user *, name, const void __user *, value,
3922 + size_t, size, int, flags)
3923 {
3924 struct path path;
3925 int error;
3926 @@ -289,9 +289,8 @@ sys_lsetxattr(const char __user *pathname, const char __user *name,
3927 return error;
3928 }
3929
3930 -asmlinkage long
3931 -sys_fsetxattr(int fd, const char __user *name, const void __user *value,
3932 - size_t size, int flags)
3933 +SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
3934 + const void __user *,value, size_t, size, int, flags)
3935 {
3936 struct file *f;
3937 struct dentry *dentry;
3938 @@ -349,9 +348,8 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
3939 return error;
3940 }
3941
3942 -asmlinkage ssize_t
3943 -sys_getxattr(const char __user *pathname, const char __user *name,
3944 - void __user *value, size_t size)
3945 +SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
3946 + const char __user *, name, void __user *, value, size_t, size)
3947 {
3948 struct path path;
3949 ssize_t error;
3950 @@ -364,9 +362,8 @@ sys_getxattr(const char __user *pathname, const char __user *name,
3951 return error;
3952 }
3953
3954 -asmlinkage ssize_t
3955 -sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value,
3956 - size_t size)
3957 +SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
3958 + const char __user *, name, void __user *, value, size_t, size)
3959 {
3960 struct path path;
3961 ssize_t error;
3962 @@ -379,8 +376,8 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user
3963 return error;
3964 }
3965
3966 -asmlinkage ssize_t
3967 -sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size)
3968 +SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
3969 + void __user *, value, size_t, size)
3970 {
3971 struct file *f;
3972 ssize_t error = -EBADF;
3973 @@ -424,8 +421,8 @@ listxattr(struct dentry *d, char __user *list, size_t size)
3974 return error;
3975 }
3976
3977 -asmlinkage ssize_t
3978 -sys_listxattr(const char __user *pathname, char __user *list, size_t size)
3979 +SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
3980 + size_t, size)
3981 {
3982 struct path path;
3983 ssize_t error;
3984 @@ -438,8 +435,8 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size)
3985 return error;
3986 }
3987
3988 -asmlinkage ssize_t
3989 -sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
3990 +SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
3991 + size_t, size)
3992 {
3993 struct path path;
3994 ssize_t error;
3995 @@ -452,8 +449,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
3996 return error;
3997 }
3998
3999 -asmlinkage ssize_t
4000 -sys_flistxattr(int fd, char __user *list, size_t size)
4001 +SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
4002 {
4003 struct file *f;
4004 ssize_t error = -EBADF;
4005 @@ -485,8 +481,8 @@ removexattr(struct dentry *d, const char __user *name)
4006 return vfs_removexattr(d, kname);
4007 }
4008
4009 -asmlinkage long
4010 -sys_removexattr(const char __user *pathname, const char __user *name)
4011 +SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
4012 + const char __user *, name)
4013 {
4014 struct path path;
4015 int error;
4016 @@ -503,8 +499,8 @@ sys_removexattr(const char __user *pathname, const char __user *name)
4017 return error;
4018 }
4019
4020 -asmlinkage long
4021 -sys_lremovexattr(const char __user *pathname, const char __user *name)
4022 +SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
4023 + const char __user *, name)
4024 {
4025 struct path path;
4026 int error;
4027 @@ -521,8 +517,7 @@ sys_lremovexattr(const char __user *pathname, const char __user *name)
4028 return error;
4029 }
4030
4031 -asmlinkage long
4032 -sys_fremovexattr(int fd, const char __user *name)
4033 +SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
4034 {
4035 struct file *f;
4036 struct dentry *dentry;
4037 diff --git a/include/linux/compat.h b/include/linux/compat.h
4038 index cf8d11c..275b9bd 100644
4039 --- a/include/linux/compat.h
4040 +++ b/include/linux/compat.h
4041 @@ -278,5 +278,18 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
4042 asmlinkage long compat_sys_timerfd_gettime(int ufd,
4043 struct compat_itimerspec __user *otmr);
4044
4045 +asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
4046 + __u32 __user *pages,
4047 + const int __user *nodes,
4048 + int __user *status,
4049 + int flags);
4050 +asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
4051 + struct compat_timeval __user *t);
4052 +asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
4053 + struct compat_stat __user *statbuf,
4054 + int flag);
4055 +asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
4056 + int flags, int mode);
4057 +
4058 #endif /* CONFIG_COMPAT */
4059 #endif /* _LINUX_COMPAT_H */
4060 diff --git a/include/linux/fs.h b/include/linux/fs.h
4061 index 580b513..d621217 100644
4062 --- a/include/linux/fs.h
4063 +++ b/include/linux/fs.h
4064 @@ -403,6 +403,9 @@ enum positive_aop_returns {
4065
4066 #define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */
4067 #define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */
4068 +#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
4069 + * helper code (eg buffer layer)
4070 + * to clear GFP_FS from alloc */
4071
4072 /*
4073 * oh the beauties of C type declarations.
4074 @@ -1959,7 +1962,7 @@ extern int page_readlink(struct dentry *, char __user *, int);
4075 extern void *page_follow_link_light(struct dentry *, struct nameidata *);
4076 extern void page_put_link(struct dentry *, struct nameidata *, void *);
4077 extern int __page_symlink(struct inode *inode, const char *symname, int len,
4078 - gfp_t gfp_mask);
4079 + int nofs);
4080 extern int page_symlink(struct inode *inode, const char *symname, int len);
4081 extern const struct inode_operations page_symlink_inode_operations;
4082 extern int generic_readlink(struct dentry *, char __user *, int);
4083 diff --git a/include/linux/mm.h b/include/linux/mm.h
4084 index 72a15dc..856d52a 100644
4085 --- a/include/linux/mm.h
4086 +++ b/include/linux/mm.h
4087 @@ -253,7 +253,6 @@ static inline int put_page_testzero(struct page *page)
4088 */
4089 static inline int get_page_unless_zero(struct page *page)
4090 {
4091 - VM_BUG_ON(PageTail(page));
4092 return atomic_inc_not_zero(&page->_count);
4093 }
4094
4095 diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
4096 index 5da31c1..62efceb 100644
4097 --- a/include/linux/pagemap.h
4098 +++ b/include/linux/pagemap.h
4099 @@ -213,7 +213,8 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
4100 unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
4101 int tag, unsigned int nr_pages, struct page **pages);
4102
4103 -struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index);
4104 +struct page *grab_cache_page_write_begin(struct address_space *mapping,
4105 + pgoff_t index, unsigned flags);
4106
4107 /*
4108 * Returns locked page at given index in given cache, creating it if needed.
4109 diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
4110 index a916c66..355f6e8 100644
4111 --- a/include/linux/radix-tree.h
4112 +++ b/include/linux/radix-tree.h
4113 @@ -136,7 +136,7 @@ do { \
4114 */
4115 static inline void *radix_tree_deref_slot(void **pslot)
4116 {
4117 - void *ret = *pslot;
4118 + void *ret = rcu_dereference(*pslot);
4119 if (unlikely(radix_tree_is_indirect_ptr(ret)))
4120 ret = RADIX_TREE_RETRY;
4121 return ret;
4122 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
4123 index d6ff145..f54aa38 100644
4124 --- a/include/linux/syscalls.h
4125 +++ b/include/linux/syscalls.h
4126 @@ -54,6 +54,7 @@ struct compat_stat;
4127 struct compat_timeval;
4128 struct robust_list_head;
4129 struct getcpu_cache;
4130 +struct old_linux_dirent;
4131
4132 #include <linux/types.h>
4133 #include <linux/aio_abi.h>
4134 @@ -65,6 +66,74 @@ struct getcpu_cache;
4135 #include <linux/quota.h>
4136 #include <linux/key.h>
4137
4138 +#define __SC_DECL1(t1, a1) t1 a1
4139 +#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__)
4140 +#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__)
4141 +#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__)
4142 +#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__)
4143 +#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__)
4144 +
4145 +#define __SC_LONG1(t1, a1) long a1
4146 +#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__)
4147 +#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__)
4148 +#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__)
4149 +#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__)
4150 +#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__)
4151 +
4152 +#define __SC_CAST1(t1, a1) (t1) a1
4153 +#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__)
4154 +#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__)
4155 +#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__)
4156 +#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__)
4157 +#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__)
4158 +
4159 +#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long))
4160 +#define __SC_TEST1(t1, a1) __SC_TEST(t1)
4161 +#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__)
4162 +#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__)
4163 +#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__)
4164 +#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
4165 +#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
4166 +
4167 +#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
4168 +#define SYSCALL_DEFINE1(...) SYSCALL_DEFINEx(1, __VA_ARGS__)
4169 +#define SYSCALL_DEFINE2(...) SYSCALL_DEFINEx(2, __VA_ARGS__)
4170 +#define SYSCALL_DEFINE3(...) SYSCALL_DEFINEx(3, __VA_ARGS__)
4171 +#define SYSCALL_DEFINE4(...) SYSCALL_DEFINEx(4, __VA_ARGS__)
4172 +#define SYSCALL_DEFINE5(...) SYSCALL_DEFINEx(5, __VA_ARGS__)
4173 +#define SYSCALL_DEFINE6(...) SYSCALL_DEFINEx(6, __VA_ARGS__)
4174 +
4175 +#ifdef CONFIG_PPC64
4176 +#define SYSCALL_ALIAS(alias, name) \
4177 + asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
4178 + "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
4179 +#else
4180 +#define SYSCALL_ALIAS(alias, name) \
4181 + asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
4182 +#endif
4183 +
4184 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
4185 +
4186 +#define SYSCALL_DEFINE(name) static inline long SYSC_##name
4187 +#define SYSCALL_DEFINEx(x, name, ...) \
4188 + asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)); \
4189 + static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)); \
4190 + asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__)) \
4191 + { \
4192 + __SC_TEST##x(__VA_ARGS__); \
4193 + return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__)); \
4194 + } \
4195 + SYSCALL_ALIAS(sys_##name, SyS_##name); \
4196 + static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
4197 +
4198 +#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
4199 +
4200 +#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
4201 +#define SYSCALL_DEFINEx(x, name, ...) \
4202 + asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
4203 +
4204 +#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
4205 +
4206 asmlinkage long sys_time(time_t __user *tloc);
4207 asmlinkage long sys_stime(time_t __user *tptr);
4208 asmlinkage long sys_gettimeofday(struct timeval __user *tv,
4209 @@ -77,7 +146,7 @@ asmlinkage long sys_times(struct tms __user *tbuf);
4210
4211 asmlinkage long sys_gettid(void);
4212 asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
4213 -asmlinkage unsigned long sys_alarm(unsigned int seconds);
4214 +asmlinkage long sys_alarm(unsigned int seconds);
4215 asmlinkage long sys_getpid(void);
4216 asmlinkage long sys_getppid(void);
4217 asmlinkage long sys_getuid(void);
4218 @@ -166,7 +235,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
4219 unsigned long flags);
4220
4221 asmlinkage long sys_exit(int error_code);
4222 -asmlinkage void sys_exit_group(int error_code);
4223 +asmlinkage long sys_exit_group(int error_code);
4224 asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
4225 int options, struct rusage __user *ru);
4226 asmlinkage long sys_waitid(int which, pid_t pid,
4227 @@ -196,7 +265,7 @@ asmlinkage long sys_tkill(int pid, int sig);
4228 asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo);
4229 asmlinkage long sys_sgetmask(void);
4230 asmlinkage long sys_ssetmask(int newmask);
4231 -asmlinkage unsigned long sys_signal(int sig, __sighandler_t handler);
4232 +asmlinkage long sys_signal(int sig, __sighandler_t handler);
4233 asmlinkage long sys_pause(void);
4234
4235 asmlinkage long sys_sync(void);
4236 @@ -246,29 +315,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
4237 const void __user *value, size_t size, int flags);
4238 asmlinkage long sys_fsetxattr(int fd, const char __user *name,
4239 const void __user *value, size_t size, int flags);
4240 -asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name,
4241 - void __user *value, size_t size);
4242 -asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name,
4243 - void __user *value, size_t size);
4244 -asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name,
4245 - void __user *value, size_t size);
4246 -asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list,
4247 - size_t size);
4248 -asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list,
4249 - size_t size);
4250 -asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size);
4251 +asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
4252 + void __user *value, size_t size);
4253 +asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
4254 + void __user *value, size_t size);
4255 +asmlinkage long sys_fgetxattr(int fd, const char __user *name,
4256 + void __user *value, size_t size);
4257 +asmlinkage long sys_listxattr(const char __user *path, char __user *list,
4258 + size_t size);
4259 +asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
4260 + size_t size);
4261 +asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
4262 asmlinkage long sys_removexattr(const char __user *path,
4263 const char __user *name);
4264 asmlinkage long sys_lremovexattr(const char __user *path,
4265 const char __user *name);
4266 asmlinkage long sys_fremovexattr(int fd, const char __user *name);
4267
4268 -asmlinkage unsigned long sys_brk(unsigned long brk);
4269 +asmlinkage long sys_brk(unsigned long brk);
4270 asmlinkage long sys_mprotect(unsigned long start, size_t len,
4271 unsigned long prot);
4272 -asmlinkage unsigned long sys_mremap(unsigned long addr,
4273 - unsigned long old_len, unsigned long new_len,
4274 - unsigned long flags, unsigned long new_addr);
4275 +asmlinkage long sys_mremap(unsigned long addr,
4276 + unsigned long old_len, unsigned long new_len,
4277 + unsigned long flags, unsigned long new_addr);
4278 asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
4279 unsigned long prot, unsigned long pgoff,
4280 unsigned long flags);
4281 @@ -321,10 +390,10 @@ asmlinkage long sys_io_submit(aio_context_t, long,
4282 struct iocb __user * __user *);
4283 asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
4284 struct io_event __user *result);
4285 -asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd,
4286 - off_t __user *offset, size_t count);
4287 -asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd,
4288 - loff_t __user *offset, size_t count);
4289 +asmlinkage long sys_sendfile(int out_fd, int in_fd,
4290 + off_t __user *offset, size_t count);
4291 +asmlinkage long sys_sendfile64(int out_fd, int in_fd,
4292 + loff_t __user *offset, size_t count);
4293 asmlinkage long sys_readlink(const char __user *path,
4294 char __user *buf, int bufsiz);
4295 asmlinkage long sys_creat(const char __user *pathname, int mode);
4296 @@ -368,26 +437,25 @@ asmlinkage long sys_utime(char __user *filename,
4297 struct utimbuf __user *times);
4298 asmlinkage long sys_utimes(char __user *filename,
4299 struct timeval __user *utimes);
4300 -asmlinkage off_t sys_lseek(unsigned int fd, off_t offset,
4301 - unsigned int origin);
4302 +asmlinkage long sys_lseek(unsigned int fd, off_t offset,
4303 + unsigned int origin);
4304 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
4305 unsigned long offset_low, loff_t __user *result,
4306 unsigned int origin);
4307 -asmlinkage ssize_t sys_read(unsigned int fd, char __user *buf,
4308 - size_t count);
4309 -asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
4310 -asmlinkage ssize_t sys_readv(unsigned long fd,
4311 - const struct iovec __user *vec,
4312 - unsigned long vlen);
4313 -asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf,
4314 - size_t count);
4315 -asmlinkage ssize_t sys_writev(unsigned long fd,
4316 - const struct iovec __user *vec,
4317 - unsigned long vlen);
4318 -asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
4319 - size_t count, loff_t pos);
4320 -asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
4321 - size_t count, loff_t pos);
4322 +asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
4323 +asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
4324 +asmlinkage long sys_readv(unsigned long fd,
4325 + const struct iovec __user *vec,
4326 + unsigned long vlen);
4327 +asmlinkage long sys_write(unsigned int fd, const char __user *buf,
4328 + size_t count);
4329 +asmlinkage long sys_writev(unsigned long fd,
4330 + const struct iovec __user *vec,
4331 + unsigned long vlen);
4332 +asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
4333 + size_t count, loff_t pos);
4334 +asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
4335 + size_t count, loff_t pos);
4336 asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
4337 asmlinkage long sys_mkdir(const char __user *pathname, int mode);
4338 asmlinkage long sys_chdir(const char __user *filename);
4339 @@ -477,7 +545,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
4340 asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
4341 asmlinkage long sys_mq_unlink(const char __user *name);
4342 asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
4343 -asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
4344 +asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
4345 asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
4346 asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
4347
4348 @@ -531,11 +599,6 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
4349 const int __user *nodes,
4350 int __user *status,
4351 int flags);
4352 -asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
4353 - __u32 __user *pages,
4354 - const int __user *nodes,
4355 - int __user *status,
4356 - int flags);
4357 asmlinkage long sys_mbind(unsigned long start, unsigned long len,
4358 unsigned long mode,
4359 unsigned long __user *nmask,
4360 @@ -550,7 +613,7 @@ asmlinkage long sys_inotify_init(void);
4361 asmlinkage long sys_inotify_init1(int flags);
4362 asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
4363 u32 mask);
4364 -asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
4365 +asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
4366
4367 asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
4368 __u32 __user *ustatus);
4369 @@ -584,13 +647,6 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *bu
4370 int bufsiz);
4371 asmlinkage long sys_utimensat(int dfd, char __user *filename,
4372 struct timespec __user *utimes, int flags);
4373 -asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
4374 - struct compat_timeval __user *t);
4375 -asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
4376 - struct compat_stat __user *statbuf,
4377 - int flag);
4378 -asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
4379 - int flags, int mode);
4380 asmlinkage long sys_unshare(unsigned long unshare_flags);
4381
4382 asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
4383 @@ -622,6 +678,15 @@ asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
4384 asmlinkage long sys_eventfd(unsigned int count);
4385 asmlinkage long sys_eventfd2(unsigned int count, int flags);
4386 asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
4387 +asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
4388 +asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
4389 + fd_set __user *, struct timespec __user *,
4390 + void __user *);
4391 +asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
4392 + struct timespec __user *, const sigset_t __user *,
4393 + size_t);
4394 +asmlinkage long sys_pipe2(int __user *, int);
4395 +asmlinkage long sys_pipe(int __user *);
4396
4397 int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
4398
4399 diff --git a/include/linux/time.h b/include/linux/time.h
4400 index e15206a..0095ad1 100644
4401 --- a/include/linux/time.h
4402 +++ b/include/linux/time.h
4403 @@ -99,6 +99,7 @@ extern unsigned long read_persistent_clock(void);
4404 extern int update_persistent_clock(struct timespec now);
4405 extern int no_sync_cmos_clock __read_mostly;
4406 void timekeeping_init(void);
4407 +extern int timekeeping_suspended;
4408
4409 unsigned long get_seconds(void);
4410 struct timespec current_kernel_time(void);
4411 diff --git a/ipc/mqueue.c b/ipc/mqueue.c
4412 index 96fb36c..a58bfad 100644
4413 --- a/ipc/mqueue.c
4414 +++ b/ipc/mqueue.c
4415 @@ -647,8 +647,8 @@ static int oflag2acc[O_ACCMODE] = { MAY_READ, MAY_WRITE,
4416 return dentry_open(dentry, mqueue_mnt, oflag);
4417 }
4418
4419 -asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode,
4420 - struct mq_attr __user *u_attr)
4421 +SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
4422 + struct mq_attr __user *, u_attr)
4423 {
4424 struct dentry *dentry;
4425 struct file *filp;
4426 @@ -715,7 +715,7 @@ out_putname:
4427 return fd;
4428 }
4429
4430 -asmlinkage long sys_mq_unlink(const char __user *u_name)
4431 +SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
4432 {
4433 int err;
4434 char *name;
4435 @@ -808,9 +808,9 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
4436 sender->state = STATE_READY;
4437 }
4438
4439 -asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr,
4440 - size_t msg_len, unsigned int msg_prio,
4441 - const struct timespec __user *u_abs_timeout)
4442 +SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
4443 + size_t, msg_len, unsigned int, msg_prio,
4444 + const struct timespec __user *, u_abs_timeout)
4445 {
4446 struct file *filp;
4447 struct inode *inode;
4448 @@ -896,9 +896,9 @@ out:
4449 return ret;
4450 }
4451
4452 -asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
4453 - size_t msg_len, unsigned int __user *u_msg_prio,
4454 - const struct timespec __user *u_abs_timeout)
4455 +SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
4456 + size_t, msg_len, unsigned int __user *, u_msg_prio,
4457 + const struct timespec __user *, u_abs_timeout)
4458 {
4459 long timeout;
4460 ssize_t ret;
4461 @@ -981,8 +981,8 @@ out:
4462 * and he isn't currently owner of notification, will be silently discarded.
4463 * It isn't explicitly defined in the POSIX.
4464 */
4465 -asmlinkage long sys_mq_notify(mqd_t mqdes,
4466 - const struct sigevent __user *u_notification)
4467 +SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
4468 + const struct sigevent __user *, u_notification)
4469 {
4470 int ret;
4471 struct file *filp;
4472 @@ -1107,9 +1107,9 @@ out:
4473 return ret;
4474 }
4475
4476 -asmlinkage long sys_mq_getsetattr(mqd_t mqdes,
4477 - const struct mq_attr __user *u_mqstat,
4478 - struct mq_attr __user *u_omqstat)
4479 +SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
4480 + const struct mq_attr __user *, u_mqstat,
4481 + struct mq_attr __user *, u_omqstat)
4482 {
4483 int ret;
4484 struct mq_attr mqstat, omqstat;
4485 diff --git a/ipc/msg.c b/ipc/msg.c
4486 index b4eee1c..2ceab7f 100644
4487 --- a/ipc/msg.c
4488 +++ b/ipc/msg.c
4489 @@ -309,7 +309,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
4490 return security_msg_queue_associate(msq, msgflg);
4491 }
4492
4493 -asmlinkage long sys_msgget(key_t key, int msgflg)
4494 +SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
4495 {
4496 struct ipc_namespace *ns;
4497 struct ipc_ops msg_ops;
4498 @@ -466,7 +466,7 @@ out_up:
4499 return err;
4500 }
4501
4502 -asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
4503 +SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
4504 {
4505 struct msg_queue *msq;
4506 int err, version;
4507 @@ -723,8 +723,8 @@ out_free:
4508 return err;
4509 }
4510
4511 -asmlinkage long
4512 -sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg)
4513 +SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
4514 + int, msgflg)
4515 {
4516 long mtype;
4517
4518 @@ -904,8 +904,8 @@ out_unlock:
4519 return msgsz;
4520 }
4521
4522 -asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz,
4523 - long msgtyp, int msgflg)
4524 +SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
4525 + long, msgtyp, int, msgflg)
4526 {
4527 long err, mtype;
4528
4529 diff --git a/ipc/sem.c b/ipc/sem.c
4530 index bf1bc36..9eb9d31 100644
4531 --- a/ipc/sem.c
4532 +++ b/ipc/sem.c
4533 @@ -308,7 +308,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
4534 return 0;
4535 }
4536
4537 -asmlinkage long sys_semget(key_t key, int nsems, int semflg)
4538 +SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
4539 {
4540 struct ipc_namespace *ns;
4541 struct ipc_ops sem_ops;
4542 @@ -887,7 +887,7 @@ out_up:
4543 return err;
4544 }
4545
4546 -asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
4547 +SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
4548 {
4549 int err = -EINVAL;
4550 int version;
4551 @@ -923,6 +923,13 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
4552 return -EINVAL;
4553 }
4554 }
4555 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
4556 +asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg)
4557 +{
4558 + return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg);
4559 +}
4560 +SYSCALL_ALIAS(sys_semctl, SyS_semctl);
4561 +#endif
4562
4563 /* If the task doesn't already have a undo_list, then allocate one
4564 * here. We guarantee there is only one thread using this undo list,
4565 @@ -1048,8 +1055,8 @@ out:
4566 return un;
4567 }
4568
4569 -asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
4570 - unsigned nsops, const struct timespec __user *timeout)
4571 +SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
4572 + unsigned, nsops, const struct timespec __user *, timeout)
4573 {
4574 int error = -EINVAL;
4575 struct sem_array *sma;
4576 @@ -1226,7 +1233,8 @@ out_free:
4577 return error;
4578 }
4579
4580 -asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsops)
4581 +SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
4582 + unsigned, nsops)
4583 {
4584 return sys_semtimedop(semid, tsops, nsops, NULL);
4585 }
4586 diff --git a/ipc/shm.c b/ipc/shm.c
4587 index e77ec69..f00c897 100644
4588 --- a/ipc/shm.c
4589 +++ b/ipc/shm.c
4590 @@ -440,7 +440,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
4591 return 0;
4592 }
4593
4594 -asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
4595 +SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
4596 {
4597 struct ipc_namespace *ns;
4598 struct ipc_ops shm_ops;
4599 @@ -621,7 +621,7 @@ out_up:
4600 return err;
4601 }
4602
4603 -asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf)
4604 +SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
4605 {
4606 struct shmid_kernel *shp;
4607 int err, version;
4608 @@ -941,7 +941,7 @@ out_put_dentry:
4609 goto out_nattch;
4610 }
4611
4612 -asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
4613 +SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
4614 {
4615 unsigned long ret;
4616 long err;
4617 @@ -957,7 +957,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
4618 * detach and kill segment if marked destroyed.
4619 * The work is done in shm_close.
4620 */
4621 -asmlinkage long sys_shmdt(char __user *shmaddr)
4622 +SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
4623 {
4624 struct mm_struct *mm = current->mm;
4625 struct vm_area_struct *vma, *next;
4626 diff --git a/kernel/acct.c b/kernel/acct.c
4627 index dd68b90..a272f53 100644
4628 --- a/kernel/acct.c
4629 +++ b/kernel/acct.c
4630 @@ -277,7 +277,7 @@ static int acct_on(char *name)
4631 * should be written. If the filename is NULL, accounting will be
4632 * shutdown.
4633 */
4634 -asmlinkage long sys_acct(const char __user *name)
4635 +SYSCALL_DEFINE1(acct, const char __user *, name)
4636 {
4637 int error;
4638
4639 diff --git a/kernel/capability.c b/kernel/capability.c
4640 index 33e51e7..6ec8359 100644
4641 --- a/kernel/capability.c
4642 +++ b/kernel/capability.c
4643 @@ -348,7 +348,7 @@ EXPORT_SYMBOL(cap_set_effective);
4644 *
4645 * Returns 0 on success and < 0 on error.
4646 */
4647 -asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
4648 +SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr)
4649 {
4650 int ret = 0;
4651 pid_t pid;
4652 @@ -425,7 +425,7 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
4653 *
4654 * Returns 0 on success and < 0 on error.
4655 */
4656 -asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
4657 +SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
4658 {
4659 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
4660 unsigned i, tocopy;
4661 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
4662 index 0ba3a5a..271763d 100644
4663 --- a/kernel/cgroup.c
4664 +++ b/kernel/cgroup.c
4665 @@ -2885,7 +2885,11 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
4666 parent = task_cgroup(tsk, subsys->subsys_id);
4667
4668 /* Pin the hierarchy */
4669 - atomic_inc(&parent->root->sb->s_active);
4670 + if (!atomic_inc_not_zero(&parent->root->sb->s_active)) {
4671 + /* We race with the final deactivate_super() */
4672 + mutex_unlock(&cgroup_mutex);
4673 + return 0;
4674 + }
4675
4676 /* Keep the cgroup alive */
4677 get_css_set(cg);
4678 diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
4679 index 0d407e8..18e8a50 100644
4680 --- a/kernel/exec_domain.c
4681 +++ b/kernel/exec_domain.c
4682 @@ -188,8 +188,7 @@ get_exec_domain_list(char *page)
4683 return (len);
4684 }
4685
4686 -asmlinkage long
4687 -sys_personality(u_long personality)
4688 +SYSCALL_DEFINE1(personality, u_long, personality)
4689 {
4690 u_long old = current->personality;
4691
4692 diff --git a/kernel/exit.c b/kernel/exit.c
4693 index 85a83c8..14096a1 100644
4694 --- a/kernel/exit.c
4695 +++ b/kernel/exit.c
4696 @@ -1145,7 +1145,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code)
4697
4698 EXPORT_SYMBOL(complete_and_exit);
4699
4700 -asmlinkage long sys_exit(int error_code)
4701 +SYSCALL_DEFINE1(exit, int, error_code)
4702 {
4703 do_exit((error_code&0xff)<<8);
4704 }
4705 @@ -1186,9 +1186,11 @@ do_group_exit(int exit_code)
4706 * wait4()-ing process will get the correct exit code - even if this
4707 * thread is not the thread group leader.
4708 */
4709 -asmlinkage void sys_exit_group(int error_code)
4710 +SYSCALL_DEFINE1(exit_group, int, error_code)
4711 {
4712 do_group_exit((error_code & 0xff) << 8);
4713 + /* NOTREACHED */
4714 + return 0;
4715 }
4716
4717 static struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
4718 @@ -1749,9 +1751,8 @@ end:
4719 return retval;
4720 }
4721
4722 -asmlinkage long sys_waitid(int which, pid_t upid,
4723 - struct siginfo __user *infop, int options,
4724 - struct rusage __user *ru)
4725 +SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
4726 + infop, int, options, struct rusage __user *, ru)
4727 {
4728 struct pid *pid = NULL;
4729 enum pid_type type;
4730 @@ -1790,8 +1791,8 @@ asmlinkage long sys_waitid(int which, pid_t upid,
4731 return ret;
4732 }
4733
4734 -asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr,
4735 - int options, struct rusage __user *ru)
4736 +SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
4737 + int, options, struct rusage __user *, ru)
4738 {
4739 struct pid *pid = NULL;
4740 enum pid_type type;
4741 @@ -1828,7 +1829,7 @@ asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr,
4742 * sys_waitpid() remains for compatibility. waitpid() should be
4743 * implemented by calling sys_wait4() from libc.a.
4744 */
4745 -asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options)
4746 +SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options)
4747 {
4748 return sys_wait4(pid, stat_addr, options, NULL);
4749 }
4750 diff --git a/kernel/fork.c b/kernel/fork.c
4751 index d8ad2c6..42fb5b0 100644
4752 --- a/kernel/fork.c
4753 +++ b/kernel/fork.c
4754 @@ -865,7 +865,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
4755 clear_freeze_flag(p);
4756 }
4757
4758 -asmlinkage long sys_set_tid_address(int __user *tidptr)
4759 +SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
4760 {
4761 current->clear_child_tid = tidptr;
4762
4763 @@ -1561,7 +1561,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
4764 * constructed. Here we are modifying the current, active,
4765 * task_struct.
4766 */
4767 -asmlinkage long sys_unshare(unsigned long unshare_flags)
4768 +SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
4769 {
4770 int err = 0;
4771 struct fs_struct *fs, *new_fs = NULL;
4772 diff --git a/kernel/futex.c b/kernel/futex.c
4773 index 7d1136e..ec84da5 100644
4774 --- a/kernel/futex.c
4775 +++ b/kernel/futex.c
4776 @@ -1797,9 +1797,8 @@ pi_faulted:
4777 * @head: pointer to the list-head
4778 * @len: length of the list-head, as userspace expects
4779 */
4780 -asmlinkage long
4781 -sys_set_robust_list(struct robust_list_head __user *head,
4782 - size_t len)
4783 +SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
4784 + size_t, len)
4785 {
4786 if (!futex_cmpxchg_enabled)
4787 return -ENOSYS;
4788 @@ -1820,9 +1819,9 @@ sys_set_robust_list(struct robust_list_head __user *head,
4789 * @head_ptr: pointer to a list-head pointer, the kernel fills it in
4790 * @len_ptr: pointer to a length field, the kernel fills in the header size
4791 */
4792 -asmlinkage long
4793 -sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
4794 - size_t __user *len_ptr)
4795 +SYSCALL_DEFINE3(get_robust_list, int, pid,
4796 + struct robust_list_head __user * __user *, head_ptr,
4797 + size_t __user *, len_ptr)
4798 {
4799 struct robust_list_head __user *head;
4800 unsigned long ret;
4801 @@ -2036,9 +2035,9 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
4802 }
4803
4804
4805 -asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
4806 - struct timespec __user *utime, u32 __user *uaddr2,
4807 - u32 val3)
4808 +SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
4809 + struct timespec __user *, utime, u32 __user *, uaddr2,
4810 + u32, val3)
4811 {
4812 struct timespec ts;
4813 ktime_t t, *tp = NULL;
4814 diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
4815 index cdec83e..98bbbe5 100644
4816 --- a/kernel/hrtimer.c
4817 +++ b/kernel/hrtimer.c
4818 @@ -1560,8 +1560,8 @@ out:
4819 return ret;
4820 }
4821
4822 -asmlinkage long
4823 -sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
4824 +SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
4825 + struct timespec __user *, rmtp)
4826 {
4827 struct timespec tu;
4828
4829 diff --git a/kernel/itimer.c b/kernel/itimer.c
4830 index ab98274..13470aa 100644
4831 --- a/kernel/itimer.c
4832 +++ b/kernel/itimer.c
4833 @@ -109,7 +109,7 @@ int do_getitimer(int which, struct itimerval *value)
4834 return 0;
4835 }
4836
4837 -asmlinkage long sys_getitimer(int which, struct itimerval __user *value)
4838 +SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value)
4839 {
4840 int error = -EFAULT;
4841 struct itimerval get_buffer;
4842 @@ -273,9 +273,8 @@ unsigned int alarm_setitimer(unsigned int seconds)
4843 return it_old.it_value.tv_sec;
4844 }
4845
4846 -asmlinkage long sys_setitimer(int which,
4847 - struct itimerval __user *value,
4848 - struct itimerval __user *ovalue)
4849 +SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
4850 + struct itimerval __user *, ovalue)
4851 {
4852 struct itimerval set_buffer, get_buffer;
4853 int error;
4854 diff --git a/kernel/kexec.c b/kernel/kexec.c
4855 index aef2653..cba525a 100644
4856 --- a/kernel/kexec.c
4857 +++ b/kernel/kexec.c
4858 @@ -933,9 +933,8 @@ struct kimage *kexec_crash_image;
4859
4860 static DEFINE_MUTEX(kexec_mutex);
4861
4862 -asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
4863 - struct kexec_segment __user *segments,
4864 - unsigned long flags)
4865 +SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
4866 + struct kexec_segment __user *, segments, unsigned long, flags)
4867 {
4868 struct kimage **dest_image, *image;
4869 int result;
4870 diff --git a/kernel/module.c b/kernel/module.c
4871 index d5fcd24..69d274a 100644
4872 --- a/kernel/module.c
4873 +++ b/kernel/module.c
4874 @@ -715,8 +715,8 @@ static void wait_for_zero_refcount(struct module *mod)
4875 mutex_lock(&module_mutex);
4876 }
4877
4878 -asmlinkage long
4879 -sys_delete_module(const char __user *name_user, unsigned int flags)
4880 +SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
4881 + unsigned int, flags)
4882 {
4883 struct module *mod;
4884 char name[MODULE_NAME_LEN];
4885 @@ -2257,10 +2257,8 @@ static noinline struct module *load_module(void __user *umod,
4886 }
4887
4888 /* This is where the real work happens */
4889 -asmlinkage long
4890 -sys_init_module(void __user *umod,
4891 - unsigned long len,
4892 - const char __user *uargs)
4893 +SYSCALL_DEFINE3(init_module, void __user *, umod,
4894 + unsigned long, len, const char __user *, uargs)
4895 {
4896 struct module *mod;
4897 int ret = 0;
4898 diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
4899 index 5131e54..24ae236 100644
4900 --- a/kernel/posix-timers.c
4901 +++ b/kernel/posix-timers.c
4902 @@ -463,10 +463,9 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
4903
4904 /* Create a POSIX.1b interval timer. */
4905
4906 -asmlinkage long
4907 -sys_timer_create(const clockid_t which_clock,
4908 - struct sigevent __user *timer_event_spec,
4909 - timer_t __user * created_timer_id)
4910 +SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
4911 + struct sigevent __user *, timer_event_spec,
4912 + timer_t __user *, created_timer_id)
4913 {
4914 int error = 0;
4915 struct k_itimer *new_timer = NULL;
4916 @@ -682,8 +681,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
4917 }
4918
4919 /* Get the time remaining on a POSIX.1b interval timer. */
4920 -asmlinkage long
4921 -sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting)
4922 +SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
4923 + struct itimerspec __user *, setting)
4924 {
4925 struct k_itimer *timr;
4926 struct itimerspec cur_setting;
4927 @@ -712,8 +711,7 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting)
4928 * the call back to do_schedule_next_timer(). So all we need to do is
4929 * to pick up the frozen overrun.
4930 */
4931 -asmlinkage long
4932 -sys_timer_getoverrun(timer_t timer_id)
4933 +SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
4934 {
4935 struct k_itimer *timr;
4936 int overrun;
4937 @@ -783,10 +781,9 @@ common_timer_set(struct k_itimer *timr, int flags,
4938 }
4939
4940 /* Set a POSIX.1b interval timer */
4941 -asmlinkage long
4942 -sys_timer_settime(timer_t timer_id, int flags,
4943 - const struct itimerspec __user *new_setting,
4944 - struct itimerspec __user *old_setting)
4945 +SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
4946 + const struct itimerspec __user *, new_setting,
4947 + struct itimerspec __user *, old_setting)
4948 {
4949 struct k_itimer *timr;
4950 struct itimerspec new_spec, old_spec;
4951 @@ -839,8 +836,7 @@ static inline int timer_delete_hook(struct k_itimer *timer)
4952 }
4953
4954 /* Delete a POSIX.1b interval timer. */
4955 -asmlinkage long
4956 -sys_timer_delete(timer_t timer_id)
4957 +SYSCALL_DEFINE1(timer_delete, timer_t, timer_id)
4958 {
4959 struct k_itimer *timer;
4960 unsigned long flags;
4961 @@ -930,8 +926,8 @@ int do_posix_clock_nonanosleep(const clockid_t clock, int flags,
4962 }
4963 EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep);
4964
4965 -asmlinkage long sys_clock_settime(const clockid_t which_clock,
4966 - const struct timespec __user *tp)
4967 +SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
4968 + const struct timespec __user *, tp)
4969 {
4970 struct timespec new_tp;
4971
4972 @@ -943,8 +939,8 @@ asmlinkage long sys_clock_settime(const clockid_t which_clock,
4973 return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));
4974 }
4975
4976 -asmlinkage long
4977 -sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)
4978 +SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
4979 + struct timespec __user *,tp)
4980 {
4981 struct timespec kernel_tp;
4982 int error;
4983 @@ -960,8 +956,8 @@ sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)
4984
4985 }
4986
4987 -asmlinkage long
4988 -sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)
4989 +SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
4990 + struct timespec __user *, tp)
4991 {
4992 struct timespec rtn_tp;
4993 int error;
4994 @@ -990,10 +986,9 @@ static int common_nsleep(const clockid_t which_clock, int flags,
4995 which_clock);
4996 }
4997
4998 -asmlinkage long
4999 -sys_clock_nanosleep(const clockid_t which_clock, int flags,
5000 - const struct timespec __user *rqtp,
5001 - struct timespec __user *rmtp)
5002 +SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
5003 + const struct timespec __user *, rqtp,
5004 + struct timespec __user *, rmtp)
5005 {
5006 struct timespec t;
5007
5008 diff --git a/kernel/printk.c b/kernel/printk.c
5009 index b51b156..0084812 100644
5010 --- a/kernel/printk.c
5011 +++ b/kernel/printk.c
5012 @@ -421,7 +421,7 @@ out:
5013 return error;
5014 }
5015
5016 -asmlinkage long sys_syslog(int type, char __user *buf, int len)
5017 +SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
5018 {
5019 return do_syslog(type, buf, len);
5020 }
5021 @@ -782,11 +782,6 @@ EXPORT_SYMBOL(vprintk);
5022
5023 #else
5024
5025 -asmlinkage long sys_syslog(int type, char __user *buf, int len)
5026 -{
5027 - return -ENOSYS;
5028 -}
5029 -
5030 static void call_console_drivers(unsigned start, unsigned end)
5031 {
5032 }
5033 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
5034 index 356699a..85c1983 100644
5035 --- a/kernel/ptrace.c
5036 +++ b/kernel/ptrace.c
5037 @@ -545,7 +545,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
5038 #define arch_ptrace_attach(child) do { } while (0)
5039 #endif
5040
5041 -asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
5042 +SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
5043 {
5044 struct task_struct *child;
5045 long ret;
5046 diff --git a/kernel/sched.c b/kernel/sched.c
5047 index 92c0a70..2a09e44 100644
5048 --- a/kernel/sched.c
5049 +++ b/kernel/sched.c
5050 @@ -4942,7 +4942,7 @@ int can_nice(const struct task_struct *p, const int nice)
5051 * sys_setpriority is a more generic, but much slower function that
5052 * does similar things.
5053 */
5054 -asmlinkage long sys_nice(int increment)
5055 +SYSCALL_DEFINE1(nice, int, increment)
5056 {
5057 long nice, retval;
5058
5059 @@ -5233,8 +5233,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5060 * @policy: new policy.
5061 * @param: structure containing the new RT priority.
5062 */
5063 -asmlinkage long
5064 -sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5065 +SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
5066 + struct sched_param __user *, param)
5067 {
5068 /* negative values for policy are not valid */
5069 if (policy < 0)
5070 @@ -5248,7 +5248,7 @@ sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5071 * @pid: the pid in question.
5072 * @param: structure containing the new RT priority.
5073 */
5074 -asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
5075 +SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
5076 {
5077 return do_sched_setscheduler(pid, -1, param);
5078 }
5079 @@ -5257,7 +5257,7 @@ asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
5080 * sys_sched_getscheduler - get the policy (scheduling class) of a thread
5081 * @pid: the pid in question.
5082 */
5083 -asmlinkage long sys_sched_getscheduler(pid_t pid)
5084 +SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
5085 {
5086 struct task_struct *p;
5087 int retval;
5088 @@ -5282,7 +5282,7 @@ asmlinkage long sys_sched_getscheduler(pid_t pid)
5089 * @pid: the pid in question.
5090 * @param: structure containing the RT priority.
5091 */
5092 -asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param)
5093 +SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
5094 {
5095 struct sched_param lp;
5096 struct task_struct *p;
5097 @@ -5390,8 +5390,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
5098 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5099 * @user_mask_ptr: user-space pointer to the new cpu mask
5100 */
5101 -asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
5102 - unsigned long __user *user_mask_ptr)
5103 +SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
5104 + unsigned long __user *, user_mask_ptr)
5105 {
5106 cpumask_t new_mask;
5107 int retval;
5108 @@ -5435,8 +5435,8 @@ out_unlock:
5109 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5110 * @user_mask_ptr: user-space pointer to hold the current cpu mask
5111 */
5112 -asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
5113 - unsigned long __user *user_mask_ptr)
5114 +SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
5115 + unsigned long __user *, user_mask_ptr)
5116 {
5117 int ret;
5118 cpumask_t mask;
5119 @@ -5460,7 +5460,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
5120 * This function yields the current CPU to other tasks. If there are no
5121 * other threads running on this CPU then this function will return.
5122 */
5123 -asmlinkage long sys_sched_yield(void)
5124 +SYSCALL_DEFINE0(sched_yield)
5125 {
5126 struct rq *rq = this_rq_lock();
5127
5128 @@ -5601,7 +5601,7 @@ long __sched io_schedule_timeout(long timeout)
5129 * this syscall returns the maximum rt_priority that can be used
5130 * by a given scheduling class.
5131 */
5132 -asmlinkage long sys_sched_get_priority_max(int policy)
5133 +SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
5134 {
5135 int ret = -EINVAL;
5136
5137 @@ -5626,7 +5626,7 @@ asmlinkage long sys_sched_get_priority_max(int policy)
5138 * this syscall returns the minimum rt_priority that can be used
5139 * by a given scheduling class.
5140 */
5141 -asmlinkage long sys_sched_get_priority_min(int policy)
5142 +SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
5143 {
5144 int ret = -EINVAL;
5145
5146 @@ -5651,8 +5651,8 @@ asmlinkage long sys_sched_get_priority_min(int policy)
5147 * this syscall writes the default timeslice value of a given process
5148 * into the user-space timespec buffer. A value of '0' means infinity.
5149 */
5150 -asmlinkage
5151 -long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval)
5152 +SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
5153 + struct timespec __user *, interval)
5154 {
5155 struct task_struct *p;
5156 unsigned int time_slice;
5157 diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
5158 index e8ab096..a0b0852 100644
5159 --- a/kernel/sched_clock.c
5160 +++ b/kernel/sched_clock.c
5161 @@ -124,7 +124,7 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
5162
5163 clock = scd->tick_gtod + delta;
5164 min_clock = wrap_max(scd->tick_gtod, scd->clock);
5165 - max_clock = scd->tick_gtod + TICK_NSEC;
5166 + max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC);
5167
5168 clock = wrap_max(clock, min_clock);
5169 clock = wrap_min(clock, max_clock);
5170 @@ -227,6 +227,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event);
5171 */
5172 void sched_clock_idle_wakeup_event(u64 delta_ns)
5173 {
5174 + if (timekeeping_suspended)
5175 + return;
5176 +
5177 sched_clock_tick();
5178 touch_softlockup_watchdog();
5179 }
5180 diff --git a/kernel/signal.c b/kernel/signal.c
5181 index e661b01..6f06f43 100644
5182 --- a/kernel/signal.c
5183 +++ b/kernel/signal.c
5184 @@ -1936,7 +1936,7 @@ EXPORT_SYMBOL(unblock_all_signals);
5185 * System call entry points.
5186 */
5187
5188 -asmlinkage long sys_restart_syscall(void)
5189 +SYSCALL_DEFINE0(restart_syscall)
5190 {
5191 struct restart_block *restart = &current_thread_info()->restart_block;
5192 return restart->fn(restart);
5193 @@ -1989,8 +1989,8 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
5194 return error;
5195 }
5196
5197 -asmlinkage long
5198 -sys_rt_sigprocmask(int how, sigset_t __user *set, sigset_t __user *oset, size_t sigsetsize)
5199 +SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set,
5200 + sigset_t __user *, oset, size_t, sigsetsize)
5201 {
5202 int error = -EINVAL;
5203 sigset_t old_set, new_set;
5204 @@ -2049,8 +2049,7 @@ out:
5205 return error;
5206 }
5207
5208 -asmlinkage long
5209 -sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize)
5210 +SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
5211 {
5212 return do_sigpending(set, sigsetsize);
5213 }
5214 @@ -2121,11 +2120,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
5215
5216 #endif
5217
5218 -asmlinkage long
5219 -sys_rt_sigtimedwait(const sigset_t __user *uthese,
5220 - siginfo_t __user *uinfo,
5221 - const struct timespec __user *uts,
5222 - size_t sigsetsize)
5223 +SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
5224 + siginfo_t __user *, uinfo, const struct timespec __user *, uts,
5225 + size_t, sigsetsize)
5226 {
5227 int ret, sig;
5228 sigset_t these;
5229 @@ -2198,8 +2195,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese,
5230 return ret;
5231 }
5232
5233 -asmlinkage long
5234 -sys_kill(pid_t pid, int sig)
5235 +SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
5236 {
5237 struct siginfo info;
5238
5239 @@ -2258,7 +2254,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
5240 * exists but it's not belonging to the target process anymore. This
5241 * method solves the problem of threads exiting and PIDs getting reused.
5242 */
5243 -asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig)
5244 +SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
5245 {
5246 /* This is only valid for single tasks */
5247 if (pid <= 0 || tgid <= 0)
5248 @@ -2270,8 +2266,7 @@ asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig)
5249 /*
5250 * Send a signal to only one task, even if it's a CLONE_THREAD task.
5251 */
5252 -asmlinkage long
5253 -sys_tkill(pid_t pid, int sig)
5254 +SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
5255 {
5256 /* This is only valid for single tasks */
5257 if (pid <= 0)
5258 @@ -2280,8 +2275,8 @@ sys_tkill(pid_t pid, int sig)
5259 return do_tkill(0, pid, sig);
5260 }
5261
5262 -asmlinkage long
5263 -sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo)
5264 +SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
5265 + siginfo_t __user *, uinfo)
5266 {
5267 siginfo_t info;
5268
5269 @@ -2409,8 +2404,7 @@ out:
5270
5271 #ifdef __ARCH_WANT_SYS_SIGPENDING
5272
5273 -asmlinkage long
5274 -sys_sigpending(old_sigset_t __user *set)
5275 +SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
5276 {
5277 return do_sigpending(set, sizeof(*set));
5278 }
5279 @@ -2421,8 +2415,8 @@ sys_sigpending(old_sigset_t __user *set)
5280 /* Some platforms have their own version with special arguments others
5281 support only sys_rt_sigprocmask. */
5282
5283 -asmlinkage long
5284 -sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)
5285 +SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
5286 + old_sigset_t __user *, oset)
5287 {
5288 int error;
5289 old_sigset_t old_set, new_set;
5290 @@ -2472,11 +2466,10 @@ out:
5291 #endif /* __ARCH_WANT_SYS_SIGPROCMASK */
5292
5293 #ifdef __ARCH_WANT_SYS_RT_SIGACTION
5294 -asmlinkage long
5295 -sys_rt_sigaction(int sig,
5296 - const struct sigaction __user *act,
5297 - struct sigaction __user *oact,
5298 - size_t sigsetsize)
5299 +SYSCALL_DEFINE4(rt_sigaction, int, sig,
5300 + const struct sigaction __user *, act,
5301 + struct sigaction __user *, oact,
5302 + size_t, sigsetsize)
5303 {
5304 struct k_sigaction new_sa, old_sa;
5305 int ret = -EINVAL;
5306 @@ -2506,15 +2499,13 @@ out:
5307 /*
5308 * For backwards compatibility. Functionality superseded by sigprocmask.
5309 */
5310 -asmlinkage long
5311 -sys_sgetmask(void)
5312 +SYSCALL_DEFINE0(sgetmask)
5313 {
5314 /* SMP safe */
5315 return current->blocked.sig[0];
5316 }
5317
5318 -asmlinkage long
5319 -sys_ssetmask(int newmask)
5320 +SYSCALL_DEFINE1(ssetmask, int, newmask)
5321 {
5322 int old;
5323
5324 @@ -2534,8 +2525,7 @@ sys_ssetmask(int newmask)
5325 /*
5326 * For backwards compatibility. Functionality superseded by sigaction.
5327 */
5328 -asmlinkage unsigned long
5329 -sys_signal(int sig, __sighandler_t handler)
5330 +SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
5331 {
5332 struct k_sigaction new_sa, old_sa;
5333 int ret;
5334 @@ -2552,8 +2542,7 @@ sys_signal(int sig, __sighandler_t handler)
5335
5336 #ifdef __ARCH_WANT_SYS_PAUSE
5337
5338 -asmlinkage long
5339 -sys_pause(void)
5340 +SYSCALL_DEFINE0(pause)
5341 {
5342 current->state = TASK_INTERRUPTIBLE;
5343 schedule();
5344 @@ -2563,7 +2552,7 @@ sys_pause(void)
5345 #endif
5346
5347 #ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
5348 -asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
5349 +SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
5350 {
5351 sigset_t newset;
5352
5353 diff --git a/kernel/sys.c b/kernel/sys.c
5354 index 038a7bc..10a263b 100644
5355 --- a/kernel/sys.c
5356 +++ b/kernel/sys.c
5357 @@ -137,7 +137,7 @@ out:
5358 return error;
5359 }
5360
5361 -asmlinkage long sys_setpriority(int which, int who, int niceval)
5362 +SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
5363 {
5364 struct task_struct *g, *p;
5365 struct user_struct *user;
5366 @@ -201,7 +201,7 @@ out:
5367 * has been offset by 20 (ie it returns 40..1 instead of -20..19)
5368 * to stay compatible.
5369 */
5370 -asmlinkage long sys_getpriority(int which, int who)
5371 +SYSCALL_DEFINE2(getpriority, int, which, int, who)
5372 {
5373 struct task_struct *g, *p;
5374 struct user_struct *user;
5375 @@ -347,7 +347,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
5376 *
5377 * reboot doesn't sync: do that yourself before calling this.
5378 */
5379 -asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg)
5380 +SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
5381 + void __user *, arg)
5382 {
5383 char buffer[256];
5384
5385 @@ -470,7 +471,7 @@ void ctrl_alt_del(void)
5386 * SMP: There are not races, the GIDs are checked only by filesystem
5387 * operations (as far as semantic preservation is concerned).
5388 */
5389 -asmlinkage long sys_setregid(gid_t rgid, gid_t egid)
5390 +SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
5391 {
5392 int old_rgid = current->gid;
5393 int old_egid = current->egid;
5394 @@ -519,7 +520,7 @@ asmlinkage long sys_setregid(gid_t rgid, gid_t egid)
5395 *
5396 * SMP: Same implicit races as above.
5397 */
5398 -asmlinkage long sys_setgid(gid_t gid)
5399 +SYSCALL_DEFINE1(setgid, gid_t, gid)
5400 {
5401 int old_egid = current->egid;
5402 int retval;
5403 @@ -589,7 +590,7 @@ static int set_user(uid_t new_ruid, int dumpclear)
5404 * 100% compatible with BSD. A program which uses just setuid() will be
5405 * 100% compatible with POSIX with saved IDs.
5406 */
5407 -asmlinkage long sys_setreuid(uid_t ruid, uid_t euid)
5408 +SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
5409 {
5410 int old_ruid, old_euid, old_suid, new_ruid, new_euid;
5411 int retval;
5412 @@ -651,7 +652,7 @@ asmlinkage long sys_setreuid(uid_t ruid, uid_t euid)
5413 * will allow a root program to temporarily drop privileges and be able to
5414 * regain them by swapping the real and effective uid.
5415 */
5416 -asmlinkage long sys_setuid(uid_t uid)
5417 +SYSCALL_DEFINE1(setuid, uid_t, uid)
5418 {
5419 int old_euid = current->euid;
5420 int old_ruid, old_suid, new_suid;
5421 @@ -690,7 +691,7 @@ asmlinkage long sys_setuid(uid_t uid)
5422 * This function implements a generic ability to update ruid, euid,
5423 * and suid. This allows you to implement the 4.4 compatible seteuid().
5424 */
5425 -asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
5426 +SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
5427 {
5428 int old_ruid = current->uid;
5429 int old_euid = current->euid;
5430 @@ -733,7 +734,7 @@ asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
5431 return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES);
5432 }
5433
5434 -asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid)
5435 +SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
5436 {
5437 int retval;
5438
5439 @@ -747,7 +748,7 @@ asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __us
5440 /*
5441 * Same as above, but for rgid, egid, sgid.
5442 */
5443 -asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
5444 +SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
5445 {
5446 int retval;
5447
5448 @@ -784,7 +785,7 @@ asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
5449 return 0;
5450 }
5451
5452 -asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid)
5453 +SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
5454 {
5455 int retval;
5456
5457 @@ -802,7 +803,7 @@ asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __us
5458 * whatever uid it wants to). It normally shadows "euid", except when
5459 * explicitly set by setfsuid() or for access..
5460 */
5461 -asmlinkage long sys_setfsuid(uid_t uid)
5462 +SYSCALL_DEFINE1(setfsuid, uid_t, uid)
5463 {
5464 int old_fsuid;
5465
5466 @@ -831,7 +832,7 @@ asmlinkage long sys_setfsuid(uid_t uid)
5467 /*
5468 * Samma på svenska..
5469 */
5470 -asmlinkage long sys_setfsgid(gid_t gid)
5471 +SYSCALL_DEFINE1(setfsgid, gid_t, gid)
5472 {
5473 int old_fsgid;
5474
5475 @@ -853,7 +854,7 @@ asmlinkage long sys_setfsgid(gid_t gid)
5476 return old_fsgid;
5477 }
5478
5479 -asmlinkage long sys_times(struct tms __user * tbuf)
5480 +SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
5481 {
5482 /*
5483 * In the SMP world we might just be unlucky and have one of
5484 @@ -903,7 +904,7 @@ asmlinkage long sys_times(struct tms __user * tbuf)
5485 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
5486 * LBT 04.03.94
5487 */
5488 -asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
5489 +SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
5490 {
5491 struct task_struct *p;
5492 struct task_struct *group_leader = current->group_leader;
5493 @@ -974,7 +975,7 @@ out:
5494 return err;
5495 }
5496
5497 -asmlinkage long sys_getpgid(pid_t pid)
5498 +SYSCALL_DEFINE1(getpgid, pid_t, pid)
5499 {
5500 struct task_struct *p;
5501 struct pid *grp;
5502 @@ -1004,14 +1005,14 @@ out:
5503
5504 #ifdef __ARCH_WANT_SYS_GETPGRP
5505
5506 -asmlinkage long sys_getpgrp(void)
5507 +SYSCALL_DEFINE0(getpgrp)
5508 {
5509 return sys_getpgid(0);
5510 }
5511
5512 #endif
5513
5514 -asmlinkage long sys_getsid(pid_t pid)
5515 +SYSCALL_DEFINE1(getsid, pid_t, pid)
5516 {
5517 struct task_struct *p;
5518 struct pid *sid;
5519 @@ -1039,7 +1040,7 @@ out:
5520 return retval;
5521 }
5522
5523 -asmlinkage long sys_setsid(void)
5524 +SYSCALL_DEFINE0(setsid)
5525 {
5526 struct task_struct *group_leader = current->group_leader;
5527 struct pid *sid = task_pid(group_leader);
5528 @@ -1245,7 +1246,7 @@ int set_current_groups(struct group_info *group_info)
5529
5530 EXPORT_SYMBOL(set_current_groups);
5531
5532 -asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)
5533 +SYSCALL_DEFINE2(getgroups, int, gidsetsize, gid_t __user *, grouplist)
5534 {
5535 int i = 0;
5536
5537 @@ -1278,7 +1279,7 @@ out:
5538 * without another task interfering.
5539 */
5540
5541 -asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist)
5542 +SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
5543 {
5544 struct group_info *group_info;
5545 int retval;
5546 @@ -1328,7 +1329,7 @@ EXPORT_SYMBOL(in_egroup_p);
5547
5548 DECLARE_RWSEM(uts_sem);
5549
5550 -asmlinkage long sys_newuname(struct new_utsname __user * name)
5551 +SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
5552 {
5553 int errno = 0;
5554
5555 @@ -1339,7 +1340,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name)
5556 return errno;
5557 }
5558
5559 -asmlinkage long sys_sethostname(char __user *name, int len)
5560 +SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
5561 {
5562 int errno;
5563 char tmp[__NEW_UTS_LEN];
5564 @@ -1361,7 +1362,7 @@ asmlinkage long sys_sethostname(char __user *name, int len)
5565
5566 #ifdef __ARCH_WANT_SYS_GETHOSTNAME
5567
5568 -asmlinkage long sys_gethostname(char __user *name, int len)
5569 +SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
5570 {
5571 int i, errno;
5572
5573 @@ -1384,7 +1385,7 @@ asmlinkage long sys_gethostname(char __user *name, int len)
5574 * Only setdomainname; getdomainname can be implemented by calling
5575 * uname()
5576 */
5577 -asmlinkage long sys_setdomainname(char __user *name, int len)
5578 +SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
5579 {
5580 int errno;
5581 char tmp[__NEW_UTS_LEN];
5582 @@ -1405,7 +1406,7 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
5583 return errno;
5584 }
5585
5586 -asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
5587 +SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
5588 {
5589 if (resource >= RLIM_NLIMITS)
5590 return -EINVAL;
5591 @@ -1424,7 +1425,8 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
5592 * Back compatibility for getrlimit. Needed for some apps.
5593 */
5594
5595 -asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim)
5596 +SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
5597 + struct rlimit __user *, rlim)
5598 {
5599 struct rlimit x;
5600 if (resource >= RLIM_NLIMITS)
5601 @@ -1442,7 +1444,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
5602
5603 #endif
5604
5605 -asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)
5606 +SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
5607 {
5608 struct rlimit new_rlim, *old_rlim;
5609 unsigned long it_prof_secs;
5610 @@ -1618,7 +1620,7 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru)
5611 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
5612 }
5613
5614 -asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
5615 +SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
5616 {
5617 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
5618 who != RUSAGE_THREAD)
5619 @@ -1626,14 +1628,14 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
5620 return getrusage(current, who, ru);
5621 }
5622
5623 -asmlinkage long sys_umask(int mask)
5624 +SYSCALL_DEFINE1(umask, int, mask)
5625 {
5626 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
5627 return mask;
5628 }
5629
5630 -asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
5631 - unsigned long arg4, unsigned long arg5)
5632 +SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
5633 + unsigned long, arg4, unsigned long, arg5)
5634 {
5635 long error = 0;
5636
5637 @@ -1734,8 +1736,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
5638 return error;
5639 }
5640
5641 -asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
5642 - struct getcpu_cache __user *unused)
5643 +SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
5644 + struct getcpu_cache __user *, unused)
5645 {
5646 int err = 0;
5647 int cpu = raw_smp_processor_id();
5648 diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
5649 index 08d6e1b..d7b7b45 100644
5650 --- a/kernel/sys_ni.c
5651 +++ b/kernel/sys_ni.c
5652 @@ -125,6 +125,7 @@ cond_syscall(sys_vm86old);
5653 cond_syscall(sys_vm86);
5654 cond_syscall(compat_sys_ipc);
5655 cond_syscall(compat_sys_sysctl);
5656 +cond_syscall(sys_syslog);
5657
5658 /* arch-specific weak syscall entries */
5659 cond_syscall(sys_pciconfig_read);
5660 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
5661 index 6ffbed2..6816e6d 100644
5662 --- a/kernel/sysctl.c
5663 +++ b/kernel/sysctl.c
5664 @@ -1614,7 +1614,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol
5665 return error;
5666 }
5667
5668 -asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
5669 +SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
5670 {
5671 struct __sysctl_args tmp;
5672 int error;
5673 @@ -2925,7 +2925,7 @@ int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
5674 #else /* CONFIG_SYSCTL_SYSCALL */
5675
5676
5677 -asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
5678 +SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
5679 {
5680 struct __sysctl_args tmp;
5681 int error;
5682 diff --git a/kernel/time.c b/kernel/time.c
5683 index 6a08660..4ed46e3 100644
5684 --- a/kernel/time.c
5685 +++ b/kernel/time.c
5686 @@ -59,7 +59,7 @@ EXPORT_SYMBOL(sys_tz);
5687 * why not move it into the appropriate arch directory (for those
5688 * architectures that need it).
5689 */
5690 -asmlinkage long sys_time(time_t __user * tloc)
5691 +SYSCALL_DEFINE1(time, time_t __user *, tloc)
5692 {
5693 time_t i = get_seconds();
5694
5695 @@ -77,7 +77,7 @@ asmlinkage long sys_time(time_t __user * tloc)
5696 * architectures that need it).
5697 */
5698
5699 -asmlinkage long sys_stime(time_t __user *tptr)
5700 +SYSCALL_DEFINE1(stime, time_t __user *, tptr)
5701 {
5702 struct timespec tv;
5703 int err;
5704 @@ -97,8 +97,8 @@ asmlinkage long sys_stime(time_t __user *tptr)
5705
5706 #endif /* __ARCH_WANT_SYS_TIME */
5707
5708 -asmlinkage long sys_gettimeofday(struct timeval __user *tv,
5709 - struct timezone __user *tz)
5710 +SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
5711 + struct timezone __user *, tz)
5712 {
5713 if (likely(tv != NULL)) {
5714 struct timeval ktv;
5715 @@ -182,8 +182,8 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
5716 return 0;
5717 }
5718
5719 -asmlinkage long sys_settimeofday(struct timeval __user *tv,
5720 - struct timezone __user *tz)
5721 +SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
5722 + struct timezone __user *, tz)
5723 {
5724 struct timeval user_tv;
5725 struct timespec new_ts;
5726 @@ -203,7 +203,7 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv,
5727 return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
5728 }
5729
5730 -asmlinkage long sys_adjtimex(struct timex __user *txc_p)
5731 +SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
5732 {
5733 struct timex txc; /* Local copy of parameter */
5734 int ret;
5735 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
5736 index e91c29f..4220a2e 100644
5737 --- a/kernel/time/timekeeping.c
5738 +++ b/kernel/time/timekeeping.c
5739 @@ -46,6 +46,9 @@ struct timespec xtime __attribute__ ((aligned (16)));
5740 struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
5741 static unsigned long total_sleep_time; /* seconds */
5742
5743 +/* flag for if timekeeping is suspended */
5744 +int __read_mostly timekeeping_suspended;
5745 +
5746 static struct timespec xtime_cache __attribute__ ((aligned (16)));
5747 void update_xtime_cache(u64 nsec)
5748 {
5749 @@ -92,6 +95,8 @@ void getnstimeofday(struct timespec *ts)
5750 unsigned long seq;
5751 s64 nsecs;
5752
5753 + WARN_ON(timekeeping_suspended);
5754 +
5755 do {
5756 seq = read_seqbegin(&xtime_lock);
5757
5758 @@ -261,8 +266,6 @@ void __init timekeeping_init(void)
5759 write_sequnlock_irqrestore(&xtime_lock, flags);
5760 }
5761
5762 -/* flag for if timekeeping is suspended */
5763 -static int timekeeping_suspended;
5764 /* time in seconds when suspend began */
5765 static unsigned long timekeeping_suspend_time;
5766 /* xtime offset when we went into suspend */
5767 diff --git a/kernel/timer.c b/kernel/timer.c
5768 index 03bc7f1..e9a0195 100644
5769 --- a/kernel/timer.c
5770 +++ b/kernel/timer.c
5771 @@ -1074,7 +1074,7 @@ void do_timer(unsigned long ticks)
5772 * For backwards compatibility? This can be done in libc so Alpha
5773 * and all newer ports shouldn't need it.
5774 */
5775 -asmlinkage unsigned long sys_alarm(unsigned int seconds)
5776 +SYSCALL_DEFINE1(alarm, unsigned int, seconds)
5777 {
5778 return alarm_setitimer(seconds);
5779 }
5780 @@ -1097,7 +1097,7 @@ asmlinkage unsigned long sys_alarm(unsigned int seconds)
5781 *
5782 * This is SMP safe as current->tgid does not change.
5783 */
5784 -asmlinkage long sys_getpid(void)
5785 +SYSCALL_DEFINE0(getpid)
5786 {
5787 return task_tgid_vnr(current);
5788 }
5789 @@ -1108,7 +1108,7 @@ asmlinkage long sys_getpid(void)
5790 * value of ->real_parent under rcu_read_lock(), see
5791 * release_task()->call_rcu(delayed_put_task_struct).
5792 */
5793 -asmlinkage long sys_getppid(void)
5794 +SYSCALL_DEFINE0(getppid)
5795 {
5796 int pid;
5797
5798 @@ -1119,25 +1119,25 @@ asmlinkage long sys_getppid(void)
5799 return pid;
5800 }
5801
5802 -asmlinkage long sys_getuid(void)
5803 +SYSCALL_DEFINE0(getuid)
5804 {
5805 /* Only we change this so SMP safe */
5806 return current->uid;
5807 }
5808
5809 -asmlinkage long sys_geteuid(void)
5810 +SYSCALL_DEFINE0(geteuid)
5811 {
5812 /* Only we change this so SMP safe */
5813 return current->euid;
5814 }
5815
5816 -asmlinkage long sys_getgid(void)
5817 +SYSCALL_DEFINE0(getgid)
5818 {
5819 /* Only we change this so SMP safe */
5820 return current->gid;
5821 }
5822
5823 -asmlinkage long sys_getegid(void)
5824 +SYSCALL_DEFINE0(getegid)
5825 {
5826 /* Only we change this so SMP safe */
5827 return current->egid;
5828 @@ -1253,7 +1253,7 @@ signed long __sched schedule_timeout_uninterruptible(signed long timeout)
5829 EXPORT_SYMBOL(schedule_timeout_uninterruptible);
5830
5831 /* Thread ID - the internal kernel "pid" */
5832 -asmlinkage long sys_gettid(void)
5833 +SYSCALL_DEFINE0(gettid)
5834 {
5835 return task_pid_vnr(current);
5836 }
5837 @@ -1345,7 +1345,7 @@ out:
5838 return 0;
5839 }
5840
5841 -asmlinkage long sys_sysinfo(struct sysinfo __user *info)
5842 +SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info)
5843 {
5844 struct sysinfo val;
5845
5846 diff --git a/kernel/uid16.c b/kernel/uid16.c
5847 index 3e41c16..67bb92c 100644
5848 --- a/kernel/uid16.c
5849 +++ b/kernel/uid16.c
5850 @@ -17,7 +17,7 @@
5851
5852 #include <asm/uaccess.h>
5853
5854 -asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group)
5855 +SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
5856 {
5857 long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
5858 /* avoid REGPARM breakage on x86: */
5859 @@ -25,7 +25,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi
5860 return ret;
5861 }
5862
5863 -asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group)
5864 +SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
5865 {
5866 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
5867 /* avoid REGPARM breakage on x86: */
5868 @@ -33,7 +33,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g
5869 return ret;
5870 }
5871
5872 -asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
5873 +SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group)
5874 {
5875 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
5876 /* avoid REGPARM breakage on x86: */
5877 @@ -41,7 +41,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
5878 return ret;
5879 }
5880
5881 -asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
5882 +SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid)
5883 {
5884 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
5885 /* avoid REGPARM breakage on x86: */
5886 @@ -49,7 +49,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
5887 return ret;
5888 }
5889
5890 -asmlinkage long sys_setgid16(old_gid_t gid)
5891 +SYSCALL_DEFINE1(setgid16, old_gid_t, gid)
5892 {
5893 long ret = sys_setgid(low2highgid(gid));
5894 /* avoid REGPARM breakage on x86: */
5895 @@ -57,7 +57,7 @@ asmlinkage long sys_setgid16(old_gid_t gid)
5896 return ret;
5897 }
5898
5899 -asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
5900 +SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid)
5901 {
5902 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
5903 /* avoid REGPARM breakage on x86: */
5904 @@ -65,7 +65,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
5905 return ret;
5906 }
5907
5908 -asmlinkage long sys_setuid16(old_uid_t uid)
5909 +SYSCALL_DEFINE1(setuid16, old_uid_t, uid)
5910 {
5911 long ret = sys_setuid(low2highuid(uid));
5912 /* avoid REGPARM breakage on x86: */
5913 @@ -73,7 +73,7 @@ asmlinkage long sys_setuid16(old_uid_t uid)
5914 return ret;
5915 }
5916
5917 -asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
5918 +SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid)
5919 {
5920 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
5921 low2highuid(suid));
5922 @@ -82,7 +82,7 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
5923 return ret;
5924 }
5925
5926 -asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid)
5927 +SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruid, old_uid_t __user *, euid, old_uid_t __user *, suid)
5928 {
5929 int retval;
5930
5931 @@ -93,7 +93,7 @@ asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid,
5932 return retval;
5933 }
5934
5935 -asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
5936 +SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid)
5937 {
5938 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
5939 low2highgid(sgid));
5940 @@ -102,7 +102,8 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
5941 return ret;
5942 }
5943
5944 -asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid)
5945 +
5946 +SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgid, old_gid_t __user *, egid, old_gid_t __user *, sgid)
5947 {
5948 int retval;
5949
5950 @@ -113,7 +114,7 @@ asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid,
5951 return retval;
5952 }
5953
5954 -asmlinkage long sys_setfsuid16(old_uid_t uid)
5955 +SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid)
5956 {
5957 long ret = sys_setfsuid(low2highuid(uid));
5958 /* avoid REGPARM breakage on x86: */
5959 @@ -121,7 +122,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid)
5960 return ret;
5961 }
5962
5963 -asmlinkage long sys_setfsgid16(old_gid_t gid)
5964 +SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid)
5965 {
5966 long ret = sys_setfsgid(low2highgid(gid));
5967 /* avoid REGPARM breakage on x86: */
5968 @@ -159,7 +160,7 @@ static int groups16_from_user(struct group_info *group_info,
5969 return 0;
5970 }
5971
5972 -asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist)
5973 +SYSCALL_DEFINE2(getgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
5974 {
5975 int i = 0;
5976
5977 @@ -183,7 +184,7 @@ out:
5978 return i;
5979 }
5980
5981 -asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)
5982 +SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
5983 {
5984 struct group_info *group_info;
5985 int retval;
5986 @@ -208,22 +209,22 @@ asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)
5987 return retval;
5988 }
5989
5990 -asmlinkage long sys_getuid16(void)
5991 +SYSCALL_DEFINE0(getuid16)
5992 {
5993 return high2lowuid(current->uid);
5994 }
5995
5996 -asmlinkage long sys_geteuid16(void)
5997 +SYSCALL_DEFINE0(geteuid16)
5998 {
5999 return high2lowuid(current->euid);
6000 }
6001
6002 -asmlinkage long sys_getgid16(void)
6003 +SYSCALL_DEFINE0(getgid16)
6004 {
6005 return high2lowgid(current->gid);
6006 }
6007
6008 -asmlinkage long sys_getegid16(void)
6009 +SYSCALL_DEFINE0(getegid16)
6010 {
6011 return high2lowgid(current->egid);
6012 }
6013 diff --git a/mm/fadvise.c b/mm/fadvise.c
6014 index 343cfdf..a32a66e 100644
6015 --- a/mm/fadvise.c
6016 +++ b/mm/fadvise.c
6017 @@ -24,7 +24,7 @@
6018 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
6019 * deactivate the pages and clear PG_Referenced.
6020 */
6021 -asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
6022 +SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
6023 {
6024 struct file *file = fget(fd);
6025 struct address_space *mapping;
6026 @@ -126,12 +126,26 @@ out:
6027 fput(file);
6028 return ret;
6029 }
6030 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
6031 +asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice)
6032 +{
6033 + return SYSC_fadvise64_64((int) fd, offset, len, (int) advice);
6034 +}
6035 +SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64);
6036 +#endif
6037
6038 #ifdef __ARCH_WANT_SYS_FADVISE64
6039
6040 -asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
6041 +SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice)
6042 {
6043 return sys_fadvise64_64(fd, offset, len, advice);
6044 }
6045 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
6046 +asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice)
6047 +{
6048 + return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice);
6049 +}
6050 +SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64);
6051 +#endif
6052
6053 #endif
6054 diff --git a/mm/filemap.c b/mm/filemap.c
6055 index 876bc59..f3033d0 100644
6056 --- a/mm/filemap.c
6057 +++ b/mm/filemap.c
6058 @@ -1353,7 +1353,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
6059 return 0;
6060 }
6061
6062 -asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
6063 +SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
6064 {
6065 ssize_t ret;
6066 struct file *file;
6067 @@ -1372,6 +1372,13 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
6068 }
6069 return ret;
6070 }
6071 +#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
6072 +asmlinkage long SyS_readahead(long fd, loff_t offset, long count)
6073 +{
6074 + return SYSC_readahead((int) fd, offset, (size_t) count);
6075 +}
6076 +SYSCALL_ALIAS(sys_readahead, SyS_readahead);
6077 +#endif
6078
6079 #ifdef CONFIG_MMU
6080 /**
6081 @@ -2026,7 +2033,7 @@ int pagecache_write_begin(struct file *file, struct address_space *mapping,
6082 struct inode *inode = mapping->host;
6083 struct page *page;
6084 again:
6085 - page = __grab_cache_page(mapping, index);
6086 + page = grab_cache_page_write_begin(mapping, index, flags);
6087 *pagep = page;
6088 if (!page)
6089 return -ENOMEM;
6090 @@ -2190,19 +2197,24 @@ EXPORT_SYMBOL(generic_file_direct_write);
6091 * Find or create a page at the given pagecache position. Return the locked
6092 * page. This function is specifically for buffered writes.
6093 */
6094 -struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index)
6095 +struct page *grab_cache_page_write_begin(struct address_space *mapping,
6096 + pgoff_t index, unsigned flags)
6097 {
6098 int status;
6099 struct page *page;
6100 + gfp_t gfp_notmask = 0;
6101 + if (flags & AOP_FLAG_NOFS)
6102 + gfp_notmask = __GFP_FS;
6103 repeat:
6104 page = find_lock_page(mapping, index);
6105 if (likely(page))
6106 return page;
6107
6108 - page = page_cache_alloc(mapping);
6109 + page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask);
6110 if (!page)
6111 return NULL;
6112 - status = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
6113 + status = add_to_page_cache_lru(page, mapping, index,
6114 + GFP_KERNEL & ~gfp_notmask);
6115 if (unlikely(status)) {
6116 page_cache_release(page);
6117 if (status == -EEXIST)
6118 @@ -2211,7 +2223,7 @@ repeat:
6119 }
6120 return page;
6121 }
6122 -EXPORT_SYMBOL(__grab_cache_page);
6123 +EXPORT_SYMBOL(grab_cache_page_write_begin);
6124
6125 static ssize_t generic_perform_write_2copy(struct file *file,
6126 struct iov_iter *i, loff_t pos)
6127 @@ -2256,7 +2268,7 @@ static ssize_t generic_perform_write_2copy(struct file *file,
6128 break;
6129 }
6130
6131 - page = __grab_cache_page(mapping, index);
6132 + page = grab_cache_page_write_begin(mapping, index, 0);
6133 if (!page) {
6134 status = -ENOMEM;
6135 break;
6136 diff --git a/mm/fremap.c b/mm/fremap.c
6137 index 7881638..b4a4aa3 100644
6138 --- a/mm/fremap.c
6139 +++ b/mm/fremap.c
6140 @@ -118,8 +118,8 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
6141 * and the vma's default protection is used. Arbitrary protections
6142 * might be implemented in the future.
6143 */
6144 -asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
6145 - unsigned long prot, unsigned long pgoff, unsigned long flags)
6146 +SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
6147 + unsigned long, prot, unsigned long, pgoff, unsigned long, flags)
6148 {
6149 struct mm_struct *mm = current->mm;
6150 struct address_space *mapping;
6151 diff --git a/mm/madvise.c b/mm/madvise.c
6152 index f9349c1..b9ce574 100644
6153 --- a/mm/madvise.c
6154 +++ b/mm/madvise.c
6155 @@ -281,7 +281,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
6156 * -EBADF - map exists, but area maps something that isn't a file.
6157 * -EAGAIN - a kernel resource was temporarily unavailable.
6158 */
6159 -asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
6160 +SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
6161 {
6162 unsigned long end, tmp;
6163 struct vm_area_struct * vma, *prev;
6164 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
6165 index 8336905..83bea4f 100644
6166 --- a/mm/mempolicy.c
6167 +++ b/mm/mempolicy.c
6168 @@ -1059,10 +1059,9 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
6169 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0;
6170 }
6171
6172 -asmlinkage long sys_mbind(unsigned long start, unsigned long len,
6173 - unsigned long mode,
6174 - unsigned long __user *nmask, unsigned long maxnode,
6175 - unsigned flags)
6176 +SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
6177 + unsigned long, mode, unsigned long __user *, nmask,
6178 + unsigned long, maxnode, unsigned, flags)
6179 {
6180 nodemask_t nodes;
6181 int err;
6182 @@ -1082,8 +1081,8 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
6183 }
6184
6185 /* Set the process memory policy */
6186 -asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
6187 - unsigned long maxnode)
6188 +SYSCALL_DEFINE3(set_mempolicy, int, mode, unsigned long __user *, nmask,
6189 + unsigned long, maxnode)
6190 {
6191 int err;
6192 nodemask_t nodes;
6193 @@ -1101,9 +1100,9 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
6194 return do_set_mempolicy(mode, flags, &nodes);
6195 }
6196
6197 -asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
6198 - const unsigned long __user *old_nodes,
6199 - const unsigned long __user *new_nodes)
6200 +SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
6201 + const unsigned long __user *, old_nodes,
6202 + const unsigned long __user *, new_nodes)
6203 {
6204 struct mm_struct *mm;
6205 struct task_struct *task;
6206 @@ -1171,10 +1170,9 @@ out:
6207
6208
6209 /* Retrieve NUMA policy */
6210 -asmlinkage long sys_get_mempolicy(int __user *policy,
6211 - unsigned long __user *nmask,
6212 - unsigned long maxnode,
6213 - unsigned long addr, unsigned long flags)
6214 +SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
6215 + unsigned long __user *, nmask, unsigned long, maxnode,
6216 + unsigned long, addr, unsigned long, flags)
6217 {
6218 int err;
6219 int uninitialized_var(pval);
6220 diff --git a/mm/migrate.c b/mm/migrate.c
6221 index 2a80136..d493c02 100644
6222 --- a/mm/migrate.c
6223 +++ b/mm/migrate.c
6224 @@ -979,10 +979,10 @@ set_status:
6225 * Move a list of pages in the address space of the currently executing
6226 * process.
6227 */
6228 -asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
6229 - const void __user * __user *pages,
6230 - const int __user *nodes,
6231 - int __user *status, int flags)
6232 +SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
6233 + const void __user * __user *, pages,
6234 + const int __user *, nodes,
6235 + int __user *, status, int, flags)
6236 {
6237 int err = 0;
6238 int i;
6239 diff --git a/mm/mincore.c b/mm/mincore.c
6240 index 5178800..8cb508f 100644
6241 --- a/mm/mincore.c
6242 +++ b/mm/mincore.c
6243 @@ -177,8 +177,8 @@ none_mapped:
6244 * mapped
6245 * -EAGAIN - A kernel resource was temporarily unavailable.
6246 */
6247 -asmlinkage long sys_mincore(unsigned long start, size_t len,
6248 - unsigned char __user * vec)
6249 +SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
6250 + unsigned char __user *, vec)
6251 {
6252 long retval;
6253 unsigned long pages;
6254 diff --git a/mm/mlock.c b/mm/mlock.c
6255 index 01fbe93..73ee3fa 100644
6256 --- a/mm/mlock.c
6257 +++ b/mm/mlock.c
6258 @@ -130,7 +130,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
6259 return error;
6260 }
6261
6262 -asmlinkage long sys_mlock(unsigned long start, size_t len)
6263 +SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
6264 {
6265 unsigned long locked;
6266 unsigned long lock_limit;
6267 @@ -156,7 +156,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
6268 return error;
6269 }
6270
6271 -asmlinkage long sys_munlock(unsigned long start, size_t len)
6272 +SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
6273 {
6274 int ret;
6275
6276 @@ -193,7 +193,7 @@ out:
6277 return 0;
6278 }
6279
6280 -asmlinkage long sys_mlockall(int flags)
6281 +SYSCALL_DEFINE1(mlockall, int, flags)
6282 {
6283 unsigned long lock_limit;
6284 int ret = -EINVAL;
6285 @@ -219,7 +219,7 @@ out:
6286 return ret;
6287 }
6288
6289 -asmlinkage long sys_munlockall(void)
6290 +SYSCALL_DEFINE0(munlockall)
6291 {
6292 int ret;
6293
6294 diff --git a/mm/mmap.c b/mm/mmap.c
6295 index e7a5a68..ca12a93 100644
6296 --- a/mm/mmap.c
6297 +++ b/mm/mmap.c
6298 @@ -244,7 +244,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
6299 return next;
6300 }
6301
6302 -asmlinkage unsigned long sys_brk(unsigned long brk)
6303 +SYSCALL_DEFINE1(brk, unsigned long, brk)
6304 {
6305 unsigned long rlim, retval;
6306 unsigned long newbrk, oldbrk;
6307 @@ -1927,7 +1927,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
6308
6309 EXPORT_SYMBOL(do_munmap);
6310
6311 -asmlinkage long sys_munmap(unsigned long addr, size_t len)
6312 +SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
6313 {
6314 int ret;
6315 struct mm_struct *mm = current->mm;
6316 diff --git a/mm/mprotect.c b/mm/mprotect.c
6317 index fded06f..2623e29 100644
6318 --- a/mm/mprotect.c
6319 +++ b/mm/mprotect.c
6320 @@ -219,8 +219,8 @@ fail:
6321 return error;
6322 }
6323
6324 -asmlinkage long
6325 -sys_mprotect(unsigned long start, size_t len, unsigned long prot)
6326 +SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
6327 + unsigned long, prot)
6328 {
6329 unsigned long vm_flags, nstart, end, tmp, reqprot;
6330 struct vm_area_struct *vma, *prev;
6331 diff --git a/mm/mremap.c b/mm/mremap.c
6332 index 1a77439..cfdeed9 100644
6333 --- a/mm/mremap.c
6334 +++ b/mm/mremap.c
6335 @@ -418,9 +418,9 @@ out_nc:
6336 return ret;
6337 }
6338
6339 -asmlinkage unsigned long sys_mremap(unsigned long addr,
6340 - unsigned long old_len, unsigned long new_len,
6341 - unsigned long flags, unsigned long new_addr)
6342 +SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
6343 + unsigned long, new_len, unsigned long, flags,
6344 + unsigned long, new_addr)
6345 {
6346 unsigned long ret;
6347
6348 diff --git a/mm/msync.c b/mm/msync.c
6349 index 144a757..9e06d2e 100644
6350 --- a/mm/msync.c
6351 +++ b/mm/msync.c
6352 @@ -28,7 +28,7 @@
6353 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to
6354 * applications.
6355 */
6356 -asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
6357 +SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
6358 {
6359 unsigned long end;
6360 struct mm_struct *mm = current->mm;
6361 diff --git a/mm/nommu.c b/mm/nommu.c
6362 index ed75bc9..4bf7686 100644
6363 --- a/mm/nommu.c
6364 +++ b/mm/nommu.c
6365 @@ -355,7 +355,7 @@ EXPORT_SYMBOL(vm_insert_page);
6366 * to a regular file. in this case, the unmapping will need
6367 * to invoke file system routines that need the global lock.
6368 */
6369 -asmlinkage unsigned long sys_brk(unsigned long brk)
6370 +SYSCALL_DEFINE1(brk, unsigned long, brk)
6371 {
6372 struct mm_struct *mm = current->mm;
6373
6374 @@ -1170,7 +1170,7 @@ int do_munmap(struct mm_struct *mm, unsigned long addr, size_t len)
6375 }
6376 EXPORT_SYMBOL(do_munmap);
6377
6378 -asmlinkage long sys_munmap(unsigned long addr, size_t len)
6379 +SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
6380 {
6381 int ret;
6382 struct mm_struct *mm = current->mm;
6383 @@ -1261,9 +1261,9 @@ unsigned long do_mremap(unsigned long addr,
6384 }
6385 EXPORT_SYMBOL(do_mremap);
6386
6387 -asmlinkage unsigned long sys_mremap(unsigned long addr,
6388 - unsigned long old_len, unsigned long new_len,
6389 - unsigned long flags, unsigned long new_addr)
6390 +SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
6391 + unsigned long, new_len, unsigned long, flags,
6392 + unsigned long, new_addr)
6393 {
6394 unsigned long ret;
6395
6396 diff --git a/mm/swapfile.c b/mm/swapfile.c
6397 index 1e330f2..572cc78 100644
6398 --- a/mm/swapfile.c
6399 +++ b/mm/swapfile.c
6400 @@ -1204,7 +1204,7 @@ int page_queue_congested(struct page *page)
6401 }
6402 #endif
6403
6404 -asmlinkage long sys_swapoff(const char __user * specialfile)
6405 +SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
6406 {
6407 struct swap_info_struct * p = NULL;
6408 unsigned short *swap_map;
6409 @@ -1448,7 +1448,7 @@ __initcall(procswaps_init);
6410 *
6411 * The swapon system call
6412 */
6413 -asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
6414 +SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6415 {
6416 struct swap_info_struct * p;
6417 char *name = NULL;
6418 diff --git a/net/socket.c b/net/socket.c
6419 index 3e8d4e3..3e2859c 100644
6420 --- a/net/socket.c
6421 +++ b/net/socket.c
6422 @@ -1216,7 +1216,7 @@ int sock_create_kern(int family, int type, int protocol, struct socket **res)
6423 return __sock_create(&init_net, family, type, protocol, res, 1);
6424 }
6425
6426 -asmlinkage long sys_socket(int family, int type, int protocol)
6427 +SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
6428 {
6429 int retval;
6430 struct socket *sock;
6431 @@ -1257,8 +1257,8 @@ out_release:
6432 * Create a pair of connected sockets.
6433 */
6434
6435 -asmlinkage long sys_socketpair(int family, int type, int protocol,
6436 - int __user *usockvec)
6437 +SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
6438 + int __user *, usockvec)
6439 {
6440 struct socket *sock1, *sock2;
6441 int fd1, fd2, err;
6442 @@ -1365,7 +1365,7 @@ out_fd:
6443 * the protocol layer (having also checked the address is ok).
6444 */
6445
6446 -asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
6447 +SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
6448 {
6449 struct socket *sock;
6450 struct sockaddr_storage address;
6451 @@ -1394,7 +1394,7 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
6452 * ready for listening.
6453 */
6454
6455 -asmlinkage long sys_listen(int fd, int backlog)
6456 +SYSCALL_DEFINE2(listen, int, fd, int, backlog)
6457 {
6458 struct socket *sock;
6459 int err, fput_needed;
6460 @@ -1567,8 +1567,8 @@ asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
6461 #endif
6462 #endif
6463
6464 -asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
6465 - int __user *upeer_addrlen)
6466 +SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
6467 + int __user *, upeer_addrlen)
6468 {
6469 return do_accept(fd, upeer_sockaddr, upeer_addrlen, 0);
6470 }
6471 @@ -1585,8 +1585,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
6472 * include the -EINPROGRESS status for such sockets.
6473 */
6474
6475 -asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr,
6476 - int addrlen)
6477 +SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr,
6478 + int, addrlen)
6479 {
6480 struct socket *sock;
6481 struct sockaddr_storage address;
6482 @@ -1617,8 +1617,8 @@ out:
6483 * name to user space.
6484 */
6485
6486 -asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr,
6487 - int __user *usockaddr_len)
6488 +SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr,
6489 + int __user *, usockaddr_len)
6490 {
6491 struct socket *sock;
6492 struct sockaddr_storage address;
6493 @@ -1648,8 +1648,8 @@ out:
6494 * name to user space.
6495 */
6496
6497 -asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr,
6498 - int __user *usockaddr_len)
6499 +SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
6500 + int __user *, usockaddr_len)
6501 {
6502 struct socket *sock;
6503 struct sockaddr_storage address;
6504 @@ -1680,9 +1680,9 @@ asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr,
6505 * the protocol.
6506 */
6507
6508 -asmlinkage long sys_sendto(int fd, void __user *buff, size_t len,
6509 - unsigned flags, struct sockaddr __user *addr,
6510 - int addr_len)
6511 +SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
6512 + unsigned, flags, struct sockaddr __user *, addr,
6513 + int, addr_len)
6514 {
6515 struct socket *sock;
6516 struct sockaddr_storage address;
6517 @@ -1725,7 +1725,8 @@ out:
6518 * Send a datagram down a socket.
6519 */
6520
6521 -asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags)
6522 +SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
6523 + unsigned, flags)
6524 {
6525 return sys_sendto(fd, buff, len, flags, NULL, 0);
6526 }
6527 @@ -1736,9 +1737,9 @@ asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags)
6528 * sender address from kernel to user space.
6529 */
6530
6531 -asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size,
6532 - unsigned flags, struct sockaddr __user *addr,
6533 - int __user *addr_len)
6534 +SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
6535 + unsigned, flags, struct sockaddr __user *, addr,
6536 + int __user *, addr_len)
6537 {
6538 struct socket *sock;
6539 struct iovec iov;
6540 @@ -1790,8 +1791,8 @@ asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size,
6541 * to pass the user mode parameter for the protocols to sort out.
6542 */
6543
6544 -asmlinkage long sys_setsockopt(int fd, int level, int optname,
6545 - char __user *optval, int optlen)
6546 +SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
6547 + char __user *, optval, int, optlen)
6548 {
6549 int err, fput_needed;
6550 struct socket *sock;
6551 @@ -1824,8 +1825,8 @@ out_put:
6552 * to pass a user mode parameter for the protocols to sort out.
6553 */
6554
6555 -asmlinkage long sys_getsockopt(int fd, int level, int optname,
6556 - char __user *optval, int __user *optlen)
6557 +SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
6558 + char __user *, optval, int __user *, optlen)
6559 {
6560 int err, fput_needed;
6561 struct socket *sock;
6562 @@ -1854,7 +1855,7 @@ out_put:
6563 * Shutdown a socket.
6564 */
6565
6566 -asmlinkage long sys_shutdown(int fd, int how)
6567 +SYSCALL_DEFINE2(shutdown, int, fd, int, how)
6568 {
6569 int err, fput_needed;
6570 struct socket *sock;
6571 @@ -1880,7 +1881,7 @@ asmlinkage long sys_shutdown(int fd, int how)
6572 * BSD sendmsg interface
6573 */
6574
6575 -asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
6576 +SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags)
6577 {
6578 struct compat_msghdr __user *msg_compat =
6579 (struct compat_msghdr __user *)msg;
6580 @@ -1986,8 +1987,8 @@ out:
6581 * BSD recvmsg interface
6582 */
6583
6584 -asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg,
6585 - unsigned int flags)
6586 +SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg,
6587 + unsigned int, flags)
6588 {
6589 struct compat_msghdr __user *msg_compat =
6590 (struct compat_msghdr __user *)msg;
6591 @@ -2110,7 +2111,7 @@ static const unsigned char nargs[19]={
6592 * it is set by the callees.
6593 */
6594
6595 -asmlinkage long sys_socketcall(int call, unsigned long __user *args)
6596 +SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
6597 {
6598 unsigned long a[6];
6599 unsigned long a0, a1;
6600 diff --git a/security/device_cgroup.c b/security/device_cgroup.c
6601 index 46f2397..9ef066d 100644
6602 --- a/security/device_cgroup.c
6603 +++ b/security/device_cgroup.c
6604 @@ -543,6 +543,9 @@ int devcgroup_inode_mknod(int mode, dev_t dev)
6605 struct dev_cgroup *dev_cgroup;
6606 struct dev_whitelist_item *wh;
6607
6608 + if (!S_ISBLK(mode) && !S_ISCHR(mode))
6609 + return 0;
6610 +
6611 rcu_read_lock();
6612
6613 dev_cgroup = task_devcgroup(current);
6614 diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
6615 index acc9c89..9b4e0e9 100644
6616 --- a/security/keys/keyctl.c
6617 +++ b/security/keys/keyctl.c
6618 @@ -54,11 +54,11 @@ static int key_get_type_from_user(char *type,
6619 * - returns the new key's serial number
6620 * - implements add_key()
6621 */
6622 -asmlinkage long sys_add_key(const char __user *_type,
6623 - const char __user *_description,
6624 - const void __user *_payload,
6625 - size_t plen,
6626 - key_serial_t ringid)
6627 +SYSCALL_DEFINE5(add_key, const char __user *, _type,
6628 + const char __user *, _description,
6629 + const void __user *, _payload,
6630 + size_t, plen,
6631 + key_serial_t, ringid)
6632 {
6633 key_ref_t keyring_ref, key_ref;
6634 char type[32], *description;
6635 @@ -146,10 +146,10 @@ asmlinkage long sys_add_key(const char __user *_type,
6636 * - if the _callout_info string is empty, it will be rendered as "-"
6637 * - implements request_key()
6638 */
6639 -asmlinkage long sys_request_key(const char __user *_type,
6640 - const char __user *_description,
6641 - const char __user *_callout_info,
6642 - key_serial_t destringid)
6643 +SYSCALL_DEFINE4(request_key, const char __user *, _type,
6644 + const char __user *, _description,
6645 + const char __user *, _callout_info,
6646 + key_serial_t, destringid)
6647 {
6648 struct key_type *ktype;
6649 struct key *key;
6650 @@ -1152,8 +1152,8 @@ long keyctl_get_security(key_serial_t keyid,
6651 /*
6652 * the key control system call
6653 */
6654 -asmlinkage long sys_keyctl(int option, unsigned long arg2, unsigned long arg3,
6655 - unsigned long arg4, unsigned long arg5)
6656 +SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
6657 + unsigned long, arg4, unsigned long, arg5)
6658 {
6659 switch (option) {
6660 case KEYCTL_GET_KEYRING_ID:
6661 diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
6662 index cb13307..591f62f 100644
6663 --- a/sound/pci/hda/patch_analog.c
6664 +++ b/sound/pci/hda/patch_analog.c
6665 @@ -3848,6 +3848,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = {
6666 static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
6667 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
6668 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE),
6669 + SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP),
6670 SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP),
6671 SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP),
6672 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD),
6673 diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h
6674 index f9fbdba..ab56e73 100644
6675 --- a/sound/usb/caiaq/caiaq-device.h
6676 +++ b/sound/usb/caiaq/caiaq-device.h
6677 @@ -75,6 +75,7 @@ struct snd_usb_caiaqdev {
6678 wait_queue_head_t ep1_wait_queue;
6679 wait_queue_head_t prepare_wait_queue;
6680 int spec_received, audio_parm_answer;
6681 + int midi_out_active;
6682
6683 char vendor_name[CAIAQ_USB_STR_LEN];
6684 char product_name[CAIAQ_USB_STR_LEN];
6685 diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c
6686 index 30b57f9..f19fd36 100644
6687 --- a/sound/usb/caiaq/caiaq-midi.c
6688 +++ b/sound/usb/caiaq/caiaq-midi.c
6689 @@ -59,6 +59,11 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea
6690
6691 static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream)
6692 {
6693 + struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
6694 + if (dev->midi_out_active) {
6695 + usb_kill_urb(&dev->midi_out_urb);
6696 + dev->midi_out_active = 0;
6697 + }
6698 return 0;
6699 }
6700
6701 @@ -69,7 +74,8 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev,
6702
6703 dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE;
6704 dev->midi_out_buf[1] = 0; /* port */
6705 - len = snd_rawmidi_transmit_peek(substream, dev->midi_out_buf+3, EP1_BUFSIZE-3);
6706 + len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3,
6707 + EP1_BUFSIZE - 3);
6708
6709 if (len <= 0)
6710 return;
6711 @@ -79,24 +85,24 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev,
6712
6713 ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC);
6714 if (ret < 0)
6715 - log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed, %d\n",
6716 - substream, ret);
6717 + log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,"
6718 + "ret=%d, len=%d\n",
6719 + substream, ret, len);
6720 + else
6721 + dev->midi_out_active = 1;
6722 }
6723
6724 static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
6725 {
6726 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
6727
6728 - if (dev->midi_out_substream != NULL)
6729 - return;
6730 -
6731 - if (!up) {
6732 + if (up) {
6733 + dev->midi_out_substream = substream;
6734 + if (!dev->midi_out_active)
6735 + snd_usb_caiaq_midi_send(dev, substream);
6736 + } else {
6737 dev->midi_out_substream = NULL;
6738 - return;
6739 }
6740 -
6741 - dev->midi_out_substream = substream;
6742 - snd_usb_caiaq_midi_send(dev, substream);
6743 }
6744
6745
6746 @@ -161,16 +167,14 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
6747 void snd_usb_caiaq_midi_output_done(struct urb* urb)
6748 {
6749 struct snd_usb_caiaqdev *dev = urb->context;
6750 - char *buf = urb->transfer_buffer;
6751
6752 + dev->midi_out_active = 0;
6753 if (urb->status != 0)
6754 return;
6755
6756 if (!dev->midi_out_substream)
6757 return;
6758
6759 - snd_rawmidi_transmit_ack(dev->midi_out_substream, buf[2]);
6760 - dev->midi_out_substream = NULL;
6761 snd_usb_caiaq_midi_send(dev, dev->midi_out_substream);
6762 }
6763