Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.27-r3/0111-2.6.27.12-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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