From 6ad66037fafeaf2d20c4bee5143d894410b84667 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Thu, 19 Feb 2009 13:50:11 +0000 Subject: [PATCH] update to 2.6.29-rc5 - all stable patches dropped - tg3 finaly uses firmware_request(), corresponding patches dropped. - nuke acenic, tg3, e100, cassini, starfire, cxgb3 firmware on orig tarball generation. - no longer disable acenic. - update firmware-cleanup.patch to all those new ones. - trivial update scripts-kconfig-reportoldconfig.patch - disable some arm feature patches that no longer apply svn path=/dists/trunk/linux-2.6/; revision=12854 --- debian/changelog | 12 + .../patches/bugfix/all/stable/patch-2.6.28.1 | 6746 ----------------- .../patches/bugfix/all/stable/patch-2.6.28.2 | 1998 ----- .../patches/bugfix/all/stable/patch-2.6.28.3 | 1651 ---- .../patches/bugfix/all/stable/patch-2.6.28.4 | 1361 ---- .../patches/bugfix/all/stable/patch-2.6.28.5 | 1688 ----- .../patches/bugfix/all/stable/patch-2.6.28.6 | 1585 ---- .../dfsg/drivers-net-acenic-remove.patch | 12 - .../dfsg/drivers-net-tg3-fix-simple.patch | 283 - .../debian/dfsg/drivers-net-tg3-mark.patch | 30 - .../debian/dfsg/drivers-net-tg3-remove.patch | 27 - debian/patches/debian/dfsg/files-1 | 10 +- .../debian/dfsg/firmware-cleanup.patch | 23 +- .../scripts-kconfig-reportoldconfig.patch | 12 +- debian/patches/series/{1 => 1~experimental.1} | 13 +- .../{1-extra => 1~experimental.1-extra} | 0 debian/patches/series/orig-0 | 3 - 17 files changed, 48 insertions(+), 15406 deletions(-) delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.1 delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.2 delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.3 delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.4 delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.5 delete mode 100644 debian/patches/bugfix/all/stable/patch-2.6.28.6 delete mode 100644 debian/patches/debian/dfsg/drivers-net-acenic-remove.patch delete mode 100644 debian/patches/debian/dfsg/drivers-net-tg3-fix-simple.patch delete mode 100644 debian/patches/debian/dfsg/drivers-net-tg3-mark.patch delete mode 100644 debian/patches/debian/dfsg/drivers-net-tg3-remove.patch rename debian/patches/series/{1 => 1~experimental.1} (70%) rename debian/patches/series/{1-extra => 1~experimental.1-extra} (100%) diff --git a/debian/changelog b/debian/changelog index 96113d5c4..68afd23fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +linux-2.6 (2.6.29~rc5-1~experimental.1) UNRELEASED; urgency=low + + * New upstream release + - tg3 use request_firmware and firmware nuked + - acenic use request_firmware and firmware nuked + - e100 use request_firmware and firmware nuked + - cassini use request_firmware and firmware nuked + - starfire use request_firmware and firmware nuked + - cxgb3 use request_firmware and firmware nuked + + -- maximilian attems Thu, 19 Feb 2009 13:25:20 +0100 + linux-2.6 (2.6.28-2) UNRELEASED; urgency=low [ Martin Michlmayr ] diff --git a/debian/patches/bugfix/all/stable/patch-2.6.28.1 b/debian/patches/bugfix/all/stable/patch-2.6.28.1 deleted file mode 100644 index ff486c157..000000000 --- a/debian/patches/bugfix/all/stable/patch-2.6.28.1 +++ /dev/null @@ -1,6746 +0,0 @@ -diff --git a/arch/Kconfig b/arch/Kconfig -index 471e72d..a05bc22 100644 ---- a/arch/Kconfig -+++ b/arch/Kconfig -@@ -60,6 +60,9 @@ config HAVE_EFFICIENT_UNALIGNED_ACCESS - See Documentation/unaligned-memory-access.txt for more - information on the topic of unaligned memory accesses. - -+config HAVE_SYSCALL_WRAPPERS -+ bool -+ - config KRETPROBES - def_bool y - depends on KPROBES && HAVE_KRETPROBES -diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S -index 5fc61e2..36a93f8 100644 ---- a/arch/alpha/kernel/entry.S -+++ b/arch/alpha/kernel/entry.S -@@ -894,9 +894,9 @@ sys_getxpid: - .end sys_getxpid - - .align 4 -- .globl sys_pipe -- .ent sys_pipe --sys_pipe: -+ .globl sys_alpha_pipe -+ .ent sys_alpha_pipe -+sys_alpha_pipe: - lda $sp, -16($sp) - stq $26, 0($sp) - .prologue 0 -@@ -914,7 +914,7 @@ sys_pipe: - stq $1, 80+16($sp) - 1: lda $sp, 16($sp) - ret --.end sys_pipe -+.end sys_alpha_pipe - - .align 4 - .globl sys_execve -diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S -index ba914af..9d9e3a9 100644 ---- a/arch/alpha/kernel/systbls.S -+++ b/arch/alpha/kernel/systbls.S -@@ -52,7 +52,7 @@ sys_call_table: - .quad sys_setpgid - .quad alpha_ni_syscall /* 40 */ - .quad sys_dup -- .quad sys_pipe -+ .quad sys_alpha_pipe - .quad osf_set_program_attributes - .quad alpha_ni_syscall - .quad sys_open /* 45 */ -diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S -index 09a061c..9ca8d13 100644 ---- a/arch/arm/kernel/calls.S -+++ b/arch/arm/kernel/calls.S -@@ -98,7 +98,7 @@ - CALL(sys_uselib) - CALL(sys_swapon) - CALL(sys_reboot) -- CALL(OBSOLETE(old_readdir)) /* used by libc4 */ -+ CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */ - /* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */ - CALL(sys_munmap) - CALL(sys_truncate) -diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S -index ed171d3..72f5cd3 100644 ---- a/arch/cris/arch-v10/kernel/entry.S -+++ b/arch/cris/arch-v10/kernel/entry.S -@@ -691,7 +691,7 @@ sys_call_table: - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S -index 7f6f93e..5e674c8 100644 ---- a/arch/cris/arch-v32/kernel/entry.S -+++ b/arch/cris/arch-v32/kernel/entry.S -@@ -614,7 +614,7 @@ sys_call_table: - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S -index 54e21c3..4eb67fa 100644 ---- a/arch/h8300/kernel/syscalls.S -+++ b/arch/h8300/kernel/syscalls.S -@@ -103,7 +103,7 @@ SYMBOL_NAME_LABEL(sys_call_table) - .long SYMBOL_NAME(sys_uselib) - .long SYMBOL_NAME(sys_swapon) - .long SYMBOL_NAME(sys_reboot) -- .long SYMBOL_NAME(old_readdir) -+ .long SYMBOL_NAME(sys_old_readdir) - .long SYMBOL_NAME(old_mmap) /* 90 */ - .long SYMBOL_NAME(sys_munmap) - .long SYMBOL_NAME(sys_truncate) -diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S -index a8cf199..a46f839 100644 ---- a/arch/ia64/ia32/ia32_entry.S -+++ b/arch/ia64/ia32/ia32_entry.S -@@ -220,7 +220,7 @@ ia32_syscall_table: - data8 sys_mkdir - data8 sys_rmdir /* 40 */ - data8 sys_dup -- data8 sys_pipe -+ data8 sys_ia64_pipe - data8 compat_sys_times - data8 sys_ni_syscall /* old prof syscall holder */ - data8 sys32_brk /* 45 */ -diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h -index f791576..9015979 100644 ---- a/arch/ia64/include/asm/unistd.h -+++ b/arch/ia64/include/asm/unistd.h -@@ -364,7 +364,7 @@ struct pt_regs; - struct sigaction; - long sys_execve(char __user *filename, char __user * __user *argv, - char __user * __user *envp, struct pt_regs *regs); --asmlinkage long sys_pipe(void); -+asmlinkage long sys_ia64_pipe(void); - asmlinkage long sys_rt_sigaction(int sig, - const struct sigaction __user *act, - struct sigaction __user *oact, -diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S -index d435f4a..e5341e2 100644 ---- a/arch/ia64/kernel/entry.S -+++ b/arch/ia64/kernel/entry.S -@@ -1442,7 +1442,7 @@ sys_call_table: - data8 sys_mkdir // 1055 - data8 sys_rmdir - data8 sys_dup -- data8 sys_pipe -+ data8 sys_ia64_pipe - data8 sys_times - data8 ia64_brk // 1060 - data8 sys_setgid -diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c -index bcbb6d8..92ed83f 100644 ---- a/arch/ia64/kernel/sys_ia64.c -+++ b/arch/ia64/kernel/sys_ia64.c -@@ -154,7 +154,7 @@ out: - * and r9) as this is faster than doing a copy_to_user(). - */ - asmlinkage long --sys_pipe (void) -+sys_ia64_pipe (void) - { - struct pt_regs *regs = task_pt_regs(current); - int fd[2]; -diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S -index f28404d..25b2176 100644 ---- a/arch/m68k/kernel/entry.S -+++ b/arch/m68k/kernel/entry.S -@@ -513,7 +513,7 @@ sys_call_table: - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S -index 812f8d8..5c3e3f6 100644 ---- a/arch/m68knommu/kernel/syscalltable.S -+++ b/arch/m68knommu/kernel/syscalltable.S -@@ -107,7 +107,7 @@ ENTRY(sys_call_table) - .long sys_uselib - .long sys_ni_syscall /* sys_swapon */ - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S -index d0916a5..51d1ba4 100644 ---- a/arch/mips/kernel/scall32-o32.S -+++ b/arch/mips/kernel/scall32-o32.S -@@ -398,7 +398,7 @@ einval: li v0, -ENOSYS - sys sys_uselib 1 - sys sys_swapon 2 - sys sys_reboot 3 -- sys old_readdir 3 -+ sys sys_old_readdir 3 - sys old_mmap 6 /* 4090 */ - sys sys_munmap 2 - sys sys_truncate 2 -diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S -index 62fba8a..ceeaaaa 100644 ---- a/arch/mn10300/kernel/entry.S -+++ b/arch/mn10300/kernel/entry.S -@@ -478,7 +478,7 @@ ENTRY(sys_call_table) - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig -index 525c13a..de93c07 100644 ---- a/arch/powerpc/Kconfig -+++ b/arch/powerpc/Kconfig -@@ -121,6 +121,7 @@ config PPC - select HAVE_DMA_ATTRS if PPC64 - select USE_GENERIC_SMP_HELPERS if SMP - select HAVE_OPROFILE -+ select HAVE_SYSCALL_WRAPPERS if PPC64 - - config EARLY_PRINTK - bool -diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h -index 803def2..72353f6 100644 ---- a/arch/powerpc/include/asm/systbl.h -+++ b/arch/powerpc/include/asm/systbl.h -@@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink) - SYSCALL(uselib) - SYSCALL(swapon) - SYSCALL(reboot) --SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir) -+SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir) - SYSCALL_SPU(mmap) - SYSCALL_SPU(munmap) - SYSCALL_SPU(truncate) -diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig -index 97619fd..ddc2a30 100644 ---- a/arch/powerpc/platforms/pseries/Kconfig -+++ b/arch/powerpc/platforms/pseries/Kconfig -@@ -54,7 +54,7 @@ config PPC_SMLPAR - - config CMM - tristate "Collaborative memory management" -- depends on PPC_SMLPAR -+ depends on PPC_SMLPAR && !CRASH_DUMP - default y - help - Select this option, if you want to enable the kernel interface -diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig -index 8116a33..e3d58e1 100644 ---- a/arch/s390/Kconfig -+++ b/arch/s390/Kconfig -@@ -70,6 +70,7 @@ mainmenu "Linux Kernel Configuration" - - config S390 - def_bool y -+ select HAVE_SYSCALL_WRAPPERS - select HAVE_OPROFILE - select HAVE_KPROBES - select HAVE_KRETPROBES -diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S -index fc2c971..6035cd2 100644 ---- a/arch/s390/kernel/compat_wrapper.S -+++ b/arch/s390/kernel/compat_wrapper.S -@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper: - .globl sys32_newuname_wrapper - sys32_newuname_wrapper: - llgtr %r2,%r2 # struct new_utsname * -- jg s390x_newuname # branch to system call -+ jg sys_s390_newuname # branch to system call - - .globl compat_sys_adjtimex_wrapper - compat_sys_adjtimex_wrapper: -@@ -615,7 +615,7 @@ sys32_sysfs_wrapper: - .globl sys32_personality_wrapper - sys32_personality_wrapper: - llgfr %r2,%r2 # unsigned long -- jg s390x_personality # branch to system call -+ jg sys_s390_personality # branch to system call - - .globl sys32_setfsuid16_wrapper - sys32_setfsuid16_wrapper: -diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h -index 6b18963..df0a813 100644 ---- a/arch/s390/kernel/entry.h -+++ b/arch/s390/kernel/entry.h -@@ -30,23 +30,23 @@ struct fadvise64_64_args; - struct old_sigaction; - struct sel_arg_struct; - --long sys_pipe(unsigned long __user *fildes); - long sys_mmap2(struct mmap_arg_struct __user *arg); --long old_mmap(struct mmap_arg_struct __user *arg); -+long sys_s390_old_mmap(struct mmap_arg_struct __user *arg); - long sys_ipc(uint call, int first, unsigned long second, - unsigned long third, void __user *ptr); --long s390x_newuname(struct new_utsname __user *name); --long s390x_personality(unsigned long personality); --long s390_fadvise64(int fd, u32 offset_high, u32 offset_low, -+long sys_s390_newuname(struct new_utsname __user *name); -+long sys_s390_personality(unsigned long personality); -+long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low, - size_t len, int advice); --long s390_fadvise64_64(struct fadvise64_64_args __user *args); --long s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, u32 len_low); -+long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args); -+long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, -+ u32 len_low); - long sys_fork(void); - long sys_clone(void); - long sys_vfork(void); - void execve_tail(void); - long sys_execve(void); --int sys_sigsuspend(int history0, int history1, old_sigset_t mask); -+long sys_sigsuspend(int history0, int history1, old_sigset_t mask); - long sys_sigaction(int sig, const struct old_sigaction __user *act, - struct old_sigaction __user *oact); - long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss); -diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c -index 04f8c67..7ccd974 100644 ---- a/arch/s390/kernel/process.c -+++ b/arch/s390/kernel/process.c -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -260,13 +261,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, - return 0; - } - --asmlinkage long sys_fork(void) -+SYSCALL_DEFINE0(fork) - { - struct pt_regs *regs = task_pt_regs(current); - return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL); - } - --asmlinkage long sys_clone(void) -+SYSCALL_DEFINE0(clone) - { - struct pt_regs *regs = task_pt_regs(current); - unsigned long clone_flags; -@@ -293,7 +294,7 @@ asmlinkage long sys_clone(void) - * do not have enough call-clobbered registers to hold all - * the information you need. - */ --asmlinkage long sys_vfork(void) -+SYSCALL_DEFINE0(vfork) - { - struct pt_regs *regs = task_pt_regs(current); - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, -@@ -313,7 +314,7 @@ asmlinkage void execve_tail(void) - /* - * sys_execve() executes a new program. - */ --asmlinkage long sys_execve(void) -+SYSCALL_DEFINE0(execve) - { - struct pt_regs *regs = task_pt_regs(current); - char *filename; -diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c -index 8e6812a..3cf74c3 100644 ---- a/arch/s390/kernel/signal.c -+++ b/arch/s390/kernel/signal.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -53,8 +54,7 @@ typedef struct - /* - * Atomically swap in the new signal mask, and wait for a signal. - */ --asmlinkage int --sys_sigsuspend(int history0, int history1, old_sigset_t mask) -+SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) - { - mask &= _BLOCKABLE; - spin_lock_irq(¤t->sighand->siglock); -@@ -70,9 +70,8 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask) - return -ERESTARTNOHAND; - } - --asmlinkage long --sys_sigaction(int sig, const struct old_sigaction __user *act, -- struct old_sigaction __user *oact) -+SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act, -+ struct old_sigaction __user *, oact) - { - struct k_sigaction new_ka, old_ka; - int ret; -@@ -102,15 +101,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, - return ret; - } - --asmlinkage long --sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) -+SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss, -+ stack_t __user *, uoss) - { - struct pt_regs *regs = task_pt_regs(current); - return do_sigaltstack(uss, uoss, regs->gprs[15]); - } - -- -- - /* Returns non-zero on fault. */ - static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) - { -@@ -164,7 +161,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) - return 0; - } - --asmlinkage long sys_sigreturn(void) -+SYSCALL_DEFINE0(sigreturn) - { - struct pt_regs *regs = task_pt_regs(current); - sigframe __user *frame = (sigframe __user *)regs->gprs[15]; -@@ -191,7 +188,7 @@ badframe: - return 0; - } - --asmlinkage long sys_rt_sigreturn(void) -+SYSCALL_DEFINE0(rt_sigreturn) - { - struct pt_regs *regs = task_pt_regs(current); - rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; -diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c -index 4fe952e..286d717 100644 ---- a/arch/s390/kernel/sys_s390.c -+++ b/arch/s390/kernel/sys_s390.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include "entry.h" - -@@ -74,7 +75,7 @@ struct mmap_arg_struct { - unsigned long offset; - }; - --asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg) -+SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg) - { - struct mmap_arg_struct a; - int error = -EFAULT; -@@ -86,7 +87,7 @@ out: - return error; - } - --asmlinkage long old_mmap(struct mmap_arg_struct __user *arg) -+SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg) - { - struct mmap_arg_struct a; - long error = -EFAULT; -@@ -127,8 +128,8 @@ asmlinkage long old_select(struct sel_arg_struct __user *arg) - * - * This is really horribly ugly. - */ --asmlinkage long sys_ipc(uint call, int first, unsigned long second, -- unsigned long third, void __user *ptr) -+SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second, -+ unsigned long, third, void __user *, ptr) - { - struct ipc_kludge tmp; - int ret; -@@ -194,7 +195,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second, - } - - #ifdef CONFIG_64BIT --asmlinkage long s390x_newuname(struct new_utsname __user *name) -+SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name) - { - int ret = sys_newuname(name); - -@@ -205,7 +206,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name) - return ret; - } - --asmlinkage long s390x_personality(unsigned long personality) -+SYSCALL_DEFINE1(s390_personality, unsigned long, personality) - { - int ret; - -@@ -224,15 +225,13 @@ asmlinkage long s390x_personality(unsigned long personality) - */ - #ifndef CONFIG_64BIT - --asmlinkage long --s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice) -+SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low, -+ size_t, len, int, advice) - { - return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low, - len, advice); - } - --#endif -- - struct fadvise64_64_args { - int fd; - long long offset; -@@ -240,8 +239,7 @@ struct fadvise64_64_args { - int advice; - }; - --asmlinkage long --s390_fadvise64_64(struct fadvise64_64_args __user *args) -+SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args) - { - struct fadvise64_64_args a; - -@@ -250,7 +248,6 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args) - return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); - } - --#ifndef CONFIG_64BIT - /* - * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last - * 64 bit argument "len" is split into the upper and lower 32 bits. The -@@ -263,9 +260,19 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args) - * to - * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len - */ --asmlinkage long s390_fallocate(int fd, int mode, loff_t offset, -+SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset, - u32 len_high, u32 len_low) - { - return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset, -+ long len_high, long len_low) -+{ -+ return SYSC_s390_fallocate((int) fd, (int) mode, offset, -+ (u32) len_high, (u32) len_low); -+} -+SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate); -+#endif -+ - #endif -diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S -index 2d61787..76d16e0 100644 ---- a/arch/s390/kernel/syscalls.S -+++ b/arch/s390/kernel/syscalls.S -@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper) - SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) - SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) - SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ --SYSCALL(old_mmap,old_mmap,old32_mmap_wrapper) /* 90 */ -+SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */ - SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) - SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) - SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) -@@ -130,7 +130,7 @@ SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) - SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) - SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */ - SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) --SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) -+SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper) - NI_SYSCALL /* modify_ldt for i386 */ - SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) - SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ -@@ -144,7 +144,7 @@ SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper) - SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper) - SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper) - SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */ --SYSCALL(sys_personality,s390x_personality,sys32_personality_wrapper) -+SYSCALL(sys_personality,sys_s390_personality,sys32_personality_wrapper) - NI_SYSCALL /* for afs_syscall */ - SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */ - SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */ -@@ -261,7 +261,7 @@ SYSCALL(sys_epoll_create,sys_epoll_create,sys_epoll_create_wrapper) - SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */ - SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper) - SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper) --SYSCALL(s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper) -+SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper) - SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper) - SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */ - SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper) -@@ -272,7 +272,7 @@ SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 - SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) - SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) - NI_SYSCALL /* reserved for vserver */ --SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) -+SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) - SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) - SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) - SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper) -@@ -322,7 +322,7 @@ NI_SYSCALL /* 310 sys_move_pages */ - SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) - SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) - SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) --SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) -+SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper) - SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ - SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) - NI_SYSCALL /* 317 old sys_timer_fd */ -diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h -index 104c5e6..8b30200 100644 ---- a/arch/sh/include/asm/syscalls_32.h -+++ b/arch/sh/include/asm/syscalls_32.h -@@ -36,9 +36,9 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, - asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7, - struct pt_regs __regs); --asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, -- unsigned long r6, unsigned long r7, -- struct pt_regs __regs); -+asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7, -+ struct pt_regs __regs); - asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf, - size_t count, long dummy, loff_t pos); - asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, -diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c -index dbba1e1..63ba128 100644 ---- a/arch/sh/kernel/sys_sh32.c -+++ b/arch/sh/kernel/sys_sh32.c -@@ -22,7 +22,7 @@ - * sys_pipe() is the normal C calling standard for creating - * a pipe. It's not the way Unix traditionally does this, though. - */ --asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, -+asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7, - struct pt_regs __regs) - { -diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S -index 0af693e..e67c173 100644 ---- a/arch/sh/kernel/syscalls_32.S -+++ b/arch/sh/kernel/syscalls_32.S -@@ -58,7 +58,7 @@ ENTRY(sys_call_table) - .long sys_mkdir - .long sys_rmdir /* 40 */ - .long sys_dup -- .long sys_pipe -+ .long sys_sh_pipe - .long sys_times - .long sys_ni_syscall /* old prof syscall holder */ - .long sys_brk /* 45 */ -@@ -105,7 +105,7 @@ ENTRY(sys_call_table) - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S -index 0b436aa..557cb91 100644 ---- a/arch/sh/kernel/syscalls_64.S -+++ b/arch/sh/kernel/syscalls_64.S -@@ -109,7 +109,7 @@ sys_call_table: - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S -index faf9ccd..f41ecc5 100644 ---- a/arch/sparc/kernel/entry.S -+++ b/arch/sparc/kernel/entry.S -@@ -1088,8 +1088,8 @@ sunos_execv: - ld [%sp + STACKFRAME_SZ + PT_I0], %o0 - - .align 4 -- .globl sys_pipe --sys_pipe: -+ .globl sys_sparc_pipe -+sys_sparc_pipe: - mov %o7, %l5 - add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg - call sparc_pipe -diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S -index 7d08075..dccc95d 100644 ---- a/arch/sparc/kernel/systbls.S -+++ b/arch/sparc/kernel/systbls.S -@@ -24,7 +24,7 @@ sys_call_table: - /*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause - /*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice - /*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile --/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid -+/*40*/ .long sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_getuid - /*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 - /*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl - /*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve -@@ -56,7 +56,7 @@ sys_call_table: - /*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname - /*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl - /*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask --/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir -+/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir - /*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 - /*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo - /*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex -diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc64/kernel/syscalls.S -index 7a6786a..87f5a3b 100644 ---- a/arch/sparc64/kernel/syscalls.S -+++ b/arch/sparc64/kernel/syscalls.S -@@ -20,7 +20,7 @@ execve_merge: - add %sp, PTREGS_OFF, %o0 - - .align 32 --sys_pipe: -+sys_sparc_pipe: - ba,pt %xcc, sparc_pipe - add %sp, PTREGS_OFF, %o0 - sys_nis_syscall: -diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S -index 9fc78cf..e6007bb 100644 ---- a/arch/sparc64/kernel/systbls.S -+++ b/arch/sparc64/kernel/systbls.S -@@ -26,7 +26,7 @@ sys_call_table32: - /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause - /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice - .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile --/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid -+/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid - .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16 - /*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl - .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve -@@ -100,7 +100,7 @@ sys_call_table: - /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall - /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice - .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64 --/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall -+/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall - .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid - /*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl - .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index ac22bb7..2187c60 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -569,7 +569,7 @@ config AMD_IOMMU - - # need this always selected by IOMMU for the VIA workaround - config SWIOTLB -- bool -+ def_bool y if X86_64 - help - Support for software bounce buffers used on x86-64 systems - which don't have a hardware IOMMU (e.g. the current generation -diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c -index ef8f831..2cf2363 100644 ---- a/arch/x86/kernel/cpu/addon_cpuid_features.c -+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c -@@ -120,9 +120,17 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) - c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) - & core_select_mask; - c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); -+ /* -+ * Reinit the apicid, now that we have extended initial_apicid. -+ */ -+ c->apicid = phys_pkg_id(c->initial_apicid, 0); - #else - c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask; - c->phys_proc_id = phys_pkg_id(core_plus_mask_width); -+ /* -+ * Reinit the apicid, now that we have extended initial_apicid. -+ */ -+ c->apicid = phys_pkg_id(0); - #endif - c->x86_max_cores = (core_level_siblings / smp_num_siblings); - -diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c -index cce0b61..57e3fba 100644 ---- a/arch/x86/kernel/cpu/intel.c -+++ b/arch/x86/kernel/cpu/intel.c -@@ -242,6 +242,13 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) - - intel_workarounds(c); - -+ /* -+ * Detect the extended topology information if available. This -+ * will reinitialise the initial_apicid which will be used -+ * in init_intel_cacheinfo() -+ */ -+ detect_extended_topology(c); -+ - l2 = init_intel_cacheinfo(c); - if (c->cpuid_level > 9) { - unsigned eax = cpuid_eax(10); -@@ -313,7 +320,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) - - #endif - -- detect_extended_topology(c); - if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { - /* - * let's use the legacy cpuid vector 0x1 and 0x4 for topology -diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c -index d16084f..9461dc3 100644 ---- a/arch/x86/kernel/head64.c -+++ b/arch/x86/kernel/head64.c -@@ -26,7 +26,7 @@ - #include - - /* boot cpu pda */ --static struct x8664_pda _boot_cpu_pda __read_mostly; -+static struct x8664_pda _boot_cpu_pda; - - #ifdef CONFIG_SMP - /* -diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S -index 26cfdc1..0e275d4 100644 ---- a/arch/x86/kernel/head_64.S -+++ b/arch/x86/kernel/head_64.S -@@ -305,7 +305,7 @@ ENTRY(early_idt_handler) - call dump_stack - #ifdef CONFIG_KALLSYMS - leaq early_idt_ripmsg(%rip),%rdi -- movq 8(%rsp),%rsi # get rip again -+ movq 0(%rsp),%rsi # get rip again - call __print_symbol - #endif - #endif /* EARLY_PRINTK */ -diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S -index d44395f..e2e86a0 100644 ---- a/arch/x86/kernel/syscall_table_32.S -+++ b/arch/x86/kernel/syscall_table_32.S -@@ -88,7 +88,7 @@ ENTRY(sys_call_table) - .long sys_uselib - .long sys_swapon - .long sys_reboot -- .long old_readdir -+ .long sys_old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate -diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c -index 04431f3..ef493a0 100644 ---- a/arch/x86/kernel/tlb_uv.c -+++ b/arch/x86/kernel/tlb_uv.c -@@ -586,7 +586,6 @@ static int __init uv_ptc_init(void) - static struct bau_control * __init uv_table_bases_init(int blade, int node) - { - int i; -- int *ip; - struct bau_msg_status *msp; - struct bau_control *bau_tabp; - -@@ -603,13 +602,6 @@ static struct bau_control * __init uv_table_bases_init(int blade, int node) - bau_cpubits_clear(&msp->seen_by, (int) - uv_blade_nr_possible_cpus(blade)); - -- bau_tabp->watching = -- kmalloc_node(sizeof(int) * DEST_NUM_RESOURCES, GFP_KERNEL, node); -- BUG_ON(!bau_tabp->watching); -- -- for (i = 0, ip = bau_tabp->watching; i < DEST_Q_SIZE; i++, ip++) -- *ip = 0; -- - uv_bau_table_bases[blade] = bau_tabp; - - return bau_tabp; -@@ -632,7 +624,6 @@ uv_table_bases_finish(int blade, int node, int cur_cpu, - bcp->bau_msg_head = bau_tablesp->va_queue_first; - bcp->va_queue_first = bau_tablesp->va_queue_first; - bcp->va_queue_last = bau_tablesp->va_queue_last; -- bcp->watching = bau_tablesp->watching; - bcp->msg_statuses = bau_tablesp->msg_statuses; - bcp->descriptor_base = adp; - } -diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c -index 31e8730..46f4cb1 100644 ---- a/arch/x86/mm/fault.c -+++ b/arch/x86/mm/fault.c -@@ -533,7 +533,7 @@ static int vmalloc_fault(unsigned long address) - happen within a race in page table update. In the later - case just flush. */ - -- pgd = pgd_offset(current->mm ?: &init_mm, address); -+ pgd = pgd_offset(current->active_mm, address); - pgd_ref = pgd_offset_k(address); - if (pgd_none(*pgd_ref)) - return -1; -diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c -index 6607fdd..f2ed033 100644 ---- a/drivers/dma/ioat_dma.c -+++ b/drivers/dma/ioat_dma.c -@@ -1341,12 +1341,11 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) - */ - #define IOAT_TEST_SIZE 2000 - --DECLARE_COMPLETION(test_completion); - static void ioat_dma_test_callback(void *dma_async_param) - { -- printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", -- dma_async_param); -- complete(&test_completion); -+ struct completion *cmp = dma_async_param; -+ -+ complete(cmp); - } - - /** -@@ -1363,6 +1362,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) - dma_addr_t dma_dest, dma_src; - dma_cookie_t cookie; - int err = 0; -+ struct completion cmp; - - src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); - if (!src) -@@ -1402,8 +1402,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device) - } - - async_tx_ack(tx); -+ init_completion(&cmp); - tx->callback = ioat_dma_test_callback; -- tx->callback_param = (void *)0x8086; -+ tx->callback_param = &cmp; - cookie = tx->tx_submit(tx); - if (cookie < 0) { - dev_err(&device->pdev->dev, -@@ -1413,7 +1414,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) - } - device->common.device_issue_pending(dma_chan); - -- wait_for_completion_timeout(&test_completion, msecs_to_jiffies(3000)); -+ wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); - - if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) - != DMA_SUCCESS) { -diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c -index 86e563b..dd5a397 100644 ---- a/drivers/hid/hid-sony.c -+++ b/drivers/hid/hid-sony.c -@@ -102,7 +102,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) - } - - ret = sony_set_operational(hdev); -- if (ret) -+ if (ret < 0) - goto err_stop; - - return 0; -diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c -index 9120063..13b63e7 100644 ---- a/drivers/ide/tx4938ide.c -+++ b/drivers/ide/tx4938ide.c -@@ -181,7 +181,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, - - while (count--) - *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); -- __ide_flush_dcache_range((unsigned long)buf, count * 2); -+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); - } - - static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, -@@ -195,7 +195,7 @@ static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, - __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); - ptr++; - } -- __ide_flush_dcache_range((unsigned long)buf, count * 2); -+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); - } - - static const struct ide_tp_ops tx4938ide_tp_ops = { -diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c -index bafb7d1..97cd9e0 100644 ---- a/drivers/ide/tx4939ide.c -+++ b/drivers/ide/tx4939ide.c -@@ -259,6 +259,12 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) - bcount = 0x10000 - (cur_addr & 0xffff); - if (bcount > cur_len) - bcount = cur_len; -+ /* -+ * This workaround for zero count seems required. -+ * (standard ide_build_dmatable do it too) -+ */ -+ if ((bcount & 0xffff) == 0x0000) -+ bcount = 0x8000; - *table++ = bcount & 0xffff; - *table++ = cur_addr; - cur_addr += bcount; -@@ -558,7 +564,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, - - while (count--) - *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); -- __ide_flush_dcache_range((unsigned long)buf, count * 2); -+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); - } - - static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, -@@ -572,7 +578,7 @@ static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, - __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); - ptr++; - } -- __ide_flush_dcache_range((unsigned long)buf, count * 2); -+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); - } - - static const struct ide_tp_ops tx4939ide_tp_ops = { -diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c -index ab7c8e4..666b7ba 100644 ---- a/drivers/md/bitmap.c -+++ b/drivers/md/bitmap.c -@@ -964,9 +964,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) - */ - page = bitmap->sb_page; - offset = sizeof(bitmap_super_t); -- read_sb_page(bitmap->mddev, bitmap->offset, -- page, -- index, count); -+ if (!file) -+ read_sb_page(bitmap->mddev, -+ bitmap->offset, -+ page, -+ index, count); - } else if (file) { - page = read_page(file, index, bitmap, count); - offset = 0; -diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c -index a8c0fc7..13e2a1a 100644 ---- a/drivers/md/dm-log.c -+++ b/drivers/md/dm-log.c -@@ -467,6 +467,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, - lc->disk_header = vmalloc(buf_size); - if (!lc->disk_header) { - DMWARN("couldn't allocate disk log buffer"); -+ dm_io_client_destroy(lc->io_req.client); - kfree(lc); - return -ENOMEM; - } -@@ -482,6 +483,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, - DMWARN("couldn't allocate sync bitset"); - if (!dev) - vfree(lc->clean_bits); -+ else -+ dm_io_client_destroy(lc->io_req.client); - vfree(lc->disk_header); - kfree(lc); - return -ENOMEM; -@@ -495,6 +498,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, - vfree(lc->sync_bits); - if (!dev) - vfree(lc->clean_bits); -+ else -+ dm_io_client_destroy(lc->io_req.client); - vfree(lc->disk_header); - kfree(lc); - return -ENOMEM; -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c -index ec43f9f..d0fed2b 100644 ---- a/drivers/md/dm-raid1.c -+++ b/drivers/md/dm-raid1.c -@@ -197,9 +197,6 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) - struct mirror_set *ms = m->ms; - struct mirror *new; - -- if (!errors_handled(ms)) -- return; -- - /* - * error_count is used for nothing more than a - * simple way to tell if a device has encountered -@@ -210,6 +207,9 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) - if (test_and_set_bit(error_type, &m->error_type)) - return; - -+ if (!errors_handled(ms)) -+ return; -+ - if (m != get_default_mirror(ms)) - goto out; - -diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c -index e43f656..35c7eb1 100644 ---- a/drivers/net/wireless/ath5k/phy.c -+++ b/drivers/net/wireless/ath5k/phy.c -@@ -2195,9 +2195,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah, - return ret; - } - -- ret = ath5k_hw_noise_floor_calibration(ah, channel->center_freq); -- if (ret) -- return ret; -+ ath5k_hw_noise_floor_calibration(ah, channel->center_freq); - - /* - * Re-enable RX/TX and beacons -diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c -index 1b6d45b..adcadae 100644 ---- a/drivers/net/wireless/ath5k/reset.c -+++ b/drivers/net/wireless/ath5k/reset.c -@@ -842,9 +842,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, - * - * XXX: Find an interval that's OK for all cards... - */ -- ret = ath5k_hw_noise_floor_calibration(ah, channel->center_freq); -- if (ret) -- return ret; -+ ath5k_hw_noise_floor_calibration(ah, channel->center_freq); - - /* - * Reset queues and start beacon timers at the end of the reset routine -diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c -index 504a044..b9b36cb 100644 ---- a/drivers/net/wireless/ath9k/recv.c -+++ b/drivers/net/wireless/ath9k/recv.c -@@ -627,9 +627,8 @@ u32 ath_calcrxfilter(struct ath_softc *sc) - rfilt &= ~ATH9K_RX_FILTER_UCAST; - } - -- if (((sc->sc_ah->ah_opmode == ATH9K_M_STA) && -- (sc->rx_filter & FIF_BCN_PRBRESP_PROMISC)) || -- (sc->sc_ah->ah_opmode == ATH9K_M_IBSS)) -+ if (sc->sc_ah->ah_opmode == ATH9K_M_STA || -+ sc->sc_ah->ah_opmode == ATH9K_M_IBSS) - rfilt |= ATH9K_RX_FILTER_BEACON; - - /* If in HOSTAP mode, want to enable reception of PSPOLL frames -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c -index c4c0371..5f8c52b 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c -@@ -1334,16 +1334,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) - priv->cfg->ops->lib->rx_handler_setup(priv); - } - --/* -- * this should be called while priv->lock is locked --*/ --static void __iwl_rx_replenish(struct iwl_priv *priv) --{ -- iwl_rx_allocate(priv); -- iwl_rx_queue_restock(priv); --} -- -- - /** - * iwl_rx_handle - Main entry function for receiving responses from uCode - * -@@ -1451,7 +1441,7 @@ void iwl_rx_handle(struct iwl_priv *priv) - count++; - if (count >= 8) { - priv->rxq.read = i; -- __iwl_rx_replenish(priv); -+ iwl_rx_queue_restock(priv); - count = 0; - } - } -diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c -index 0509c16..bd30af6 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-rx.c -+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c -@@ -245,25 +245,31 @@ void iwl_rx_allocate(struct iwl_priv *priv) - struct list_head *element; - struct iwl_rx_mem_buffer *rxb; - unsigned long flags; -- spin_lock_irqsave(&rxq->lock, flags); -- while (!list_empty(&rxq->rx_used)) { -+ -+ while (1) { -+ spin_lock_irqsave(&rxq->lock, flags); -+ -+ if (list_empty(&rxq->rx_used)) { -+ spin_unlock_irqrestore(&rxq->lock, flags); -+ return; -+ } - element = rxq->rx_used.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); -+ list_del(element); -+ -+ spin_unlock_irqrestore(&rxq->lock, flags); - - /* Alloc a new receive buffer */ - rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, -- __GFP_NOWARN | GFP_ATOMIC); -+ GFP_KERNEL); - if (!rxb->skb) { -- if (net_ratelimit()) -- printk(KERN_CRIT DRV_NAME -- ": Can not allocate SKB buffers\n"); -+ printk(KERN_CRIT DRV_NAME -+ "Can not allocate SKB buffers\n"); - /* We don't reschedule replenish work here -- we will - * call the restock method and if it still needs - * more buffers it will schedule replenish */ - break; - } -- priv->alloc_rxb_skb++; -- list_del(element); - - /* Get physical address of RB/SKB */ - rxb->real_dma_addr = pci_map_single( -@@ -277,12 +283,15 @@ void iwl_rx_allocate(struct iwl_priv *priv) - rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256); - skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); - -+ spin_lock_irqsave(&rxq->lock, flags); -+ - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; -+ priv->alloc_rxb_skb++; -+ -+ spin_unlock_irqrestore(&rxq->lock, flags); - } -- spin_unlock_irqrestore(&rxq->lock, flags); - } --EXPORT_SYMBOL(iwl_rx_allocate); - - void iwl_rx_replenish(struct iwl_priv *priv) - { -diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c -index 645d7a6..ec22284 100644 ---- a/drivers/pci/syscall.c -+++ b/drivers/pci/syscall.c -@@ -14,10 +14,8 @@ - #include - #include "pci.h" - --asmlinkage long --sys_pciconfig_read(unsigned long bus, unsigned long dfn, -- unsigned long off, unsigned long len, -- void __user *buf) -+SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, -+ unsigned long, off, unsigned long, len, void __user *, buf) - { - struct pci_dev *dev; - u8 byte; -@@ -86,10 +84,8 @@ error: - return err; - } - --asmlinkage long --sys_pciconfig_write(unsigned long bus, unsigned long dfn, -- unsigned long off, unsigned long len, -- void __user *buf) -+SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, -+ unsigned long, off, unsigned long, len, void __user *, buf) - { - struct pci_dev *dev; - u8 byte; -diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c -index a73a6bb..976cdd5 100644 ---- a/drivers/scsi/eata.c -+++ b/drivers/scsi/eata.c -@@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha) - - cpp->sense_len = SCSI_SENSE_BUFFERSIZE; - -- count = scsi_dma_map(SCpnt); -- BUG_ON(count < 0); -+ if (!scsi_sg_count(SCpnt)) { -+ cpp->data_len = 0; -+ return; -+ } -+ -+ count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt), -+ pci_dir); -+ BUG_ON(!count); -+ - scsi_for_each_sg(SCpnt, sg, count, k) { - cpp->sglist[k].address = H2DEV(sg_dma_address(sg)); - cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg)); -@@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha) - pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr), - DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); - -- scsi_dma_unmap(SCpnt); -+ if (scsi_sg_count(SCpnt)) -+ pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt), -+ pci_dir); - - if (!DEV2H(cpp->data_len)) - pci_dir = PCI_DMA_BIDIRECTIONAL; -diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c -index 7650707..189be8c 100644 ---- a/drivers/scsi/ibmvscsi/ibmvfc.c -+++ b/drivers/scsi/ibmvscsi/ibmvfc.c -@@ -566,7 +566,7 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin) - struct ibmvfc_target *tgt; - - if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { -- if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) { -+ if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) { - dev_err(vhost->dev, - "Host initialization retries exceeded. Taking adapter offline\n"); - ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); -@@ -847,11 +847,12 @@ static void ibmvfc_reset_host(struct ibmvfc_host *vhost) - static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost) - { - if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { -- if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) { -+ vhost->delay_init = 1; -+ if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) { - dev_err(vhost->dev, - "Host initialization retries exceeded. Taking adapter offline\n"); - ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); -- } else if (vhost->init_retries == IBMVFC_MAX_INIT_RETRIES) -+ } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES) - __ibmvfc_reset_host(vhost); - else - ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT); -@@ -2089,15 +2090,17 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, - case IBMVFC_AE_LINK_UP: - case IBMVFC_AE_RESUME: - vhost->events_to_log |= IBMVFC_AE_LINKUP; -- ibmvfc_init_host(vhost, 1); -+ vhost->delay_init = 1; -+ __ibmvfc_reset_host(vhost); - break; - case IBMVFC_AE_SCN_FABRIC: -+ case IBMVFC_AE_SCN_DOMAIN: - vhost->events_to_log |= IBMVFC_AE_RSCN; -- ibmvfc_init_host(vhost, 1); -+ vhost->delay_init = 1; -+ __ibmvfc_reset_host(vhost); - break; - case IBMVFC_AE_SCN_NPORT: - case IBMVFC_AE_SCN_GROUP: -- case IBMVFC_AE_SCN_DOMAIN: - vhost->events_to_log |= IBMVFC_AE_RSCN; - case IBMVFC_AE_ELS_LOGO: - case IBMVFC_AE_ELS_PRLO: -@@ -2669,7 +2672,7 @@ static void ibmvfc_init_tgt(struct ibmvfc_target *tgt, - static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, - void (*job_step) (struct ibmvfc_target *)) - { -- if (++tgt->init_retries > IBMVFC_MAX_INIT_RETRIES) { -+ if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) { - ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); - wake_up(&tgt->vhost->work_wait_q); - } else -@@ -3519,7 +3522,13 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) - break; - case IBMVFC_HOST_ACTION_INIT: - BUG_ON(vhost->state != IBMVFC_INITIALIZING); -- vhost->job_step(vhost); -+ if (vhost->delay_init) { -+ vhost->delay_init = 0; -+ spin_unlock_irqrestore(vhost->host->host_lock, flags); -+ ssleep(15); -+ return; -+ } else -+ vhost->job_step(vhost); - break; - case IBMVFC_HOST_ACTION_QUERY: - list_for_each_entry(tgt, &vhost->targets, queue) -diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h -index fb3177a..d0e76d5 100644 ---- a/drivers/scsi/ibmvscsi/ibmvfc.h -+++ b/drivers/scsi/ibmvscsi/ibmvfc.h -@@ -33,7 +33,7 @@ - #define IBMVFC_DRIVER_DATE "(August 14, 2008)" - - #define IBMVFC_DEFAULT_TIMEOUT 15 --#define IBMVFC_INIT_TIMEOUT 30 -+#define IBMVFC_INIT_TIMEOUT 120 - #define IBMVFC_MAX_REQUESTS_DEFAULT 100 - - #define IBMVFC_DEBUG 0 -@@ -43,7 +43,8 @@ - #define IBMVFC_MAX_DISC_THREADS 4 - #define IBMVFC_TGT_MEMPOOL_SZ 64 - #define IBMVFC_MAX_CMDS_PER_LUN 64 --#define IBMVFC_MAX_INIT_RETRIES 3 -+#define IBMVFC_MAX_HOST_INIT_RETRIES 6 -+#define IBMVFC_MAX_TGT_INIT_RETRIES 3 - #define IBMVFC_DEV_LOSS_TMO (5 * 60) - #define IBMVFC_DEFAULT_LOG_LEVEL 2 - #define IBMVFC_MAX_CDB_LEN 16 -@@ -671,6 +672,7 @@ struct ibmvfc_host { - int discovery_threads; - int client_migrated; - int reinit; -+ int delay_init; - int events_to_log; - #define IBMVFC_AE_LINKUP 0x0001 - #define IBMVFC_AE_LINKDOWN 0x0002 -diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c -index 1dd70d7..23e5a87 100644 ---- a/drivers/scsi/mvsas.c -+++ b/drivers/scsi/mvsas.c -@@ -2959,7 +2959,7 @@ static int __devinit mvs_hw_init(struct mvs_info *mvi) - - /* enable auto port detection */ - mw32(GBL_PORT_TYPE, MODE_AUTO_DET_EN); -- msleep(100); -+ msleep(1100); - /* init and reset phys */ - for (i = 0; i < mvi->chip->n_phy; i++) { - u32 lo = be32_to_cpu(*(u32 *)&mvi->sas_addr[4]); -diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c -index 165ff88..67cde01 100644 ---- a/drivers/scsi/pcmcia/aha152x_stub.c -+++ b/drivers/scsi/pcmcia/aha152x_stub.c -@@ -114,7 +114,7 @@ static int aha152x_probe(struct pcmcia_device *link) - link->io.NumPorts1 = 0x20; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - link->io.IOAddrLines = 10; -- link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; -+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; - link->irq.IRQInfo1 = IRQ_LEVEL_ID; - link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; -diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c -index b87ca7c..2545306 100644 ---- a/drivers/usb/host/isp1760-if.c -+++ b/drivers/usb/host/isp1760-if.c -@@ -129,23 +129,23 @@ static struct of_platform_driver isp1760_of_driver = { - #endif - - #ifdef CONFIG_PCI --static u32 nxp_pci_io_base; --static u32 iolength; --static u32 pci_mem_phy0; --static u32 length; --static u8 __iomem *chip_addr; --static u8 __iomem *iobase; -- - static int __devinit isp1761_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) - { - u8 latency, limit; - __u32 reg_data; - int retry_count; -- int length; -- int status = 1; - struct usb_hcd *hcd; - unsigned int devflags = 0; -+ int ret_status = 0; -+ -+ resource_size_t pci_mem_phy0; -+ resource_size_t memlength; -+ -+ u8 __iomem *chip_addr; -+ u8 __iomem *iobase; -+ resource_size_t nxp_pci_io_base; -+ resource_size_t iolength; - - if (usb_disabled()) - return -ENODEV; -@@ -168,26 +168,30 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev, - iobase = ioremap_nocache(nxp_pci_io_base, iolength); - if (!iobase) { - printk(KERN_ERR "ioremap #1\n"); -- release_mem_region(nxp_pci_io_base, iolength); -- return -ENOMEM; -+ ret_status = -ENOMEM; -+ goto cleanup1; - } - /* Grab the PLX PCI shared memory of the ISP 1761 we need */ - pci_mem_phy0 = pci_resource_start(dev, 3); -- length = pci_resource_len(dev, 3); -- -- if (length < 0xffff) { -- printk(KERN_ERR "memory length for this resource is less than " -- "required\n"); -- release_mem_region(nxp_pci_io_base, iolength); -- iounmap(iobase); -- return -ENOMEM; -+ memlength = pci_resource_len(dev, 3); -+ if (memlength < 0xffff) { -+ printk(KERN_ERR "memory length for this resource is wrong\n"); -+ ret_status = -ENOMEM; -+ goto cleanup2; - } - -- if (!request_mem_region(pci_mem_phy0, length, "ISP-PCI")) { -+ if (!request_mem_region(pci_mem_phy0, memlength, "ISP-PCI")) { - printk(KERN_ERR "host controller already in use\n"); -- release_mem_region(nxp_pci_io_base, iolength); -- iounmap(iobase); -- return -EBUSY; -+ ret_status = -EBUSY; -+ goto cleanup2; -+ } -+ -+ /* map available memory */ -+ chip_addr = ioremap_nocache(pci_mem_phy0,memlength); -+ if (!chip_addr) { -+ printk(KERN_ERR "Error ioremap failed\n"); -+ ret_status = -ENOMEM; -+ goto cleanup3; - } - - /* bad pci latencies can contribute to overruns */ -@@ -210,39 +214,54 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev, - * */ - writel(0xface, chip_addr + HC_SCRATCH_REG); - udelay(100); -- reg_data = readl(chip_addr + HC_SCRATCH_REG); -+ reg_data = readl(chip_addr + HC_SCRATCH_REG) & 0x0000ffff; - retry_count--; - } - -+ iounmap(chip_addr); -+ - /* Host Controller presence is detected by writing to scratch register - * and reading back and checking the contents are same or not - */ - if (reg_data != 0xFACE) { - dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data); -- goto clean; -+ ret_status = -ENOMEM; -+ goto cleanup3; - } - - pci_set_master(dev); - -- status = readl(iobase + 0x68); -- status |= 0x900; -- writel(status, iobase + 0x68); -+ /* configure PLX PCI chip to pass interrupts */ -+#define PLX_INT_CSR_REG 0x68 -+ reg_data = readl(iobase + PLX_INT_CSR_REG); -+ reg_data |= 0x900; -+ writel(reg_data, iobase + PLX_INT_CSR_REG); - - dev->dev.dma_mask = NULL; -- hcd = isp1760_register(pci_mem_phy0, length, dev->irq, -+ hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq, - IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev), - devflags); -- if (!IS_ERR(hcd)) { -- pci_set_drvdata(dev, hcd); -- return 0; -+ if (IS_ERR(hcd)) { -+ ret_status = -ENODEV; -+ goto cleanup3; - } --clean: -- status = -ENODEV; -+ -+ /* done with PLX IO access */ - iounmap(iobase); -- release_mem_region(pci_mem_phy0, length); - release_mem_region(nxp_pci_io_base, iolength); -- return status; -+ -+ pci_set_drvdata(dev, hcd); -+ return 0; -+ -+cleanup3: -+ release_mem_region(pci_mem_phy0, memlength); -+cleanup2: -+ iounmap(iobase); -+cleanup1: -+ release_mem_region(nxp_pci_io_base, iolength); -+ return ret_status; - } -+ - static void isp1761_pci_remove(struct pci_dev *dev) - { - struct usb_hcd *hcd; -@@ -255,12 +274,6 @@ static void isp1761_pci_remove(struct pci_dev *dev) - usb_put_hcd(hcd); - - pci_disable_device(dev); -- -- iounmap(iobase); -- iounmap(chip_addr); -- -- release_mem_region(nxp_pci_io_base, iolength); -- release_mem_region(pci_mem_phy0, length); - } - - static void isp1761_pci_shutdown(struct pci_dev *dev) -@@ -268,12 +281,16 @@ static void isp1761_pci_shutdown(struct pci_dev *dev) - printk(KERN_ERR "ips1761_pci_shutdown\n"); - } - --static const struct pci_device_id isp1760_plx [] = { { -- /* handle any USB 2.0 EHCI controller */ -- PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_OTHER << 8) | (0x06 << 16)), ~0), -- .driver_data = 0, --}, --{ /* end: all zeroes */ } -+static const struct pci_device_id isp1760_plx [] = { -+ { -+ .class = PCI_CLASS_BRIDGE_OTHER << 8, -+ .class_mask = ~0, -+ .vendor = PCI_VENDOR_ID_PLX, -+ .device = 0x5406, -+ .subvendor = PCI_VENDOR_ID_PLX, -+ .subdevice = 0x9054, -+ }, -+ { } - }; - MODULE_DEVICE_TABLE(pci, isp1760_plx); - -diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c -index e762beb..879a980 100644 ---- a/drivers/usb/misc/emi26.c -+++ b/drivers/usb/misc/emi26.c -@@ -160,7 +160,7 @@ static int emi26_load_firmware (struct usb_device *dev) - err("%s - error loading firmware: error = %d", __func__, err); - goto wraperr; - } -- } while (i > 0); -+ } while (rec); - - /* Assert reset (stop the CPU in the EMI) */ - err = emi26_set_reset(dev,1); -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index bfcc1fe..a078540 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -260,6 +260,13 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), - -+/* Reported by Paulo Fessel */ -+UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999, -+ "Nokia", -+ "5200", -+ US_SC_DEVICE, US_PR_DEVICE, NULL, -+ US_FL_FIX_CAPACITY ), -+ - /* Reported by Richard Nauber */ - UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660, - "Nokia", -@@ -1040,7 +1047,7 @@ UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0100, - US_FL_FIX_CAPACITY | US_FL_GO_SLOW ), - - /* Reported by Alex Butcher */ --UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001, -+UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0101, - "Prolific Technology Inc.", - "ATAPI-6 Bridge Controller", - US_SC_DEVICE, US_PR_DEVICE, NULL, -@@ -1320,6 +1327,13 @@ UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0001, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY), - -+/* Reported and patched by Nguyen Anh Quynh */ -+UNUSUAL_DEV( 0x0840, 0x0084, 0x0001, 0x0001, -+ "Argosy", -+ "Storage", -+ US_SC_DEVICE, US_PR_DEVICE, NULL, -+ US_FL_FIX_CAPACITY), -+ - /* Entry and supporting patch by Theodore Kilgore . - * Flag will support Bulk devices which use a standards-violating 32-byte - * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with -@@ -1425,6 +1439,13 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_INQUIRY ), - -+/* Reported by Jaak Ristioja */ -+UNUSUAL_DEV( 0x0a17, 0x006e, 0x0100, 0x0100, -+ "Pentax", -+ "K10D", -+ US_SC_DEVICE, US_PR_DEVICE, NULL, -+ US_FL_FIX_CAPACITY ), -+ - /* These are virtual windows driver CDs, which the zd1211rw driver - * automatically converts into WLAN devices. */ - UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, -diff --git a/fs/affs/file.c b/fs/affs/file.c -index 1377b12..9246cb4 100644 ---- a/fs/affs/file.c -+++ b/fs/affs/file.c -@@ -628,7 +628,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping - } - - index = pos >> PAGE_CACHE_SHIFT; -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -diff --git a/fs/afs/write.c b/fs/afs/write.c -index d6b85da..3fb36d4 100644 ---- a/fs/afs/write.c -+++ b/fs/afs/write.c -@@ -144,7 +144,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, - candidate->state = AFS_WBACK_PENDING; - init_waitqueue_head(&candidate->waitq); - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) { - kfree(candidate); - return -ENOMEM; -diff --git a/fs/aio.c b/fs/aio.c -index f658441..048648d 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -1258,7 +1258,7 @@ static void io_destroy(struct kioctx *ioctx) - * pointer is passed for ctxp. Will fail with -ENOSYS if not - * implemented. - */ --asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) -+SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) - { - struct kioctx *ioctx = NULL; - unsigned long ctx; -@@ -1296,7 +1296,7 @@ out: - * implemented. May fail with -EFAULT if the context pointed to - * is invalid. - */ --asmlinkage long sys_io_destroy(aio_context_t ctx) -+SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx) - { - struct kioctx *ioctx = lookup_ioctx(ctx); - if (likely(NULL != ioctx)) { -@@ -1650,8 +1650,8 @@ out_put_req: - * are available to queue any iocbs. Will return 0 if nr is 0. Will - * fail with -ENOSYS if not implemented. - */ --asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, -- struct iocb __user * __user *iocbpp) -+SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr, -+ struct iocb __user * __user *, iocbpp) - { - struct kioctx *ctx; - long ret = 0; -@@ -1725,8 +1725,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, - * invalid. May fail with -EAGAIN if the iocb specified was not - * cancelled. Will fail with -ENOSYS if not implemented. - */ --asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, -- struct io_event __user *result) -+SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, -+ struct io_event __user *, result) - { - int (*cancel)(struct kiocb *iocb, struct io_event *res); - struct kioctx *ctx; -@@ -1787,11 +1787,11 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, - * will be updated if not NULL and the operation blocks. Will fail - * with -ENOSYS if not implemented. - */ --asmlinkage long sys_io_getevents(aio_context_t ctx_id, -- long min_nr, -- long nr, -- struct io_event __user *events, -- struct timespec __user *timeout) -+SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, -+ long, min_nr, -+ long, nr, -+ struct io_event __user *, events, -+ struct timespec __user *, timeout) - { - struct kioctx *ioctx = lookup_ioctx(ctx_id); - long ret = -EINVAL; -diff --git a/fs/buffer.c b/fs/buffer.c -index 10179cf..5e62011 100644 ---- a/fs/buffer.c -+++ b/fs/buffer.c -@@ -1988,7 +1988,7 @@ int block_write_begin(struct file *file, struct address_space *mapping, - page = *pagep; - if (page == NULL) { - ownpage = 1; -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) { - status = -ENOMEM; - goto out; -@@ -2494,7 +2494,7 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, - from = pos & (PAGE_CACHE_SIZE - 1); - to = from + len; - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -@@ -3177,7 +3177,7 @@ void block_sync_page(struct page *page) - * Use of bdflush() is deprecated and will be removed in a future kernel. - * The `pdflush' kernel threads fully replace bdflush daemons and this call. - */ --asmlinkage long sys_bdflush(int func, long data) -+SYSCALL_DEFINE2(bdflush, int, func, long, data) - { - static int msg_count; - -diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c -index e1c1836..85c0a74 100644 ---- a/fs/cifs/cifs_dfs_ref.c -+++ b/fs/cifs/cifs_dfs_ref.c -@@ -122,7 +122,7 @@ static char *compose_mount_options(const char *sb_mountdata, - char **devname) - { - int rc; -- char *mountdata; -+ char *mountdata = NULL; - int md_len; - char *tkn_e; - char *srvIP = NULL; -@@ -136,10 +136,9 @@ static char *compose_mount_options(const char *sb_mountdata, - *devname = cifs_get_share_name(ref->node_name); - rc = dns_resolve_server_name_to_ip(*devname, &srvIP); - if (rc != 0) { -- cERROR(1, ("%s: Failed to resolve server part of %s to IP", -- __func__, *devname)); -- mountdata = ERR_PTR(rc); -- goto compose_mount_options_out; -+ cERROR(1, ("%s: Failed to resolve server part of %s to IP: %d", -+ __func__, *devname, rc));; -+ goto compose_mount_options_err; - } - /* md_len = strlen(...) + 12 for 'sep+prefixpath=' - * assuming that we have 'unc=' and 'ip=' in -@@ -149,8 +148,8 @@ static char *compose_mount_options(const char *sb_mountdata, - strlen(ref->node_name) + 12; - mountdata = kzalloc(md_len+1, GFP_KERNEL); - if (mountdata == NULL) { -- mountdata = ERR_PTR(-ENOMEM); -- goto compose_mount_options_out; -+ rc = -ENOMEM; -+ goto compose_mount_options_err; - } - - /* copy all options except of unc,ip,prefixpath */ -@@ -197,18 +196,32 @@ static char *compose_mount_options(const char *sb_mountdata, - - /* find & copy prefixpath */ - tkn_e = strchr(ref->node_name + 2, '\\'); -- if (tkn_e == NULL) /* invalid unc, missing share name*/ -- goto compose_mount_options_out; -+ if (tkn_e == NULL) { -+ /* invalid unc, missing share name*/ -+ rc = -EINVAL; -+ goto compose_mount_options_err; -+ } - -+ /* -+ * this function gives us a path with a double backslash prefix. We -+ * require a single backslash for DFS. Temporarily increment fullpath -+ * to put it in the proper form and decrement before freeing it. -+ */ - fullpath = build_path_from_dentry(dentry); -+ if (!fullpath) { -+ rc = -ENOMEM; -+ goto compose_mount_options_err; -+ } -+ ++fullpath; - tkn_e = strchr(tkn_e + 1, '\\'); -- if (tkn_e || strlen(fullpath) - (ref->path_consumed)) { -+ if (tkn_e || (strlen(fullpath) - ref->path_consumed)) { - strncat(mountdata, &sep, 1); - strcat(mountdata, "prefixpath="); - if (tkn_e) - strcat(mountdata, tkn_e + 1); -- strcat(mountdata, fullpath + (ref->path_consumed)); -+ strcat(mountdata, fullpath + ref->path_consumed); - } -+ --fullpath; - kfree(fullpath); - - /*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/ -@@ -217,6 +230,11 @@ static char *compose_mount_options(const char *sb_mountdata, - compose_mount_options_out: - kfree(srvIP); - return mountdata; -+ -+compose_mount_options_err: -+ kfree(mountdata); -+ mountdata = ERR_PTR(rc); -+ goto compose_mount_options_out; - } - - -@@ -309,13 +327,19 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) - goto out_err; - } - -+ /* -+ * The MSDFS spec states that paths in DFS referral requests and -+ * responses must be prefixed by a single '\' character instead of -+ * the double backslashes usually used in the UNC. This function -+ * gives us the latter, so we must adjust the result. -+ */ - full_path = build_path_from_dentry(dentry); - if (full_path == NULL) { - rc = -ENOMEM; - goto out_err; - } - -- rc = get_dfs_path(xid, ses , full_path, cifs_sb->local_nls, -+ rc = get_dfs_path(xid, ses , full_path + 1, cifs_sb->local_nls, - &num_referrals, &referrals, - cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); - -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index f0a81e6..586d2be 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -2073,7 +2073,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping, - - cFYI(1, ("write_begin from %lld len %d", (long long)pos, len)); - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) { - rc = -ENOMEM; - goto out; -diff --git a/fs/compat.c b/fs/compat.c -index e5f49f5..ce35592 100644 ---- a/fs/compat.c -+++ b/fs/compat.c -@@ -1697,7 +1697,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, - } - - #ifdef HAVE_SET_RESTORE_SIGMASK --asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp, -+static long do_compat_pselect(int n, compat_ulong_t __user *inp, - compat_ulong_t __user *outp, compat_ulong_t __user *exp, - struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, - compat_size_t sigsetsize) -@@ -1763,8 +1763,8 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, - (compat_size_t __user *)(sig+sizeof(up)))) - return -EFAULT; - } -- return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up), -- sigsetsize); -+ return do_compat_pselect(n, inp, outp, exp, tsp, compat_ptr(up), -+ sigsetsize); - } - - asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, -diff --git a/fs/dcache.c b/fs/dcache.c -index a1d86c7..ca1fd3b 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1620,8 +1620,11 @@ static void switch_names(struct dentry *dentry, struct dentry *target) - */ - memcpy(dentry->d_iname, target->d_name.name, - target->d_name.len + 1); -+ dentry->d_name.len = target->d_name.len; -+ return; - } - } -+ do_switch(dentry->d_name.len, target->d_name.len); - } - - /* -@@ -1681,7 +1684,6 @@ already_unhashed: - - /* Switch the names.. */ - switch_names(dentry, target); -- do_switch(dentry->d_name.len, target->d_name.len); - do_switch(dentry->d_name.hash, target->d_name.hash); - - /* ... and switch the parents */ -@@ -1791,7 +1793,6 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) - struct dentry *dparent, *aparent; - - switch_names(dentry, anon); -- do_switch(dentry->d_name.len, anon->d_name.len); - do_switch(dentry->d_name.hash, anon->d_name.hash); - - dparent = dentry->d_parent; -@@ -2095,7 +2096,7 @@ Elong: - * return NULL; - * } - */ --asmlinkage long sys_getcwd(char __user *buf, unsigned long size) -+SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) - { - int error; - struct path pwd, root; -diff --git a/fs/dcookies.c b/fs/dcookies.c -index 855d4b1..f0da95b 100644 ---- a/fs/dcookies.c -+++ b/fs/dcookies.c -@@ -140,7 +140,7 @@ out: - /* And here is where the userspace process can look up the cookie value - * to retrieve the path. - */ --asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) -+SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len) - { - unsigned long cookie = (unsigned long)cookie64; - int err = -EINVAL; -@@ -193,7 +193,13 @@ out: - mutex_unlock(&dcookie_mutex); - return err; - } -- -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len) -+{ -+ return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len); -+} -+SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie); -+#endif - - static int dcookie_init(void) - { -diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c -index 89209f0..5e78fc1 100644 ---- a/fs/ecryptfs/inode.c -+++ b/fs/ecryptfs/inode.c -@@ -673,10 +673,11 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd) - ecryptfs_printk(KERN_DEBUG, "Calling readlink w/ " - "dentry->d_name.name = [%s]\n", dentry->d_name.name); - rc = dentry->d_inode->i_op->readlink(dentry, (char __user *)buf, len); -- buf[rc] = '\0'; - set_fs(old_fs); - if (rc < 0) - goto out_free; -+ else -+ buf[rc] = '\0'; - rc = 0; - nd_set_link(nd, buf); - goto out; -diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c -index 04d7b3f..46cec2b 100644 ---- a/fs/ecryptfs/mmap.c -+++ b/fs/ecryptfs/mmap.c -@@ -288,7 +288,7 @@ static int ecryptfs_write_begin(struct file *file, - loff_t prev_page_end_size; - int rc = 0; - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -diff --git a/fs/eventfd.c b/fs/eventfd.c -index 08bf558..5de2c2d 100644 ---- a/fs/eventfd.c -+++ b/fs/eventfd.c -@@ -198,7 +198,7 @@ struct file *eventfd_fget(int fd) - return file; - } - --asmlinkage long sys_eventfd2(unsigned int count, int flags) -+SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags) - { - int fd; - struct eventfd_ctx *ctx; -@@ -228,8 +228,7 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags) - return fd; - } - --asmlinkage long sys_eventfd(unsigned int count) -+SYSCALL_DEFINE1(eventfd, unsigned int, count) - { - return sys_eventfd2(count, 0); - } -- -diff --git a/fs/eventpoll.c b/fs/eventpoll.c -index 96355d5..ba2f9ec 100644 ---- a/fs/eventpoll.c -+++ b/fs/eventpoll.c -@@ -1110,7 +1110,7 @@ retry: - /* - * Open an eventpoll file descriptor. - */ --asmlinkage long sys_epoll_create1(int flags) -+SYSCALL_DEFINE1(epoll_create1, int, flags) - { - int error, fd = -1; - struct eventpoll *ep; -@@ -1150,7 +1150,7 @@ error_return: - return fd; - } - --asmlinkage long sys_epoll_create(int size) -+SYSCALL_DEFINE1(epoll_create, int, size) - { - if (size < 0) - return -EINVAL; -@@ -1163,8 +1163,8 @@ asmlinkage long sys_epoll_create(int size) - * the eventpoll file that enables the insertion/removal/change of - * file descriptors inside the interest set. - */ --asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, -- struct epoll_event __user *event) -+SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, -+ struct epoll_event __user *, event) - { - int error; - struct file *file, *tfile; -@@ -1261,8 +1261,8 @@ error_return: - * Implement the event wait interface for the eventpoll file. It is the kernel - * part of the user space epoll_wait(2). - */ --asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, -- int maxevents, int timeout) -+SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, -+ int, maxevents, int, timeout) - { - int error; - struct file *file; -@@ -1319,9 +1319,9 @@ error_return: - * Implement the event wait interface for the eventpoll file. It is the kernel - * part of the user space epoll_pwait(2). - */ --asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events, -- int maxevents, int timeout, const sigset_t __user *sigmask, -- size_t sigsetsize) -+SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events, -+ int, maxevents, int, timeout, const sigset_t __user *, sigmask, -+ size_t, sigsetsize) - { - int error; - sigset_t ksigmask, sigsaved; -diff --git a/fs/exec.c b/fs/exec.c -index ec5df9a..c9f22cb 100644 ---- a/fs/exec.c -+++ b/fs/exec.c -@@ -102,7 +102,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt) - * - * Also note that we take the address to load from from the file itself. - */ --asmlinkage long sys_uselib(const char __user * library) -+SYSCALL_DEFINE1(uselib, const char __user *, library) - { - struct file *file; - struct nameidata nd; -diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c -index f8424ad..846e8ca 100644 ---- a/fs/ext3/inode.c -+++ b/fs/ext3/inode.c -@@ -1160,7 +1160,7 @@ static int ext3_write_begin(struct file *file, struct address_space *mapping, - to = from + len; - - retry: -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c -index 3e5edc9..a48e965 100644 ---- a/fs/ext3/namei.c -+++ b/fs/ext3/namei.c -@@ -2170,8 +2170,7 @@ retry: - * We have a transaction open. All is sweetness. It also sets - * i_size in generic_commit_write(). - */ -- err = __page_symlink(inode, symname, l, -- mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); -+ err = __page_symlink(inode, symname, l, 1); - if (err) { - drop_nlink(inode); - ext3_mark_inode_dirty(handle, inode); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index be21a5a..8e46b19 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1345,7 +1345,7 @@ retry: - goto out; - } - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) { - ext4_journal_stop(handle); - ret = -ENOMEM; -@@ -2549,7 +2549,7 @@ retry: - goto out; - } - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) { - ext4_journal_stop(handle); - ret = -ENOMEM; -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 63adcb7..92c8397 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -2208,8 +2208,7 @@ retry: - * We have a transaction open. All is sweetness. It also sets - * i_size in generic_commit_write(). - */ -- err = __page_symlink(inode, symname, l, -- mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); -+ err = __page_symlink(inode, symname, l, 1); - if (err) { - clear_nlink(inode); - ext4_mark_inode_dirty(handle, inode); -diff --git a/fs/fcntl.c b/fs/fcntl.c -index 549daf8..08a109b 100644 ---- a/fs/fcntl.c -+++ b/fs/fcntl.c -@@ -50,7 +50,7 @@ static int get_close_on_exec(unsigned int fd) - return res; - } - --asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) -+SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags) - { - int err = -EBADF; - struct file * file, *tofree; -@@ -113,7 +113,7 @@ out_unlock: - return err; - } - --asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) -+SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd) - { - if (unlikely(newfd == oldfd)) { /* corner case */ - struct files_struct *files = current->files; -@@ -126,7 +126,7 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) - return sys_dup3(oldfd, newfd, 0); - } - --asmlinkage long sys_dup(unsigned int fildes) -+SYSCALL_DEFINE1(dup, unsigned int, fildes) - { - int ret = -EBADF; - struct file *file = fget(fildes); -@@ -334,7 +334,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, - return err; - } - --asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) -+SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) - { - struct file *filp; - long err = -EBADF; -@@ -357,7 +357,8 @@ out: - } - - #if BITS_PER_LONG == 32 --asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) -+SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, -+ unsigned long, arg) - { - struct file * filp; - long err; -diff --git a/fs/filesystems.c b/fs/filesystems.c -index d0e20ce..ee44dc8 100644 ---- a/fs/filesystems.c -+++ b/fs/filesystems.c -@@ -179,7 +179,7 @@ static int fs_maxindex(void) - /* - * Whee.. Weird sysv syscall. - */ --asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2) -+SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2) - { - int retval = -EINVAL; - -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 34930a9..4c9ee70 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -646,7 +646,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping, - { - pgoff_t index = pos >> PAGE_CACHE_SHIFT; - -- *pagep = __grab_cache_page(mapping, index); -+ *pagep = grab_cache_page_write_begin(mapping, index, flags); - if (!*pagep) - return -ENOMEM; - return 0; -@@ -779,7 +779,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, - break; - - err = -ENOMEM; -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, 0); - if (!page) - break; - -diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c -index 2756381..15f710f 100644 ---- a/fs/gfs2/ops_address.c -+++ b/fs/gfs2/ops_address.c -@@ -675,7 +675,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, - goto out_trans_fail; - - error = -ENOMEM; -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - *pagep = page; - if (unlikely(!page)) - goto out_endtrans; -diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c -index 3a31451..5c538e0 100644 ---- a/fs/hostfs/hostfs_kern.c -+++ b/fs/hostfs/hostfs_kern.c -@@ -501,7 +501,7 @@ int hostfs_write_begin(struct file *file, struct address_space *mapping, - { - pgoff_t index = pos >> PAGE_CACHE_SHIFT; - -- *pagep = __grab_cache_page(mapping, index); -+ *pagep = grab_cache_page_write_begin(mapping, index, flags); - if (!*pagep) - return -ENOMEM; - return 0; -diff --git a/fs/inotify_user.c b/fs/inotify_user.c -index d367e9b..a7aea80 100644 ---- a/fs/inotify_user.c -+++ b/fs/inotify_user.c -@@ -576,7 +576,7 @@ static const struct inotify_operations inotify_user_ops = { - .destroy_watch = free_inotify_user_watch, - }; - --asmlinkage long sys_inotify_init1(int flags) -+SYSCALL_DEFINE1(inotify_init1, int, flags) - { - struct inotify_device *dev; - struct inotify_handle *ih; -@@ -655,12 +655,13 @@ out_put_fd: - return ret; - } - --asmlinkage long sys_inotify_init(void) -+SYSCALL_DEFINE0(inotify_init) - { - return sys_inotify_init1(0); - } - --asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask) -+SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, -+ u32, mask) - { - struct inode *inode; - struct inotify_device *dev; -@@ -704,7 +705,7 @@ fput_and_out: - return ret; - } - --asmlinkage long sys_inotify_rm_watch(int fd, u32 wd) -+SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd) - { - struct file *filp; - struct inotify_device *dev; -diff --git a/fs/ioctl.c b/fs/ioctl.c -index 43e8b2c..d3e2130 100644 ---- a/fs/ioctl.c -+++ b/fs/ioctl.c -@@ -472,7 +472,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, - return error; - } - --asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -+SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) - { - struct file *filp; - int error = -EBADF; -diff --git a/fs/ioprio.c b/fs/ioprio.c -index da3cc46..3715d7d 100644 ---- a/fs/ioprio.c -+++ b/fs/ioprio.c -@@ -65,7 +65,7 @@ static int set_task_ioprio(struct task_struct *task, int ioprio) - return err; - } - --asmlinkage long sys_ioprio_set(int which, int who, int ioprio) -+SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio) - { - int class = IOPRIO_PRIO_CLASS(ioprio); - int data = IOPRIO_PRIO_DATA(ioprio); -@@ -181,7 +181,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio) - return aprio; - } - --asmlinkage long sys_ioprio_get(int which, int who) -+SYSCALL_DEFINE2(ioprio_get, int, which, int, who) - { - struct task_struct *g, *p; - struct user_struct *user; -@@ -245,4 +245,3 @@ asmlinkage long sys_ioprio_get(int which, int who) - read_unlock(&tasklist_lock); - return ret; - } -- -diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c -index 5a98aa8..5edc2bf 100644 ---- a/fs/jffs2/file.c -+++ b/fs/jffs2/file.c -@@ -132,7 +132,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - uint32_t pageofs = index << PAGE_CACHE_SHIFT; - int ret = 0; - -- pg = __grab_cache_page(mapping, index); -+ pg = grab_cache_page_write_begin(mapping, index, flags); - if (!pg) - return -ENOMEM; - *pagep = pg; -diff --git a/fs/libfs.c b/fs/libfs.c -index e960a83..bdaec17 100644 ---- a/fs/libfs.c -+++ b/fs/libfs.c -@@ -360,7 +360,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping, - index = pos >> PAGE_CACHE_SHIFT; - from = pos & (PAGE_CACHE_SIZE - 1); - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - -diff --git a/fs/locks.c b/fs/locks.c -index 09062e3..ec45f4d 100644 ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -1564,7 +1564,7 @@ EXPORT_SYMBOL(flock_lock_file_wait); - * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other - * processes read and write access respectively. - */ --asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) -+SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) - { - struct file *filp; - struct file_lock *lock; -diff --git a/fs/minix/dir.c b/fs/minix/dir.c -index f704338..d4946c4 100644 ---- a/fs/minix/dir.c -+++ b/fs/minix/dir.c -@@ -280,7 +280,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) - return -EINVAL; - - got_it: -- pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page); -+ pos = page_offset(page) + p - (char *)page_address(page); - err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize, - AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); - if (err) -diff --git a/fs/namei.c b/fs/namei.c -index d34e0f9..3ca2574 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -1969,8 +1969,8 @@ static int may_mknod(mode_t mode) - } - } - --asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode, -- unsigned dev) -+SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode, -+ unsigned, dev) - { - int error; - char *tmp; -@@ -2020,7 +2020,7 @@ out_unlock: - return error; - } - --asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev) -+SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev) - { - return sys_mknodat(AT_FDCWD, filename, mode, dev); - } -@@ -2047,7 +2047,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) - return error; - } - --asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode) -+SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode) - { - int error = 0; - char * tmp; -@@ -2080,7 +2080,7 @@ out_err: - return error; - } - --asmlinkage long sys_mkdir(const char __user *pathname, int mode) -+SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode) - { - return sys_mkdirat(AT_FDCWD, pathname, mode); - } -@@ -2190,7 +2190,7 @@ exit1: - return error; - } - --asmlinkage long sys_rmdir(const char __user *pathname) -+SYSCALL_DEFINE1(rmdir, const char __user *, pathname) - { - return do_rmdir(AT_FDCWD, pathname); - } -@@ -2282,7 +2282,7 @@ slashes: - goto exit2; - } - --asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag) -+SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag) - { - if ((flag & ~AT_REMOVEDIR) != 0) - return -EINVAL; -@@ -2293,7 +2293,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag) - return do_unlinkat(dfd, pathname); - } - --asmlinkage long sys_unlink(const char __user *pathname) -+SYSCALL_DEFINE1(unlink, const char __user *, pathname) - { - return do_unlinkat(AT_FDCWD, pathname); - } -@@ -2319,8 +2319,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) - return error; - } - --asmlinkage long sys_symlinkat(const char __user *oldname, -- int newdfd, const char __user *newname) -+SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, -+ int, newdfd, const char __user *, newname) - { - int error; - char *from; -@@ -2357,7 +2357,7 @@ out_putname: - return error; - } - --asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname) -+SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname) - { - return sys_symlinkat(oldname, AT_FDCWD, newname); - } -@@ -2409,9 +2409,8 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de - * with linux 2.0, and to avoid hard-linking to directories - * and other special files. --ADM - */ --asmlinkage long sys_linkat(int olddfd, const char __user *oldname, -- int newdfd, const char __user *newname, -- int flags) -+SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, -+ int, newdfd, const char __user *, newname, int, flags) - { - struct dentry *new_dentry; - struct nameidata nd; -@@ -2456,7 +2455,7 @@ out: - return error; - } - --asmlinkage long sys_link(const char __user *oldname, const char __user *newname) -+SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname) - { - return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); - } -@@ -2607,8 +2606,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - return error; - } - --asmlinkage long sys_renameat(int olddfd, const char __user *oldname, -- int newdfd, const char __user *newname) -+SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, -+ int, newdfd, const char __user *, newname) - { - struct dentry *old_dir, *new_dir; - struct dentry *old_dentry, *new_dentry; -@@ -2696,7 +2695,7 @@ exit: - return error; - } - --asmlinkage long sys_rename(const char __user *oldname, const char __user *newname) -+SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname) - { - return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); - } -@@ -2786,18 +2785,23 @@ void page_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) - } - } - --int __page_symlink(struct inode *inode, const char *symname, int len, -- gfp_t gfp_mask) -+/* -+ * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS -+ */ -+int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) - { - struct address_space *mapping = inode->i_mapping; - struct page *page; - void *fsdata; - int err; - char *kaddr; -+ unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE; -+ if (nofs) -+ flags |= AOP_FLAG_NOFS; - - retry: - err = pagecache_write_begin(NULL, mapping, 0, len-1, -- AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); -+ flags, &page, &fsdata); - if (err) - goto fail; - -@@ -2821,7 +2825,7 @@ fail: - int page_symlink(struct inode *inode, const char *symname, int len) - { - return __page_symlink(inode, symname, len, -- mapping_gfp_mask(inode->i_mapping)); -+ !(mapping_gfp_mask(inode->i_mapping) & __GFP_FS)); - } - - const struct inode_operations page_symlink_inode_operations = { -diff --git a/fs/namespace.c b/fs/namespace.c -index 65b3dc8..ff3258b 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1128,7 +1128,7 @@ static int do_umount(struct vfsmount *mnt, int flags) - * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD - */ - --asmlinkage long sys_umount(char __user * name, int flags) -+SYSCALL_DEFINE2(umount, char __user *, name, int, flags) - { - struct path path; - int retval; -@@ -1160,7 +1160,7 @@ out: - /* - * The 2.0 compatible umount. No flags. - */ --asmlinkage long sys_oldumount(char __user * name) -+SYSCALL_DEFINE1(oldumount, char __user *, name) - { - return sys_umount(name, 0); - } -@@ -2045,9 +2045,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, - return new_ns; - } - --asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, -- char __user * type, unsigned long flags, -- void __user * data) -+SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, -+ char __user *, type, unsigned long, flags, void __user *, data) - { - int retval; - unsigned long data_page; -@@ -2172,8 +2171,8 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root) - * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root - * first. - */ --asmlinkage long sys_pivot_root(const char __user * new_root, -- const char __user * put_old) -+SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, -+ const char __user *, put_old) - { - struct vfsmount *tmp; - struct path new, old, parent_path, root_parent, root; -diff --git a/fs/nfs/file.c b/fs/nfs/file.c -index d319b49..90f292b 100644 ---- a/fs/nfs/file.c -+++ b/fs/nfs/file.c -@@ -354,7 +354,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, - file->f_path.dentry->d_name.name, - mapping->host->i_ino, len, (long long) pos); - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -diff --git a/fs/nfs/read.c b/fs/nfs/read.c -index 40d1798..f856004 100644 ---- a/fs/nfs/read.c -+++ b/fs/nfs/read.c -@@ -533,12 +533,6 @@ readpage_async_filler(void *data, struct page *page) - unsigned int len; - int error; - -- error = nfs_wb_page(inode, page); -- if (error) -- goto out_unlock; -- if (PageUptodate(page)) -- goto out_unlock; -- - len = nfs_page_length(page); - if (len == 0) - return nfs_return_empty_page(page); -diff --git a/fs/nfsctl.c b/fs/nfsctl.c -index aed8145..bf2cbd9 100644 ---- a/fs/nfsctl.c -+++ b/fs/nfsctl.c -@@ -82,8 +82,8 @@ static struct { - }, - }; - --long --asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res) -+SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg, -+ void __user *, res) - { - struct file *file; - void __user *p = &arg->u; -diff --git a/fs/open.c b/fs/open.c -index 83cdb9d..ef64264 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -122,7 +122,7 @@ static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf) - return 0; - } - --asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf) -+SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf) - { - struct path path; - int error; -@@ -138,8 +138,7 @@ asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * b - return error; - } - -- --asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf) -+SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf) - { - struct path path; - long error; -@@ -157,8 +156,7 @@ asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct stat - return error; - } - -- --asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf) -+SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf) - { - struct file * file; - struct statfs tmp; -@@ -176,7 +174,7 @@ out: - return error; - } - --asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf) -+SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf) - { - struct file * file; - struct statfs64 tmp; -@@ -287,7 +285,7 @@ out: - return error; - } - --asmlinkage long sys_truncate(const char __user * path, unsigned long length) -+SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length) - { - /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ - return do_sys_truncate(path, (long)length); -@@ -336,7 +334,7 @@ out: - return error; - } - --asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) -+SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) - { - long ret = do_sys_ftruncate(fd, length, 1); - /* avoid REGPARM breakage on x86: */ -@@ -346,21 +344,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) - - /* LFS versions of truncate are only needed on 32 bit machines */ - #if BITS_PER_LONG == 32 --asmlinkage long sys_truncate64(const char __user * path, loff_t length) -+SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) - { - return do_sys_truncate(path, length); - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_truncate64(long path, loff_t length) -+{ -+ return SYSC_truncate64((const char __user *) path, length); -+} -+SYSCALL_ALIAS(sys_truncate64, SyS_truncate64); -+#endif - --asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) -+SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length) - { - long ret = do_sys_ftruncate(fd, length, 0); - /* avoid REGPARM breakage on x86: */ - asmlinkage_protect(2, ret, fd, length); - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_ftruncate64(long fd, loff_t length) -+{ -+ return SYSC_ftruncate64((unsigned int) fd, length); -+} -+SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64); - #endif -+#endif /* BITS_PER_LONG == 32 */ - --asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len) -+SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) - { - struct file *file; - struct inode *inode; -@@ -417,13 +429,20 @@ out_fput: - out: - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len) -+{ -+ return SYSC_fallocate((int)fd, (int)mode, offset, len); -+} -+SYSCALL_ALIAS(sys_fallocate, SyS_fallocate); -+#endif - - /* - * access() needs to use the real uid/gid, not the effective uid/gid. - * We do this by temporarily clearing all FS-related capabilities and - * switching the fsuid/fsgid around to the real ones. - */ --asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) -+SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode) - { - struct path path; - struct inode *inode; -@@ -503,12 +522,12 @@ out: - return res; - } - --asmlinkage long sys_access(const char __user *filename, int mode) -+SYSCALL_DEFINE2(access, const char __user *, filename, int, mode) - { - return sys_faccessat(AT_FDCWD, filename, mode); - } - --asmlinkage long sys_chdir(const char __user * filename) -+SYSCALL_DEFINE1(chdir, const char __user *, filename) - { - struct path path; - int error; -@@ -529,7 +548,7 @@ out: - return error; - } - --asmlinkage long sys_fchdir(unsigned int fd) -+SYSCALL_DEFINE1(fchdir, unsigned int, fd) - { - struct file *file; - struct inode *inode; -@@ -555,7 +574,7 @@ out: - return error; - } - --asmlinkage long sys_chroot(const char __user * filename) -+SYSCALL_DEFINE1(chroot, const char __user *, filename) - { - struct path path; - int error; -@@ -580,7 +599,7 @@ out: - return error; - } - --asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) -+SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) - { - struct inode * inode; - struct dentry * dentry; -@@ -614,8 +633,7 @@ out: - return err; - } - --asmlinkage long sys_fchmodat(int dfd, const char __user *filename, -- mode_t mode) -+SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) - { - struct path path; - struct inode *inode; -@@ -644,7 +662,7 @@ out: - return error; - } - --asmlinkage long sys_chmod(const char __user *filename, mode_t mode) -+SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode) - { - return sys_fchmodat(AT_FDCWD, filename, mode); - } -@@ -674,7 +692,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group) - return error; - } - --asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group) -+SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group) - { - struct path path; - int error; -@@ -693,8 +711,8 @@ out: - return error; - } - --asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, -- gid_t group, int flag) -+SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, -+ gid_t, group, int, flag) - { - struct path path; - int error = -EINVAL; -@@ -718,7 +736,7 @@ out: - return error; - } - --asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group) -+SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group) - { - struct path path; - int error; -@@ -737,8 +755,7 @@ out: - return error; - } - -- --asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group) -+SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) - { - struct file * file; - int error = -EBADF; -@@ -1029,7 +1046,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode) - return fd; - } - --asmlinkage long sys_open(const char __user *filename, int flags, int mode) -+SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) - { - long ret; - -@@ -1042,8 +1059,8 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode) - return ret; - } - --asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, -- int mode) -+SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, -+ int, mode) - { - long ret; - -@@ -1062,7 +1079,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, - * For backward compatibility? Maybe this should be moved - * into arch/i386 instead? - */ --asmlinkage long sys_creat(const char __user * pathname, int mode) -+SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode) - { - return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); - } -@@ -1098,7 +1115,7 @@ EXPORT_SYMBOL(filp_close); - * releasing the fd. This ensures that one clone task can't release - * an fd while another clone is opening it. - */ --asmlinkage long sys_close(unsigned int fd) -+SYSCALL_DEFINE1(close, unsigned int, fd) - { - struct file * filp; - struct files_struct *files = current->files; -@@ -1131,14 +1148,13 @@ out_unlock: - spin_unlock(&files->file_lock); - return -EBADF; - } -- - EXPORT_SYMBOL(sys_close); - - /* - * This routine simulates a hangup on the tty, to arrange that users - * are given clean terminals at login time. - */ --asmlinkage long sys_vhangup(void) -+SYSCALL_DEFINE0(vhangup) - { - if (capable(CAP_SYS_TTY_CONFIG)) { - tty_vhangup_self(); -diff --git a/fs/pipe.c b/fs/pipe.c -index 7aea8b8..47b34d2 100644 ---- a/fs/pipe.c -+++ b/fs/pipe.c -@@ -1048,7 +1048,7 @@ int do_pipe(int *fd) - * sys_pipe() is the normal C calling standard for creating - * a pipe. It's not the way Unix traditionally does this, though. - */ --asmlinkage long __weak sys_pipe2(int __user *fildes, int flags) -+SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags) - { - int fd[2]; - int error; -@@ -1064,7 +1064,7 @@ asmlinkage long __weak sys_pipe2(int __user *fildes, int flags) - return error; - } - --asmlinkage long __weak sys_pipe(int __user *fildes) -+SYSCALL_DEFINE1(pipe, int __user *, fildes) - { - return sys_pipe2(fildes, 0); - } -diff --git a/fs/quota.c b/fs/quota.c -index 7f4386e..e9851af 100644 ---- a/fs/quota.c -+++ b/fs/quota.c -@@ -368,7 +368,8 @@ static inline struct super_block *quotactl_block(const char __user *special) - * calls. Maybe we need to add the process quotas etc. in the future, - * but we probably should use rlimits for that. - */ --asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr) -+SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, -+ qid_t, id, void __user *, addr) - { - uint cmds, type; - struct super_block *sb = NULL; -diff --git a/fs/read_write.c b/fs/read_write.c -index 969a6d9..b83f306 100644 ---- a/fs/read_write.c -+++ b/fs/read_write.c -@@ -134,7 +134,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin) - } - EXPORT_SYMBOL(vfs_llseek); - --asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin) -+SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin) - { - off_t retval; - struct file * file; -@@ -158,9 +158,9 @@ bad: - } - - #ifdef __ARCH_WANT_SYS_LLSEEK --asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, -- unsigned long offset_low, loff_t __user * result, -- unsigned int origin) -+SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, -+ unsigned long, offset_low, loff_t __user *, result, -+ unsigned int, origin) - { - int retval; - struct file * file; -@@ -356,7 +356,7 @@ static inline void file_pos_write(struct file *file, loff_t pos) - file->f_pos = pos; - } - --asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) -+SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -373,7 +373,8 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) - return ret; - } - --asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) -+SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, -+ size_t, count) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -390,8 +391,8 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co - return ret; - } - --asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, -- size_t count, loff_t pos) -+SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf, -+ size_t count, loff_t pos) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -410,9 +411,17 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, - - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos) -+{ -+ return SYSC_pread64((unsigned int) fd, (char __user *) buf, -+ (size_t) count, pos); -+} -+SYSCALL_ALIAS(sys_pread64, SyS_pread64); -+#endif - --asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, -- size_t count, loff_t pos) -+SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf, -+ size_t count, loff_t pos) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -431,6 +440,14 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, - - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos) -+{ -+ return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf, -+ (size_t) count, pos); -+} -+SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64); -+#endif - - /* - * Reduce an iovec's length in-place. Return the resulting number of segments -@@ -659,8 +676,8 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec, - - EXPORT_SYMBOL(vfs_writev); - --asmlinkage ssize_t --sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) -+SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, -+ unsigned long, vlen) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -680,8 +697,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) - return ret; - } - --asmlinkage ssize_t --sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) -+SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, -+ unsigned long, vlen) - { - struct file *file; - ssize_t ret = -EBADF; -@@ -799,7 +816,7 @@ out: - return retval; - } - --asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) -+SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count) - { - loff_t pos; - off_t off; -@@ -818,7 +835,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz - return do_sendfile(out_fd, in_fd, NULL, count, 0); - } - --asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) -+SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count) - { - loff_t pos; - ssize_t ret; -diff --git a/fs/readdir.c b/fs/readdir.c -index b318d9b..7723401 100644 ---- a/fs/readdir.c -+++ b/fs/readdir.c -@@ -102,7 +102,8 @@ efault: - return -EFAULT; - } - --asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * dirent, unsigned int count) -+SYSCALL_DEFINE3(old_readdir, unsigned int, fd, -+ struct old_linux_dirent __user *, dirent, unsigned int, count) - { - int error; - struct file * file; -@@ -187,7 +188,8 @@ efault: - return -EFAULT; - } - --asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) -+SYSCALL_DEFINE3(getdents, unsigned int, fd, -+ struct linux_dirent __user *, dirent, unsigned int, count) - { - struct file * file; - struct linux_dirent __user * lastdirent; -@@ -268,7 +270,8 @@ efault: - return -EFAULT; - } - --asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) -+SYSCALL_DEFINE3(getdents64, unsigned int, fd, -+ struct linux_dirent64 __user *, dirent, unsigned int, count) - { - struct file * file; - struct linux_dirent64 __user * lastdirent; -diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c -index 6c4c2c6..8a6bfb4 100644 ---- a/fs/reiserfs/inode.c -+++ b/fs/reiserfs/inode.c -@@ -2556,7 +2556,7 @@ static int reiserfs_write_begin(struct file *file, - } - - index = pos >> PAGE_CACHE_SHIFT; -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (!page) - return -ENOMEM; - *pagep = page; -diff --git a/fs/select.c b/fs/select.c -index 87df51e..b140f90 100644 ---- a/fs/select.c -+++ b/fs/select.c -@@ -507,8 +507,8 @@ out_nofds: - return ret; - } - --asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, -- fd_set __user *exp, struct timeval __user *tvp) -+SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, -+ fd_set __user *, exp, struct timeval __user *, tvp) - { - struct timespec end_time, *to = NULL; - struct timeval tv; -@@ -532,9 +532,9 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, - } - - #ifdef HAVE_SET_RESTORE_SIGMASK --asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, -- fd_set __user *exp, struct timespec __user *tsp, -- const sigset_t __user *sigmask, size_t sigsetsize) -+static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp, -+ fd_set __user *exp, struct timespec __user *tsp, -+ const sigset_t __user *sigmask, size_t sigsetsize) - { - sigset_t ksigmask, sigsaved; - struct timespec ts, end_time, *to = NULL; -@@ -560,7 +560,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, - sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); - } - -- ret = core_sys_select(n, inp, outp, exp, &end_time); -+ ret = core_sys_select(n, inp, outp, exp, to); - ret = poll_select_copy_remaining(&end_time, tsp, 0, ret); - - if (ret == -ERESTARTNOHAND) { -@@ -586,8 +586,9 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, - * which has a pointer to the sigset_t itself followed by a size_t containing - * the sigset size. - */ --asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, -- fd_set __user *exp, struct timespec __user *tsp, void __user *sig) -+SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp, -+ fd_set __user *, exp, struct timespec __user *, tsp, -+ void __user *, sig) - { - size_t sigsetsize = 0; - sigset_t __user *up = NULL; -@@ -600,7 +601,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, - return -EFAULT; - } - -- return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize); -+ return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize); - } - #endif /* HAVE_SET_RESTORE_SIGMASK */ - -@@ -806,8 +807,8 @@ static long do_restart_poll(struct restart_block *restart_block) - return ret; - } - --asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, -- long timeout_msecs) -+SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, -+ long, timeout_msecs) - { - struct timespec end_time, *to = NULL; - int ret; -@@ -841,9 +842,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, - } - - #ifdef HAVE_SET_RESTORE_SIGMASK --asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, -- struct timespec __user *tsp, const sigset_t __user *sigmask, -- size_t sigsetsize) -+SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds, -+ struct timespec __user *, tsp, const sigset_t __user *, sigmask, -+ size_t, sigsetsize) - { - sigset_t ksigmask, sigsaved; - struct timespec ts, end_time, *to = NULL; -diff --git a/fs/signalfd.c b/fs/signalfd.c -index 9c39bc7..b07565c 100644 ---- a/fs/signalfd.c -+++ b/fs/signalfd.c -@@ -205,8 +205,8 @@ static const struct file_operations signalfd_fops = { - .read = signalfd_read, - }; - --asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, -- size_t sizemask, int flags) -+SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask, -+ size_t, sizemask, int, flags) - { - sigset_t sigmask; - struct signalfd_ctx *ctx; -@@ -259,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, - return ufd; - } - --asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, -- size_t sizemask) -+SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask, -+ size_t, sizemask) - { - return sys_signalfd4(ufd, user_mask, sizemask, 0); - } -diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c -index e4f8d51..92d5e8f 100644 ---- a/fs/smbfs/file.c -+++ b/fs/smbfs/file.c -@@ -297,7 +297,7 @@ static int smb_write_begin(struct file *file, struct address_space *mapping, - struct page **pagep, void **fsdata) - { - pgoff_t index = pos >> PAGE_CACHE_SHIFT; -- *pagep = __grab_cache_page(mapping, index); -+ *pagep = grab_cache_page_write_begin(mapping, index, flags); - if (!*pagep) - return -ENOMEM; - return 0; -diff --git a/fs/splice.c b/fs/splice.c -index 1abab5c..1eaef06 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1434,8 +1434,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, - * Currently we punt and implement it as a normal copy, see pipe_to_user(). - * - */ --asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, -- unsigned long nr_segs, unsigned int flags) -+SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov, -+ unsigned long, nr_segs, unsigned int, flags) - { - struct file *file; - long error; -@@ -1460,9 +1460,9 @@ asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, - return error; - } - --asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, -- int fd_out, loff_t __user *off_out, -- size_t len, unsigned int flags) -+SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in, -+ int, fd_out, loff_t __user *, off_out, -+ size_t, len, unsigned int, flags) - { - long error; - struct file *in, *out; -@@ -1684,7 +1684,7 @@ static long do_tee(struct file *in, struct file *out, size_t len, - return ret; - } - --asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags) -+SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags) - { - struct file *in; - int error, fput_in; -diff --git a/fs/stat.c b/fs/stat.c -index 7c46fbe..4bd85da 100644 ---- a/fs/stat.c -+++ b/fs/stat.c -@@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; - } - --asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) -+SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_stat_fd(AT_FDCWD, filename, &stat); -@@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user - - return error; - } --asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) -+ -+SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); -@@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use - - return error; - } --asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) -+ -+SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_fstat(fd, &stat); -@@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; - } - --asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) -+SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_stat_fd(AT_FDCWD, filename, &stat); -@@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) - return error; - } - --asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) -+SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); -@@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) - } - - #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) --asmlinkage long sys_newfstatat(int dfd, char __user *filename, -- struct stat __user *statbuf, int flag) -+SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename, -+ struct stat __user *, statbuf, int, flag) - { - struct kstat stat; - int error = -EINVAL; -@@ -280,7 +282,7 @@ out: - } - #endif - --asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) -+SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf) - { - struct kstat stat; - int error = vfs_fstat(fd, &stat); -@@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) - return error; - } - --asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, -- char __user *buf, int bufsiz) -+SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, -+ char __user *, buf, int, bufsiz) - { - struct path path; - int error; -@@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, - return error; - } - --asmlinkage long sys_readlink(const char __user *path, char __user *buf, -- int bufsiz) -+SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf, -+ int, bufsiz) - { - return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); - } -@@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; - } - --asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf) -+SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf) - { - struct kstat stat; - int error = vfs_stat(filename, &stat); -@@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu - - return error; - } --asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf) -+ -+SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf) - { - struct kstat stat; - int error = vfs_lstat(filename, &stat); -@@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb - - return error; - } --asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) -+ -+SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf) - { - struct kstat stat; - int error = vfs_fstat(fd, &stat); -@@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) - return error; - } - --asmlinkage long sys_fstatat64(int dfd, char __user *filename, -- struct stat64 __user *statbuf, int flag) -+SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, -+ struct stat64 __user *, statbuf, int, flag) - { - struct kstat stat; - int error = -EINVAL; -diff --git a/fs/super.c b/fs/super.c -index 400a760..f7d4bd6 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -534,7 +534,7 @@ rescan: - return NULL; - } - --asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) -+SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf) - { - struct super_block *s; - struct ustat tmp; -diff --git a/fs/sync.c b/fs/sync.c -index 2967562..6cc8cb4 100644 ---- a/fs/sync.c -+++ b/fs/sync.c -@@ -36,7 +36,7 @@ static void do_sync(unsigned long wait) - laptop_sync_completion(); - } - --asmlinkage long sys_sync(void) -+SYSCALL_DEFINE0(sync) - { - do_sync(1); - return 0; -@@ -118,12 +118,12 @@ static long __do_fsync(unsigned int fd, int datasync) - return ret; - } - --asmlinkage long sys_fsync(unsigned int fd) -+SYSCALL_DEFINE1(fsync, unsigned int, fd) - { - return __do_fsync(fd, 0); - } - --asmlinkage long sys_fdatasync(unsigned int fd) -+SYSCALL_DEFINE1(fdatasync, unsigned int, fd) - { - return __do_fsync(fd, 1); - } -@@ -175,8 +175,8 @@ asmlinkage long sys_fdatasync(unsigned int fd) - * already-instantiated disk blocks, there are no guarantees here that the data - * will be available after a crash. - */ --asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, -- unsigned int flags) -+SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, -+ unsigned int flags) - { - int ret; - struct file *file; -@@ -236,14 +236,32 @@ out_put: - out: - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes, -+ long flags) -+{ -+ return SYSC_sync_file_range((int) fd, offset, nbytes, -+ (unsigned int) flags); -+} -+SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range); -+#endif - - /* It would be nice if people remember that not all the world's an i386 - when they introduce new system calls */ --asmlinkage long sys_sync_file_range2(int fd, unsigned int flags, -- loff_t offset, loff_t nbytes) -+SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags, -+ loff_t offset, loff_t nbytes) - { - return sys_sync_file_range(fd, offset, nbytes, flags); - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_sync_file_range2(long fd, long flags, -+ loff_t offset, loff_t nbytes) -+{ -+ return SYSC_sync_file_range2((int) fd, (unsigned int) flags, -+ offset, nbytes); -+} -+SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2); -+#endif - - /* - * `endbyte' is inclusive -diff --git a/fs/timerfd.c b/fs/timerfd.c -index 0862f0e..6a123b8 100644 ---- a/fs/timerfd.c -+++ b/fs/timerfd.c -@@ -177,7 +177,7 @@ static struct file *timerfd_fget(int fd) - return file; - } - --asmlinkage long sys_timerfd_create(int clockid, int flags) -+SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) - { - int ufd; - struct timerfd_ctx *ctx; -@@ -208,9 +208,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) - return ufd; - } - --asmlinkage long sys_timerfd_settime(int ufd, int flags, -- const struct itimerspec __user *utmr, -- struct itimerspec __user *otmr) -+SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, -+ const struct itimerspec __user *, utmr, -+ struct itimerspec __user *, otmr) - { - struct file *file; - struct timerfd_ctx *ctx; -@@ -265,7 +265,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags, - return 0; - } - --asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr) -+SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) - { - struct file *file; - struct timerfd_ctx *ctx; -diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c -index 2624411..b1496f5 100644 ---- a/fs/ubifs/file.c -+++ b/fs/ubifs/file.c -@@ -219,7 +219,8 @@ static void release_existing_page_budget(struct ubifs_info *c) - } - - static int write_begin_slow(struct address_space *mapping, -- loff_t pos, unsigned len, struct page **pagep) -+ loff_t pos, unsigned len, struct page **pagep, -+ unsigned flags) - { - struct inode *inode = mapping->host; - struct ubifs_info *c = inode->i_sb->s_fs_info; -@@ -247,7 +248,7 @@ static int write_begin_slow(struct address_space *mapping, - if (unlikely(err)) - return err; - -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (unlikely(!page)) { - ubifs_release_budget(c, &req); - return -ENOMEM; -@@ -438,7 +439,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping, - return -EROFS; - - /* Try out the fast-path part first */ -- page = __grab_cache_page(mapping, index); -+ page = grab_cache_page_write_begin(mapping, index, flags); - if (unlikely(!page)) - return -ENOMEM; - -@@ -483,7 +484,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping, - unlock_page(page); - page_cache_release(page); - -- return write_begin_slow(mapping, pos, len, pagep); -+ return write_begin_slow(mapping, pos, len, pagep, flags); - } - - /* -diff --git a/fs/utimes.c b/fs/utimes.c -index 6929e3e..e4c75db 100644 ---- a/fs/utimes.c -+++ b/fs/utimes.c -@@ -24,7 +24,7 @@ - * must be owner or have write permission. - * Else, update from *times, must be owner or super user. - */ --asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) -+SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times) - { - struct timespec tv[2]; - -@@ -170,7 +170,8 @@ out: - return error; - } - --asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags) -+SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename, -+ struct timespec __user *, utimes, int, flags) - { - struct timespec tstimes[2]; - -@@ -187,7 +188,8 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __ - return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); - } - --asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes) -+SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename, -+ struct timeval __user *, utimes) - { - struct timeval times[2]; - struct timespec tstimes[2]; -@@ -214,7 +216,8 @@ asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __u - return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0); - } - --asmlinkage long sys_utimes(char __user *filename, struct timeval __user *utimes) -+SYSCALL_DEFINE2(utimes, char __user *, filename, -+ struct timeval __user *, utimes) - { - return sys_futimesat(AT_FDCWD, filename, utimes); - } -diff --git a/fs/xattr.c b/fs/xattr.c -index 468377e..086db06 100644 ---- a/fs/xattr.c -+++ b/fs/xattr.c -@@ -251,9 +251,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, - return error; - } - --asmlinkage long --sys_setxattr(const char __user *pathname, const char __user *name, -- const void __user *value, size_t size, int flags) -+SYSCALL_DEFINE5(setxattr, const char __user *, pathname, -+ const char __user *, name, const void __user *, value, -+ size_t, size, int, flags) - { - struct path path; - int error; -@@ -270,9 +270,9 @@ sys_setxattr(const char __user *pathname, const char __user *name, - return error; - } - --asmlinkage long --sys_lsetxattr(const char __user *pathname, const char __user *name, -- const void __user *value, size_t size, int flags) -+SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname, -+ const char __user *, name, const void __user *, value, -+ size_t, size, int, flags) - { - struct path path; - int error; -@@ -289,9 +289,8 @@ sys_lsetxattr(const char __user *pathname, const char __user *name, - return error; - } - --asmlinkage long --sys_fsetxattr(int fd, const char __user *name, const void __user *value, -- size_t size, int flags) -+SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, -+ const void __user *,value, size_t, size, int, flags) - { - struct file *f; - struct dentry *dentry; -@@ -349,9 +348,8 @@ getxattr(struct dentry *d, const char __user *name, void __user *value, - return error; - } - --asmlinkage ssize_t --sys_getxattr(const char __user *pathname, const char __user *name, -- void __user *value, size_t size) -+SYSCALL_DEFINE4(getxattr, const char __user *, pathname, -+ const char __user *, name, void __user *, value, size_t, size) - { - struct path path; - ssize_t error; -@@ -364,9 +362,8 @@ sys_getxattr(const char __user *pathname, const char __user *name, - return error; - } - --asmlinkage ssize_t --sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, -- size_t size) -+SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname, -+ const char __user *, name, void __user *, value, size_t, size) - { - struct path path; - ssize_t error; -@@ -379,8 +376,8 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user - return error; - } - --asmlinkage ssize_t --sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) -+SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, -+ void __user *, value, size_t, size) - { - struct file *f; - ssize_t error = -EBADF; -@@ -424,8 +421,8 @@ listxattr(struct dentry *d, char __user *list, size_t size) - return error; - } - --asmlinkage ssize_t --sys_listxattr(const char __user *pathname, char __user *list, size_t size) -+SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list, -+ size_t, size) - { - struct path path; - ssize_t error; -@@ -438,8 +435,8 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size) - return error; - } - --asmlinkage ssize_t --sys_llistxattr(const char __user *pathname, char __user *list, size_t size) -+SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list, -+ size_t, size) - { - struct path path; - ssize_t error; -@@ -452,8 +449,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size) - return error; - } - --asmlinkage ssize_t --sys_flistxattr(int fd, char __user *list, size_t size) -+SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) - { - struct file *f; - ssize_t error = -EBADF; -@@ -485,8 +481,8 @@ removexattr(struct dentry *d, const char __user *name) - return vfs_removexattr(d, kname); - } - --asmlinkage long --sys_removexattr(const char __user *pathname, const char __user *name) -+SYSCALL_DEFINE2(removexattr, const char __user *, pathname, -+ const char __user *, name) - { - struct path path; - int error; -@@ -503,8 +499,8 @@ sys_removexattr(const char __user *pathname, const char __user *name) - return error; - } - --asmlinkage long --sys_lremovexattr(const char __user *pathname, const char __user *name) -+SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname, -+ const char __user *, name) - { - struct path path; - int error; -@@ -521,8 +517,7 @@ sys_lremovexattr(const char __user *pathname, const char __user *name) - return error; - } - --asmlinkage long --sys_fremovexattr(int fd, const char __user *name) -+SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) - { - struct file *f; - struct dentry *dentry; -diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c -index e2fa0a1..e1f0a06 100644 ---- a/fs/xfs/xfs_dir2_block.c -+++ b/fs/xfs/xfs_dir2_block.c -@@ -517,9 +517,9 @@ xfs_dir2_block_getdents( - /* - * If it didn't fit, set the final offset to here & return. - */ -- if (filldir(dirent, dep->name, dep->namelen, cook, -+ if (filldir(dirent, dep->name, dep->namelen, cook & 0x7fffffff, - ino, DT_UNKNOWN)) { -- *offset = cook; -+ *offset = cook & 0x7fffffff; - xfs_da_brelse(NULL, bp); - return 0; - } -@@ -529,7 +529,8 @@ xfs_dir2_block_getdents( - * Reached the end of the block. - * Set the offset to a non-existent block 1 and return. - */ -- *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); -+ *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) & -+ 0x7fffffff; - xfs_da_brelse(NULL, bp); - return 0; - } -diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c -index 9353599..ef805a3 100644 ---- a/fs/xfs/xfs_dir2_leaf.c -+++ b/fs/xfs/xfs_dir2_leaf.c -@@ -1092,7 +1092,7 @@ xfs_dir2_leaf_getdents( - * Won't fit. Return to caller. - */ - if (filldir(dirent, dep->name, dep->namelen, -- xfs_dir2_byte_to_dataptr(mp, curoff), -+ xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff, - ino, DT_UNKNOWN)) - break; - -@@ -1108,9 +1108,9 @@ xfs_dir2_leaf_getdents( - * All done. Set output offset value to current offset. - */ - if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) -- *offset = XFS_DIR2_MAX_DATAPTR; -+ *offset = XFS_DIR2_MAX_DATAPTR & 0x7fffffff; - else -- *offset = xfs_dir2_byte_to_dataptr(mp, curoff); -+ *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff; - kmem_free(map); - if (bp) - xfs_da_brelse(NULL, bp); -diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c -index b46af00..a8a8a6e 100644 ---- a/fs/xfs/xfs_dir2_sf.c -+++ b/fs/xfs/xfs_dir2_sf.c -@@ -752,8 +752,8 @@ xfs_dir2_sf_getdents( - #if XFS_BIG_INUMS - ino += mp->m_inoadd; - #endif -- if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) { -- *offset = dot_offset; -+ if (filldir(dirent, ".", 1, dot_offset & 0x7fffffff, ino, DT_DIR)) { -+ *offset = dot_offset & 0x7fffffff; - return 0; - } - } -@@ -766,8 +766,8 @@ xfs_dir2_sf_getdents( - #if XFS_BIG_INUMS - ino += mp->m_inoadd; - #endif -- if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) { -- *offset = dotdot_offset; -+ if (filldir(dirent, "..", 2, dotdot_offset & 0x7fffffff, ino, DT_DIR)) { -+ *offset = dotdot_offset & 0x7fffffff; - return 0; - } - } -@@ -791,14 +791,15 @@ xfs_dir2_sf_getdents( - #endif - - if (filldir(dirent, sfep->name, sfep->namelen, -- off, ino, DT_UNKNOWN)) { -- *offset = off; -+ off & 0x7fffffff, ino, DT_UNKNOWN)) { -+ *offset = off & 0x7fffffff; - return 0; - } - sfep = xfs_dir2_sf_nextentry(sfp, sfep); - } - -- *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); -+ *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) & -+ 0x7fffffff; - return 0; - } - -diff --git a/include/linux/compat.h b/include/linux/compat.h -index e88f3ec..3fd2194 100644 ---- a/include/linux/compat.h -+++ b/include/linux/compat.h -@@ -280,5 +280,18 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, - asmlinkage long compat_sys_timerfd_gettime(int ufd, - struct compat_itimerspec __user *otmr); - -+asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, -+ __u32 __user *pages, -+ const int __user *nodes, -+ int __user *status, -+ int flags); -+asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, -+ struct compat_timeval __user *t); -+asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, -+ struct compat_stat __user *statbuf, -+ int flag); -+asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, -+ int flags, int mode); -+ - #endif /* CONFIG_COMPAT */ - #endif /* _LINUX_COMPAT_H */ -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 4a853ef..efeff3d 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -414,6 +414,9 @@ enum positive_aop_returns { - - #define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ - #define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ -+#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct -+ * helper code (eg buffer layer) -+ * to clear GFP_FS from alloc */ - - /* - * oh the beauties of C type declarations. -@@ -2023,7 +2026,7 @@ extern int page_readlink(struct dentry *, char __user *, int); - extern void *page_follow_link_light(struct dentry *, struct nameidata *); - extern void page_put_link(struct dentry *, struct nameidata *, void *); - extern int __page_symlink(struct inode *inode, const char *symname, int len, -- gfp_t gfp_mask); -+ int nofs); - extern int page_symlink(struct inode *inode, const char *symname, int len); - extern const struct inode_operations page_symlink_inode_operations; - extern int generic_readlink(struct dentry *, char __user *, int); -diff --git a/include/linux/mm.h b/include/linux/mm.h -index ffee2f7..86b836d 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -253,7 +253,6 @@ static inline int put_page_testzero(struct page *page) - */ - static inline int get_page_unless_zero(struct page *page) - { -- VM_BUG_ON(PageTail(page)); - return atomic_inc_not_zero(&page->_count); - } - -diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h -index 709742b..01ca085 100644 ---- a/include/linux/pagemap.h -+++ b/include/linux/pagemap.h -@@ -241,7 +241,8 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, - unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, - int tag, unsigned int nr_pages, struct page **pages); - --struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index); -+struct page *grab_cache_page_write_begin(struct address_space *mapping, -+ pgoff_t index, unsigned flags); - - /* - * Returns locked page at given index in given cache, creating it if needed. -diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h -index a916c66..355f6e8 100644 ---- a/include/linux/radix-tree.h -+++ b/include/linux/radix-tree.h -@@ -136,7 +136,7 @@ do { \ - */ - static inline void *radix_tree_deref_slot(void **pslot) - { -- void *ret = *pslot; -+ void *ret = rcu_dereference(*pslot); - if (unlikely(radix_tree_is_indirect_ptr(ret))) - ret = RADIX_TREE_RETRY; - return ret; -diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h -index 04fb47b..16875f8 100644 ---- a/include/linux/syscalls.h -+++ b/include/linux/syscalls.h -@@ -54,6 +54,7 @@ struct compat_stat; - struct compat_timeval; - struct robust_list_head; - struct getcpu_cache; -+struct old_linux_dirent; - - #include - #include -@@ -65,6 +66,74 @@ struct getcpu_cache; - #include - #include - -+#define __SC_DECL1(t1, a1) t1 a1 -+#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) -+#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) -+#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) -+#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) -+#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) -+ -+#define __SC_LONG1(t1, a1) long a1 -+#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) -+#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) -+#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) -+#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) -+#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) -+ -+#define __SC_CAST1(t1, a1) (t1) a1 -+#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) -+#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) -+#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) -+#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) -+#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) -+ -+#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long)) -+#define __SC_TEST1(t1, a1) __SC_TEST(t1) -+#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__) -+#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__) -+#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__) -+#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) -+#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) -+ -+#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) -+#define SYSCALL_DEFINE1(...) SYSCALL_DEFINEx(1, __VA_ARGS__) -+#define SYSCALL_DEFINE2(...) SYSCALL_DEFINEx(2, __VA_ARGS__) -+#define SYSCALL_DEFINE3(...) SYSCALL_DEFINEx(3, __VA_ARGS__) -+#define SYSCALL_DEFINE4(...) SYSCALL_DEFINEx(4, __VA_ARGS__) -+#define SYSCALL_DEFINE5(...) SYSCALL_DEFINEx(5, __VA_ARGS__) -+#define SYSCALL_DEFINE6(...) SYSCALL_DEFINEx(6, __VA_ARGS__) -+ -+#ifdef CONFIG_PPC64 -+#define SYSCALL_ALIAS(alias, name) \ -+ asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ -+ "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) -+#else -+#define SYSCALL_ALIAS(alias, name) \ -+ asm ("\t.globl " #alias "\n\t.set " #alias ", " #name) -+#endif -+ -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+ -+#define SYSCALL_DEFINE(name) static inline long SYSC_##name -+#define SYSCALL_DEFINEx(x, name, ...) \ -+ asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)); \ -+ static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)); \ -+ asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__)) \ -+ { \ -+ __SC_TEST##x(__VA_ARGS__); \ -+ return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__)); \ -+ } \ -+ SYSCALL_ALIAS(sys_##name, SyS_##name); \ -+ static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)) -+ -+#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ -+ -+#define SYSCALL_DEFINE(name) asmlinkage long sys_##name -+#define SYSCALL_DEFINEx(x, name, ...) \ -+ asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)) -+ -+#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ -+ - asmlinkage long sys_time(time_t __user *tloc); - asmlinkage long sys_stime(time_t __user *tptr); - asmlinkage long sys_gettimeofday(struct timeval __user *tv, -@@ -77,7 +146,7 @@ asmlinkage long sys_times(struct tms __user *tbuf); - - asmlinkage long sys_gettid(void); - asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); --asmlinkage unsigned long sys_alarm(unsigned int seconds); -+asmlinkage long sys_alarm(unsigned int seconds); - asmlinkage long sys_getpid(void); - asmlinkage long sys_getppid(void); - asmlinkage long sys_getuid(void); -@@ -166,7 +235,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, - unsigned long flags); - - asmlinkage long sys_exit(int error_code); --asmlinkage void sys_exit_group(int error_code); -+asmlinkage long sys_exit_group(int error_code); - asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, - int options, struct rusage __user *ru); - asmlinkage long sys_waitid(int which, pid_t pid, -@@ -196,7 +265,7 @@ asmlinkage long sys_tkill(int pid, int sig); - asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo); - asmlinkage long sys_sgetmask(void); - asmlinkage long sys_ssetmask(int newmask); --asmlinkage unsigned long sys_signal(int sig, __sighandler_t handler); -+asmlinkage long sys_signal(int sig, __sighandler_t handler); - asmlinkage long sys_pause(void); - - asmlinkage long sys_sync(void); -@@ -246,29 +315,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name, - const void __user *value, size_t size, int flags); - asmlinkage long sys_fsetxattr(int fd, const char __user *name, - const void __user *value, size_t size, int flags); --asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name, -- void __user *value, size_t size); --asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name, -- void __user *value, size_t size); --asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name, -- void __user *value, size_t size); --asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list, -- size_t size); --asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list, -- size_t size); --asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); -+asmlinkage long sys_getxattr(const char __user *path, const char __user *name, -+ void __user *value, size_t size); -+asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name, -+ void __user *value, size_t size); -+asmlinkage long sys_fgetxattr(int fd, const char __user *name, -+ void __user *value, size_t size); -+asmlinkage long sys_listxattr(const char __user *path, char __user *list, -+ size_t size); -+asmlinkage long sys_llistxattr(const char __user *path, char __user *list, -+ size_t size); -+asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size); - asmlinkage long sys_removexattr(const char __user *path, - const char __user *name); - asmlinkage long sys_lremovexattr(const char __user *path, - const char __user *name); - asmlinkage long sys_fremovexattr(int fd, const char __user *name); - --asmlinkage unsigned long sys_brk(unsigned long brk); -+asmlinkage long sys_brk(unsigned long brk); - asmlinkage long sys_mprotect(unsigned long start, size_t len, - unsigned long prot); --asmlinkage unsigned long sys_mremap(unsigned long addr, -- unsigned long old_len, unsigned long new_len, -- unsigned long flags, unsigned long new_addr); -+asmlinkage long sys_mremap(unsigned long addr, -+ unsigned long old_len, unsigned long new_len, -+ unsigned long flags, unsigned long new_addr); - asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, - unsigned long prot, unsigned long pgoff, - unsigned long flags); -@@ -321,10 +390,10 @@ asmlinkage long sys_io_submit(aio_context_t, long, - struct iocb __user * __user *); - asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, - struct io_event __user *result); --asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, -- off_t __user *offset, size_t count); --asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, -- loff_t __user *offset, size_t count); -+asmlinkage long sys_sendfile(int out_fd, int in_fd, -+ off_t __user *offset, size_t count); -+asmlinkage long sys_sendfile64(int out_fd, int in_fd, -+ loff_t __user *offset, size_t count); - asmlinkage long sys_readlink(const char __user *path, - char __user *buf, int bufsiz); - asmlinkage long sys_creat(const char __user *pathname, int mode); -@@ -368,26 +437,25 @@ asmlinkage long sys_utime(char __user *filename, - struct utimbuf __user *times); - asmlinkage long sys_utimes(char __user *filename, - struct timeval __user *utimes); --asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, -- unsigned int origin); -+asmlinkage long sys_lseek(unsigned int fd, off_t offset, -+ unsigned int origin); - asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, - unsigned long offset_low, loff_t __user *result, - unsigned int origin); --asmlinkage ssize_t sys_read(unsigned int fd, char __user *buf, -- size_t count); --asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); --asmlinkage ssize_t sys_readv(unsigned long fd, -- const struct iovec __user *vec, -- unsigned long vlen); --asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf, -- size_t count); --asmlinkage ssize_t sys_writev(unsigned long fd, -- const struct iovec __user *vec, -- unsigned long vlen); --asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, -- size_t count, loff_t pos); --asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, -- size_t count, loff_t pos); -+asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count); -+asmlinkage long sys_readahead(int fd, loff_t offset, size_t count); -+asmlinkage long sys_readv(unsigned long fd, -+ const struct iovec __user *vec, -+ unsigned long vlen); -+asmlinkage long sys_write(unsigned int fd, const char __user *buf, -+ size_t count); -+asmlinkage long sys_writev(unsigned long fd, -+ const struct iovec __user *vec, -+ unsigned long vlen); -+asmlinkage long sys_pread64(unsigned int fd, char __user *buf, -+ size_t count, loff_t pos); -+asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, -+ size_t count, loff_t pos); - asmlinkage long sys_getcwd(char __user *buf, unsigned long size); - asmlinkage long sys_mkdir(const char __user *pathname, int mode); - asmlinkage long sys_chdir(const char __user *filename); -@@ -476,7 +544,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); - asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); - asmlinkage long sys_mq_unlink(const char __user *name); - 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); --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); -+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); - asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); - asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); - -@@ -530,11 +598,6 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, - const int __user *nodes, - int __user *status, - int flags); --asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, -- __u32 __user *pages, -- const int __user *nodes, -- int __user *status, -- int flags); - asmlinkage long sys_mbind(unsigned long start, unsigned long len, - unsigned long mode, - unsigned long __user *nmask, -@@ -549,7 +612,7 @@ asmlinkage long sys_inotify_init(void); - asmlinkage long sys_inotify_init1(int flags); - asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, - u32 mask); --asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); -+asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd); - - asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, - __u32 __user *ustatus); -@@ -583,13 +646,6 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *bu - int bufsiz); - asmlinkage long sys_utimensat(int dfd, char __user *filename, - struct timespec __user *utimes, int flags); --asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, -- struct compat_timeval __user *t); --asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, -- struct compat_stat __user *statbuf, -- int flag); --asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, -- int flags, int mode); - asmlinkage long sys_unshare(unsigned long unshare_flags); - - asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, -@@ -621,6 +677,15 @@ asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); - asmlinkage long sys_eventfd(unsigned int count); - asmlinkage long sys_eventfd2(unsigned int count, int flags); - asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); -+asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int); -+asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, -+ fd_set __user *, struct timespec __user *, -+ void __user *); -+asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, -+ struct timespec __user *, const sigset_t __user *, -+ size_t); -+asmlinkage long sys_pipe2(int __user *, int); -+asmlinkage long sys_pipe(int __user *); - - int kernel_execve(const char *filename, char *const argv[], char *const envp[]); - -diff --git a/include/linux/time.h b/include/linux/time.h -index ce321ac..fbbd2a1 100644 ---- a/include/linux/time.h -+++ b/include/linux/time.h -@@ -105,6 +105,7 @@ extern unsigned long read_persistent_clock(void); - extern int update_persistent_clock(struct timespec now); - extern int no_sync_cmos_clock __read_mostly; - void timekeeping_init(void); -+extern int timekeeping_suspended; - - unsigned long get_seconds(void); - struct timespec current_kernel_time(void); -diff --git a/ipc/mqueue.c b/ipc/mqueue.c -index 68eb857..1b3884b 100644 ---- a/ipc/mqueue.c -+++ b/ipc/mqueue.c -@@ -655,8 +655,8 @@ static int oflag2acc[O_ACCMODE] = { MAY_READ, MAY_WRITE, - return dentry_open(dentry, mqueue_mnt, oflag); - } - --asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, -- struct mq_attr __user *u_attr) -+SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode, -+ struct mq_attr __user *, u_attr) - { - struct dentry *dentry; - struct file *filp; -@@ -723,7 +723,7 @@ out_putname: - return fd; - } - --asmlinkage long sys_mq_unlink(const char __user *u_name) -+SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) - { - int err; - char *name; -@@ -816,9 +816,9 @@ static inline void pipelined_receive(struct mqueue_inode_info *info) - sender->state = STATE_READY; - } - --asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, -- size_t msg_len, unsigned int msg_prio, -- const struct timespec __user *u_abs_timeout) -+SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, -+ size_t, msg_len, unsigned int, msg_prio, -+ const struct timespec __user *, u_abs_timeout) - { - struct file *filp; - struct inode *inode; -@@ -904,9 +904,9 @@ out: - return ret; - } - --asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, -- size_t msg_len, unsigned int __user *u_msg_prio, -- const struct timespec __user *u_abs_timeout) -+SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, -+ size_t, msg_len, unsigned int __user *, u_msg_prio, -+ const struct timespec __user *, u_abs_timeout) - { - long timeout; - ssize_t ret; -@@ -989,8 +989,8 @@ out: - * and he isn't currently owner of notification, will be silently discarded. - * It isn't explicitly defined in the POSIX. - */ --asmlinkage long sys_mq_notify(mqd_t mqdes, -- const struct sigevent __user *u_notification) -+SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, -+ const struct sigevent __user *, u_notification) - { - int ret; - struct file *filp; -@@ -1115,9 +1115,9 @@ out: - return ret; - } - --asmlinkage long sys_mq_getsetattr(mqd_t mqdes, -- const struct mq_attr __user *u_mqstat, -- struct mq_attr __user *u_omqstat) -+SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, -+ const struct mq_attr __user *, u_mqstat, -+ struct mq_attr __user *, u_omqstat) - { - int ret; - struct mq_attr mqstat, omqstat; -diff --git a/ipc/msg.c b/ipc/msg.c -index b4eee1c..2ceab7f 100644 ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -309,7 +309,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg) - return security_msg_queue_associate(msq, msgflg); - } - --asmlinkage long sys_msgget(key_t key, int msgflg) -+SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg) - { - struct ipc_namespace *ns; - struct ipc_ops msg_ops; -@@ -466,7 +466,7 @@ out_up: - return err; - } - --asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf) -+SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf) - { - struct msg_queue *msq; - int err, version; -@@ -723,8 +723,8 @@ out_free: - return err; - } - --asmlinkage long --sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg) -+SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, -+ int, msgflg) - { - long mtype; - -@@ -904,8 +904,8 @@ out_unlock: - return msgsz; - } - --asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, -- long msgtyp, int msgflg) -+SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, -+ long, msgtyp, int, msgflg) - { - long err, mtype; - -diff --git a/ipc/sem.c b/ipc/sem.c -index 0821224..4d842a5 100644 ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -308,7 +308,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp, - return 0; - } - --asmlinkage long sys_semget(key_t key, int nsems, int semflg) -+SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg) - { - struct ipc_namespace *ns; - struct ipc_ops sem_ops; -@@ -887,7 +887,7 @@ out_up: - return err; - } - --asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg) -+SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg) - { - int err = -EINVAL; - int version; -@@ -923,6 +923,13 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg) - return -EINVAL; - } - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg) -+{ -+ return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg); -+} -+SYSCALL_ALIAS(sys_semctl, SyS_semctl); -+#endif - - /* If the task doesn't already have a undo_list, then allocate one - * here. We guarantee there is only one thread using this undo list, -@@ -1048,8 +1055,8 @@ out: - return un; - } - --asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, -- unsigned nsops, const struct timespec __user *timeout) -+SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, -+ unsigned, nsops, const struct timespec __user *, timeout) - { - int error = -EINVAL; - struct sem_array *sma; -@@ -1226,7 +1233,8 @@ out_free: - return error; - } - --asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsops) -+SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops, -+ unsigned, nsops) - { - return sys_semtimedop(semid, tsops, nsops, NULL); - } -diff --git a/ipc/shm.c b/ipc/shm.c -index 867e5d6..5afe608 100644 ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -440,7 +440,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp, - return 0; - } - --asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) -+SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg) - { - struct ipc_namespace *ns; - struct ipc_ops shm_ops; -@@ -621,7 +621,7 @@ out_up: - return err; - } - --asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) -+SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) - { - struct shmid_kernel *shp; - int err, version; -@@ -945,7 +945,7 @@ out_put_dentry: - goto out_nattch; - } - --asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) -+SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg) - { - unsigned long ret; - long err; -@@ -961,7 +961,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) - * detach and kill segment if marked destroyed. - * The work is done in shm_close. - */ --asmlinkage long sys_shmdt(char __user *shmaddr) -+SYSCALL_DEFINE1(shmdt, char __user *, shmaddr) - { - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma, *next; -diff --git a/kernel/acct.c b/kernel/acct.c -index f6006a6..8afbb31 100644 ---- a/kernel/acct.c -+++ b/kernel/acct.c -@@ -277,7 +277,7 @@ static int acct_on(char *name) - * should be written. If the filename is NULL, accounting will be - * shutdown. - */ --asmlinkage long sys_acct(const char __user *name) -+SYSCALL_DEFINE1(acct, const char __user *, name) - { - int error; - -diff --git a/kernel/capability.c b/kernel/capability.c -index 33e51e7..6ec8359 100644 ---- a/kernel/capability.c -+++ b/kernel/capability.c -@@ -348,7 +348,7 @@ EXPORT_SYMBOL(cap_set_effective); - * - * Returns 0 on success and < 0 on error. - */ --asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) -+SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr) - { - int ret = 0; - pid_t pid; -@@ -425,7 +425,7 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) - * - * Returns 0 on success and < 0 on error. - */ --asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) -+SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data) - { - struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S]; - unsigned i, tocopy; -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 2606d0f..c882385 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -2942,7 +2942,11 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys, - parent = task_cgroup(tsk, subsys->subsys_id); - - /* Pin the hierarchy */ -- atomic_inc(&parent->root->sb->s_active); -+ if (!atomic_inc_not_zero(&parent->root->sb->s_active)) { -+ /* We race with the final deactivate_super() */ -+ mutex_unlock(&cgroup_mutex); -+ return 0; -+ } - - /* Keep the cgroup alive */ - get_css_set(cg); -diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c -index 0511716..667c841 100644 ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -209,8 +209,7 @@ static int __init proc_execdomains_init(void) - module_init(proc_execdomains_init); - #endif - --asmlinkage long --sys_personality(u_long personality) -+SYSCALL_DEFINE1(personality, u_long, personality) - { - u_long old = current->personality; - -diff --git a/kernel/exit.c b/kernel/exit.c -index 2d8be7e..10e393b 100644 ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -1143,7 +1143,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code) - - EXPORT_SYMBOL(complete_and_exit); - --asmlinkage long sys_exit(int error_code) -+SYSCALL_DEFINE1(exit, int, error_code) - { - do_exit((error_code&0xff)<<8); - } -@@ -1184,9 +1184,11 @@ do_group_exit(int exit_code) - * wait4()-ing process will get the correct exit code - even if this - * thread is not the thread group leader. - */ --asmlinkage void sys_exit_group(int error_code) -+SYSCALL_DEFINE1(exit_group, int, error_code) - { - do_group_exit((error_code & 0xff) << 8); -+ /* NOTREACHED */ -+ return 0; - } - - static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) -@@ -1753,9 +1755,8 @@ end: - return retval; - } - --asmlinkage long sys_waitid(int which, pid_t upid, -- struct siginfo __user *infop, int options, -- struct rusage __user *ru) -+SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *, -+ infop, int, options, struct rusage __user *, ru) - { - struct pid *pid = NULL; - enum pid_type type; -@@ -1794,8 +1795,8 @@ asmlinkage long sys_waitid(int which, pid_t upid, - return ret; - } - --asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr, -- int options, struct rusage __user *ru) -+SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr, -+ int, options, struct rusage __user *, ru) - { - struct pid *pid = NULL; - enum pid_type type; -@@ -1832,7 +1833,7 @@ asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr, - * sys_waitpid() remains for compatibility. waitpid() should be - * implemented by calling sys_wait4() from libc.a. - */ --asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options) -+SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options) - { - return sys_wait4(pid, stat_addr, options, NULL); - } -diff --git a/kernel/fork.c b/kernel/fork.c -index 495da2e..f2c9c60 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -894,7 +894,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p) - clear_freeze_flag(p); - } - --asmlinkage long sys_set_tid_address(int __user *tidptr) -+SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr) - { - current->clear_child_tid = tidptr; - -@@ -1589,7 +1589,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp - * constructed. Here we are modifying the current, active, - * task_struct. - */ --asmlinkage long sys_unshare(unsigned long unshare_flags) -+SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) - { - int err = 0; - struct fs_struct *fs, *new_fs = NULL; -diff --git a/kernel/futex.c b/kernel/futex.c -index 8af1002..c14b159 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -1800,9 +1800,8 @@ pi_faulted: - * @head: pointer to the list-head - * @len: length of the list-head, as userspace expects - */ --asmlinkage long --sys_set_robust_list(struct robust_list_head __user *head, -- size_t len) -+SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head, -+ size_t, len) - { - if (!futex_cmpxchg_enabled) - return -ENOSYS; -@@ -1823,9 +1822,9 @@ sys_set_robust_list(struct robust_list_head __user *head, - * @head_ptr: pointer to a list-head pointer, the kernel fills it in - * @len_ptr: pointer to a length field, the kernel fills in the header size - */ --asmlinkage long --sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, -- size_t __user *len_ptr) -+SYSCALL_DEFINE3(get_robust_list, int, pid, -+ struct robust_list_head __user * __user *, head_ptr, -+ size_t __user *, len_ptr) - { - struct robust_list_head __user *head; - unsigned long ret; -@@ -2039,9 +2038,9 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, - } - - --asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, -- struct timespec __user *utime, u32 __user *uaddr2, -- u32 val3) -+SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, -+ struct timespec __user *, utime, u32 __user *, uaddr2, -+ u32, val3) - { - struct timespec ts; - ktime_t t, *tp = NULL; -diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c -index 47e6334..3016911 100644 ---- a/kernel/hrtimer.c -+++ b/kernel/hrtimer.c -@@ -1628,8 +1628,8 @@ out: - return ret; - } - --asmlinkage long --sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) -+SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp, -+ struct timespec __user *, rmtp) - { - struct timespec tu; - -diff --git a/kernel/itimer.c b/kernel/itimer.c -index db7c358..6a5fe93 100644 ---- a/kernel/itimer.c -+++ b/kernel/itimer.c -@@ -100,7 +100,7 @@ int do_getitimer(int which, struct itimerval *value) - return 0; - } - --asmlinkage long sys_getitimer(int which, struct itimerval __user *value) -+SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value) - { - int error = -EFAULT; - struct itimerval get_buffer; -@@ -260,9 +260,8 @@ unsigned int alarm_setitimer(unsigned int seconds) - return it_old.it_value.tv_sec; - } - --asmlinkage long sys_setitimer(int which, -- struct itimerval __user *value, -- struct itimerval __user *ovalue) -+SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, -+ struct itimerval __user *, ovalue) - { - struct itimerval set_buffer, get_buffer; - int error; -diff --git a/kernel/kexec.c b/kernel/kexec.c -index ac0fde7..ad257a5 100644 ---- a/kernel/kexec.c -+++ b/kernel/kexec.c -@@ -934,9 +934,8 @@ struct kimage *kexec_crash_image; - - static DEFINE_MUTEX(kexec_mutex); - --asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, -- struct kexec_segment __user *segments, -- unsigned long flags) -+SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, -+ struct kexec_segment __user *, segments, unsigned long, flags) - { - struct kimage **dest_image, *image; - int result; -diff --git a/kernel/module.c b/kernel/module.c -index 1f4cc00..79fd4d2 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -743,8 +743,8 @@ static void wait_for_zero_refcount(struct module *mod) - mutex_lock(&module_mutex); - } - --asmlinkage long --sys_delete_module(const char __user *name_user, unsigned int flags) -+SYSCALL_DEFINE2(delete_module, const char __user *, name_user, -+ unsigned int, flags) - { - struct module *mod; - char name[MODULE_NAME_LEN]; -@@ -2288,10 +2288,8 @@ static noinline struct module *load_module(void __user *umod, - } - - /* This is where the real work happens */ --asmlinkage long --sys_init_module(void __user *umod, -- unsigned long len, -- const char __user *uargs) -+SYSCALL_DEFINE3(init_module, void __user *, umod, -+ unsigned long, len, const char __user *, uargs) - { - struct module *mod; - int ret = 0; -diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c -index a140e44..6c48fc8 100644 ---- a/kernel/posix-timers.c -+++ b/kernel/posix-timers.c -@@ -470,10 +470,9 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set) - - /* Create a POSIX.1b interval timer. */ - --asmlinkage long --sys_timer_create(const clockid_t which_clock, -- struct sigevent __user *timer_event_spec, -- timer_t __user * created_timer_id) -+SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, -+ struct sigevent __user *, timer_event_spec, -+ timer_t __user *, created_timer_id) - { - struct k_itimer *new_timer; - int error, new_timer_id; -@@ -659,8 +658,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) - } - - /* Get the time remaining on a POSIX.1b interval timer. */ --asmlinkage long --sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) -+SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, -+ struct itimerspec __user *, setting) - { - struct k_itimer *timr; - struct itimerspec cur_setting; -@@ -689,8 +688,7 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) - * the call back to do_schedule_next_timer(). So all we need to do is - * to pick up the frozen overrun. - */ --asmlinkage long --sys_timer_getoverrun(timer_t timer_id) -+SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id) - { - struct k_itimer *timr; - int overrun; -@@ -758,10 +756,9 @@ common_timer_set(struct k_itimer *timr, int flags, - } - - /* Set a POSIX.1b interval timer */ --asmlinkage long --sys_timer_settime(timer_t timer_id, int flags, -- const struct itimerspec __user *new_setting, -- struct itimerspec __user *old_setting) -+SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, -+ const struct itimerspec __user *, new_setting, -+ struct itimerspec __user *, old_setting) - { - struct k_itimer *timr; - struct itimerspec new_spec, old_spec; -@@ -814,8 +811,7 @@ static inline int timer_delete_hook(struct k_itimer *timer) - } - - /* Delete a POSIX.1b interval timer. */ --asmlinkage long --sys_timer_delete(timer_t timer_id) -+SYSCALL_DEFINE1(timer_delete, timer_t, timer_id) - { - struct k_itimer *timer; - unsigned long flags; -@@ -903,8 +899,8 @@ int do_posix_clock_nonanosleep(const clockid_t clock, int flags, - } - EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); - --asmlinkage long sys_clock_settime(const clockid_t which_clock, -- const struct timespec __user *tp) -+SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, -+ const struct timespec __user *, tp) - { - struct timespec new_tp; - -@@ -916,8 +912,8 @@ asmlinkage long sys_clock_settime(const clockid_t which_clock, - return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp)); - } - --asmlinkage long --sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp) -+SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, -+ struct timespec __user *,tp) - { - struct timespec kernel_tp; - int error; -@@ -933,8 +929,8 @@ sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp) - - } - --asmlinkage long --sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) -+SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, -+ struct timespec __user *, tp) - { - struct timespec rtn_tp; - int error; -@@ -963,10 +959,9 @@ static int common_nsleep(const clockid_t which_clock, int flags, - which_clock); - } - --asmlinkage long --sys_clock_nanosleep(const clockid_t which_clock, int flags, -- const struct timespec __user *rqtp, -- struct timespec __user *rmtp) -+SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, -+ const struct timespec __user *, rqtp, -+ struct timespec __user *, rmtp) - { - struct timespec t; - -diff --git a/kernel/printk.c b/kernel/printk.c -index f492f15..b84eec7 100644 ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -382,7 +382,7 @@ out: - return error; - } - --asmlinkage long sys_syslog(int type, char __user *buf, int len) -+SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) - { - return do_syslog(type, buf, len); - } -@@ -742,11 +742,6 @@ EXPORT_SYMBOL(vprintk); - - #else - --asmlinkage long sys_syslog(int type, char __user *buf, int len) --{ -- return -ENOSYS; --} -- - static void call_console_drivers(unsigned start, unsigned end) - { - } -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 4c8bcd7..9234a16 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -545,7 +545,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid) - #define arch_ptrace_attach(child) do { } while (0) - #endif - --asmlinkage long sys_ptrace(long request, long pid, long addr, long data) -+SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data) - { - struct task_struct *child; - long ret; -diff --git a/kernel/sched.c b/kernel/sched.c -index e4bb1dd..2c68ec3 100644 ---- a/kernel/sched.c -+++ b/kernel/sched.c -@@ -5025,7 +5025,7 @@ int can_nice(const struct task_struct *p, const int nice) - * sys_setpriority is a more generic, but much slower function that - * does similar things. - */ --asmlinkage long sys_nice(int increment) -+SYSCALL_DEFINE1(nice, int, increment) - { - long nice, retval; - -@@ -5317,8 +5317,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) - * @policy: new policy. - * @param: structure containing the new RT priority. - */ --asmlinkage long --sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) -+SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, -+ struct sched_param __user *, param) - { - /* negative values for policy are not valid */ - if (policy < 0) -@@ -5332,7 +5332,7 @@ sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) - * @pid: the pid in question. - * @param: structure containing the new RT priority. - */ --asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) -+SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param) - { - return do_sched_setscheduler(pid, -1, param); - } -@@ -5341,7 +5341,7 @@ asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) - * sys_sched_getscheduler - get the policy (scheduling class) of a thread - * @pid: the pid in question. - */ --asmlinkage long sys_sched_getscheduler(pid_t pid) -+SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) - { - struct task_struct *p; - int retval; -@@ -5366,7 +5366,7 @@ asmlinkage long sys_sched_getscheduler(pid_t pid) - * @pid: the pid in question. - * @param: structure containing the RT priority. - */ --asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param) -+SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) - { - struct sched_param lp; - struct task_struct *p; -@@ -5474,8 +5474,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to the new cpu mask - */ --asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, -- unsigned long __user *user_mask_ptr) -+SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len, -+ unsigned long __user *, user_mask_ptr) - { - cpumask_t new_mask; - int retval; -@@ -5519,8 +5519,8 @@ out_unlock: - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to hold the current cpu mask - */ --asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, -- unsigned long __user *user_mask_ptr) -+SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, -+ unsigned long __user *, user_mask_ptr) - { - int ret; - cpumask_t mask; -@@ -5544,7 +5544,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, - * This function yields the current CPU to other tasks. If there are no - * other threads running on this CPU then this function will return. - */ --asmlinkage long sys_sched_yield(void) -+SYSCALL_DEFINE0(sched_yield) - { - struct rq *rq = this_rq_lock(); - -@@ -5685,7 +5685,7 @@ long __sched io_schedule_timeout(long timeout) - * this syscall returns the maximum rt_priority that can be used - * by a given scheduling class. - */ --asmlinkage long sys_sched_get_priority_max(int policy) -+SYSCALL_DEFINE1(sched_get_priority_max, int, policy) - { - int ret = -EINVAL; - -@@ -5710,7 +5710,7 @@ asmlinkage long sys_sched_get_priority_max(int policy) - * this syscall returns the minimum rt_priority that can be used - * by a given scheduling class. - */ --asmlinkage long sys_sched_get_priority_min(int policy) -+SYSCALL_DEFINE1(sched_get_priority_min, int, policy) - { - int ret = -EINVAL; - -@@ -5735,8 +5735,8 @@ asmlinkage long sys_sched_get_priority_min(int policy) - * this syscall writes the default timeslice value of a given process - * into the user-space timespec buffer. A value of '0' means infinity. - */ --asmlinkage --long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval) -+SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, -+ struct timespec __user *, interval) - { - struct task_struct *p; - unsigned int time_slice; -diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c -index e8ab096..a0b0852 100644 ---- a/kernel/sched_clock.c -+++ b/kernel/sched_clock.c -@@ -124,7 +124,7 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now) - - clock = scd->tick_gtod + delta; - min_clock = wrap_max(scd->tick_gtod, scd->clock); -- max_clock = scd->tick_gtod + TICK_NSEC; -+ max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC); - - clock = wrap_max(clock, min_clock); - clock = wrap_min(clock, max_clock); -@@ -227,6 +227,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event); - */ - void sched_clock_idle_wakeup_event(u64 delta_ns) - { -+ if (timekeeping_suspended) -+ return; -+ - sched_clock_tick(); - touch_softlockup_watchdog(); - } -diff --git a/kernel/signal.c b/kernel/signal.c -index 4530fc6..28859a9 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -1940,7 +1940,7 @@ EXPORT_SYMBOL(unblock_all_signals); - * System call entry points. - */ - --asmlinkage long sys_restart_syscall(void) -+SYSCALL_DEFINE0(restart_syscall) - { - struct restart_block *restart = ¤t_thread_info()->restart_block; - return restart->fn(restart); -@@ -1993,8 +1993,8 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset) - return error; - } - --asmlinkage long --sys_rt_sigprocmask(int how, sigset_t __user *set, sigset_t __user *oset, size_t sigsetsize) -+SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set, -+ sigset_t __user *, oset, size_t, sigsetsize) - { - int error = -EINVAL; - sigset_t old_set, new_set; -@@ -2053,8 +2053,7 @@ out: - return error; - } - --asmlinkage long --sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize) -+SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize) - { - return do_sigpending(set, sigsetsize); - } -@@ -2125,11 +2124,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from) - - #endif - --asmlinkage long --sys_rt_sigtimedwait(const sigset_t __user *uthese, -- siginfo_t __user *uinfo, -- const struct timespec __user *uts, -- size_t sigsetsize) -+SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, -+ siginfo_t __user *, uinfo, const struct timespec __user *, uts, -+ size_t, sigsetsize) - { - int ret, sig; - sigset_t these; -@@ -2202,8 +2199,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese, - return ret; - } - --asmlinkage long --sys_kill(pid_t pid, int sig) -+SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) - { - struct siginfo info; - -@@ -2262,7 +2258,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig) - * exists but it's not belonging to the target process anymore. This - * method solves the problem of threads exiting and PIDs getting reused. - */ --asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig) -+SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig) - { - /* This is only valid for single tasks */ - if (pid <= 0 || tgid <= 0) -@@ -2274,8 +2270,7 @@ asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig) - /* - * Send a signal to only one task, even if it's a CLONE_THREAD task. - */ --asmlinkage long --sys_tkill(pid_t pid, int sig) -+SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig) - { - /* This is only valid for single tasks */ - if (pid <= 0) -@@ -2284,8 +2279,8 @@ sys_tkill(pid_t pid, int sig) - return do_tkill(0, pid, sig); - } - --asmlinkage long --sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo) -+SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, -+ siginfo_t __user *, uinfo) - { - siginfo_t info; - -@@ -2413,8 +2408,7 @@ out: - - #ifdef __ARCH_WANT_SYS_SIGPENDING - --asmlinkage long --sys_sigpending(old_sigset_t __user *set) -+SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set) - { - return do_sigpending(set, sizeof(*set)); - } -@@ -2425,8 +2419,8 @@ sys_sigpending(old_sigset_t __user *set) - /* Some platforms have their own version with special arguments others - support only sys_rt_sigprocmask. */ - --asmlinkage long --sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset) -+SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set, -+ old_sigset_t __user *, oset) - { - int error; - old_sigset_t old_set, new_set; -@@ -2476,11 +2470,10 @@ out: - #endif /* __ARCH_WANT_SYS_SIGPROCMASK */ - - #ifdef __ARCH_WANT_SYS_RT_SIGACTION --asmlinkage long --sys_rt_sigaction(int sig, -- const struct sigaction __user *act, -- struct sigaction __user *oact, -- size_t sigsetsize) -+SYSCALL_DEFINE4(rt_sigaction, int, sig, -+ const struct sigaction __user *, act, -+ struct sigaction __user *, oact, -+ size_t, sigsetsize) - { - struct k_sigaction new_sa, old_sa; - int ret = -EINVAL; -@@ -2510,15 +2503,13 @@ out: - /* - * For backwards compatibility. Functionality superseded by sigprocmask. - */ --asmlinkage long --sys_sgetmask(void) -+SYSCALL_DEFINE0(sgetmask) - { - /* SMP safe */ - return current->blocked.sig[0]; - } - --asmlinkage long --sys_ssetmask(int newmask) -+SYSCALL_DEFINE1(ssetmask, int, newmask) - { - int old; - -@@ -2538,8 +2529,7 @@ sys_ssetmask(int newmask) - /* - * For backwards compatibility. Functionality superseded by sigaction. - */ --asmlinkage unsigned long --sys_signal(int sig, __sighandler_t handler) -+SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler) - { - struct k_sigaction new_sa, old_sa; - int ret; -@@ -2556,8 +2546,7 @@ sys_signal(int sig, __sighandler_t handler) - - #ifdef __ARCH_WANT_SYS_PAUSE - --asmlinkage long --sys_pause(void) -+SYSCALL_DEFINE0(pause) - { - current->state = TASK_INTERRUPTIBLE; - schedule(); -@@ -2567,7 +2556,7 @@ sys_pause(void) - #endif - - #ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND --asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) -+SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize) - { - sigset_t newset; - -diff --git a/kernel/sys.c b/kernel/sys.c -index 31deba8..855eebb 100644 ---- a/kernel/sys.c -+++ b/kernel/sys.c -@@ -137,7 +137,7 @@ out: - return error; - } - --asmlinkage long sys_setpriority(int which, int who, int niceval) -+SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) - { - struct task_struct *g, *p; - struct user_struct *user; -@@ -201,7 +201,7 @@ out: - * has been offset by 20 (ie it returns 40..1 instead of -20..19) - * to stay compatible. - */ --asmlinkage long sys_getpriority(int which, int who) -+SYSCALL_DEFINE2(getpriority, int, which, int, who) - { - struct task_struct *g, *p; - struct user_struct *user; -@@ -347,7 +347,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off); - * - * reboot doesn't sync: do that yourself before calling this. - */ --asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg) -+SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, -+ void __user *, arg) - { - char buffer[256]; - -@@ -470,7 +471,7 @@ void ctrl_alt_del(void) - * SMP: There are not races, the GIDs are checked only by filesystem - * operations (as far as semantic preservation is concerned). - */ --asmlinkage long sys_setregid(gid_t rgid, gid_t egid) -+SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid) - { - int old_rgid = current->gid; - int old_egid = current->egid; -@@ -519,7 +520,7 @@ asmlinkage long sys_setregid(gid_t rgid, gid_t egid) - * - * SMP: Same implicit races as above. - */ --asmlinkage long sys_setgid(gid_t gid) -+SYSCALL_DEFINE1(setgid, gid_t, gid) - { - int old_egid = current->egid; - int retval; -@@ -589,7 +590,7 @@ static int set_user(uid_t new_ruid, int dumpclear) - * 100% compatible with BSD. A program which uses just setuid() will be - * 100% compatible with POSIX with saved IDs. - */ --asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) -+SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid) - { - int old_ruid, old_euid, old_suid, new_ruid, new_euid; - int retval; -@@ -651,7 +652,7 @@ asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) - * will allow a root program to temporarily drop privileges and be able to - * regain them by swapping the real and effective uid. - */ --asmlinkage long sys_setuid(uid_t uid) -+SYSCALL_DEFINE1(setuid, uid_t, uid) - { - int old_euid = current->euid; - int old_ruid, old_suid, new_suid; -@@ -690,7 +691,7 @@ asmlinkage long sys_setuid(uid_t uid) - * This function implements a generic ability to update ruid, euid, - * and suid. This allows you to implement the 4.4 compatible seteuid(). - */ --asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) -+SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid) - { - int old_ruid = current->uid; - int old_euid = current->euid; -@@ -733,7 +734,7 @@ asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) - return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES); - } - --asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid) -+SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid) - { - int retval; - -@@ -747,7 +748,7 @@ asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __us - /* - * Same as above, but for rgid, egid, sgid. - */ --asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) -+SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid) - { - int retval; - -@@ -784,7 +785,7 @@ asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) - return 0; - } - --asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid) -+SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid) - { - int retval; - -@@ -802,7 +803,7 @@ asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __us - * whatever uid it wants to). It normally shadows "euid", except when - * explicitly set by setfsuid() or for access.. - */ --asmlinkage long sys_setfsuid(uid_t uid) -+SYSCALL_DEFINE1(setfsuid, uid_t, uid) - { - int old_fsuid; - -@@ -831,7 +832,7 @@ asmlinkage long sys_setfsuid(uid_t uid) - /* - * Samma pÃ¥ svenska.. - */ --asmlinkage long sys_setfsgid(gid_t gid) -+SYSCALL_DEFINE1(setfsgid, gid_t, gid) - { - int old_fsgid; - -@@ -869,7 +870,7 @@ void do_sys_times(struct tms *tms) - tms->tms_cstime = cputime_to_clock_t(cstime); - } - --asmlinkage long sys_times(struct tms __user * tbuf) -+SYSCALL_DEFINE1(times, struct tms __user *, tbuf) - { - if (tbuf) { - struct tms tmp; -@@ -893,7 +894,7 @@ asmlinkage long sys_times(struct tms __user * tbuf) - * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. - * LBT 04.03.94 - */ --asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) -+SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) - { - struct task_struct *p; - struct task_struct *group_leader = current->group_leader; -@@ -964,7 +965,7 @@ out: - return err; - } - --asmlinkage long sys_getpgid(pid_t pid) -+SYSCALL_DEFINE1(getpgid, pid_t, pid) - { - struct task_struct *p; - struct pid *grp; -@@ -994,14 +995,14 @@ out: - - #ifdef __ARCH_WANT_SYS_GETPGRP - --asmlinkage long sys_getpgrp(void) -+SYSCALL_DEFINE0(getpgrp) - { - return sys_getpgid(0); - } - - #endif - --asmlinkage long sys_getsid(pid_t pid) -+SYSCALL_DEFINE1(getsid, pid_t, pid) - { - struct task_struct *p; - struct pid *sid; -@@ -1029,7 +1030,7 @@ out: - return retval; - } - --asmlinkage long sys_setsid(void) -+SYSCALL_DEFINE0(setsid) - { - struct task_struct *group_leader = current->group_leader; - struct pid *sid = task_pid(group_leader); -@@ -1233,7 +1234,7 @@ int set_current_groups(struct group_info *group_info) - - EXPORT_SYMBOL(set_current_groups); - --asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) -+SYSCALL_DEFINE2(getgroups, int, gidsetsize, gid_t __user *, grouplist) - { - int i = 0; - -@@ -1266,7 +1267,7 @@ out: - * without another task interfering. - */ - --asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist) -+SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist) - { - struct group_info *group_info; - int retval; -@@ -1316,7 +1317,7 @@ EXPORT_SYMBOL(in_egroup_p); - - DECLARE_RWSEM(uts_sem); - --asmlinkage long sys_newuname(struct new_utsname __user * name) -+SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) - { - int errno = 0; - -@@ -1327,7 +1328,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name) - return errno; - } - --asmlinkage long sys_sethostname(char __user *name, int len) -+SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) - { - int errno; - char tmp[__NEW_UTS_LEN]; -@@ -1351,7 +1352,7 @@ asmlinkage long sys_sethostname(char __user *name, int len) - - #ifdef __ARCH_WANT_SYS_GETHOSTNAME - --asmlinkage long sys_gethostname(char __user *name, int len) -+SYSCALL_DEFINE2(gethostname, char __user *, name, int, len) - { - int i, errno; - struct new_utsname *u; -@@ -1376,7 +1377,7 @@ asmlinkage long sys_gethostname(char __user *name, int len) - * Only setdomainname; getdomainname can be implemented by calling - * uname() - */ --asmlinkage long sys_setdomainname(char __user *name, int len) -+SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len) - { - int errno; - char tmp[__NEW_UTS_LEN]; -@@ -1399,7 +1400,7 @@ asmlinkage long sys_setdomainname(char __user *name, int len) - return errno; - } - --asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) -+SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim) - { - if (resource >= RLIM_NLIMITS) - return -EINVAL; -@@ -1418,7 +1419,8 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) - * Back compatibility for getrlimit. Needed for some apps. - */ - --asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim) -+SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource, -+ struct rlimit __user *, rlim) - { - struct rlimit x; - if (resource >= RLIM_NLIMITS) -@@ -1436,7 +1438,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r - - #endif - --asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim) -+SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim) - { - struct rlimit new_rlim, *old_rlim; - int retval; -@@ -1551,6 +1553,8 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) - utime = stime = cputime_zero; - - if (who == RUSAGE_THREAD) { -+ utime = task_utime(current); -+ stime = task_stime(current); - accumulate_thread_rusage(p, r); - goto out; - } -@@ -1607,7 +1611,7 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru) - return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; - } - --asmlinkage long sys_getrusage(int who, struct rusage __user *ru) -+SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru) - { - if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN && - who != RUSAGE_THREAD) -@@ -1615,14 +1619,14 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru) - return getrusage(current, who, ru); - } - --asmlinkage long sys_umask(int mask) -+SYSCALL_DEFINE1(umask, int, mask) - { - mask = xchg(¤t->fs->umask, mask & S_IRWXUGO); - return mask; - } - --asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, -- unsigned long arg4, unsigned long arg5) -+SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, -+ unsigned long, arg4, unsigned long, arg5) - { - long error = 0; - -@@ -1733,8 +1737,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, - return error; - } - --asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, -- struct getcpu_cache __user *unused) -+SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, -+ struct getcpu_cache __user *, unused) - { - int err = 0; - int cpu = raw_smp_processor_id(); -diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c -index e14a232..27dad29 100644 ---- a/kernel/sys_ni.c -+++ b/kernel/sys_ni.c -@@ -131,6 +131,7 @@ cond_syscall(sys_io_destroy); - cond_syscall(sys_io_submit); - cond_syscall(sys_io_cancel); - cond_syscall(sys_io_getevents); -+cond_syscall(sys_syslog); - - /* arch-specific weak syscall entries */ - cond_syscall(sys_pciconfig_read); -diff --git a/kernel/sysctl.c b/kernel/sysctl.c -index 3d56fe7..68fd128 100644 ---- a/kernel/sysctl.c -+++ b/kernel/sysctl.c -@@ -1623,7 +1623,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol - return error; - } - --asmlinkage long sys_sysctl(struct __sysctl_args __user *args) -+SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) - { - struct __sysctl_args tmp; - int error; -@@ -2924,7 +2924,7 @@ int sysctl_ms_jiffies(struct ctl_table *table, - #else /* CONFIG_SYSCTL_SYSCALL */ - - --asmlinkage long sys_sysctl(struct __sysctl_args __user *args) -+SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) - { - struct __sysctl_args tmp; - int error; -diff --git a/kernel/time.c b/kernel/time.c -index d63a433..8a2693a 100644 ---- a/kernel/time.c -+++ b/kernel/time.c -@@ -59,7 +59,7 @@ EXPORT_SYMBOL(sys_tz); - * why not move it into the appropriate arch directory (for those - * architectures that need it). - */ --asmlinkage long sys_time(time_t __user * tloc) -+SYSCALL_DEFINE1(time, time_t __user *, tloc) - { - time_t i = get_seconds(); - -@@ -77,7 +77,7 @@ asmlinkage long sys_time(time_t __user * tloc) - * architectures that need it). - */ - --asmlinkage long sys_stime(time_t __user *tptr) -+SYSCALL_DEFINE1(stime, time_t __user *, tptr) - { - struct timespec tv; - int err; -@@ -97,8 +97,8 @@ asmlinkage long sys_stime(time_t __user *tptr) - - #endif /* __ARCH_WANT_SYS_TIME */ - --asmlinkage long sys_gettimeofday(struct timeval __user *tv, -- struct timezone __user *tz) -+SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv, -+ struct timezone __user *, tz) - { - if (likely(tv != NULL)) { - struct timeval ktv; -@@ -182,8 +182,8 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz) - return 0; - } - --asmlinkage long sys_settimeofday(struct timeval __user *tv, -- struct timezone __user *tz) -+SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv, -+ struct timezone __user *, tz) - { - struct timeval user_tv; - struct timespec new_ts; -@@ -203,7 +203,7 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv, - return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); - } - --asmlinkage long sys_adjtimex(struct timex __user *txc_p) -+SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p) - { - struct timex txc; /* Local copy of parameter */ - int ret; -diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c -index fa05e88..900f1b6 100644 ---- a/kernel/time/timekeeping.c -+++ b/kernel/time/timekeeping.c -@@ -46,6 +46,9 @@ struct timespec xtime __attribute__ ((aligned (16))); - struct timespec wall_to_monotonic __attribute__ ((aligned (16))); - static unsigned long total_sleep_time; /* seconds */ - -+/* flag for if timekeeping is suspended */ -+int __read_mostly timekeeping_suspended; -+ - static struct timespec xtime_cache __attribute__ ((aligned (16))); - void update_xtime_cache(u64 nsec) - { -@@ -92,6 +95,8 @@ void getnstimeofday(struct timespec *ts) - unsigned long seq; - s64 nsecs; - -+ WARN_ON(timekeeping_suspended); -+ - do { - seq = read_seqbegin(&xtime_lock); - -@@ -299,8 +304,6 @@ void __init timekeeping_init(void) - write_sequnlock_irqrestore(&xtime_lock, flags); - } - --/* flag for if timekeeping is suspended */ --static int timekeeping_suspended; - /* time in seconds when suspend began */ - static unsigned long timekeeping_suspend_time; - -diff --git a/kernel/timer.c b/kernel/timer.c -index dbd50fa..a5eaea2 100644 ---- a/kernel/timer.c -+++ b/kernel/timer.c -@@ -1144,7 +1144,7 @@ void do_timer(unsigned long ticks) - * For backwards compatibility? This can be done in libc so Alpha - * and all newer ports shouldn't need it. - */ --asmlinkage unsigned long sys_alarm(unsigned int seconds) -+SYSCALL_DEFINE1(alarm, unsigned int, seconds) - { - return alarm_setitimer(seconds); - } -@@ -1167,7 +1167,7 @@ asmlinkage unsigned long sys_alarm(unsigned int seconds) - * - * This is SMP safe as current->tgid does not change. - */ --asmlinkage long sys_getpid(void) -+SYSCALL_DEFINE0(getpid) - { - return task_tgid_vnr(current); - } -@@ -1178,7 +1178,7 @@ asmlinkage long sys_getpid(void) - * value of ->real_parent under rcu_read_lock(), see - * release_task()->call_rcu(delayed_put_task_struct). - */ --asmlinkage long sys_getppid(void) -+SYSCALL_DEFINE0(getppid) - { - int pid; - -@@ -1189,25 +1189,25 @@ asmlinkage long sys_getppid(void) - return pid; - } - --asmlinkage long sys_getuid(void) -+SYSCALL_DEFINE0(getuid) - { - /* Only we change this so SMP safe */ - return current->uid; - } - --asmlinkage long sys_geteuid(void) -+SYSCALL_DEFINE0(geteuid) - { - /* Only we change this so SMP safe */ - return current->euid; - } - --asmlinkage long sys_getgid(void) -+SYSCALL_DEFINE0(getgid) - { - /* Only we change this so SMP safe */ - return current->gid; - } - --asmlinkage long sys_getegid(void) -+SYSCALL_DEFINE0(getegid) - { - /* Only we change this so SMP safe */ - return current->egid; -@@ -1323,7 +1323,7 @@ signed long __sched schedule_timeout_uninterruptible(signed long timeout) - EXPORT_SYMBOL(schedule_timeout_uninterruptible); - - /* Thread ID - the internal kernel "pid" */ --asmlinkage long sys_gettid(void) -+SYSCALL_DEFINE0(gettid) - { - return task_pid_vnr(current); - } -@@ -1415,7 +1415,7 @@ out: - return 0; - } - --asmlinkage long sys_sysinfo(struct sysinfo __user *info) -+SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info) - { - struct sysinfo val; - -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 668bbb5..71202ac 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -769,6 +769,7 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer) - * back to us). This allows us to do a simple loop to - * assign the commit to the tail. - */ -+ again: - while (cpu_buffer->commit_page != cpu_buffer->tail_page) { - cpu_buffer->commit_page->commit = - cpu_buffer->commit_page->write; -@@ -783,6 +784,17 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer) - cpu_buffer->commit_page->write; - barrier(); - } -+ -+ /* again, keep gcc from optimizing */ -+ barrier(); -+ -+ /* -+ * If an interrupt came in just after the first while loop -+ * and pushed the tail page forward, we will be left with -+ * a dangling commit that will never go forward. -+ */ -+ if (unlikely(cpu_buffer->commit_page != cpu_buffer->tail_page)) -+ goto again; - } - - static void rb_reset_reader_page(struct ring_buffer_per_cpu *cpu_buffer) -@@ -880,12 +892,15 @@ static struct ring_buffer_event * - __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, - unsigned type, unsigned long length, u64 *ts) - { -- struct buffer_page *tail_page, *head_page, *reader_page; -+ struct buffer_page *tail_page, *head_page, *reader_page, *commit_page; - unsigned long tail, write; - struct ring_buffer *buffer = cpu_buffer->buffer; - struct ring_buffer_event *event; - unsigned long flags; - -+ commit_page = cpu_buffer->commit_page; -+ /* we just need to protect against interrupts */ -+ barrier(); - tail_page = cpu_buffer->tail_page; - write = local_add_return(length, &tail_page->write); - tail = write - length; -@@ -909,7 +924,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, - * it all the way around the buffer, bail, and warn - * about it. - */ -- if (unlikely(next_page == cpu_buffer->commit_page)) { -+ if (unlikely(next_page == commit_page)) { - WARN_ON_ONCE(1); - goto out_unlock; - } -diff --git a/kernel/uid16.c b/kernel/uid16.c -index 3e41c16..67bb92c 100644 ---- a/kernel/uid16.c -+++ b/kernel/uid16.c -@@ -17,7 +17,7 @@ - - #include - --asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) -+SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) - { - long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); - /* avoid REGPARM breakage on x86: */ -@@ -25,7 +25,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi - return ret; - } - --asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) -+SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) - { - long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); - /* avoid REGPARM breakage on x86: */ -@@ -33,7 +33,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g - return ret; - } - --asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) -+SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group) - { - long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); - /* avoid REGPARM breakage on x86: */ -@@ -41,7 +41,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) - return ret; - } - --asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) -+SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid) - { - long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); - /* avoid REGPARM breakage on x86: */ -@@ -49,7 +49,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) - return ret; - } - --asmlinkage long sys_setgid16(old_gid_t gid) -+SYSCALL_DEFINE1(setgid16, old_gid_t, gid) - { - long ret = sys_setgid(low2highgid(gid)); - /* avoid REGPARM breakage on x86: */ -@@ -57,7 +57,7 @@ asmlinkage long sys_setgid16(old_gid_t gid) - return ret; - } - --asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) -+SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid) - { - long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); - /* avoid REGPARM breakage on x86: */ -@@ -65,7 +65,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) - return ret; - } - --asmlinkage long sys_setuid16(old_uid_t uid) -+SYSCALL_DEFINE1(setuid16, old_uid_t, uid) - { - long ret = sys_setuid(low2highuid(uid)); - /* avoid REGPARM breakage on x86: */ -@@ -73,7 +73,7 @@ asmlinkage long sys_setuid16(old_uid_t uid) - return ret; - } - --asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) -+SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid) - { - long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), - low2highuid(suid)); -@@ -82,7 +82,7 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) - return ret; - } - --asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) -+SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruid, old_uid_t __user *, euid, old_uid_t __user *, suid) - { - int retval; - -@@ -93,7 +93,7 @@ asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, - return retval; - } - --asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) -+SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid) - { - long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), - low2highgid(sgid)); -@@ -102,7 +102,8 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) - return ret; - } - --asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) -+ -+SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgid, old_gid_t __user *, egid, old_gid_t __user *, sgid) - { - int retval; - -@@ -113,7 +114,7 @@ asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, - return retval; - } - --asmlinkage long sys_setfsuid16(old_uid_t uid) -+SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid) - { - long ret = sys_setfsuid(low2highuid(uid)); - /* avoid REGPARM breakage on x86: */ -@@ -121,7 +122,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid) - return ret; - } - --asmlinkage long sys_setfsgid16(old_gid_t gid) -+SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid) - { - long ret = sys_setfsgid(low2highgid(gid)); - /* avoid REGPARM breakage on x86: */ -@@ -159,7 +160,7 @@ static int groups16_from_user(struct group_info *group_info, - return 0; - } - --asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist) -+SYSCALL_DEFINE2(getgroups16, int, gidsetsize, old_gid_t __user *, grouplist) - { - int i = 0; - -@@ -183,7 +184,7 @@ out: - return i; - } - --asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) -+SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist) - { - struct group_info *group_info; - int retval; -@@ -208,22 +209,22 @@ asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) - return retval; - } - --asmlinkage long sys_getuid16(void) -+SYSCALL_DEFINE0(getuid16) - { - return high2lowuid(current->uid); - } - --asmlinkage long sys_geteuid16(void) -+SYSCALL_DEFINE0(geteuid16) - { - return high2lowuid(current->euid); - } - --asmlinkage long sys_getgid16(void) -+SYSCALL_DEFINE0(getgid16) - { - return high2lowgid(current->gid); - } - --asmlinkage long sys_getegid16(void) -+SYSCALL_DEFINE0(getegid16) - { - return high2lowgid(current->egid); - } -diff --git a/mm/fadvise.c b/mm/fadvise.c -index a1da969..54a0f80 100644 ---- a/mm/fadvise.c -+++ b/mm/fadvise.c -@@ -24,7 +24,7 @@ - * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could - * deactivate the pages and clear PG_Referenced. - */ --asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) -+SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) - { - struct file *file = fget(fd); - struct address_space *mapping; -@@ -126,12 +126,26 @@ out: - fput(file); - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice) -+{ -+ return SYSC_fadvise64_64((int) fd, offset, len, (int) advice); -+} -+SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64); -+#endif - - #ifdef __ARCH_WANT_SYS_FADVISE64 - --asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) -+SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice) - { - return sys_fadvise64_64(fd, offset, len, advice); - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice) -+{ -+ return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice); -+} -+SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64); -+#endif - - #endif -diff --git a/mm/filemap.c b/mm/filemap.c -index f3e5f89..f65417c 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -1366,7 +1366,7 @@ do_readahead(struct address_space *mapping, struct file *filp, - return 0; - } - --asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) -+SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count) - { - ssize_t ret; - struct file *file; -@@ -1385,6 +1385,13 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) - } - return ret; - } -+#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -+asmlinkage long SyS_readahead(long fd, loff_t offset, long count) -+{ -+ return SYSC_readahead((int) fd, offset, (size_t) count); -+} -+SYSCALL_ALIAS(sys_readahead, SyS_readahead); -+#endif - - #ifdef CONFIG_MMU - /** -@@ -2140,19 +2147,24 @@ EXPORT_SYMBOL(generic_file_direct_write); - * Find or create a page at the given pagecache position. Return the locked - * page. This function is specifically for buffered writes. - */ --struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index) -+struct page *grab_cache_page_write_begin(struct address_space *mapping, -+ pgoff_t index, unsigned flags) - { - int status; - struct page *page; -+ gfp_t gfp_notmask = 0; -+ if (flags & AOP_FLAG_NOFS) -+ gfp_notmask = __GFP_FS; - repeat: - page = find_lock_page(mapping, index); - if (likely(page)) - return page; - -- page = page_cache_alloc(mapping); -+ page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); - if (!page) - return NULL; -- status = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL); -+ status = add_to_page_cache_lru(page, mapping, index, -+ GFP_KERNEL & ~gfp_notmask); - if (unlikely(status)) { - page_cache_release(page); - if (status == -EEXIST) -@@ -2161,7 +2173,7 @@ repeat: - } - return page; - } --EXPORT_SYMBOL(__grab_cache_page); -+EXPORT_SYMBOL(grab_cache_page_write_begin); - - static ssize_t generic_perform_write(struct file *file, - struct iov_iter *i, loff_t pos) -diff --git a/mm/fremap.c b/mm/fremap.c -index 7d12ca7..b602c27 100644 ---- a/mm/fremap.c -+++ b/mm/fremap.c -@@ -120,8 +120,8 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma, - * and the vma's default protection is used. Arbitrary protections - * might be implemented in the future. - */ --asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, -- unsigned long prot, unsigned long pgoff, unsigned long flags) -+SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, -+ unsigned long, prot, unsigned long, pgoff, unsigned long, flags) - { - struct mm_struct *mm = current->mm; - struct address_space *mapping; -diff --git a/mm/madvise.c b/mm/madvise.c -index f9349c1..b9ce574 100644 ---- a/mm/madvise.c -+++ b/mm/madvise.c -@@ -281,7 +281,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, - * -EBADF - map exists, but area maps something that isn't a file. - * -EAGAIN - a kernel resource was temporarily unavailable. - */ --asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior) -+SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior) - { - unsigned long end, tmp; - struct vm_area_struct * vma, *prev; -diff --git a/mm/mempolicy.c b/mm/mempolicy.c -index e9493b1..ac8f8f3 100644 ---- a/mm/mempolicy.c -+++ b/mm/mempolicy.c -@@ -1068,10 +1068,9 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode, - return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0; - } - --asmlinkage long sys_mbind(unsigned long start, unsigned long len, -- unsigned long mode, -- unsigned long __user *nmask, unsigned long maxnode, -- unsigned flags) -+SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len, -+ unsigned long, mode, unsigned long __user *, nmask, -+ unsigned long, maxnode, unsigned, flags) - { - nodemask_t nodes; - int err; -@@ -1091,8 +1090,8 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len, - } - - /* Set the process memory policy */ --asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, -- unsigned long maxnode) -+SYSCALL_DEFINE3(set_mempolicy, int, mode, unsigned long __user *, nmask, -+ unsigned long, maxnode) - { - int err; - nodemask_t nodes; -@@ -1110,9 +1109,9 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, - return do_set_mempolicy(mode, flags, &nodes); - } - --asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, -- const unsigned long __user *old_nodes, -- const unsigned long __user *new_nodes) -+SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, -+ const unsigned long __user *, old_nodes, -+ const unsigned long __user *, new_nodes) - { - struct mm_struct *mm; - struct task_struct *task; -@@ -1180,10 +1179,9 @@ out: - - - /* Retrieve NUMA policy */ --asmlinkage long sys_get_mempolicy(int __user *policy, -- unsigned long __user *nmask, -- unsigned long maxnode, -- unsigned long addr, unsigned long flags) -+SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, -+ unsigned long __user *, nmask, unsigned long, maxnode, -+ unsigned long, addr, unsigned long, flags) - { - int err; - int uninitialized_var(pval); -diff --git a/mm/migrate.c b/mm/migrate.c -index 037b096..7fc57cc 100644 ---- a/mm/migrate.c -+++ b/mm/migrate.c -@@ -1070,10 +1070,10 @@ out: - * Move a list of pages in the address space of the currently executing - * process. - */ --asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, -- const void __user * __user *pages, -- const int __user *nodes, -- int __user *status, int flags) -+SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, -+ const void __user * __user *, pages, -+ const int __user *, nodes, -+ int __user *, status, int, flags) - { - struct task_struct *task; - struct mm_struct *mm; -diff --git a/mm/mincore.c b/mm/mincore.c -index 5178800..8cb508f 100644 ---- a/mm/mincore.c -+++ b/mm/mincore.c -@@ -177,8 +177,8 @@ none_mapped: - * mapped - * -EAGAIN - A kernel resource was temporarily unavailable. - */ --asmlinkage long sys_mincore(unsigned long start, size_t len, -- unsigned char __user * vec) -+SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len, -+ unsigned char __user *, vec) - { - long retval; - unsigned long pages; -diff --git a/mm/mlock.c b/mm/mlock.c -index 1ada366..d35fe89 100644 ---- a/mm/mlock.c -+++ b/mm/mlock.c -@@ -529,7 +529,7 @@ static int do_mlock(unsigned long start, size_t len, int on) - return error; - } - --asmlinkage long sys_mlock(unsigned long start, size_t len) -+SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) - { - unsigned long locked; - unsigned long lock_limit; -@@ -557,7 +557,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len) - return error; - } - --asmlinkage long sys_munlock(unsigned long start, size_t len) -+SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) - { - int ret; - -@@ -594,7 +594,7 @@ out: - return 0; - } - --asmlinkage long sys_mlockall(int flags) -+SYSCALL_DEFINE1(mlockall, int, flags) - { - unsigned long lock_limit; - int ret = -EINVAL; -@@ -622,7 +622,7 @@ out: - return ret; - } - --asmlinkage long sys_munlockall(void) -+SYSCALL_DEFINE0(munlockall) - { - int ret; - -diff --git a/mm/mmap.c b/mm/mmap.c -index d4855a6..937b44f 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -245,7 +245,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) - return next; - } - --asmlinkage unsigned long sys_brk(unsigned long brk) -+SYSCALL_DEFINE1(brk, unsigned long, brk) - { - unsigned long rlim, retval; - unsigned long newbrk, oldbrk; -@@ -1949,7 +1949,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) - - EXPORT_SYMBOL(do_munmap); - --asmlinkage long sys_munmap(unsigned long addr, size_t len) -+SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) - { - int ret; - struct mm_struct *mm = current->mm; -diff --git a/mm/mprotect.c b/mm/mprotect.c -index fded06f..2623e29 100644 ---- a/mm/mprotect.c -+++ b/mm/mprotect.c -@@ -219,8 +219,8 @@ fail: - return error; - } - --asmlinkage long --sys_mprotect(unsigned long start, size_t len, unsigned long prot) -+SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, -+ unsigned long, prot) - { - unsigned long vm_flags, nstart, end, tmp, reqprot; - struct vm_area_struct *vma, *prev; -diff --git a/mm/mremap.c b/mm/mremap.c -index 58a2908..4207055 100644 ---- a/mm/mremap.c -+++ b/mm/mremap.c -@@ -420,9 +420,9 @@ out_nc: - return ret; - } - --asmlinkage unsigned long sys_mremap(unsigned long addr, -- unsigned long old_len, unsigned long new_len, -- unsigned long flags, unsigned long new_addr) -+SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, -+ unsigned long, new_len, unsigned long, flags, -+ unsigned long, new_addr) - { - unsigned long ret; - -diff --git a/mm/msync.c b/mm/msync.c -index 144a757..9e06d2e 100644 ---- a/mm/msync.c -+++ b/mm/msync.c -@@ -28,7 +28,7 @@ - * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to - * applications. - */ --asmlinkage long sys_msync(unsigned long start, size_t len, int flags) -+SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) - { - unsigned long end; - struct mm_struct *mm = current->mm; -diff --git a/mm/nommu.c b/mm/nommu.c -index 7695dc8..b8fade4 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -377,7 +377,7 @@ EXPORT_SYMBOL(vm_insert_page); - * to a regular file. in this case, the unmapping will need - * to invoke file system routines that need the global lock. - */ --asmlinkage unsigned long sys_brk(unsigned long brk) -+SYSCALL_DEFINE1(brk, unsigned long, brk) - { - struct mm_struct *mm = current->mm; - -@@ -1192,7 +1192,7 @@ int do_munmap(struct mm_struct *mm, unsigned long addr, size_t len) - } - EXPORT_SYMBOL(do_munmap); - --asmlinkage long sys_munmap(unsigned long addr, size_t len) -+SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) - { - int ret; - struct mm_struct *mm = current->mm; -@@ -1283,9 +1283,9 @@ unsigned long do_mremap(unsigned long addr, - } - EXPORT_SYMBOL(do_mremap); - --asmlinkage unsigned long sys_mremap(unsigned long addr, -- unsigned long old_len, unsigned long new_len, -- unsigned long flags, unsigned long new_addr) -+SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, -+ unsigned long, new_len, unsigned long, flags, -+ unsigned long, new_addr) - { - unsigned long ret; - -diff --git a/mm/swapfile.c b/mm/swapfile.c -index 90cb67a..d06896b 100644 ---- a/mm/swapfile.c -+++ b/mm/swapfile.c -@@ -1223,7 +1223,7 @@ int page_queue_congested(struct page *page) - } - #endif - --asmlinkage long sys_swapoff(const char __user * specialfile) -+SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) - { - struct swap_info_struct * p = NULL; - unsigned short *swap_map; -@@ -1467,7 +1467,7 @@ __initcall(procswaps_init); - * - * The swapon system call - */ --asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) -+SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) - { - struct swap_info_struct * p; - char *name = NULL; -diff --git a/mm/vmalloc.c b/mm/vmalloc.c -index 1ddb77b..7465f22 100644 ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -151,11 +151,12 @@ static int vmap_pud_range(pgd_t *pgd, unsigned long addr, - * - * Ie. pte at addr+N*PAGE_SIZE shall point to pfn corresponding to pages[N] - */ --static int vmap_page_range(unsigned long addr, unsigned long end, -+static int vmap_page_range(unsigned long start, unsigned long end, - pgprot_t prot, struct page **pages) - { - pgd_t *pgd; - unsigned long next; -+ unsigned long addr = start; - int err = 0; - int nr = 0; - -@@ -167,7 +168,7 @@ static int vmap_page_range(unsigned long addr, unsigned long end, - if (err) - break; - } while (pgd++, addr = next, addr != end); -- flush_cache_vmap(addr, end); -+ flush_cache_vmap(start, end); - - if (unlikely(err)) - return err; -diff --git a/net/socket.c b/net/socket.c -index 76ba80a..787a405 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -1215,7 +1215,7 @@ int sock_create_kern(int family, int type, int protocol, struct socket **res) - return __sock_create(&init_net, family, type, protocol, res, 1); - } - --asmlinkage long sys_socket(int family, int type, int protocol) -+SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) - { - int retval; - struct socket *sock; -@@ -1256,8 +1256,8 @@ out_release: - * Create a pair of connected sockets. - */ - --asmlinkage long sys_socketpair(int family, int type, int protocol, -- int __user *usockvec) -+SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol, -+ int __user *, usockvec) - { - struct socket *sock1, *sock2; - int fd1, fd2, err; -@@ -1364,7 +1364,7 @@ out_fd: - * the protocol layer (having also checked the address is ok). - */ - --asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) -+SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen) - { - struct socket *sock; - struct sockaddr_storage address; -@@ -1393,7 +1393,7 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) - * ready for listening. - */ - --asmlinkage long sys_listen(int fd, int backlog) -+SYSCALL_DEFINE2(listen, int, fd, int, backlog) - { - struct socket *sock; - int err, fput_needed; -@@ -1426,8 +1426,8 @@ asmlinkage long sys_listen(int fd, int backlog) - * clean when we restucture accept also. - */ - --asmlinkage long sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, -- int __user *upeer_addrlen, int flags) -+SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, -+ int __user *, upeer_addrlen, int, flags) - { - struct socket *sock, *newsock; - struct file *newfile; -@@ -1510,8 +1510,8 @@ out_fd: - goto out_put; - } - --asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, -- int __user *upeer_addrlen) -+SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr, -+ int __user *, upeer_addrlen) - { - return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0); - } -@@ -1528,8 +1528,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, - * include the -EINPROGRESS status for such sockets. - */ - --asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, -- int addrlen) -+SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr, -+ int, addrlen) - { - struct socket *sock; - struct sockaddr_storage address; -@@ -1560,8 +1560,8 @@ out: - * name to user space. - */ - --asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, -- int __user *usockaddr_len) -+SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr, -+ int __user *, usockaddr_len) - { - struct socket *sock; - struct sockaddr_storage address; -@@ -1591,8 +1591,8 @@ out: - * name to user space. - */ - --asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, -- int __user *usockaddr_len) -+SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr, -+ int __user *, usockaddr_len) - { - struct socket *sock; - struct sockaddr_storage address; -@@ -1623,9 +1623,9 @@ asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, - * the protocol. - */ - --asmlinkage long sys_sendto(int fd, void __user *buff, size_t len, -- unsigned flags, struct sockaddr __user *addr, -- int addr_len) -+SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, -+ unsigned, flags, struct sockaddr __user *, addr, -+ int, addr_len) - { - struct socket *sock; - struct sockaddr_storage address; -@@ -1668,7 +1668,8 @@ out: - * Send a datagram down a socket. - */ - --asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags) -+SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len, -+ unsigned, flags) - { - return sys_sendto(fd, buff, len, flags, NULL, 0); - } -@@ -1679,9 +1680,9 @@ asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags) - * sender address from kernel to user space. - */ - --asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size, -- unsigned flags, struct sockaddr __user *addr, -- int __user *addr_len) -+SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, -+ unsigned, flags, struct sockaddr __user *, addr, -+ int __user *, addr_len) - { - struct socket *sock; - struct iovec iov; -@@ -1733,8 +1734,8 @@ asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size, - * to pass the user mode parameter for the protocols to sort out. - */ - --asmlinkage long sys_setsockopt(int fd, int level, int optname, -- char __user *optval, int optlen) -+SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, -+ char __user *, optval, int, optlen) - { - int err, fput_needed; - struct socket *sock; -@@ -1767,8 +1768,8 @@ out_put: - * to pass a user mode parameter for the protocols to sort out. - */ - --asmlinkage long sys_getsockopt(int fd, int level, int optname, -- char __user *optval, int __user *optlen) -+SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, -+ char __user *, optval, int __user *, optlen) - { - int err, fput_needed; - struct socket *sock; -@@ -1797,7 +1798,7 @@ out_put: - * Shutdown a socket. - */ - --asmlinkage long sys_shutdown(int fd, int how) -+SYSCALL_DEFINE2(shutdown, int, fd, int, how) - { - int err, fput_needed; - struct socket *sock; -@@ -1823,7 +1824,7 @@ asmlinkage long sys_shutdown(int fd, int how) - * BSD sendmsg interface - */ - --asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) -+SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) - { - struct compat_msghdr __user *msg_compat = - (struct compat_msghdr __user *)msg; -@@ -1929,8 +1930,8 @@ out: - * BSD recvmsg interface - */ - --asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, -- unsigned int flags) -+SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg, -+ unsigned int, flags) - { - struct compat_msghdr __user *msg_compat = - (struct compat_msghdr __user *)msg; -@@ -2053,7 +2054,7 @@ static const unsigned char nargs[19]={ - * it is set by the callees. - */ - --asmlinkage long sys_socketcall(int call, unsigned long __user *args) -+SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) - { - unsigned long a[6]; - unsigned long a0, a1; -diff --git a/security/device_cgroup.c b/security/device_cgroup.c -index 5ba7870..df9d491 100644 ---- a/security/device_cgroup.c -+++ b/security/device_cgroup.c -@@ -513,6 +513,9 @@ int devcgroup_inode_mknod(int mode, dev_t dev) - struct dev_cgroup *dev_cgroup; - struct dev_whitelist_item *wh; - -+ if (!S_ISBLK(mode) && !S_ISCHR(mode)) -+ return 0; -+ - rcu_read_lock(); - - dev_cgroup = task_devcgroup(current); -diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c -index acc9c89..9b4e0e9 100644 ---- a/security/keys/keyctl.c -+++ b/security/keys/keyctl.c -@@ -54,11 +54,11 @@ static int key_get_type_from_user(char *type, - * - returns the new key's serial number - * - implements add_key() - */ --asmlinkage long sys_add_key(const char __user *_type, -- const char __user *_description, -- const void __user *_payload, -- size_t plen, -- key_serial_t ringid) -+SYSCALL_DEFINE5(add_key, const char __user *, _type, -+ const char __user *, _description, -+ const void __user *, _payload, -+ size_t, plen, -+ key_serial_t, ringid) - { - key_ref_t keyring_ref, key_ref; - char type[32], *description; -@@ -146,10 +146,10 @@ asmlinkage long sys_add_key(const char __user *_type, - * - if the _callout_info string is empty, it will be rendered as "-" - * - implements request_key() - */ --asmlinkage long sys_request_key(const char __user *_type, -- const char __user *_description, -- const char __user *_callout_info, -- key_serial_t destringid) -+SYSCALL_DEFINE4(request_key, const char __user *, _type, -+ const char __user *, _description, -+ const char __user *, _callout_info, -+ key_serial_t, destringid) - { - struct key_type *ktype; - struct key *key; -@@ -1152,8 +1152,8 @@ long keyctl_get_security(key_serial_t keyid, - /* - * the key control system call - */ --asmlinkage long sys_keyctl(int option, unsigned long arg2, unsigned long arg3, -- unsigned long arg4, unsigned long arg5) -+SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3, -+ unsigned long, arg4, unsigned long, arg5) - { - switch (option) { - case KEYCTL_GET_KEYRING_ID: -diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c -index 686c774..2dc976d 100644 ---- a/sound/pci/hda/patch_analog.c -+++ b/sound/pci/hda/patch_analog.c -@@ -3861,6 +3861,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = { - static struct snd_pci_quirk ad1884a_cfg_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), - SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), -+ SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), -@@ -4221,13 +4222,13 @@ static int patch_ad1882(struct hda_codec *codec) - spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); - spec->adc_nids = ad1882_adc_nids; - spec->capsrc_nids = ad1882_capsrc_nids; -- if (codec->vendor_id == 0x11d1882) -+ if (codec->vendor_id == 0x11d41882) - spec->input_mux = &ad1882_capture_source; - else - spec->input_mux = &ad1882a_capture_source; - spec->num_mixers = 2; - spec->mixers[0] = ad1882_base_mixers; -- if (codec->vendor_id == 0x11d1882) -+ if (codec->vendor_id == 0x11d41882) - spec->mixers[1] = ad1882_loopback_mixers; - else - spec->mixers[1] = ad1882a_loopback_mixers; -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index b77f330..24ff2b8 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -1720,6 +1720,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { - "HP dv5", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, - "HP dv7", STAC_HP_M4), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, -+ "HP dv7", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, - "unknown HP", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, -diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h -index f9fbdba..ab56e73 100644 ---- a/sound/usb/caiaq/caiaq-device.h -+++ b/sound/usb/caiaq/caiaq-device.h -@@ -75,6 +75,7 @@ struct snd_usb_caiaqdev { - wait_queue_head_t ep1_wait_queue; - wait_queue_head_t prepare_wait_queue; - int spec_received, audio_parm_answer; -+ int midi_out_active; - - char vendor_name[CAIAQ_USB_STR_LEN]; - char product_name[CAIAQ_USB_STR_LEN]; -diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c -index 30b57f9..f19fd36 100644 ---- a/sound/usb/caiaq/caiaq-midi.c -+++ b/sound/usb/caiaq/caiaq-midi.c -@@ -59,6 +59,11 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea - - static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) - { -+ struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; -+ if (dev->midi_out_active) { -+ usb_kill_urb(&dev->midi_out_urb); -+ dev->midi_out_active = 0; -+ } - return 0; - } - -@@ -69,7 +74,8 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, - - dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; - dev->midi_out_buf[1] = 0; /* port */ -- len = snd_rawmidi_transmit_peek(substream, dev->midi_out_buf+3, EP1_BUFSIZE-3); -+ len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, -+ EP1_BUFSIZE - 3); - - if (len <= 0) - return; -@@ -79,24 +85,24 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, - - ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); - if (ret < 0) -- log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed, %d\n", -- substream, ret); -+ log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," -+ "ret=%d, len=%d\n", -+ substream, ret, len); -+ else -+ dev->midi_out_active = 1; - } - - static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) - { - struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; - -- if (dev->midi_out_substream != NULL) -- return; -- -- if (!up) { -+ if (up) { -+ dev->midi_out_substream = substream; -+ if (!dev->midi_out_active) -+ snd_usb_caiaq_midi_send(dev, substream); -+ } else { - dev->midi_out_substream = NULL; -- return; - } -- -- dev->midi_out_substream = substream; -- snd_usb_caiaq_midi_send(dev, substream); - } - - -@@ -161,16 +167,14 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) - void snd_usb_caiaq_midi_output_done(struct urb* urb) - { - struct snd_usb_caiaqdev *dev = urb->context; -- char *buf = urb->transfer_buffer; - -+ dev->midi_out_active = 0; - if (urb->status != 0) - return; - - if (!dev->midi_out_substream) - return; - -- snd_rawmidi_transmit_ack(dev->midi_out_substream, buf[2]); -- dev->midi_out_substream = NULL; - snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); - } - diff --git a/debian/patches/bugfix/all/stable/patch-2.6.28.2 b/debian/patches/bugfix/all/stable/patch-2.6.28.2 deleted file mode 100644 index d421a3127..000000000 --- a/debian/patches/bugfix/all/stable/patch-2.6.28.2 +++ /dev/null @@ -1,1998 +0,0 @@ -diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt -index 394d7d3..bef6550 100644 ---- a/Documentation/sound/alsa/ALSA-Configuration.txt -+++ b/Documentation/sound/alsa/ALSA-Configuration.txt -@@ -979,9 +979,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. - 6stack 6-jack, separate surrounds (default) - 3stack 3-stack, shared surrounds - laptop 2-channel only (FSC V2060, Samsung M50) -- laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J) -+ laptop-eapd 2-channel with EAPD (ASUS A6J) - laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100) - ultra 2-channel with EAPD (Samsung Ultra tablet PC) -+ samsung 2-channel with EAPD (Samsung R65) - - AD1988/AD1988B/AD1989A/AD1989B - 6stack 6-jack -diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig -index 6bd91ed..0429d3e 100644 ---- a/arch/ia64/Kconfig -+++ b/arch/ia64/Kconfig -@@ -17,6 +17,7 @@ config IA64 - select ACPI if (!IA64_HP_SIM) - select PM if (!IA64_HP_SIM) - select ARCH_SUPPORTS_MSI -+ select HAVE_UNSTABLE_SCHED_CLOCK - select HAVE_IDE - select HAVE_OPROFILE - select HAVE_KPROBES -diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c -index db44e02..ba51948 100644 ---- a/arch/powerpc/mm/slice.c -+++ b/arch/powerpc/mm/slice.c -@@ -710,9 +710,18 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, - unsigned long len) - { - struct slice_mask mask, available; -+ unsigned int psize = mm->context.user_psize; - - mask = slice_range_to_mask(addr, len); -- available = slice_mask_for_size(mm, mm->context.user_psize); -+ available = slice_mask_for_size(mm, psize); -+#ifdef CONFIG_PPC_64K_PAGES -+ /* We need to account for 4k slices too */ -+ if (psize == MMU_PAGE_64K) { -+ struct slice_mask compat_mask; -+ compat_mask = slice_mask_for_size(mm, MMU_PAGE_4K); -+ or_mask(available, compat_mask); -+ } -+#endif - - #if 0 /* too verbose */ - slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n", -diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c -index 13946eb..b4704e1 100644 ---- a/drivers/firmware/dell_rbu.c -+++ b/drivers/firmware/dell_rbu.c -@@ -576,7 +576,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, - { - int size = 0; - if (!pos) -- size = sprintf(buffer, "%s\n", image_type); -+ size = scnprintf(buffer, count, "%s\n", image_type); - return size; - } - -@@ -648,7 +648,7 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj, - int size = 0; - if (!pos) { - spin_lock(&rbu_data.lock); -- size = sprintf(buffer, "%lu\n", rbu_data.packetsize); -+ size = scnprintf(buffer, count, "%lu\n", rbu_data.packetsize); - spin_unlock(&rbu_data.lock); - } - return size; -diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c -index 70bb854..fcf74eb 100644 ---- a/drivers/hwmon/abituguru3.c -+++ b/drivers/hwmon/abituguru3.c -@@ -1153,7 +1153,7 @@ static int __init abituguru3_dmi_detect(void) - - static inline int abituguru3_dmi_detect(void) - { -- return -ENODEV; -+ return 1; - } - - #endif /* CONFIG_DMI */ -diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c -index b4882cc..d32c1ee 100644 ---- a/drivers/misc/sgi-xp/xpc_sn2.c -+++ b/drivers/misc/sgi-xp/xpc_sn2.c -@@ -904,7 +904,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version, - dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", - part_sn2->remote_vars_pa); - -- part->last_heartbeat = remote_vars->heartbeat; -+ part->last_heartbeat = remote_vars->heartbeat - 1; - dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", - part->last_heartbeat); - -diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c -index b5d6b9a..b427978 100644 ---- a/drivers/net/irda/irda-usb.c -+++ b/drivers/net/irda/irda-usb.c -@@ -1075,7 +1075,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) - { - unsigned int i; - int ret; -- char stir421x_fw_name[11]; -+ char stir421x_fw_name[12]; - const struct firmware *fw; - const unsigned char *fw_version_ptr; /* pointer to version string */ - unsigned long fw_version = 0; -diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c -index 34fe7ef..9934dbc 100644 ---- a/drivers/net/r6040.c -+++ b/drivers/net/r6040.c -@@ -49,8 +49,8 @@ - #include - - #define DRV_NAME "r6040" --#define DRV_VERSION "0.18" --#define DRV_RELDATE "13Jul2008" -+#define DRV_VERSION "0.19" -+#define DRV_RELDATE "18Dec2008" - - /* PHY CHIP Address */ - #define PHY1_ADDR 1 /* For MAC1 */ -@@ -214,7 +214,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg) - /* Wait for the read bit to be cleared */ - while (limit--) { - cmd = ioread16(ioaddr + MMDIO); -- if (cmd & MDIO_READ) -+ if (!(cmd & MDIO_READ)) - break; - } - -@@ -233,7 +233,7 @@ static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val - /* Wait for the write bit to be cleared */ - while (limit--) { - cmd = ioread16(ioaddr + MMDIO); -- if (cmd & MDIO_WRITE) -+ if (!(cmd & MDIO_WRITE)) - break; - } - } -@@ -681,8 +681,10 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) - struct net_device *dev = dev_id; - struct r6040_private *lp = netdev_priv(dev); - void __iomem *ioaddr = lp->base; -- u16 status; -+ u16 misr, status; - -+ /* Save MIER */ -+ misr = ioread16(ioaddr + MIER); - /* Mask off RDC MAC interrupt */ - iowrite16(MSK_INT, ioaddr + MIER); - /* Read MISR status and clear */ -@@ -702,7 +704,7 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) - dev->stats.rx_fifo_errors++; - - /* Mask off RX interrupt */ -- iowrite16(ioread16(ioaddr + MIER) & ~RX_INTS, ioaddr + MIER); -+ misr &= ~RX_INTS; - netif_rx_schedule(dev, &lp->napi); - } - -@@ -710,6 +712,9 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) - if (status & TX_INTS) - r6040_tx(dev); - -+ /* Restore RDC MAC interrupt */ -+ iowrite16(misr, ioaddr + MIER); -+ - return IRQ_HANDLED; - } - -diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c -index 75d749b..8a2e32d 100644 ---- a/drivers/net/wireless/p54/p54usb.c -+++ b/drivers/net/wireless/p54/p54usb.c -@@ -54,6 +54,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { - {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ - {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ - {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ -+ {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ - {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ - {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ - {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ -@@ -214,6 +215,8 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct p54_control_hdr *data, - usb_fill_bulk_urb(data_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), data, len, - free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev); -+ addr_urb->transfer_flags |= URB_ZERO_PACKET; -+ data_urb->transfer_flags |= URB_ZERO_PACKET; - - usb_submit_urb(addr_urb, GFP_ATOMIC); - usb_submit_urb(data_urb, GFP_ATOMIC); -@@ -251,6 +254,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, - len + sizeof(*hdr), free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, - dev); -+ data_urb->transfer_flags |= URB_ZERO_PACKET; - - usb_submit_urb(data_urb, GFP_ATOMIC); - } -@@ -293,11 +297,13 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct p54_control_hdr *da - usb_fill_bulk_urb(int_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), - p54u_tx_free_cb, dev); -+ int_urb->transfer_flags |= URB_ZERO_PACKET; - usb_submit_urb(int_urb, GFP_ATOMIC); - - usb_fill_bulk_urb(data_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, len + sizeof(*hdr), - free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev); -+ data_urb->transfer_flags |= URB_ZERO_PACKET; - usb_submit_urb(data_urb, GFP_ATOMIC); - } - -diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c -index 934f8e0..42cfa05 100644 ---- a/drivers/net/wireless/rt2x00/rt73usb.c -+++ b/drivers/net/wireless/rt2x00/rt73usb.c -@@ -2434,6 +2434,7 @@ static struct usb_device_id rt73usb_device_table[] = { - /* Linksys */ - { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, - { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, -+ { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) }, - /* MSI */ - { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, - { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, -diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c -index 9aad608..503f082 100644 ---- a/drivers/pci/pcie/aspm.c -+++ b/drivers/pci/pcie/aspm.c -@@ -33,6 +33,11 @@ struct endpoint_state { - struct pcie_link_state { - struct list_head sibiling; - struct pci_dev *pdev; -+ bool downstream_has_switch; -+ -+ struct pcie_link_state *parent; -+ struct list_head children; -+ struct list_head link; - - /* ASPM state */ - unsigned int support_state; -@@ -125,7 +130,7 @@ static void pcie_set_clock_pm(struct pci_dev *pdev, int enable) - link_state->clk_pm_enabled = !!enable; - } - --static void pcie_check_clock_pm(struct pci_dev *pdev) -+static void pcie_check_clock_pm(struct pci_dev *pdev, int blacklist) - { - int pos; - u32 reg32; -@@ -149,10 +154,26 @@ static void pcie_check_clock_pm(struct pci_dev *pdev) - if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN)) - enabled = 0; - } -- link_state->clk_pm_capable = capable; - link_state->clk_pm_enabled = enabled; - link_state->bios_clk_state = enabled; -- pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); -+ if (!blacklist) { -+ link_state->clk_pm_capable = capable; -+ pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); -+ } else { -+ link_state->clk_pm_capable = 0; -+ pcie_set_clock_pm(pdev, 0); -+ } -+} -+ -+static bool pcie_aspm_downstream_has_switch(struct pci_dev *pdev) -+{ -+ struct pci_dev *child_dev; -+ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ if (child_dev->pcie_type == PCI_EXP_TYPE_UPSTREAM) -+ return true; -+ } -+ return false; - } - - /* -@@ -419,9 +440,9 @@ static unsigned int pcie_aspm_check_state(struct pci_dev *pdev, - { - struct pci_dev *child_dev; - -- /* If no child, disable the link */ -+ /* If no child, ignore the link */ - if (list_empty(&pdev->subordinate->devices)) -- return 0; -+ return state; - list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { - if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { - /* -@@ -462,6 +483,9 @@ static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state) - int valid = 1; - struct pcie_link_state *link_state = pdev->link_state; - -+ /* If no child, disable the link */ -+ if (list_empty(&pdev->subordinate->devices)) -+ state = 0; - /* - * if the downstream component has pci bridge function, don't do ASPM - * now -@@ -493,20 +517,52 @@ static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state) - link_state->enabled_state = state; - } - -+static struct pcie_link_state *get_root_port_link(struct pcie_link_state *link) -+{ -+ struct pcie_link_state *root_port_link = link; -+ while (root_port_link->parent) -+ root_port_link = root_port_link->parent; -+ return root_port_link; -+} -+ -+/* check the whole hierarchy, and configure each link in the hierarchy */ - static void __pcie_aspm_configure_link_state(struct pci_dev *pdev, - unsigned int state) - { - struct pcie_link_state *link_state = pdev->link_state; -+ struct pcie_link_state *root_port_link = get_root_port_link(link_state); -+ struct pcie_link_state *leaf; - -- if (link_state->support_state == 0) -- return; - state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; - -- /* state 0 means disabling aspm */ -- state = pcie_aspm_check_state(pdev, state); -+ /* check all links who have specific root port link */ -+ list_for_each_entry(leaf, &link_list, sibiling) { -+ if (!list_empty(&leaf->children) || -+ get_root_port_link(leaf) != root_port_link) -+ continue; -+ state = pcie_aspm_check_state(leaf->pdev, state); -+ } -+ /* check root port link too in case it hasn't children */ -+ state = pcie_aspm_check_state(root_port_link->pdev, state); -+ - if (link_state->enabled_state == state) - return; -- __pcie_aspm_config_link(pdev, state); -+ -+ /* -+ * we must change the hierarchy. See comments in -+ * __pcie_aspm_config_link for the order -+ **/ -+ if (state & PCIE_LINK_STATE_L1) { -+ list_for_each_entry(leaf, &link_list, sibiling) { -+ if (get_root_port_link(leaf) == root_port_link) -+ __pcie_aspm_config_link(leaf->pdev, state); -+ } -+ } else { -+ list_for_each_entry_reverse(leaf, &link_list, sibiling) { -+ if (get_root_port_link(leaf) == root_port_link) -+ __pcie_aspm_config_link(leaf->pdev, state); -+ } -+ } - } - - /* -@@ -570,6 +626,7 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) - unsigned int state; - struct pcie_link_state *link_state; - int error = 0; -+ int blacklist; - - if (aspm_disabled || !pdev->is_pcie || pdev->link_state) - return; -@@ -580,29 +637,58 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) - if (list_empty(&pdev->subordinate->devices)) - goto out; - -- if (pcie_aspm_sanity_check(pdev)) -- goto out; -+ blacklist = !!pcie_aspm_sanity_check(pdev); - - mutex_lock(&aspm_lock); - - link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); - if (!link_state) - goto unlock_out; -- pdev->link_state = link_state; - -- pcie_aspm_configure_common_clock(pdev); -+ link_state->downstream_has_switch = pcie_aspm_downstream_has_switch(pdev); -+ INIT_LIST_HEAD(&link_state->children); -+ INIT_LIST_HEAD(&link_state->link); -+ if (pdev->bus->self) {/* this is a switch */ -+ struct pcie_link_state *parent_link_state; - -- pcie_aspm_cap_init(pdev); -+ parent_link_state = pdev->bus->parent->self->link_state; -+ if (!parent_link_state) { -+ kfree(link_state); -+ goto unlock_out; -+ } -+ list_add(&link_state->link, &parent_link_state->children); -+ link_state->parent = parent_link_state; -+ } - -- /* config link state to avoid BIOS error */ -- state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev)); -- __pcie_aspm_config_link(pdev, state); -+ pdev->link_state = link_state; - -- pcie_check_clock_pm(pdev); -+ if (!blacklist) { -+ pcie_aspm_configure_common_clock(pdev); -+ pcie_aspm_cap_init(pdev); -+ } else { -+ link_state->enabled_state = PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; -+ link_state->bios_aspm_state = 0; -+ /* Set support state to 0, so we will disable ASPM later */ -+ link_state->support_state = 0; -+ } - - link_state->pdev = pdev; - list_add(&link_state->sibiling, &link_list); - -+ if (link_state->downstream_has_switch) { -+ /* -+ * If link has switch, delay the link config. The leaf link -+ * initialization will config the whole hierarchy. but we must -+ * make sure BIOS doesn't set unsupported link state -+ **/ -+ state = pcie_aspm_check_state(pdev, link_state->bios_aspm_state); -+ __pcie_aspm_config_link(pdev, state); -+ } else -+ __pcie_aspm_configure_link_state(pdev, -+ policy_to_aspm_state(pdev)); -+ -+ pcie_check_clock_pm(pdev, blacklist); -+ - unlock_out: - if (error) - free_link_state(pdev); -@@ -635,6 +721,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) - /* All functions are removed, so just disable ASPM for the link */ - __pcie_aspm_config_one_dev(parent, 0); - list_del(&link_state->sibiling); -+ list_del(&link_state->link); - /* Clock PM is for endpoint device */ - - free_link_state(parent); -diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c -index 8c08130..7c3710e 100644 ---- a/drivers/usb/core/driver.c -+++ b/drivers/usb/core/driver.c -@@ -279,9 +279,12 @@ static int usb_unbind_interface(struct device *dev) - * altsetting means creating new endpoint device entries). - * When either of these happens, defer the Set-Interface. - */ -- if (intf->cur_altsetting->desc.bAlternateSetting == 0) -- ; /* Already in altsetting 0 so skip Set-Interface */ -- else if (!error && intf->dev.power.status == DPM_ON) -+ if (intf->cur_altsetting->desc.bAlternateSetting == 0) { -+ /* Already in altsetting 0 so skip Set-Interface. -+ * Just re-enable it without affecting the endpoint toggles. -+ */ -+ usb_enable_interface(udev, intf, false); -+ } else if (!error && intf->dev.power.status == DPM_ON) - usb_set_interface(udev, intf->altsetting[0]. - desc.bInterfaceNumber, 0); - else -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index b19cbfc..81eea42 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -2385,7 +2385,7 @@ void usb_ep0_reinit(struct usb_device *udev) - { - usb_disable_endpoint(udev, 0 + USB_DIR_IN); - usb_disable_endpoint(udev, 0 + USB_DIR_OUT); -- usb_enable_endpoint(udev, &udev->ep0); -+ usb_enable_endpoint(udev, &udev->ep0, true); - } - EXPORT_SYMBOL_GPL(usb_ep0_reinit); - -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index 6d1048f..bdcfe92 100644 ---- a/drivers/usb/core/message.c -+++ b/drivers/usb/core/message.c -@@ -1113,22 +1113,26 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) - * usb_enable_endpoint - Enable an endpoint for USB communications - * @dev: the device whose interface is being enabled - * @ep: the endpoint -+ * @reset_toggle: flag to set the endpoint's toggle back to 0 - * -- * Resets the endpoint toggle, and sets dev->ep_{in,out} pointers. -+ * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers. - * For control endpoints, both the input and output sides are handled. - */ --void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep) -+void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, -+ bool reset_toggle) - { - int epnum = usb_endpoint_num(&ep->desc); - int is_out = usb_endpoint_dir_out(&ep->desc); - int is_control = usb_endpoint_xfer_control(&ep->desc); - - if (is_out || is_control) { -- usb_settoggle(dev, epnum, 1, 0); -+ if (reset_toggle) -+ usb_settoggle(dev, epnum, 1, 0); - dev->ep_out[epnum] = ep; - } - if (!is_out || is_control) { -- usb_settoggle(dev, epnum, 0, 0); -+ if (reset_toggle) -+ usb_settoggle(dev, epnum, 0, 0); - dev->ep_in[epnum] = ep; - } - ep->enabled = 1; -@@ -1138,17 +1142,18 @@ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep) - * usb_enable_interface - Enable all the endpoints for an interface - * @dev: the device whose interface is being enabled - * @intf: pointer to the interface descriptor -+ * @reset_toggles: flag to set the endpoints' toggles back to 0 - * - * Enables all the endpoints for the interface's current altsetting. - */ --static void usb_enable_interface(struct usb_device *dev, -- struct usb_interface *intf) -+void usb_enable_interface(struct usb_device *dev, -+ struct usb_interface *intf, bool reset_toggles) - { - struct usb_host_interface *alt = intf->cur_altsetting; - int i; - - for (i = 0; i < alt->desc.bNumEndpoints; ++i) -- usb_enable_endpoint(dev, &alt->endpoint[i]); -+ usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles); - } - - /** -@@ -1271,7 +1276,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) - * during the SETUP stage - hence EP0 toggles are "don't care" here. - * (Likewise, EP0 never "halts" on well designed devices.) - */ -- usb_enable_interface(dev, iface); -+ usb_enable_interface(dev, iface, true); - if (device_is_registered(&iface->dev)) - usb_create_sysfs_intf_files(iface); - -@@ -1346,7 +1351,7 @@ int usb_reset_configuration(struct usb_device *dev) - alt = &intf->altsetting[0]; - - intf->cur_altsetting = alt; -- usb_enable_interface(dev, intf); -+ usb_enable_interface(dev, intf, true); - if (device_is_registered(&intf->dev)) - usb_create_sysfs_intf_files(intf); - } -@@ -1604,7 +1609,7 @@ free_interfaces: - alt = &intf->altsetting[0]; - - intf->cur_altsetting = alt; -- usb_enable_interface(dev, intf); -+ usb_enable_interface(dev, intf, true); - intf->dev.parent = &dev->dev; - intf->dev.driver = NULL; - intf->dev.bus = &usb_bus_type; -diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c -index be1fa07..956bf1e 100644 ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -362,7 +362,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, - dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE; - dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT; - /* ep0 maxpacket comes later, from device descriptor */ -- usb_enable_endpoint(dev, &dev->ep0); -+ usb_enable_endpoint(dev, &dev->ep0, true); - dev->can_submit = 1; - - /* Save readable and stable topology id, distinguishing devices -diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h -index 9a1a45a..1d450e9 100644 ---- a/drivers/usb/core/usb.h -+++ b/drivers/usb/core/usb.h -@@ -10,7 +10,9 @@ extern int usb_create_ep_files(struct device *parent, - extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint); - - extern void usb_enable_endpoint(struct usb_device *dev, -- struct usb_host_endpoint *ep); -+ struct usb_host_endpoint *ep, bool reset_toggle); -+extern void usb_enable_interface(struct usb_device *dev, -+ struct usb_interface *intf, bool reset_toggles); - extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr); - extern void usb_disable_interface(struct usb_device *dev, - struct usb_interface *intf); -diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c -index d617e8a..f970b27 100644 ---- a/drivers/usb/storage/libusual.c -+++ b/drivers/usb/storage/libusual.c -@@ -46,6 +46,12 @@ static int usu_probe_thread(void *arg); - { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ - .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } - -+#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ -+ vendorName, productName, useProtocol, useTransport, \ -+ initFunction, flags) \ -+{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ -+ .driver_info = (flags) } -+ - #define USUAL_DEV(useProto, useTrans, useType) \ - { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ - .driver_info = ((useType)<<24) } -@@ -57,6 +63,7 @@ struct usb_device_id storage_usb_ids [] = { - - #undef USUAL_DEV - #undef UNUSUAL_DEV -+#undef COMPLIANT_DEV - - MODULE_DEVICE_TABLE(usb, storage_usb_ids); - EXPORT_SYMBOL_GPL(storage_usb_ids); -diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c -index 09779f6..620c2b5 100644 ---- a/drivers/usb/storage/scsiglue.c -+++ b/drivers/usb/storage/scsiglue.c -@@ -59,6 +59,13 @@ - #include "transport.h" - #include "protocol.h" - -+/* Vendor IDs for companies that seem to include the READ CAPACITY bug -+ * in all their devices -+ */ -+#define VENDOR_ID_NOKIA 0x0421 -+#define VENDOR_ID_NIKON 0x04b0 -+#define VENDOR_ID_MOTOROLA 0x22b8 -+ - /*********************************************************************** - * Host functions - ***********************************************************************/ -@@ -134,6 +141,22 @@ static int slave_configure(struct scsi_device *sdev) - * settings can't be overridden via the scsi devinfo mechanism. */ - if (sdev->type == TYPE_DISK) { - -+ /* Some vendors seem to put the READ CAPACITY bug into -+ * all their devices -- primarily makers of cell phones -+ * and digital cameras. Since these devices always use -+ * flash media and can be expected to have an even number -+ * of sectors, we will always enable the CAPACITY_HEURISTICS -+ * flag unless told otherwise. */ -+ switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) { -+ case VENDOR_ID_NOKIA: -+ case VENDOR_ID_NIKON: -+ case VENDOR_ID_MOTOROLA: -+ if (!(us->fflags & (US_FL_FIX_CAPACITY | -+ US_FL_CAPACITY_OK))) -+ us->fflags |= US_FL_CAPACITY_HEURISTICS; -+ break; -+ } -+ - /* Disk-type devices use MODE SENSE(6) if the protocol - * (SubClass) is Transparent SCSI, otherwise they use - * MODE SENSE(10). */ -@@ -196,6 +219,14 @@ static int slave_configure(struct scsi_device *sdev) - * sector in a larger then 1 sector read, since the performance - * impact is negible we set this flag for all USB disks */ - sdev->last_sector_bug = 1; -+ -+ /* Enable last-sector hacks for single-target devices using -+ * the Bulk-only transport, unless we already know the -+ * capacity will be decremented or is correct. */ -+ if (!(us->fflags & (US_FL_FIX_CAPACITY | US_FL_CAPACITY_OK | -+ US_FL_SCM_MULT_TARG)) && -+ us->protocol == US_PR_BULK) -+ us->use_last_sector_hacks = 1; - } else { - - /* Non-disk-type devices don't need to blacklist any pages -diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c -index 79108d5..95de764 100644 ---- a/drivers/usb/storage/transport.c -+++ b/drivers/usb/storage/transport.c -@@ -57,6 +57,9 @@ - #include "scsiglue.h" - #include "debug.h" - -+#include -+#include "../../scsi/sd.h" -+ - - /*********************************************************************** - * Data transfer routines -@@ -511,6 +514,80 @@ int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe, - * Transport routines - ***********************************************************************/ - -+/* There are so many devices that report the capacity incorrectly, -+ * this routine was written to counteract some of the resulting -+ * problems. -+ */ -+static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) -+{ -+ struct gendisk *disk; -+ struct scsi_disk *sdkp; -+ u32 sector; -+ -+ /* To Report "Medium Error: Record Not Found */ -+ static unsigned char record_not_found[18] = { -+ [0] = 0x70, /* current error */ -+ [2] = MEDIUM_ERROR, /* = 0x03 */ -+ [7] = 0x0a, /* additional length */ -+ [12] = 0x14 /* Record Not Found */ -+ }; -+ -+ /* If last-sector problems can't occur, whether because the -+ * capacity was already decremented or because the device is -+ * known to report the correct capacity, then we don't need -+ * to do anything. -+ */ -+ if (!us->use_last_sector_hacks) -+ return; -+ -+ /* Was this command a READ(10) or a WRITE(10)? */ -+ if (srb->cmnd[0] != READ_10 && srb->cmnd[0] != WRITE_10) -+ goto done; -+ -+ /* Did this command access the last sector? */ -+ sector = (srb->cmnd[2] << 24) | (srb->cmnd[3] << 16) | -+ (srb->cmnd[4] << 8) | (srb->cmnd[5]); -+ disk = srb->request->rq_disk; -+ if (!disk) -+ goto done; -+ sdkp = scsi_disk(disk); -+ if (!sdkp) -+ goto done; -+ if (sector + 1 != sdkp->capacity) -+ goto done; -+ -+ if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) { -+ -+ /* The command succeeded. We know this device doesn't -+ * have the last-sector bug, so stop checking it. -+ */ -+ us->use_last_sector_hacks = 0; -+ -+ } else { -+ /* The command failed. Allow up to 3 retries in case this -+ * is some normal sort of failure. After that, assume the -+ * capacity is wrong and we're trying to access the sector -+ * beyond the end. Replace the result code and sense data -+ * with values that will cause the SCSI core to fail the -+ * command immediately, instead of going into an infinite -+ * (or even just a very long) retry loop. -+ */ -+ if (++us->last_sector_retries < 3) -+ return; -+ srb->result = SAM_STAT_CHECK_CONDITION; -+ memcpy(srb->sense_buffer, record_not_found, -+ sizeof(record_not_found)); -+ } -+ -+ done: -+ /* Don't reset the retry counter for TEST UNIT READY commands, -+ * because they get issued after device resets which might be -+ * caused by a failed last-sector access. -+ */ -+ if (srb->cmnd[0] != TEST_UNIT_READY) -+ us->last_sector_retries = 0; -+} -+ - /* Invoke the transport and basic error-handling/recovery methods - * - * This is used by the protocol layers to actually send the message to -@@ -544,6 +621,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) - /* if the transport provided its own sense data, don't auto-sense */ - if (result == USB_STOR_TRANSPORT_NO_SENSE) { - srb->result = SAM_STAT_CHECK_CONDITION; -+ last_sector_hacks(us, srb); - return; - } - -@@ -667,6 +745,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) - scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) - srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24); - -+ last_sector_hacks(us, srb); - return; - - /* Error and abort processing: try to resynchronize with the device -@@ -694,6 +773,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) - us->transport_reset(us); - } - clear_bit(US_FLIDX_RESETTING, &us->dflags); -+ last_sector_hacks(us, srb); - } - - /* Stop the current URB transfer */ -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index a078540..ce7f746 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -27,7 +27,8 @@ - - /* IMPORTANT NOTE: This file must be included in another file which does - * the following thing for it to work: -- * The macro UNUSUAL_DEV() must be defined before this file is included -+ * The UNUSUAL_DEV, COMPLIANT_DEV, and USUAL_DEV macros must be defined -+ * before this file is included. - */ - - /* If you edit this file, please try to keep it sorted first by VendorID, -@@ -46,6 +47,12 @@ - * - */ - -+/* Note: If you add an entry only in order to set the CAPACITY_OK flag, -+ * use the COMPLIANT_DEV macro instead of UNUSUAL_DEV. This is -+ * because such entries mark devices which actually work correctly, -+ * as opposed to devices that do something strangely or wrongly. -+ */ -+ - /* patch submitted by Vivian Bregier - */ - UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, -@@ -160,34 +167,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64 ), - --/* Reported by Filip Joelsson */ --UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600, -- "Nokia", -- "Nokia 3110c", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Reported by Ozan Sener */ --UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551, -- "Nokia", -- "3500c", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Reported by CSECSY Laszlo */ --UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601, -- "Nokia", -- "Nokia 3109c", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Patch for Nokia 5310 capacity */ --UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701, -- "Nokia", -- "5310", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- - /* Reported by Mario Rettig */ - UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, - "Nokia", -@@ -253,42 +232,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64 ), - --/* Reported by Cedric Godin */ --UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551, -- "Nokia", -- "5300", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Reported by Paulo Fessel */ --UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999, -- "Nokia", -- "5200", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Reported by Richard Nauber */ --UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660, -- "Nokia", -- "6300", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Patch for Nokia 5310 capacity */ --UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591, -- "Nokia", -- "5310", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- --/* Submitted by Ricky Wong Yung Fei */ --/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */ --UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470, -- "Nokia", -- "7610 Supernova", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY ), -- - /* Reported by Olaf Hering from novell bug #105878 */ - UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, - "SMSC", -@@ -403,83 +346,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010, - US_SC_DEVICE, US_PR_DEVICE,NULL, - US_FL_NOT_LOCKABLE ), - --/* Reported by Stefan de Konink */ --UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200, -- "NIKON", -- "NIKON DSC D100", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Tobias Kunze Briseno */ --UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200, -- "NIKON", -- "NIKON DSC D2H", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Milinevsky Dmitry */ --UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100, -- "NIKON", -- "NIKON DSC D50", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Andreas Bockhold */ --UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, -- "NIKON", -- "NIKON DSC D70", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Jamie Kitson */ --UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100, -- "NIKON", -- "NIKON DSC D70s", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Graber and Mike Pagano */ --UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200, -- "NIKON", -- "NIKON DSC D200", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Emil Larsson */ --UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111, -- "NIKON", -- "NIKON DSC D80", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Ortwin Glueck */ --UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111, -- "NIKON", -- "NIKON DSC D40", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Paul Check */ --UNUSUAL_DEV( 0x04b0, 0x0415, 0x0100, 0x0100, -- "NIKON", -- "NIKON DSC D2Xs", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by Shan Destromp (shansan@gmail.com) */ --UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100, -- "NIKON", -- "NIKON DSC D40X", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* Reported by paul ready */ --UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200, -- "NIKON", -- "NIKON DSC D300", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- - /* Reported by Doug Maxey (dwm@austin.ibm.com) */ - UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, - "IBM", -@@ -692,6 +558,13 @@ UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100, - US_SC_8070, US_PR_DEVICE, NULL, - US_FL_FIX_INQUIRY ), - -+/* Added by Alan Stern */ -+COMPLIANT_DEV(0x0525, 0xa4a5, 0x0000, 0x9999, -+ "Linux", -+ "File-backed Storage Gadget", -+ US_SC_DEVICE, US_PR_DEVICE, NULL, -+ US_FL_CAPACITY_OK ), -+ - /* Yakumo Mega Image 37 - * Submitted by Stephan Fuhrmann */ - UNUSUAL_DEV( 0x052b, 0x1801, 0x0100, 0x0100, -@@ -2107,27 +1980,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, - US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), - - /* -- * Patch by Pete Zaitcev -- * Report by Mark Patton. Red Hat bz#208928. -- * Added support for rev 0x0002 (Motorola ROKR W5) -- * by Javier Smaldone -- */ --UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002, -- "Motorola", -- "RAZR V3i/ROKR W5", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* -- * Patch by Jost Diederichs -- */ --UNUSUAL_DEV(0x22b8, 0x6410, 0x0001, 0x9999, -- "Motorola Inc.", -- "Motorola Phone (RAZRV3xx)", -- US_SC_DEVICE, US_PR_DEVICE, NULL, -- US_FL_FIX_CAPACITY), -- --/* - * Patch by Constantin Baranov - * Report by Andreas Koenecke. - * Motorola ROKR Z6. -diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c -index 27016fd..ceb8ac3 100644 ---- a/drivers/usb/storage/usb.c -+++ b/drivers/usb/storage/usb.c -@@ -126,6 +126,8 @@ MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device"); - { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ - .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } - -+#define COMPLIANT_DEV UNUSUAL_DEV -+ - #define USUAL_DEV(useProto, useTrans, useType) \ - { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ - .driver_info = (USB_US_TYPE_STOR<<24) } -@@ -134,6 +136,7 @@ static struct usb_device_id storage_usb_ids [] = { - - # include "unusual_devs.h" - #undef UNUSUAL_DEV -+#undef COMPLIANT_DEV - #undef USUAL_DEV - /* Terminating entry */ - { } -@@ -164,6 +167,8 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids); - .initFunction = init_function, \ - } - -+#define COMPLIANT_DEV UNUSUAL_DEV -+ - #define USUAL_DEV(use_protocol, use_transport, use_type) \ - { \ - .useProtocol = use_protocol, \ -@@ -173,6 +178,7 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids); - static struct us_unusual_dev us_unusual_dev_list[] = { - # include "unusual_devs.h" - # undef UNUSUAL_DEV -+# undef COMPLIANT_DEV - # undef USUAL_DEV - - /* Terminating entry */ -diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h -index a4ad73b..2e995c9 100644 ---- a/drivers/usb/storage/usb.h -+++ b/drivers/usb/storage/usb.h -@@ -155,6 +155,10 @@ struct us_data { - #ifdef CONFIG_PM - pm_hook suspend_resume_hook; - #endif -+ -+ /* hacks for READ CAPACITY bug handling */ -+ int use_last_sector_hacks; -+ int last_sector_retries; - }; - - /* Convert between us_data and the corresponding Scsi_Host */ -diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c -index d0ff0b8..e5eaa62 100644 ---- a/fs/fs-writeback.c -+++ b/fs/fs-writeback.c -@@ -421,9 +421,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) - * If we're a pdlfush thread, then implement pdflush collision avoidance - * against the entire list. - * -- * WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so -- * that it can be located for waiting on in __writeback_single_inode(). -- * - * If `bdi' is non-zero then we're being asked to writeback a specific queue. - * This function assumes that the blockdev superblock's inodes are backed by - * a variety of queues, so all inodes are searched. For other superblocks, -@@ -443,6 +440,7 @@ void generic_sync_sb_inodes(struct super_block *sb, - struct writeback_control *wbc) - { - const unsigned long start = jiffies; /* livelock avoidance */ -+ int sync = wbc->sync_mode == WB_SYNC_ALL; - - spin_lock(&inode_lock); - if (!wbc->for_kupdate || list_empty(&sb->s_io)) -@@ -499,10 +497,6 @@ void generic_sync_sb_inodes(struct super_block *sb, - __iget(inode); - pages_skipped = wbc->pages_skipped; - __writeback_single_inode(inode, wbc); -- if (wbc->sync_mode == WB_SYNC_HOLD) { -- inode->dirtied_when = jiffies; -- list_move(&inode->i_list, &sb->s_dirty); -- } - if (current_is_pdflush()) - writeback_release(bdi); - if (wbc->pages_skipped != pages_skipped) { -@@ -523,7 +517,49 @@ void generic_sync_sb_inodes(struct super_block *sb, - if (!list_empty(&sb->s_more_io)) - wbc->more_io = 1; - } -- spin_unlock(&inode_lock); -+ -+ if (sync) { -+ struct inode *inode, *old_inode = NULL; -+ -+ /* -+ * Data integrity sync. Must wait for all pages under writeback, -+ * because there may have been pages dirtied before our sync -+ * call, but which had writeout started before we write it out. -+ * In which case, the inode may not be on the dirty list, but -+ * we still have to wait for that writeout. -+ */ -+ list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { -+ struct address_space *mapping; -+ -+ if (inode->i_state & (I_FREEING|I_WILL_FREE)) -+ continue; -+ mapping = inode->i_mapping; -+ if (mapping->nrpages == 0) -+ continue; -+ __iget(inode); -+ spin_unlock(&inode_lock); -+ /* -+ * We hold a reference to 'inode' so it couldn't have -+ * been removed from s_inodes list while we dropped the -+ * inode_lock. We cannot iput the inode now as we can -+ * be holding the last reference and we cannot iput it -+ * under inode_lock. So we keep the reference and iput -+ * it later. -+ */ -+ iput(old_inode); -+ old_inode = inode; -+ -+ filemap_fdatawait(mapping); -+ -+ cond_resched(); -+ -+ spin_lock(&inode_lock); -+ } -+ spin_unlock(&inode_lock); -+ iput(old_inode); -+ } else -+ spin_unlock(&inode_lock); -+ - return; /* Leave any unwritten inodes on s_io */ - } - EXPORT_SYMBOL_GPL(generic_sync_sb_inodes); -@@ -588,8 +624,7 @@ restart: - - /* - * writeback and wait upon the filesystem's dirty inodes. The caller will -- * do this in two passes - one to write, and one to wait. WB_SYNC_HOLD is -- * used to park the written inodes on sb->s_dirty for the wait pass. -+ * do this in two passes - one to write, and one to wait. - * - * A finite limit is set on the number of pages which will be written. - * To prevent infinite livelock of sys_sync(). -@@ -600,30 +635,21 @@ restart: - void sync_inodes_sb(struct super_block *sb, int wait) - { - struct writeback_control wbc = { -- .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, -+ .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, - .range_start = 0, - .range_end = LLONG_MAX, - }; -- unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); -- unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS); - -- wbc.nr_to_write = nr_dirty + nr_unstable + -- (inodes_stat.nr_inodes - inodes_stat.nr_unused) + -- nr_dirty + nr_unstable; -- wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */ -- sync_sb_inodes(sb, &wbc); --} -+ if (!wait) { -+ unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); -+ unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS); - --/* -- * Rather lame livelock avoidance. -- */ --static void set_sb_syncing(int val) --{ -- struct super_block *sb; -- spin_lock(&sb_lock); -- list_for_each_entry_reverse(sb, &super_blocks, s_list) -- sb->s_syncing = val; -- spin_unlock(&sb_lock); -+ wbc.nr_to_write = nr_dirty + nr_unstable + -+ (inodes_stat.nr_inodes - inodes_stat.nr_unused); -+ } else -+ wbc.nr_to_write = LONG_MAX; /* doesn't actually matter */ -+ -+ sync_sb_inodes(sb, &wbc); - } - - /** -@@ -652,9 +678,6 @@ static void __sync_inodes(int wait) - spin_lock(&sb_lock); - restart: - list_for_each_entry(sb, &super_blocks, s_list) { -- if (sb->s_syncing) -- continue; -- sb->s_syncing = 1; - sb->s_count++; - spin_unlock(&sb_lock); - down_read(&sb->s_umount); -@@ -672,13 +695,10 @@ restart: - - void sync_inodes(int wait) - { -- set_sb_syncing(0); - __sync_inodes(0); - -- if (wait) { -- set_sb_syncing(0); -+ if (wait) - __sync_inodes(1); -- } - } - - /** -diff --git a/fs/sync.c b/fs/sync.c -index 6cc8cb4..9e5f60d 100644 ---- a/fs/sync.c -+++ b/fs/sync.c -@@ -287,7 +287,7 @@ int do_sync_mapping_range(struct address_space *mapping, loff_t offset, - - if (flags & SYNC_FILE_RANGE_WRITE) { - ret = __filemap_fdatawrite_range(mapping, offset, endbyte, -- WB_SYNC_NONE); -+ WB_SYNC_ALL); - if (ret < 0) - goto out; - } -diff --git a/include/linux/fs.h b/include/linux/fs.h -index efeff3d..4b91924 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -1124,7 +1124,6 @@ struct super_block { - struct rw_semaphore s_umount; - struct mutex s_lock; - int s_count; -- int s_syncing; - int s_need_sync_fs; - atomic_t s_active; - #ifdef CONFIG_SECURITY -diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h -index d9a3bbe..bd414ec 100644 ---- a/include/linux/usb_usual.h -+++ b/include/linux/usb_usual.h -@@ -52,8 +52,9 @@ - US_FLAG(MAX_SECTORS_MIN,0x00002000) \ - /* Sets max_sectors to arch min */ \ - US_FLAG(BULK_IGNORE_TAG,0x00004000) \ -- /* Ignore tag mismatch in bulk operations */ -- -+ /* Ignore tag mismatch in bulk operations */ \ -+ US_FLAG(CAPACITY_OK, 0x00010000) \ -+ /* READ CAPACITY response is correct */ - - #define US_FLAG(name, value) US_FL_##name = value , - enum { US_DO_ALL_FLAGS }; -diff --git a/include/linux/writeback.h b/include/linux/writeback.h -index e585657..b93ab38 100644 ---- a/include/linux/writeback.h -+++ b/include/linux/writeback.h -@@ -30,7 +30,6 @@ static inline int task_is_pdflush(struct task_struct *task) - enum writeback_sync_modes { - WB_SYNC_NONE, /* Don't wait on anything */ - WB_SYNC_ALL, /* Wait on every mapping */ -- WB_SYNC_HOLD, /* Hold the inode on sb_dirty for sys_sync() */ - }; - - /* -diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c -index 98345e4..06a68c4 100644 ---- a/kernel/sched_fair.c -+++ b/kernel/sched_fair.c -@@ -283,7 +283,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq) - struct sched_entity, - run_node); - -- if (vruntime == cfs_rq->min_vruntime) -+ if (!cfs_rq->curr) - vruntime = se->vruntime; - else - vruntime = min_vruntime(vruntime, se->vruntime); -diff --git a/lib/idr.c b/lib/idr.c -index 1c4f928..21154ae 100644 ---- a/lib/idr.c -+++ b/lib/idr.c -@@ -121,7 +121,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask) - { - while (idp->id_free_cnt < IDR_FREE_MAX) { - struct idr_layer *new; -- new = kmem_cache_alloc(idr_layer_cache, gfp_mask); -+ new = kmem_cache_zalloc(idr_layer_cache, gfp_mask); - if (new == NULL) - return (0); - move_to_free_list(idp, new); -@@ -623,16 +623,10 @@ void *idr_replace(struct idr *idp, void *ptr, int id) - } - EXPORT_SYMBOL(idr_replace); - --static void idr_cache_ctor(void *idr_layer) --{ -- memset(idr_layer, 0, sizeof(struct idr_layer)); --} -- - void __init idr_init_cache(void) - { - idr_layer_cache = kmem_cache_create("idr_layer_cache", -- sizeof(struct idr_layer), 0, SLAB_PANIC, -- idr_cache_ctor); -+ sizeof(struct idr_layer), 0, SLAB_PANIC, NULL); - } - - /** -diff --git a/mm/filemap.c b/mm/filemap.c -index f65417c..6f62ef9 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -210,7 +210,7 @@ int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, - int ret; - struct writeback_control wbc = { - .sync_mode = sync_mode, -- .nr_to_write = mapping->nrpages * 2, -+ .nr_to_write = LONG_MAX, - .range_start = start, - .range_end = end, - }; -@@ -1317,7 +1317,8 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, - goto out; /* skip atime */ - size = i_size_read(inode); - if (pos < size) { -- retval = filemap_write_and_wait(mapping); -+ retval = filemap_write_and_wait_range(mapping, pos, -+ pos + iov_length(iov, nr_segs) - 1); - if (!retval) { - retval = mapping->a_ops->direct_IO(READ, iocb, - iov, pos, nr_segs); -@@ -2067,18 +2068,10 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov, - if (count != ocount) - *nr_segs = iov_shorten((struct iovec *)iov, *nr_segs, count); - -- /* -- * Unmap all mmappings of the file up-front. -- * -- * This will cause any pte dirty bits to be propagated into the -- * pageframes for the subsequent filemap_write_and_wait(). -- */ - write_len = iov_length(iov, *nr_segs); - end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT; -- if (mapping_mapped(mapping)) -- unmap_mapping_range(mapping, pos, write_len, 0); - -- written = filemap_write_and_wait(mapping); -+ written = filemap_write_and_wait_range(mapping, pos, pos + write_len - 1); - if (written) - goto out; - -@@ -2298,7 +2291,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, - * the file data here, to try to honour O_DIRECT expectations. - */ - if (unlikely(file->f_flags & O_DIRECT) && written) -- status = filemap_write_and_wait(mapping); -+ status = filemap_write_and_wait_range(mapping, -+ pos, pos + written - 1); - - return written ? written : status; - } -diff --git a/mm/page-writeback.c b/mm/page-writeback.c -index 2970e35..08d2b96 100644 ---- a/mm/page-writeback.c -+++ b/mm/page-writeback.c -@@ -868,9 +868,11 @@ int write_cache_pages(struct address_space *mapping, - int done = 0; - struct pagevec pvec; - int nr_pages; -+ pgoff_t uninitialized_var(writeback_index); - pgoff_t index; - pgoff_t end; /* Inclusive */ -- int scanned = 0; -+ pgoff_t done_index; -+ int cycled; - int range_whole = 0; - long nr_to_write = wbc->nr_to_write; - -@@ -881,83 +883,134 @@ int write_cache_pages(struct address_space *mapping, - - pagevec_init(&pvec, 0); - if (wbc->range_cyclic) { -- index = mapping->writeback_index; /* Start from prev offset */ -+ writeback_index = mapping->writeback_index; /* prev offset */ -+ index = writeback_index; -+ if (index == 0) -+ cycled = 1; -+ else -+ cycled = 0; - end = -1; - } else { - index = wbc->range_start >> PAGE_CACHE_SHIFT; - end = wbc->range_end >> PAGE_CACHE_SHIFT; - if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) - range_whole = 1; -- scanned = 1; -+ cycled = 1; /* ignore range_cyclic tests */ - } - retry: -- while (!done && (index <= end) && -- (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, -- PAGECACHE_TAG_DIRTY, -- min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { -- unsigned i; -+ done_index = index; -+ while (!done && (index <= end)) { -+ int i; -+ -+ nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, -+ PAGECACHE_TAG_DIRTY, -+ min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1); -+ if (nr_pages == 0) -+ break; - -- scanned = 1; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; - - /* -- * At this point we hold neither mapping->tree_lock nor -- * lock on the page itself: the page may be truncated or -- * invalidated (changing page->mapping to NULL), or even -- * swizzled back from swapper_space to tmpfs file -- * mapping -+ * At this point, the page may be truncated or -+ * invalidated (changing page->mapping to NULL), or -+ * even swizzled back from swapper_space to tmpfs file -+ * mapping. However, page->index will not change -+ * because we have a reference on the page. - */ -+ if (page->index > end) { -+ /* -+ * can't be range_cyclic (1st pass) because -+ * end == -1 in that case. -+ */ -+ done = 1; -+ break; -+ } -+ -+ done_index = page->index + 1; -+ - lock_page(page); - -+ /* -+ * Page truncated or invalidated. We can freely skip it -+ * then, even for data integrity operations: the page -+ * has disappeared concurrently, so there could be no -+ * real expectation of this data interity operation -+ * even if there is now a new, dirty page at the same -+ * pagecache address. -+ */ - if (unlikely(page->mapping != mapping)) { -+continue_unlock: - unlock_page(page); - continue; - } - -- if (!wbc->range_cyclic && page->index > end) { -- done = 1; -- unlock_page(page); -- continue; -+ if (!PageDirty(page)) { -+ /* someone wrote it for us */ -+ goto continue_unlock; - } - -- if (wbc->sync_mode != WB_SYNC_NONE) -- wait_on_page_writeback(page); -- -- if (PageWriteback(page) || -- !clear_page_dirty_for_io(page)) { -- unlock_page(page); -- continue; -+ if (PageWriteback(page)) { -+ if (wbc->sync_mode != WB_SYNC_NONE) -+ wait_on_page_writeback(page); -+ else -+ goto continue_unlock; - } - -- ret = (*writepage)(page, wbc, data); -+ BUG_ON(PageWriteback(page)); -+ if (!clear_page_dirty_for_io(page)) -+ goto continue_unlock; - -- if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) { -- unlock_page(page); -- ret = 0; -+ ret = (*writepage)(page, wbc, data); -+ if (unlikely(ret)) { -+ if (ret == AOP_WRITEPAGE_ACTIVATE) { -+ unlock_page(page); -+ ret = 0; -+ } else { -+ /* -+ * done_index is set past this page, -+ * so media errors will not choke -+ * background writeout for the entire -+ * file. This has consequences for -+ * range_cyclic semantics (ie. it may -+ * not be suitable for data integrity -+ * writeout). -+ */ -+ done = 1; -+ break; -+ } -+ } -+ -+ if (wbc->sync_mode == WB_SYNC_NONE) { -+ wbc->nr_to_write--; -+ if (wbc->nr_to_write <= 0) { -+ done = 1; -+ break; -+ } - } -- if (ret || (--nr_to_write <= 0)) -- done = 1; - if (wbc->nonblocking && bdi_write_congested(bdi)) { - wbc->encountered_congestion = 1; - done = 1; -+ break; - } - } - pagevec_release(&pvec); - cond_resched(); - } -- if (!scanned && !done) { -+ if (!cycled) { - /* -+ * range_cyclic: - * We hit the last page and there is more work to be done: wrap - * back to the start of the file - */ -- scanned = 1; -+ cycled = 1; - index = 0; -+ end = writeback_index - 1; - goto retry; - } - if (!wbc->no_nrwrite_index_update) { - if (wbc->range_cyclic || (range_whole && nr_to_write > 0)) -- mapping->writeback_index = index; -+ mapping->writeback_index = done_index; - wbc->nr_to_write = nr_to_write; - } - -diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c -index 0fa208e..05f198d 100644 ---- a/net/bridge/netfilter/ebtables.c -+++ b/net/bridge/netfilter/ebtables.c -@@ -80,7 +80,7 @@ static inline int ebt_do_match (struct ebt_entry_match *m, - { - par->match = m->u.match; - par->matchinfo = m->data; -- return m->u.match->match(skb, par); -+ return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH; - } - - static inline int ebt_dev_check(char *entry, const struct net_device *device) -diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c -index 4e88792..625707a 100644 ---- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c -+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c -@@ -20,7 +20,7 @@ - #include - #include - --static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; -+static unsigned int nf_ct_icmp_timeout __read_mostly = 30*HZ; - - static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, - struct nf_conntrack_tuple *tuple) -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c -index c5aca0b..9e31f91 100644 ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -578,10 +578,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, - else if (!ret) { - if (spliced) - break; -- if (flags & SPLICE_F_NONBLOCK) { -- ret = -EAGAIN; -- break; -- } - if (sock_flag(sk, SOCK_DONE)) - break; - if (sk->sk_err) { -@@ -599,6 +595,10 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, - ret = -ENOTCONN; - break; - } -+ if (flags & SPLICE_F_NONBLOCK) { -+ ret = -EAGAIN; -+ break; -+ } - if (!timeo) { - ret = -EAGAIN; - break; -diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c -index 29c7c99..52ee1dc 100644 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -298,6 +298,10 @@ static void fib6_dump_end(struct netlink_callback *cb) - struct fib6_walker_t *w = (void*)cb->args[2]; - - if (w) { -+ if (cb->args[4]) { -+ cb->args[4] = 0; -+ fib6_walker_unlink(w); -+ } - cb->args[2] = 0; - kfree(w); - } -@@ -330,15 +334,12 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb, - read_lock_bh(&table->tb6_lock); - res = fib6_walk_continue(w); - read_unlock_bh(&table->tb6_lock); -- if (res != 0) { -- if (res < 0) -- fib6_walker_unlink(w); -- goto end; -+ if (res <= 0) { -+ fib6_walker_unlink(w); -+ cb->args[4] = 0; - } -- fib6_walker_unlink(w); -- cb->args[4] = 0; - } --end: -+ - return res; - } - -diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c -index 0572617..7cd13e5 100644 ---- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c -+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c -@@ -26,7 +26,7 @@ - #include - #include - --static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; -+static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ; - - static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, - unsigned int dataoff, -diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c -index 89837a4..bfbf521 100644 ---- a/net/netfilter/x_tables.c -+++ b/net/netfilter/x_tables.c -@@ -273,6 +273,10 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp) - have_rev = 1; - } - } -+ -+ if (af != NFPROTO_UNSPEC && !have_rev) -+ return match_revfn(NFPROTO_UNSPEC, name, revision, bestp); -+ - return have_rev; - } - -@@ -289,6 +293,10 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp) - have_rev = 1; - } - } -+ -+ if (af != NFPROTO_UNSPEC && !have_rev) -+ return target_revfn(NFPROTO_UNSPEC, name, revision, bestp); -+ - return have_rev; - } - -diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c -index 246f906..ea51fcd 100644 ---- a/net/sched/cls_u32.c -+++ b/net/sched/cls_u32.c -@@ -637,8 +637,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, - break; - - n->next = *ins; -- wmb(); -+ tcf_tree_lock(tp); - *ins = n; -+ tcf_tree_unlock(tp); - - *arg = (unsigned long)n; - return 0; -diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c -index d14f020..d2943a4 100644 ---- a/net/sched/sch_htb.c -+++ b/net/sched/sch_htb.c -@@ -924,6 +924,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) - } - } - sch->qstats.overlimits++; -+ qdisc_watchdog_cancel(&q->watchdog); - qdisc_watchdog_schedule(&q->watchdog, next_event); - fin: - return skb; -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c -index a6a0ea7..679fcde 100644 ---- a/net/sctp/sm_statefuns.c -+++ b/net/sctp/sm_statefuns.c -@@ -3691,6 +3691,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, - { - struct sctp_chunk *chunk = arg; - struct sctp_fwdtsn_hdr *fwdtsn_hdr; -+ struct sctp_fwdtsn_skip *skip; - __u16 len; - __u32 tsn; - -@@ -3720,6 +3721,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, - if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) - goto discard_noforce; - -+ /* Silently discard the chunk if stream-id is not valid */ -+ sctp_walk_fwdtsn(skip, chunk) { -+ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams) -+ goto discard_noforce; -+ } -+ - sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); - if (len > sizeof(struct sctp_fwdtsn_hdr)) - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, -@@ -3751,6 +3758,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( - { - struct sctp_chunk *chunk = arg; - struct sctp_fwdtsn_hdr *fwdtsn_hdr; -+ struct sctp_fwdtsn_skip *skip; - __u16 len; - __u32 tsn; - -@@ -3780,6 +3788,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( - if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) - goto gen_shutdown; - -+ /* Silently discard the chunk if stream-id is not valid */ -+ sctp_walk_fwdtsn(skip, chunk) { -+ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams) -+ goto gen_shutdown; -+ } -+ - sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); - if (len > sizeof(struct sctp_fwdtsn_hdr)) - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, -diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c -index 9b4e0e9..3c0f421 100644 ---- a/security/keys/keyctl.c -+++ b/security/keys/keyctl.c -@@ -270,6 +270,7 @@ long keyctl_join_session_keyring(const char __user *_name) - - /* join the session */ - ret = join_session_keyring(name); -+ kfree(name); - - error: - return ret; -diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c -index 2dc976d..87bade3 100644 ---- a/sound/pci/hda/patch_analog.c -+++ b/sound/pci/hda/patch_analog.c -@@ -629,6 +629,36 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { - HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), - HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), -+ HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT), -+ HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT), -+ HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), -+ HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), -+ HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), -+ HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), -+ HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "Capture Source", -+ .info = ad198x_mux_enum_info, -+ .get = ad198x_mux_enum_get, -+ .put = ad198x_mux_enum_put, -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "External Amplifier", -+ .info = ad198x_eapd_info, -+ .get = ad198x_eapd_get, -+ .put = ad198x_eapd_put, -+ .private_value = 0x1b | (1 << 8), /* port-D, inversed */ -+ }, -+ { } /* end */ -+}; -+ -+static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { -+ HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), -+ HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), -+ HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), -+ HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), -@@ -917,6 +947,7 @@ enum { - AD1986A_LAPTOP_EAPD, - AD1986A_LAPTOP_AUTOMUTE, - AD1986A_ULTRA, -+ AD1986A_SAMSUNG, - AD1986A_MODELS - }; - -@@ -927,6 +958,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = { - [AD1986A_LAPTOP_EAPD] = "laptop-eapd", - [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", - [AD1986A_ULTRA] = "ultra", -+ [AD1986A_SAMSUNG] = "samsung", - }; - - static struct snd_pci_quirk ad1986a_cfg_tbl[] = { -@@ -949,9 +981,9 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { - SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), - SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), - SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), -- SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), -- SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), -- SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), -+ SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG), -+ SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG), -+ SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG), - SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), - SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), - SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), -@@ -1033,6 +1065,17 @@ static int patch_ad1986a(struct hda_codec *codec) - break; - case AD1986A_LAPTOP_EAPD: - spec->mixers[0] = ad1986a_laptop_eapd_mixers; -+ spec->num_init_verbs = 2; -+ spec->init_verbs[1] = ad1986a_eapd_init_verbs; -+ spec->multiout.max_channels = 2; -+ spec->multiout.num_dacs = 1; -+ spec->multiout.dac_nids = ad1986a_laptop_dac_nids; -+ if (!is_jack_available(codec, 0x25)) -+ spec->multiout.dig_out_nid = 0; -+ spec->input_mux = &ad1986a_laptop_eapd_capture_source; -+ break; -+ case AD1986A_SAMSUNG: -+ spec->mixers[0] = ad1986a_samsung_mixers; - spec->num_init_verbs = 3; - spec->init_verbs[1] = ad1986a_eapd_init_verbs; - spec->init_verbs[2] = ad1986a_automic_verbs; -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index a378c01..befb699 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -10473,6 +10473,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { - SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), - SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), - SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), -+ SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), - SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), - SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), - SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 24ff2b8..8b204b8 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -89,6 +89,7 @@ enum { - STAC_DELL_M4_2, - STAC_DELL_M4_3, - STAC_HP_M4, -+ STAC_HP_DV5, - STAC_92HD71BXX_MODELS - }; - -@@ -1702,6 +1703,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { - [STAC_DELL_M4_2] = dell_m4_2_pin_configs, - [STAC_DELL_M4_3] = dell_m4_3_pin_configs, - [STAC_HP_M4] = NULL, -+ [STAC_HP_DV5] = NULL, - }; - - static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { -@@ -1710,6 +1712,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { - [STAC_DELL_M4_2] = "dell-m4-2", - [STAC_DELL_M4_3] = "dell-m4-3", - [STAC_HP_M4] = "hp-m4", -+ [STAC_HP_DV5] = "hp-dv5", - }; - - static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { -@@ -1722,6 +1725,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { - "HP dv7", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, - "HP dv7", STAC_HP_M4), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, -+ "HP dv5", STAC_HP_DV5), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, - "unknown HP", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, -@@ -3980,8 +3985,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) - continue; - if (presence) - stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); -+#if 0 /* FIXME */ -+/* Resetting the pinctl like below may lead to (a sort of) regressions -+ * on some devices since they use the HP pin actually for line/speaker -+ * outs although the default pin config shows a different pin (that is -+ * wrong and useless). -+ * -+ * So, it's basically a problem of default pin configs, likely a BIOS issue. -+ * But, disabling the code below just works around it, and I'm too tired of -+ * bug reports with such devices... -+ */ - else - stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); -+#endif /* FIXME */ - } - } - -diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c -index 98c6a8c..e9e829e 100644 ---- a/sound/pci/oxygen/virtuoso.c -+++ b/sound/pci/oxygen/virtuoso.c -@@ -26,7 +26,7 @@ - * SPI 0 -> 1st PCM1796 (front) - * SPI 1 -> 2nd PCM1796 (surround) - * SPI 2 -> 3rd PCM1796 (center/LFE) -- * SPI 4 -> 4th PCM1796 (back) -+ * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!) - * - * GPIO 2 -> M0 of CS5381 - * GPIO 3 -> M1 of CS5381 -@@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip); - static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, - u8 reg, u8 value) - { -+ /* -+ * We don't want to do writes on SPI 4 because the EEPROM, which shares -+ * the same pin, might get confused and broken. We'd better take care -+ * that the driver works with the default register values ... -+ */ -+#if 0 - /* maps ALSA channel pair number to SPI output */ - static const u8 codec_map[4] = { - 0, 1, 2, 4 -@@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, - (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | - OXYGEN_SPI_CEN_LATCH_CLOCK_HI, - (reg << 8) | value); -+#endif - } - - static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, -@@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); - - static int xonar_d2_control_filter(struct snd_kcontrol_new *template) - { -+ if (!strncmp(template->name, "Master Playback ", 16)) -+ /* disable volume/mute because they would require SPI writes */ -+ return 1; - if (!strncmp(template->name, "CD Capture ", 11)) - /* CD in is actually connected to the video in pin */ - template->private_value ^= AC97_CD ^ AC97_VIDEO; -@@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = { - .dac_volume_min = 0x0f, - .dac_volume_max = 0xff, - .misc_flags = OXYGEN_MISC_MIDI, -- .function_flags = OXYGEN_FUNCTION_SPI | -- OXYGEN_FUNCTION_ENABLE_SPI_4_5, -- .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, -+ .function_flags = OXYGEN_FUNCTION_SPI, -+ .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, - .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, - }; - diff --git a/debian/patches/bugfix/all/stable/patch-2.6.28.3 b/debian/patches/bugfix/all/stable/patch-2.6.28.3 deleted file mode 100644 index 79e406bfd..000000000 --- a/debian/patches/bugfix/all/stable/patch-2.6.28.3 +++ /dev/null @@ -1,1651 +0,0 @@ -diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c -index 3221201..a03fbca 100644 ---- a/arch/alpha/kernel/irq_srm.c -+++ b/arch/alpha/kernel/irq_srm.c -@@ -63,6 +63,8 @@ init_srm_irqs(long max, unsigned long ignore_mask) - { - long i; - -+ if (NR_IRQS <= 16) -+ return; - for (i = 16; i < max; ++i) { - if (i < 64 && ((ignore_mask >> i) & 1)) - continue; -diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h -index cb7c151..dd14c54 100644 ---- a/arch/x86/include/asm/pgalloc.h -+++ b/arch/x86/include/asm/pgalloc.h -@@ -42,6 +42,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) - - static inline void pte_free(struct mm_struct *mm, struct page *pte) - { -+ pgtable_page_dtor(pte); - __free_page(pte); - } - -diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c -index e89d248..84ba748 100644 ---- a/arch/x86/mm/pageattr.c -+++ b/arch/x86/mm/pageattr.c -@@ -534,6 +534,36 @@ out_unlock: - return 0; - } - -+static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr, -+ int primary) -+{ -+ /* -+ * Ignore all non primary paths. -+ */ -+ if (!primary) -+ return 0; -+ -+ /* -+ * Ignore the NULL PTE for kernel identity mapping, as it is expected -+ * to have holes. -+ * Also set numpages to '1' indicating that we processed cpa req for -+ * one virtual address page and its pfn. TBD: numpages can be set based -+ * on the initial value and the level returned by lookup_address(). -+ */ -+ if (within(vaddr, PAGE_OFFSET, -+ PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))) { -+ cpa->numpages = 1; -+ cpa->pfn = __pa(vaddr) >> PAGE_SHIFT; -+ return 0; -+ } else { -+ WARN(1, KERN_WARNING "CPA: called for zero pte. " -+ "vaddr = %lx cpa->vaddr = %lx\n", vaddr, -+ *cpa->vaddr); -+ -+ return -EFAULT; -+ } -+} -+ - static int __change_page_attr(struct cpa_data *cpa, int primary) - { - unsigned long address; -@@ -549,17 +579,11 @@ static int __change_page_attr(struct cpa_data *cpa, int primary) - repeat: - kpte = lookup_address(address, &level); - if (!kpte) -- return 0; -+ return __cpa_process_fault(cpa, address, primary); - - old_pte = *kpte; -- if (!pte_val(old_pte)) { -- if (!primary) -- return 0; -- WARN(1, KERN_WARNING "CPA: called for zero pte. " -- "vaddr = %lx cpa->vaddr = %lx\n", address, -- *cpa->vaddr); -- return -EINVAL; -- } -+ if (!pte_val(old_pte)) -+ return __cpa_process_fault(cpa, address, primary); - - if (level == PG_LEVEL_4K) { - pte_t new_pte; -@@ -657,12 +681,7 @@ static int cpa_process_alias(struct cpa_data *cpa) - vaddr = *cpa->vaddr; - - if (!(within(vaddr, PAGE_OFFSET, -- PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT)) --#ifdef CONFIG_X86_64 -- || within(vaddr, PAGE_OFFSET + (1UL<<32), -- PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT)) --#endif -- )) { -+ PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT)))) { - - alias_cpa = *cpa; - temp_cpa_vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT); -diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c -index eb1bf00..bd8bcce 100644 ---- a/arch/x86/mm/pat.c -+++ b/arch/x86/mm/pat.c -@@ -333,11 +333,23 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, - req_type & _PAGE_CACHE_MASK); - } - -- is_range_ram = pagerange_is_ram(start, end); -- if (is_range_ram == 1) -- return reserve_ram_pages_type(start, end, req_type, new_type); -- else if (is_range_ram < 0) -- return -EINVAL; -+ if (new_type) -+ *new_type = actual_type; -+ -+ /* -+ * For legacy reasons, some parts of the physical address range in the -+ * legacy 1MB region is treated as non-RAM (even when listed as RAM in -+ * the e820 tables). So we will track the memory attributes of this -+ * legacy 1MB region using the linear memtype_list always. -+ */ -+ if (end >= ISA_END_ADDRESS) { -+ is_range_ram = pagerange_is_ram(start, end); -+ if (is_range_ram == 1) -+ return reserve_ram_pages_type(start, end, req_type, -+ new_type); -+ else if (is_range_ram < 0) -+ return -EINVAL; -+ } - - new = kmalloc(sizeof(struct memtype), GFP_KERNEL); - if (!new) -@@ -347,9 +359,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, - new->end = end; - new->type = actual_type; - -- if (new_type) -- *new_type = actual_type; -- - spin_lock(&memtype_lock); - - if (cached_entry && start >= cached_start) -@@ -437,11 +446,19 @@ int free_memtype(u64 start, u64 end) - if (is_ISA_range(start, end - 1)) - return 0; - -- is_range_ram = pagerange_is_ram(start, end); -- if (is_range_ram == 1) -- return free_ram_pages_type(start, end); -- else if (is_range_ram < 0) -- return -EINVAL; -+ /* -+ * For legacy reasons, some parts of the physical address range in the -+ * legacy 1MB region is treated as non-RAM (even when listed as RAM in -+ * the e820 tables). So we will track the memory attributes of this -+ * legacy 1MB region using the linear memtype_list always. -+ */ -+ if (end >= ISA_END_ADDRESS) { -+ is_range_ram = pagerange_is_ram(start, end); -+ if (is_range_ram == 1) -+ return free_ram_pages_type(start, end); -+ else if (is_range_ram < 0) -+ return -EINVAL; -+ } - - spin_lock(&memtype_lock); - list_for_each_entry(entry, &memtype_list, nd) { -diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c -index dcbf1be..c5d71aa 100644 ---- a/crypto/async_tx/async_tx.c -+++ b/crypto/async_tx/async_tx.c -@@ -124,6 +124,8 @@ void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx) - if (!dep) - return; - -+ /* we'll submit tx->next now, so clear the link */ -+ tx->next = NULL; - chan = dep->chan; - - /* keep submitting up until a channel switch is detected -diff --git a/crypto/authenc.c b/crypto/authenc.c -index fd9f06c..0861dc2 100644 ---- a/crypto/authenc.c -+++ b/crypto/authenc.c -@@ -157,16 +157,19 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv, - dstp = sg_page(dst); - vdst = PageHighMem(dstp) ? NULL : page_address(dstp) + dst->offset; - -- sg_init_table(cipher, 2); -- sg_set_buf(cipher, iv, ivsize); -- authenc_chain(cipher, dst, vdst == iv + ivsize); -+ if (ivsize) { -+ sg_init_table(cipher, 2); -+ sg_set_buf(cipher, iv, ivsize); -+ authenc_chain(cipher, dst, vdst == iv + ivsize); -+ dst = cipher; -+ } - - cryptlen = req->cryptlen + ivsize; -- hash = crypto_authenc_hash(req, flags, cipher, cryptlen); -+ hash = crypto_authenc_hash(req, flags, dst, cryptlen); - if (IS_ERR(hash)) - return PTR_ERR(hash); - -- scatterwalk_map_and_copy(hash, cipher, cryptlen, -+ scatterwalk_map_and_copy(hash, dst, cryptlen, - crypto_aead_authsize(authenc), 1); - return 0; - } -@@ -284,11 +287,14 @@ static int crypto_authenc_iverify(struct aead_request *req, u8 *iv, - srcp = sg_page(src); - vsrc = PageHighMem(srcp) ? NULL : page_address(srcp) + src->offset; - -- sg_init_table(cipher, 2); -- sg_set_buf(cipher, iv, ivsize); -- authenc_chain(cipher, src, vsrc == iv + ivsize); -+ if (ivsize) { -+ sg_init_table(cipher, 2); -+ sg_set_buf(cipher, iv, ivsize); -+ authenc_chain(cipher, src, vsrc == iv + ivsize); -+ src = cipher; -+ } - -- return crypto_authenc_verify(req, cipher, cryptlen + ivsize); -+ return crypto_authenc_verify(req, src, cryptlen + ivsize); - } - - static int crypto_authenc_decrypt(struct aead_request *req) -diff --git a/crypto/ccm.c b/crypto/ccm.c -index 7cf7e5a..c36d654 100644 ---- a/crypto/ccm.c -+++ b/crypto/ccm.c -@@ -266,6 +266,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, - if (assoclen) { - pctx->ilen = format_adata(idata, assoclen); - get_data_to_compute(cipher, pctx, req->assoc, req->assoclen); -+ } else { -+ pctx->ilen = 0; - } - - /* compute plaintext into mac */ -diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c -index 681169c..79a6c9a 100644 ---- a/drivers/ata/pata_via.c -+++ b/drivers/ata/pata_via.c -@@ -86,6 +86,10 @@ enum { - VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ - }; - -+enum { -+ VIA_IDFLAG_SINGLE = (1 << 0), /* single channel controller) */ -+}; -+ - /* - * VIA SouthBridge chips. - */ -@@ -97,8 +101,12 @@ static const struct via_isa_bridge { - u8 rev_max; - u16 flags; - } via_isa_bridges[] = { -+ { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, -+ VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, - { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | - VIA_BAD_AST | VIA_SATA_PATA }, -+ { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, -+ VIA_UDMA_133 | VIA_BAD_AST }, - { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, - { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, - { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, -@@ -122,6 +130,8 @@ static const struct via_isa_bridge { - { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, - { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, - { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, -+ { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, -+ VIA_UDMA_133 | VIA_BAD_AST }, - { NULL } - }; - -@@ -460,6 +470,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) - static int printed_version; - u8 enable; - u32 timing; -+ unsigned long flags = id->driver_data; - int rc; - - if (!printed_version++) -@@ -469,9 +480,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) - if (rc) - return rc; - -+ if (flags & VIA_IDFLAG_SINGLE) -+ ppi[1] = &ata_dummy_port_info; -+ - /* To find out how the IDE will behave and what features we - actually have to look at the bridge not the IDE controller */ -- for (config = via_isa_bridges; config->id; config++) -+ for (config = via_isa_bridges; config->id != PCI_DEVICE_ID_VIA_ANON; -+ config++) - if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + - !!(config->flags & VIA_BAD_ID), - config->id, NULL))) { -@@ -482,10 +497,6 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) - pci_dev_put(isa); - } - -- if (!config->id) { -- printk(KERN_WARNING "via: Unknown VIA SouthBridge, disabling.\n"); -- return -ENODEV; -- } - pci_dev_put(isa); - - if (!(config->flags & VIA_NO_ENABLES)) { -@@ -587,6 +598,7 @@ static const struct pci_device_id via[] = { - { PCI_VDEVICE(VIA, 0x1571), }, - { PCI_VDEVICE(VIA, 0x3164), }, - { PCI_VDEVICE(VIA, 0x5324), }, -+ { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE }, - - { }, - }; -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index 82020ab..a4424c8 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -789,6 +789,7 @@ int gpio_request(unsigned gpio, const char *label) - } else { - status = -EBUSY; - module_put(chip->owner); -+ goto done; - } - - if (chip->request) { -diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c -index 3d33b82..1479659 100644 ---- a/drivers/gpu/drm/drm_agpsupport.c -+++ b/drivers/gpu/drm/drm_agpsupport.c -@@ -33,10 +33,11 @@ - - #include "drmP.h" - #include --#include - - #if __OS_HAS_AGP - -+#include -+ - /** - * Get AGP information. - * -diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c -index ef00408..011e6d6 100644 ---- a/drivers/ide/it821x.c -+++ b/drivers/ide/it821x.c -@@ -68,6 +68,8 @@ - - #define DRV_NAME "it821x" - -+#define QUIRK_VORTEX86 1 -+ - struct it821x_dev - { - unsigned int smart:1, /* Are we in smart raid mode */ -@@ -79,6 +81,7 @@ struct it821x_dev - u16 pio[2]; /* Cached PIO values */ - u16 mwdma[2]; /* Cached MWDMA values */ - u16 udma[2]; /* Cached UDMA values (per drive) */ -+ u16 quirks; - }; - - #define ATA_66 0 -@@ -580,6 +583,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) - - hwif->ultra_mask = ATA_UDMA6; - hwif->mwdma_mask = ATA_MWDMA2; -+ -+ /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */ -+ if (idev->quirks & QUIRK_VORTEX86) { -+ if (dev->revision == 0x11) -+ hwif->ultra_mask = 0; -+ } - } - - static void it8212_disable_raid(struct pci_dev *dev) -@@ -652,6 +661,8 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic - return -ENOMEM; - } - -+ itdevs->quirks = id->driver_data; -+ - rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); - if (rc) - kfree(itdevs); -@@ -671,6 +682,7 @@ static void __devexit it821x_remove(struct pci_dev *dev) - static const struct pci_device_id it821x_pci_tbl[] = { - { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, - { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, -+ { PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 }, - { 0, }, - }; - -diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c -index d32c1ee..59ff816 100644 ---- a/drivers/misc/sgi-xp/xpc_sn2.c -+++ b/drivers/misc/sgi-xp/xpc_sn2.c -@@ -1841,6 +1841,7 @@ xpc_process_msg_chctl_flags_sn2(struct xpc_partition *part, int ch_number) - */ - xpc_clear_remote_msgqueue_flags_sn2(ch); - -+ smp_wmb(); /* ensure flags have been cleared before bte_copy */ - ch_sn2->w_remote_GP.put = ch_sn2->remote_GP.put; - - dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, " -@@ -1939,7 +1940,7 @@ xpc_get_deliverable_payload_sn2(struct xpc_channel *ch) - break; - - get = ch_sn2->w_local_GP.get; -- rmb(); /* guarantee that .get loads before .put */ -+ smp_rmb(); /* guarantee that .get loads before .put */ - if (get == ch_sn2->w_remote_GP.put) - break; - -@@ -1961,11 +1962,13 @@ xpc_get_deliverable_payload_sn2(struct xpc_channel *ch) - - msg = xpc_pull_remote_msg_sn2(ch, get); - -- DBUG_ON(msg != NULL && msg->number != get); -- DBUG_ON(msg != NULL && (msg->flags & XPC_M_SN2_DONE)); -- DBUG_ON(msg != NULL && !(msg->flags & XPC_M_SN2_READY)); -+ if (msg != NULL) { -+ DBUG_ON(msg->number != get); -+ DBUG_ON(msg->flags & XPC_M_SN2_DONE); -+ DBUG_ON(!(msg->flags & XPC_M_SN2_READY)); - -- payload = &msg->payload; -+ payload = &msg->payload; -+ } - break; - } - -@@ -2058,7 +2061,7 @@ xpc_allocate_msg_sn2(struct xpc_channel *ch, u32 flags, - while (1) { - - put = ch_sn2->w_local_GP.put; -- rmb(); /* guarantee that .put loads before .get */ -+ smp_rmb(); /* guarantee that .put loads before .get */ - if (put - ch_sn2->w_remote_GP.get < ch->local_nentries) { - - /* There are available message entries. We need to try -@@ -2191,7 +2194,7 @@ xpc_send_payload_sn2(struct xpc_channel *ch, u32 flags, void *payload, - * The preceding store of msg->flags must occur before the following - * load of local_GP->put. - */ -- mb(); -+ smp_mb(); - - /* see if the message is next in line to be sent, if so send it */ - -@@ -2292,7 +2295,7 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload) - * The preceding store of msg->flags must occur before the following - * load of local_GP->get. - */ -- mb(); -+ smp_mb(); - - /* - * See if this message is next in line to be acknowledged as having -diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c -index 1ac694c..b8f8d50 100644 ---- a/drivers/misc/sgi-xp/xpc_uv.c -+++ b/drivers/misc/sgi-xp/xpc_uv.c -@@ -1238,7 +1238,7 @@ xpc_send_payload_uv(struct xpc_channel *ch, u32 flags, void *payload, - atomic_inc(&ch->n_to_notify); - - msg_slot->key = key; -- wmb(); /* a non-NULL func must hit memory after the key */ -+ smp_wmb(); /* a non-NULL func must hit memory after the key */ - msg_slot->func = func; - - if (ch->flags & XPC_C_DISCONNECTING) { -diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c -index 600210d..d672d40 100644 ---- a/drivers/net/bnx2x_main.c -+++ b/drivers/net/bnx2x_main.c -@@ -8079,6 +8079,9 @@ static int bnx2x_get_eeprom(struct net_device *dev, - struct bnx2x *bp = netdev_priv(dev); - int rc; - -+ if (!netif_running(dev)) -+ return -EAGAIN; -+ - DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" - DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", - eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, -diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c -index 2d14255..e521555 100644 ---- a/drivers/net/wireless/ath5k/base.c -+++ b/drivers/net/wireless/ath5k/base.c -@@ -2157,7 +2157,8 @@ ath5k_beacon_config(struct ath5k_softc *sc) - - if (sc->opmode == NL80211_IFTYPE_STATION) { - sc->imask |= AR5K_INT_BMISS; -- } else if (sc->opmode == NL80211_IFTYPE_ADHOC) { -+ } else if (sc->opmode == NL80211_IFTYPE_ADHOC || -+ sc->opmode == NL80211_IFTYPE_MESH_POINT) { - /* - * In IBSS mode we use a self-linked tx descriptor and let the - * hardware send the beacons automatically. We have to load it -@@ -2748,6 +2749,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, - switch (conf->type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: -+ case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_MONITOR: - sc->opmode = conf->type; - break; -@@ -2819,7 +2821,8 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - } - - if (conf->changed & IEEE80211_IFCC_BEACON && -- vif->type == NL80211_IFTYPE_ADHOC) { -+ (vif->type == NL80211_IFTYPE_ADHOC || -+ vif->type == NL80211_IFTYPE_MESH_POINT)) { - struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); - if (!beacon) { - ret = -ENOMEM; -@@ -2951,6 +2954,9 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, - sc->opmode == NL80211_IFTYPE_ADHOC) { - rfilt |= AR5K_RX_FILTER_BEACON; - } -+ if (sc->opmode == NL80211_IFTYPE_MESH_POINT) -+ rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | -+ AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; - - /* Set filters */ - ath5k_hw_set_rx_filter(ah,rfilt); -diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c -index 69eb013..47c1c48 100644 ---- a/drivers/net/wireless/rtl8187_dev.c -+++ b/drivers/net/wireless/rtl8187_dev.c -@@ -263,6 +263,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) - - usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep), - buf, skb->len, rtl8187_tx_cb, skb); -+ urb->transfer_flags |= URB_ZERO_PACKET; - rc = usb_submit_urb(urb, GFP_ATOMIC); - if (rc < 0) { - usb_free_urb(urb); -diff --git a/drivers/net/wireless/rtl8187_rtl8225.c b/drivers/net/wireless/rtl8187_rtl8225.c -index 1bae899..487593f 100644 ---- a/drivers/net/wireless/rtl8187_rtl8225.c -+++ b/drivers/net/wireless/rtl8187_rtl8225.c -@@ -287,7 +287,10 @@ static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel) - ofdm_power = priv->channels[channel - 1].hw_value >> 4; - - cck_power = min(cck_power, (u8)11); -- ofdm_power = min(ofdm_power, (u8)35); -+ if (ofdm_power > (u8)15) -+ ofdm_power = 25; -+ else -+ ofdm_power += 10; - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, - rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); -@@ -540,7 +543,10 @@ static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel) - cck_power += priv->txpwr_base & 0xF; - cck_power = min(cck_power, (u8)35); - -- ofdm_power = min(ofdm_power, (u8)15); -+ if (ofdm_power > (u8)15) -+ ofdm_power = 25; -+ else -+ ofdm_power += 10; - ofdm_power += priv->txpwr_base >> 4; - ofdm_power = min(ofdm_power, (u8)35); - -diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c -index 39cf248..b2ecff4 100644 ---- a/drivers/pci/hotplug/pciehp_core.c -+++ b/drivers/pci/hotplug/pciehp_core.c -@@ -126,8 +126,10 @@ static int set_lock_status(struct hotplug_slot *hotplug_slot, u8 status) - mutex_lock(&slot->ctrl->crit_sect); - - /* has it been >1 sec since our last toggle? */ -- if ((get_seconds() - slot->last_emi_toggle) < 1) -+ if ((get_seconds() - slot->last_emi_toggle) < 1) { -+ mutex_unlock(&slot->ctrl->crit_sect); - return -EINVAL; -+ } - - /* see what our current state is */ - retval = get_lock_status(hotplug_slot, &value); -diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c -index 5450a0e..222cffa 100644 ---- a/drivers/serial/8250_pci.c -+++ b/drivers/serial/8250_pci.c -@@ -2271,6 +2271,9 @@ static struct pci_device_id serial_pci_tbl[] = { - { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b2_8_115200 }, -+ { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803, -+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, -+ pbn_b2_8_460800 }, - { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b2_8_115200 }, -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 2bccefe..c7e5339 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -1703,7 +1703,7 @@ const struct file_operations usbdev_file_operations = { - .release = usbdev_release, - }; - --void usb_fs_classdev_common_remove(struct usb_device *udev) -+static void usbdev_remove(struct usb_device *udev) - { - struct dev_state *ps; - struct siginfo sinfo; -@@ -1745,10 +1745,15 @@ static void usb_classdev_remove(struct usb_device *dev) - { - if (dev->usb_classdev) - device_unregister(dev->usb_classdev); -- usb_fs_classdev_common_remove(dev); - } - --static int usb_classdev_notify(struct notifier_block *self, -+#else -+#define usb_classdev_add(dev) 0 -+#define usb_classdev_remove(dev) do {} while (0) -+ -+#endif -+ -+static int usbdev_notify(struct notifier_block *self, - unsigned long action, void *dev) - { - switch (action) { -@@ -1758,15 +1763,15 @@ static int usb_classdev_notify(struct notifier_block *self, - break; - case USB_DEVICE_REMOVE: - usb_classdev_remove(dev); -+ usbdev_remove(dev); - break; - } - return NOTIFY_OK; - } - - static struct notifier_block usbdev_nb = { -- .notifier_call = usb_classdev_notify, -+ .notifier_call = usbdev_notify, - }; --#endif - - static struct cdev usb_device_cdev; - -@@ -1801,9 +1806,8 @@ int __init usb_devio_init(void) - * to /sys/dev - */ - usb_classdev_class->dev_kobj = NULL; -- -- usb_register_notify(&usbdev_nb); - #endif -+ usb_register_notify(&usbdev_nb); - out: - return retval; - -@@ -1814,8 +1818,8 @@ error_cdev: - - void usb_devio_cleanup(void) - { --#ifdef CONFIG_USB_DEVICE_CLASS - usb_unregister_notify(&usbdev_nb); -+#ifdef CONFIG_USB_DEVICE_CLASS - class_destroy(usb_classdev_class); - #endif - cdev_del(&usb_device_cdev); -diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c -index 7c3710e..f9473fb 100644 ---- a/drivers/usb/core/driver.c -+++ b/drivers/usb/core/driver.c -@@ -269,7 +269,7 @@ static int usb_unbind_interface(struct device *dev) - * supports "soft" unbinding. - */ - if (!driver->soft_unbind) -- usb_disable_interface(udev, intf); -+ usb_disable_interface(udev, intf, false); - - driver->disconnect(intf); - -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 81eea42..da11baf 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -2383,8 +2383,8 @@ static int hub_port_debounce(struct usb_hub *hub, int port1) - - void usb_ep0_reinit(struct usb_device *udev) - { -- usb_disable_endpoint(udev, 0 + USB_DIR_IN); -- usb_disable_endpoint(udev, 0 + USB_DIR_OUT); -+ usb_disable_endpoint(udev, 0 + USB_DIR_IN, true); -+ usb_disable_endpoint(udev, 0 + USB_DIR_OUT, true); - usb_enable_endpoint(udev, &udev->ep0, true); - } - EXPORT_SYMBOL_GPL(usb_ep0_reinit); -diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c -index 9463226..3181d7d 100644 ---- a/drivers/usb/core/inode.c -+++ b/drivers/usb/core/inode.c -@@ -718,7 +718,6 @@ static void usbfs_remove_device(struct usb_device *dev) - fs_remove_file (dev->usbfs_dentry); - dev->usbfs_dentry = NULL; - } -- usb_fs_classdev_common_remove(dev); - } - - static int usbfs_notify(struct notifier_block *self, unsigned long action, void *dev) -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index bdcfe92..8497f63 100644 ---- a/drivers/usb/core/message.c -+++ b/drivers/usb/core/message.c -@@ -1009,14 +1009,15 @@ EXPORT_SYMBOL_GPL(usb_clear_halt); - * @dev: the device whose endpoint is being disabled - * @epaddr: the endpoint's address. Endpoint number for output, - * endpoint number + USB_DIR_IN for input -+ * @reset_hardware: flag to erase any endpoint state stored in the -+ * controller hardware - * -- * Deallocates hcd/hardware state for this endpoint ... and nukes all -- * pending urbs. -- * -- * If the HCD hasn't registered a disable() function, this sets the -- * endpoint's maxpacket size to 0 to prevent further submissions. -+ * Disables the endpoint for URB submission and nukes all pending URBs. -+ * If @reset_hardware is set then also deallocates hcd/hardware state -+ * for the endpoint. - */ --void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr) -+void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, -+ bool reset_hardware) - { - unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK; - struct usb_host_endpoint *ep; -@@ -1026,15 +1027,18 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr) - - if (usb_endpoint_out(epaddr)) { - ep = dev->ep_out[epnum]; -- dev->ep_out[epnum] = NULL; -+ if (reset_hardware) -+ dev->ep_out[epnum] = NULL; - } else { - ep = dev->ep_in[epnum]; -- dev->ep_in[epnum] = NULL; -+ if (reset_hardware) -+ dev->ep_in[epnum] = NULL; - } - if (ep) { - ep->enabled = 0; - usb_hcd_flush_endpoint(dev, ep); -- usb_hcd_disable_endpoint(dev, ep); -+ if (reset_hardware) -+ usb_hcd_disable_endpoint(dev, ep); - } - } - -@@ -1042,17 +1046,21 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr) - * usb_disable_interface -- Disable all endpoints for an interface - * @dev: the device whose interface is being disabled - * @intf: pointer to the interface descriptor -+ * @reset_hardware: flag to erase any endpoint state stored in the -+ * controller hardware - * - * Disables all the endpoints for the interface's current altsetting. - */ --void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf) -+void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, -+ bool reset_hardware) - { - struct usb_host_interface *alt = intf->cur_altsetting; - int i; - - for (i = 0; i < alt->desc.bNumEndpoints; ++i) { - usb_disable_endpoint(dev, -- alt->endpoint[i].desc.bEndpointAddress); -+ alt->endpoint[i].desc.bEndpointAddress, -+ reset_hardware); - } - } - -@@ -1073,8 +1081,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) - dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, - skip_ep0 ? "non-ep0" : "all"); - for (i = skip_ep0; i < 16; ++i) { -- usb_disable_endpoint(dev, i); -- usb_disable_endpoint(dev, i + USB_DIR_IN); -+ usb_disable_endpoint(dev, i, true); -+ usb_disable_endpoint(dev, i + USB_DIR_IN, true); - } - dev->toggle[0] = dev->toggle[1] = 0; - -@@ -1242,7 +1250,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) - /* prevent submissions using previous endpoint settings */ - if (iface->cur_altsetting != alt) - usb_remove_sysfs_intf_files(iface); -- usb_disable_interface(dev, iface); -+ usb_disable_interface(dev, iface, true); - - iface->cur_altsetting = alt; - -@@ -1320,8 +1328,8 @@ int usb_reset_configuration(struct usb_device *dev) - */ - - for (i = 1; i < 16; ++i) { -- usb_disable_endpoint(dev, i); -- usb_disable_endpoint(dev, i + USB_DIR_IN); -+ usb_disable_endpoint(dev, i, true); -+ usb_disable_endpoint(dev, i + USB_DIR_IN, true); - } - - config = dev->actconfig; -diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h -index 1d450e9..6c90be1 100644 ---- a/drivers/usb/core/usb.h -+++ b/drivers/usb/core/usb.h -@@ -13,9 +13,10 @@ extern void usb_enable_endpoint(struct usb_device *dev, - struct usb_host_endpoint *ep, bool reset_toggle); - extern void usb_enable_interface(struct usb_device *dev, - struct usb_interface *intf, bool reset_toggles); --extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr); -+extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, -+ bool reset_hardware); - extern void usb_disable_interface(struct usb_device *dev, -- struct usb_interface *intf); -+ struct usb_interface *intf, bool reset_hardware); - extern void usb_release_interface_cache(struct kref *ref); - extern void usb_disable_device(struct usb_device *dev, int skip_ep0); - extern int usb_deauthorize_device(struct usb_device *); -@@ -147,7 +148,6 @@ extern struct usb_driver usbfs_driver; - extern const struct file_operations usbfs_devices_fops; - extern const struct file_operations usbdev_file_operations; - extern void usbfs_conn_disc_event(void); --extern void usb_fs_classdev_common_remove(struct usb_device *udev); - - extern int usb_devio_init(void); - extern void usb_devio_cleanup(void); -diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c -index e06810a..4cf27c7 100644 ---- a/drivers/usb/mon/mon_bin.c -+++ b/drivers/usb/mon/mon_bin.c -@@ -37,6 +37,7 @@ - #define MON_IOCX_GET _IOW(MON_IOC_MAGIC, 6, struct mon_bin_get) - #define MON_IOCX_MFETCH _IOWR(MON_IOC_MAGIC, 7, struct mon_bin_mfetch) - #define MON_IOCH_MFLUSH _IO(MON_IOC_MAGIC, 8) -+ - #ifdef CONFIG_COMPAT - #define MON_IOCX_GET32 _IOW(MON_IOC_MAGIC, 6, struct mon_bin_get32) - #define MON_IOCX_MFETCH32 _IOWR(MON_IOC_MAGIC, 7, struct mon_bin_mfetch32) -@@ -921,21 +922,6 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file, - } - break; - --#ifdef CONFIG_COMPAT -- case MON_IOCX_GET32: { -- struct mon_bin_get32 getb; -- -- if (copy_from_user(&getb, (void __user *)arg, -- sizeof(struct mon_bin_get32))) -- return -EFAULT; -- -- ret = mon_bin_get_event(file, rp, -- compat_ptr(getb.hdr32), compat_ptr(getb.data32), -- getb.alloc32); -- } -- break; --#endif -- - case MON_IOCX_MFETCH: - { - struct mon_bin_mfetch mfetch; -@@ -962,7 +948,57 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file, - } - break; - -+ case MON_IOCG_STATS: { -+ struct mon_bin_stats __user *sp; -+ unsigned int nevents; -+ unsigned int ndropped; -+ -+ spin_lock_irqsave(&rp->b_lock, flags); -+ ndropped = rp->cnt_lost; -+ rp->cnt_lost = 0; -+ spin_unlock_irqrestore(&rp->b_lock, flags); -+ nevents = mon_bin_queued(rp); -+ -+ sp = (struct mon_bin_stats __user *)arg; -+ if (put_user(rp->cnt_lost, &sp->dropped)) -+ return -EFAULT; -+ if (put_user(nevents, &sp->queued)) -+ return -EFAULT; -+ -+ } -+ break; -+ -+ default: -+ return -ENOTTY; -+ } -+ -+ return ret; -+} -+ - #ifdef CONFIG_COMPAT -+static long mon_bin_compat_ioctl(struct file *file, -+ unsigned int cmd, unsigned long arg) -+{ -+ struct mon_reader_bin *rp = file->private_data; -+ int ret; -+ -+ switch (cmd) { -+ -+ case MON_IOCX_GET32: { -+ struct mon_bin_get32 getb; -+ -+ if (copy_from_user(&getb, (void __user *)arg, -+ sizeof(struct mon_bin_get32))) -+ return -EFAULT; -+ -+ ret = mon_bin_get_event(file, rp, -+ compat_ptr(getb.hdr32), compat_ptr(getb.data32), -+ getb.alloc32); -+ if (ret < 0) -+ return ret; -+ } -+ return 0; -+ - case MON_IOCX_MFETCH32: - { - struct mon_bin_mfetch32 mfetch; -@@ -986,37 +1022,25 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file, - return ret; - if (put_user(ret, &uptr->nfetch32)) - return -EFAULT; -- ret = 0; - } -- break; --#endif -- -- case MON_IOCG_STATS: { -- struct mon_bin_stats __user *sp; -- unsigned int nevents; -- unsigned int ndropped; -- -- spin_lock_irqsave(&rp->b_lock, flags); -- ndropped = rp->cnt_lost; -- rp->cnt_lost = 0; -- spin_unlock_irqrestore(&rp->b_lock, flags); -- nevents = mon_bin_queued(rp); -+ return 0; - -- sp = (struct mon_bin_stats __user *)arg; -- if (put_user(rp->cnt_lost, &sp->dropped)) -- return -EFAULT; -- if (put_user(nevents, &sp->queued)) -- return -EFAULT; -+ case MON_IOCG_STATS: -+ return mon_bin_ioctl(NULL, file, cmd, -+ (unsigned long) compat_ptr(arg)); - -- } -- break; -+ case MON_IOCQ_URB_LEN: -+ case MON_IOCQ_RING_SIZE: -+ case MON_IOCT_RING_SIZE: -+ case MON_IOCH_MFLUSH: -+ return mon_bin_ioctl(NULL, file, cmd, arg); - - default: -- return -ENOTTY; -+ ; - } -- -- return ret; -+ return -ENOTTY; - } -+#endif /* CONFIG_COMPAT */ - - static unsigned int - mon_bin_poll(struct file *file, struct poll_table_struct *wait) -@@ -1094,6 +1118,9 @@ static const struct file_operations mon_fops_binary = { - /* .write = mon_text_write, */ - .poll = mon_bin_poll, - .ioctl = mon_bin_ioctl, -+#ifdef CONFIG_COMPAT -+ .compat_ioctl = mon_bin_compat_ioctl, -+#endif - .release = mon_bin_release, - .mmap = mon_bin_mmap, - }; -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index ce7f746..443122f 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -1970,6 +1970,12 @@ UNUSUAL_DEV( 0x19d2, 0x2000, 0x0000, 0x0000, - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_IGNORE_DEVICE), - -+UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, -+ "ST", -+ "2A", -+ US_SC_DEVICE, US_PR_DEVICE, NULL, -+ US_FL_FIX_CAPACITY), -+ - /* patch submitted by Davide Perini - * and Renato Perini - */ -diff --git a/fs/eventpoll.c b/fs/eventpoll.c -index ba2f9ec..011b9b8 100644 ---- a/fs/eventpoll.c -+++ b/fs/eventpoll.c -@@ -234,8 +234,6 @@ struct ep_pqueue { - /* - * Configuration options available inside /proc/sys/fs/epoll/ - */ --/* Maximum number of epoll devices, per user */ --static int max_user_instances __read_mostly; - /* Maximum number of epoll watched descriptors, per user */ - static int max_user_watches __read_mostly; - -@@ -261,14 +259,6 @@ static int zero; - - ctl_table epoll_table[] = { - { -- .procname = "max_user_instances", -- .data = &max_user_instances, -- .maxlen = sizeof(int), -- .mode = 0644, -- .proc_handler = &proc_dointvec_minmax, -- .extra1 = &zero, -- }, -- { - .procname = "max_user_watches", - .data = &max_user_watches, - .maxlen = sizeof(int), -@@ -491,7 +481,6 @@ static void ep_free(struct eventpoll *ep) - - mutex_unlock(&epmutex); - mutex_destroy(&ep->mtx); -- atomic_dec(&ep->user->epoll_devs); - free_uid(ep->user); - kfree(ep); - } -@@ -581,10 +570,6 @@ static int ep_alloc(struct eventpoll **pep) - struct eventpoll *ep; - - user = get_current_user(); -- error = -EMFILE; -- if (unlikely(atomic_read(&user->epoll_devs) >= -- max_user_instances)) -- goto free_uid; - error = -ENOMEM; - ep = kzalloc(sizeof(*ep), GFP_KERNEL); - if (unlikely(!ep)) -@@ -1141,7 +1126,6 @@ SYSCALL_DEFINE1(epoll_create1, int, flags) - flags & O_CLOEXEC); - if (fd < 0) - ep_free(ep); -- atomic_inc(&ep->user->epoll_devs); - - error_return: - DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n", -@@ -1366,8 +1350,10 @@ static int __init eventpoll_init(void) - struct sysinfo si; - - si_meminfo(&si); -- max_user_instances = 128; -- max_user_watches = (((si.totalram - si.totalhigh) / 32) << PAGE_SHIFT) / -+ /* -+ * Allows top 4% of lomem to be allocated for epoll watches (per user). -+ */ -+ max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) / - EP_ITEM_COST; - - /* Initialize the structure used to perform safe poll wait head wake ups */ -diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c -index a48e965..83bd869 100644 ---- a/fs/ext3/namei.c -+++ b/fs/ext3/namei.c -@@ -1357,7 +1357,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, - struct fake_dirent *fde; - - blocksize = dir->i_sb->s_blocksize; -- dxtrace(printk("Creating index\n")); -+ dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino)); - retval = ext3_journal_get_write_access(handle, bh); - if (retval) { - ext3_std_error(dir->i_sb, retval); -@@ -1366,6 +1366,19 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, - } - root = (struct dx_root *) bh->b_data; - -+ /* The 0th block becomes the root, move the dirents out */ -+ fde = &root->dotdot; -+ de = (struct ext3_dir_entry_2 *)((char *)fde + -+ ext3_rec_len_from_disk(fde->rec_len)); -+ if ((char *) de >= (((char *) root) + blocksize)) { -+ ext3_error(dir->i_sb, __func__, -+ "invalid rec_len for '..' in inode %lu", -+ dir->i_ino); -+ brelse(bh); -+ return -EIO; -+ } -+ len = ((char *) root) + blocksize - (char *) de; -+ - bh2 = ext3_append (handle, dir, &block, &retval); - if (!(bh2)) { - brelse(bh); -@@ -1374,11 +1387,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, - EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; - data1 = bh2->b_data; - -- /* The 0th block becomes the root, move the dirents out */ -- fde = &root->dotdot; -- de = (struct ext3_dir_entry_2 *)((char *)fde + -- ext3_rec_len_from_disk(fde->rec_len)); -- len = ((char *) root) + blocksize - (char *) de; - memcpy (data1, de, len); - de = (struct ext3_dir_entry_2 *) data1; - top = data1 + len; -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index b723614..2e37f14 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -281,7 +281,8 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) - fc->blocked = 0; - wake_up_all(&fc->blocked_waitq); - } -- if (fc->num_background == FUSE_CONGESTION_THRESHOLD) { -+ if (fc->num_background == FUSE_CONGESTION_THRESHOLD && -+ fc->connected) { - clear_bdi_congested(&fc->bdi, READ); - clear_bdi_congested(&fc->bdi, WRITE); - } -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 4c9ee70..d8029d8 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -54,7 +54,7 @@ struct fuse_file *fuse_file_alloc(void) - ff->reserved_req = fuse_request_alloc(); - if (!ff->reserved_req) { - kfree(ff); -- ff = NULL; -+ return NULL; - } else { - INIT_LIST_HEAD(&ff->write_entry); - atomic_set(&ff->count, 0); -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 2e99f34..755fe24 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -292,6 +292,7 @@ static void fuse_put_super(struct super_block *sb) - list_del(&fc->entry); - fuse_ctl_remove_conn(fc); - mutex_unlock(&fuse_mutex); -+ bdi_destroy(&fc->bdi); - fuse_conn_put(fc); - } - -@@ -531,7 +532,6 @@ void fuse_conn_put(struct fuse_conn *fc) - if (fc->destroy_req) - fuse_request_free(fc->destroy_req); - mutex_destroy(&fc->inst_mutex); -- bdi_destroy(&fc->bdi); - kfree(fc); - } - } -@@ -825,12 +825,16 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) - if (!file) - return -EINVAL; - -- if (file->f_op != &fuse_dev_operations) -+ if (file->f_op != &fuse_dev_operations) { -+ fput(file); - return -EINVAL; -+ } - - fc = new_conn(sb); -- if (!fc) -+ if (!fc) { -+ fput(file); - return -ENOMEM; -+ } - - fc->flags = d.flags; - fc->user_id = d.user_id; -diff --git a/fs/inotify_user.c b/fs/inotify_user.c -index a7aea80..12533a6 100644 ---- a/fs/inotify_user.c -+++ b/fs/inotify_user.c -@@ -427,10 +427,61 @@ static unsigned int inotify_poll(struct file *file, poll_table *wait) - return ret; - } - -+/* -+ * Get an inotify_kernel_event if one exists and is small -+ * enough to fit in "count". Return an error pointer if -+ * not large enough. -+ * -+ * Called with the device ev_mutex held. -+ */ -+static struct inotify_kernel_event *get_one_event(struct inotify_device *dev, -+ size_t count) -+{ -+ size_t event_size = sizeof(struct inotify_event); -+ struct inotify_kernel_event *kevent; -+ -+ if (list_empty(&dev->events)) -+ return NULL; -+ -+ kevent = inotify_dev_get_event(dev); -+ if (kevent->name) -+ event_size += kevent->event.len; -+ -+ if (event_size > count) -+ return ERR_PTR(-EINVAL); -+ -+ remove_kevent(dev, kevent); -+ return kevent; -+} -+ -+/* -+ * Copy an event to user space, returning how much we copied. -+ * -+ * We already checked that the event size is smaller than the -+ * buffer we had in "get_one_event()" above. -+ */ -+static ssize_t copy_event_to_user(struct inotify_kernel_event *kevent, -+ char __user *buf) -+{ -+ size_t event_size = sizeof(struct inotify_event); -+ -+ if (copy_to_user(buf, &kevent->event, event_size)) -+ return -EFAULT; -+ -+ if (kevent->name) { -+ buf += event_size; -+ -+ if (copy_to_user(buf, kevent->name, kevent->event.len)) -+ return -EFAULT; -+ -+ event_size += kevent->event.len; -+ } -+ return event_size; -+} -+ - static ssize_t inotify_read(struct file *file, char __user *buf, - size_t count, loff_t *pos) - { -- size_t event_size = sizeof (struct inotify_event); - struct inotify_device *dev; - char __user *start; - int ret; -@@ -440,81 +491,43 @@ static ssize_t inotify_read(struct file *file, char __user *buf, - dev = file->private_data; - - while (1) { -+ struct inotify_kernel_event *kevent; - - prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE); - - mutex_lock(&dev->ev_mutex); -- if (!list_empty(&dev->events)) { -- ret = 0; -- break; -- } -+ kevent = get_one_event(dev, count); - mutex_unlock(&dev->ev_mutex); - -- if (file->f_flags & O_NONBLOCK) { -- ret = -EAGAIN; -- break; -- } -- -- if (signal_pending(current)) { -- ret = -EINTR; -- break; -+ if (kevent) { -+ ret = PTR_ERR(kevent); -+ if (IS_ERR(kevent)) -+ break; -+ ret = copy_event_to_user(kevent, buf); -+ free_kevent(kevent); -+ if (ret < 0) -+ break; -+ buf += ret; -+ count -= ret; -+ continue; - } - -- schedule(); -- } -- -- finish_wait(&dev->wq, &wait); -- if (ret) -- return ret; -- -- while (1) { -- struct inotify_kernel_event *kevent; -- -- ret = buf - start; -- if (list_empty(&dev->events)) -+ ret = -EAGAIN; -+ if (file->f_flags & O_NONBLOCK) - break; -- -- kevent = inotify_dev_get_event(dev); -- if (event_size + kevent->event.len > count) { -- if (ret == 0 && count > 0) { -- /* -- * could not get a single event because we -- * didn't have enough buffer space. -- */ -- ret = -EINVAL; -- } -+ ret = -EINTR; -+ if (signal_pending(current)) - break; -- } -- remove_kevent(dev, kevent); - -- /* -- * Must perform the copy_to_user outside the mutex in order -- * to avoid a lock order reversal with mmap_sem. -- */ -- mutex_unlock(&dev->ev_mutex); -- -- if (copy_to_user(buf, &kevent->event, event_size)) { -- ret = -EFAULT; -+ if (start != buf) - break; -- } -- buf += event_size; -- count -= event_size; -- -- if (kevent->name) { -- if (copy_to_user(buf, kevent->name, kevent->event.len)){ -- ret = -EFAULT; -- break; -- } -- buf += kevent->event.len; -- count -= kevent->event.len; -- } -- -- free_kevent(kevent); - -- mutex_lock(&dev->ev_mutex); -+ schedule(); - } -- mutex_unlock(&dev->ev_mutex); - -+ finish_wait(&dev->wq, &wait); -+ if (start != buf && ret != -EFAULT) -+ ret = buf - start; - return ret; - } - -diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c -index 66f6e58..f2c478c 100644 ---- a/fs/sysfs/bin.c -+++ b/fs/sysfs/bin.c -@@ -63,6 +63,9 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off) - int count = min_t(size_t, bytes, PAGE_SIZE); - char *temp; - -+ if (!bytes) -+ return 0; -+ - if (size) { - if (offs > size) - return 0; -@@ -131,6 +134,9 @@ static ssize_t write(struct file *file, const char __user *userbuf, - int count = min_t(size_t, bytes, PAGE_SIZE); - char *temp; - -+ if (!bytes) -+ return 0; -+ - if (size) { - if (offs > size) - return 0; -diff --git a/include/linux/Kbuild b/include/linux/Kbuild -index e531783..3a025d9 100644 ---- a/include/linux/Kbuild -+++ b/include/linux/Kbuild -@@ -41,6 +41,7 @@ header-y += baycom.h - header-y += bfs_fs.h - header-y += blkpg.h - header-y += bpqether.h -+header-y += bsg.h - header-y += can.h - header-y += cdk.h - header-y += chio.h -diff --git a/include/linux/klist.h b/include/linux/klist.h -index 8ea98db..a21cd7a 100644 ---- a/include/linux/klist.h -+++ b/include/linux/klist.h -@@ -23,7 +23,7 @@ struct klist { - struct list_head k_list; - void (*get)(struct klist_node *); - void (*put)(struct klist_node *); --}; -+} __attribute__ ((aligned (4))); - - #define KLIST_INIT(_name, _get, _put) \ - { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ -diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h -index 1800f1d..52df0cb 100644 ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -1357,6 +1357,7 @@ - #define PCI_DEVICE_ID_VIA_8783_0 0x3208 - #define PCI_DEVICE_ID_VIA_8237 0x3227 - #define PCI_DEVICE_ID_VIA_8251 0x3287 -+#define PCI_DEVICE_ID_VIA_8261 0x3402 - #define PCI_DEVICE_ID_VIA_8237A 0x3337 - #define PCI_DEVICE_ID_VIA_8237S 0x3372 - #define PCI_DEVICE_ID_VIA_SATA_EIDE 0x5324 -@@ -1366,10 +1367,13 @@ - #define PCI_DEVICE_ID_VIA_CX700 0x8324 - #define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581 - #define PCI_DEVICE_ID_VIA_VX800 0x8353 -+#define PCI_DEVICE_ID_VIA_VX855 0x8409 - #define PCI_DEVICE_ID_VIA_8371_1 0x8391 - #define PCI_DEVICE_ID_VIA_82C598_1 0x8598 - #define PCI_DEVICE_ID_VIA_838X_1 0xB188 - #define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198 -+#define PCI_DEVICE_ID_VIA_C409_IDE 0XC409 -+#define PCI_DEVICE_ID_VIA_ANON 0xFFFF - - #define PCI_VENDOR_ID_SIEMENS 0x110A - #define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 -@@ -1795,6 +1799,7 @@ - #define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 - #define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 - #define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 -+#define PCI_DEVICE_ID_SEALEVEL_7803 0x7803 - #define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804 - - #define PCI_VENDOR_ID_HYPERCOPE 0x1365 -@@ -2171,6 +2176,7 @@ - #define PCI_DEVICE_ID_RDC_R6040 0x6040 - #define PCI_DEVICE_ID_RDC_R6060 0x6060 - #define PCI_DEVICE_ID_RDC_R6061 0x6061 -+#define PCI_DEVICE_ID_RDC_D1010 0x1010 - - #define PCI_VENDOR_ID_LENOVO 0x17aa - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 55e30d1..3883c32 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -631,7 +631,6 @@ struct user_struct { - atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ - #endif - #ifdef CONFIG_EPOLL -- atomic_t epoll_devs; /* The number of epoll descriptors currently open */ - atomic_t epoll_watches; /* The number of file descriptors currently watched */ - #endif - #ifdef CONFIG_POSIX_MQUEUE -diff --git a/kernel/relay.c b/kernel/relay.c -index 09ac200..9d79b78 100644 ---- a/kernel/relay.c -+++ b/kernel/relay.c -@@ -663,8 +663,10 @@ int relay_late_setup_files(struct rchan *chan, - - mutex_lock(&relay_channels_mutex); - /* Is chan already set up? */ -- if (unlikely(chan->has_base_filename)) -+ if (unlikely(chan->has_base_filename)) { -+ mutex_unlock(&relay_channels_mutex); - return -EEXIST; -+ } - chan->has_base_filename = 1; - chan->parent = parent; - curr_cpu = get_cpu(); -diff --git a/kernel/resource.c b/kernel/resource.c -index 4337063..e633106 100644 ---- a/kernel/resource.c -+++ b/kernel/resource.c -@@ -853,6 +853,15 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size) - if (PFN_DOWN(p->start) <= PFN_DOWN(addr) && - PFN_DOWN(p->end) >= PFN_DOWN(addr + size - 1)) - continue; -+ /* -+ * if a resource is "BUSY", it's not a hardware resource -+ * but a driver mapping of such a resource; we don't want -+ * to warn for those; some drivers legitimately map only -+ * partial hardware resources. (example: vesafb) -+ */ -+ if (p->flags & IORESOURCE_BUSY) -+ continue; -+ - printk(KERN_WARNING "resource map sanity check conflict: " - "0x%llx 0x%llx 0x%llx 0x%llx %s\n", - (unsigned long long)addr, -diff --git a/mm/mmap.c b/mm/mmap.c -index 937b44f..9c3f4f8 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -1095,6 +1095,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, - { - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma, *prev; -+ struct vm_area_struct *merged_vma; - int correct_wcount = 0; - int error; - struct rb_node **rb_link, *rb_parent; -@@ -1207,13 +1208,17 @@ munmap_back: - if (vma_wants_writenotify(vma)) - vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); - -- if (file && vma_merge(mm, prev, addr, vma->vm_end, -- vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) { -+ merged_vma = NULL; -+ if (file) -+ merged_vma = vma_merge(mm, prev, addr, vma->vm_end, -+ vma->vm_flags, NULL, file, pgoff, vma_policy(vma)); -+ if (merged_vma) { - mpol_put(vma_policy(vma)); - kmem_cache_free(vm_area_cachep, vma); - fput(file); - if (vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(mm); -+ vma = merged_vma; - } else { - vma_link(mm, vma, prev, rb_link, rb_parent); - file = vma->vm_file; -diff --git a/mm/vmalloc.c b/mm/vmalloc.c -index 7465f22..0380ea5 100644 ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -960,6 +961,8 @@ EXPORT_SYMBOL(vm_map_ram); - - void __init vmalloc_init(void) - { -+ struct vmap_area *va; -+ struct vm_struct *tmp; - int i; - - for_each_possible_cpu(i) { -@@ -972,6 +975,14 @@ void __init vmalloc_init(void) - vbq->nr_dirty = 0; - } - -+ /* Import existing vmlist entries. */ -+ for (tmp = vmlist; tmp; tmp = tmp->next) { -+ va = alloc_bootmem(sizeof(struct vmap_area)); -+ va->flags = tmp->flags | VM_VM_AREA; -+ va->va_start = (unsigned long)tmp->addr; -+ va->va_end = va->va_start + tmp->size; -+ __insert_vmap_area(va); -+ } - vmap_initialized = true; - } - -diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c -index 1895a4c..0bc398c 100644 ---- a/net/core/net_namespace.c -+++ b/net/core/net_namespace.c -@@ -342,8 +342,8 @@ again: - rv = register_pernet_operations(first_device, ops); - if (rv < 0) - ida_remove(&net_generic_ids, *id); -- mutex_unlock(&net_mutex); - out: -+ mutex_unlock(&net_mutex); - return rv; - } - EXPORT_SYMBOL_GPL(register_pernet_gen_subsys); -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index 1460537..077be80 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1299,8 +1299,10 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev) - if (is_multicast_ether_addr(hdr->addr3)) - memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); - else -- if (mesh_nexthop_lookup(skb, osdata)) -- return 0; -+ if (mesh_nexthop_lookup(skb, osdata)) { -+ dev_put(odev); -+ return 0; -+ } - if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) - IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh, - fwded_frames); -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index 7c1eb23..a50089f 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -1470,6 +1470,7 @@ static struct snd_pci_quirk cxt5047_cfg_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), - SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), -+ SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP), - SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), - {} - }; -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index befb699..75101d8 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -6780,6 +6780,7 @@ static int patch_alc882(struct hda_codec *codec) - case 0x106b00a4: /* MacbookPro4,1 */ - case 0x106b2c00: /* Macbook Pro rev3 */ - case 0x106b3600: /* Macbook 3.1 */ -+ case 0x106b3800: /* MacbookPro4,1 - latter revision */ - board_config = ALC885_MBP3; - break; - default: -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 8b204b8..1f9fcfe 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -2428,6 +2428,8 @@ static int stac92xx_build_pcms(struct hda_codec *codec) - - info->name = "STAC92xx Analog"; - info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; -+ info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = -+ spec->multiout.dac_nids[0]; - info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; - info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; - info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; -diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c -index e9e829e..a962166 100644 ---- a/sound/pci/oxygen/virtuoso.c -+++ b/sound/pci/oxygen/virtuoso.c -@@ -908,6 +908,7 @@ static const struct oxygen_model model_xonar_hdav = { - .dac_channels = 8, - .dac_volume_min = 0x0f, - .dac_volume_max = 0xff, -+ .misc_flags = OXYGEN_MISC_MIDI, - .function_flags = OXYGEN_FUNCTION_2WIRE, - .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, - .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, diff --git a/debian/patches/bugfix/all/stable/patch-2.6.28.4 b/debian/patches/bugfix/all/stable/patch-2.6.28.4 deleted file mode 100644 index cfab818fe..000000000 --- a/debian/patches/bugfix/all/stable/patch-2.6.28.4 +++ /dev/null @@ -1,1361 +0,0 @@ -diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig -index 76b66fe..d532687 100644 ---- a/arch/m68knommu/Kconfig -+++ b/arch/m68knommu/Kconfig -@@ -14,6 +14,10 @@ config MMU - bool - default n - -+config NO_DMA -+ bool -+ default y -+ - config FPU - bool - default n -diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c -index c2502eb..a4805b3 100644 ---- a/arch/x86/kernel/acpi/cstate.c -+++ b/arch/x86/kernel/acpi/cstate.c -@@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */ - static short mwait_supported[ACPI_PROCESSOR_MAX_POWER]; - - #define MWAIT_SUBSTATE_MASK (0xf) -+#define MWAIT_CSTATE_MASK (0xf) - #define MWAIT_SUBSTATE_SIZE (4) - - #define CPUID_MWAIT_LEAF (5) -@@ -98,7 +99,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, - cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); - - /* Check whether this particular cx_type (in CST) is supported or not */ -- cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1; -+ cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) & -+ MWAIT_CSTATE_MASK) + 1; - edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); - num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; - -diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c -index 9e68075..44a4921 100644 ---- a/arch/x86/lib/usercopy_32.c -+++ b/arch/x86/lib/usercopy_32.c -@@ -56,7 +56,7 @@ do { \ - " jmp 2b\n" \ - ".previous\n" \ - _ASM_EXTABLE(0b,3b) \ -- : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ -+ : "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \ - "=&D" (__d2) \ - : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ - : "memory"); \ -@@ -218,7 +218,7 @@ long strnlen_user(const char __user *s, long n) - " .align 4\n" - " .long 0b,2b\n" - ".previous" -- :"=r" (n), "=D" (s), "=a" (res), "=c" (tmp) -+ :"=&r" (n), "=&D" (s), "=&a" (res), "=&c" (tmp) - :"0" (n), "1" (s), "2" (0), "3" (mask) - :"cc"); - return res & mask; -diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c -index f4df6e7..500b930 100644 ---- a/arch/x86/lib/usercopy_64.c -+++ b/arch/x86/lib/usercopy_64.c -@@ -32,7 +32,7 @@ do { \ - " jmp 2b\n" \ - ".previous\n" \ - _ASM_EXTABLE(0b,3b) \ -- : "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ -+ : "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \ - "=&D" (__d2) \ - : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ - : "memory"); \ -@@ -86,7 +86,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size) - ".previous\n" - _ASM_EXTABLE(0b,3b) - _ASM_EXTABLE(1b,2b) -- : [size8] "=c"(size), [dst] "=&D" (__d0) -+ : [size8] "=&c"(size), [dst] "=&D" (__d0) - : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr), - [zero] "r" (0UL), [eight] "r" (8UL)); - return size; -diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c -index bf69dbe..4656c2c 100644 ---- a/arch/x86/pci/irq.c -+++ b/arch/x86/pci/irq.c -@@ -573,6 +573,7 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route - case PCI_DEVICE_ID_INTEL_ICH7_1: - case PCI_DEVICE_ID_INTEL_ICH7_30: - case PCI_DEVICE_ID_INTEL_ICH7_31: -+ case PCI_DEVICE_ID_INTEL_TGP_LPC: - case PCI_DEVICE_ID_INTEL_ESB2_0: - case PCI_DEVICE_ID_INTEL_ICH8_0: - case PCI_DEVICE_ID_INTEL_ICH8_1: -diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c -index 1423b0c..65132f9 100644 ---- a/drivers/acpi/battery.c -+++ b/drivers/acpi/battery.c -@@ -471,7 +471,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) - - static int acpi_battery_update(struct acpi_battery *battery) - { -- int result; -+ int result, old_present = acpi_battery_present(battery); - result = acpi_battery_get_status(battery); - if (result) - return result; -@@ -482,7 +482,8 @@ static int acpi_battery_update(struct acpi_battery *battery) - return 0; - } - #endif -- if (!battery->update_time) { -+ if (!battery->update_time || -+ old_present != acpi_battery_present(battery)) { - result = acpi_battery_get_info(battery); - if (result) - return result; -diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c -index b0817e1..337fb04 100644 ---- a/drivers/acpi/namespace/nsutils.c -+++ b/drivers/acpi/namespace/nsutils.c -@@ -314,9 +314,15 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) - * - * strlen() + 1 covers the first name_seg, which has no path separator - */ -- if (acpi_ns_valid_root_prefix(next_external_char[0])) { -+ if (acpi_ns_valid_root_prefix(*next_external_char)) { - info->fully_qualified = TRUE; - next_external_char++; -+ -+ /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ -+ -+ while (acpi_ns_valid_root_prefix(*next_external_char)) { -+ next_external_char++; -+ } - } else { - /* - * Handle Carat prefixes -diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c -index e52ad91..e33c0bc 100644 ---- a/drivers/acpi/pci_link.c -+++ b/drivers/acpi/pci_link.c -@@ -796,10 +796,6 @@ static int irqrouter_resume(struct sys_device *dev) - struct list_head *node = NULL; - struct acpi_pci_link *link = NULL; - -- -- /* Make sure SCI is enabled again (Apple firmware bug?) */ -- acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1); -- - list_for_each(node, &acpi_link.entries) { - link = list_entry(node, struct acpi_pci_link, node); - if (!link) { -diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c -index baa4419..66a610d 100644 ---- a/drivers/acpi/video.c -+++ b/drivers/acpi/video.c -@@ -481,6 +481,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) - int status = AE_OK; - union acpi_object arg0 = { ACPI_TYPE_INTEGER }; - struct acpi_object_list args = { 1, &arg0 }; -+ int state; - - - arg0.integer.value = level; -@@ -489,6 +490,10 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) - status = acpi_evaluate_object(device->dev->handle, "_BCM", - &args, NULL); - device->brightness->curr = level; -+ for (state = 2; state < device->brightness->count; state++) -+ if (level == device->brightness->levels[state]) -+ device->backlight->props.brightness = state - 2; -+ - return status; - } - -diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c -index 2b24ae5..8092e2b 100644 ---- a/drivers/ata/sata_mv.c -+++ b/drivers/ata/sata_mv.c -@@ -669,8 +669,8 @@ static const struct pci_device_id mv_pci_tbl[] = { - { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, - /* RocketRAID 1720/174x have different identifiers */ - { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, -- { PCI_VDEVICE(TTI, 0x1740), chip_508x }, -- { PCI_VDEVICE(TTI, 0x1742), chip_508x }, -+ { PCI_VDEVICE(TTI, 0x1740), chip_6042 }, -+ { PCI_VDEVICE(TTI, 0x1742), chip_6042 }, - - { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, - { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, -@@ -883,7 +883,7 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio, - struct mv_host_priv *hpriv = ap->host->private_data; - int hardport = mv_hardport_from_port(ap->port_no); - void __iomem *hc_mmio = mv_hc_base_from_port( -- mv_host_base(ap->host), hardport); -+ mv_host_base(ap->host), ap->port_no); - u32 hc_irq_cause, ipending; - - /* clear EDMA event indicators, if any */ -diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c -index 6f14606..444af04 100644 ---- a/drivers/ata/sata_nv.c -+++ b/drivers/ata/sata_nv.c -@@ -305,10 +305,10 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance); - static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); - static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); - -+static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class, -+ unsigned long deadline); - static void nv_nf2_freeze(struct ata_port *ap); - static void nv_nf2_thaw(struct ata_port *ap); --static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, -- unsigned long deadline); - static void nv_ck804_freeze(struct ata_port *ap); - static void nv_ck804_thaw(struct ata_port *ap); - static int nv_adma_slave_config(struct scsi_device *sdev); -@@ -352,6 +352,7 @@ enum nv_host_type - NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */ - CK804, - ADMA, -+ MCP5x, - SWNCQ, - }; - -@@ -363,10 +364,10 @@ static const struct pci_device_id nv_pci_tbl[] = { - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 }, - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 }, - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 }, -- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), SWNCQ }, -- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ }, -- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ }, -- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ }, -+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), MCP5x }, -+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), MCP5x }, -+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), MCP5x }, -+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), MCP5x }, - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC }, - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC }, - { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC }, -@@ -432,14 +433,19 @@ static struct ata_port_operations nv_nf2_ops = { - .inherits = &nv_common_ops, - .freeze = nv_nf2_freeze, - .thaw = nv_nf2_thaw, -- .hardreset = nv_nf2_hardreset, -+ .hardreset = nv_noclassify_hardreset, - }; - --/* CK804 finally gets hardreset right */ -+/* For initial probing after boot and hot plugging, hardreset mostly -+ * works fine on CK804 but curiously, reprobing on the initial port by -+ * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS -+ * in somewhat undeterministic way. Use noclassify hardreset. -+ */ - static struct ata_port_operations nv_ck804_ops = { - .inherits = &nv_common_ops, - .freeze = nv_ck804_freeze, - .thaw = nv_ck804_thaw, -+ .hardreset = nv_noclassify_hardreset, - .host_stop = nv_ck804_host_stop, - }; - -@@ -467,8 +473,19 @@ static struct ata_port_operations nv_adma_ops = { - .host_stop = nv_adma_host_stop, - }; - -+/* Kernel bz#12351 reports that when SWNCQ is enabled, for hotplug to -+ * work, hardreset should be used and hardreset can't report proper -+ * signature, which suggests that mcp5x is closer to nf2 as long as -+ * reset quirkiness is concerned. Define separate ops for mcp5x with -+ * nv_noclassify_hardreset(). -+ */ -+static struct ata_port_operations nv_mcp5x_ops = { -+ .inherits = &nv_common_ops, -+ .hardreset = nv_noclassify_hardreset, -+}; -+ - static struct ata_port_operations nv_swncq_ops = { -- .inherits = &nv_generic_ops, -+ .inherits = &nv_mcp5x_ops, - - .qc_defer = ata_std_qc_defer, - .qc_prep = nv_swncq_qc_prep, -@@ -531,6 +548,15 @@ static const struct ata_port_info nv_port_info[] = { - .port_ops = &nv_adma_ops, - .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht), - }, -+ /* MCP5x */ -+ { -+ .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, -+ .pio_mask = NV_PIO_MASK, -+ .mwdma_mask = NV_MWDMA_MASK, -+ .udma_mask = NV_UDMA_MASK, -+ .port_ops = &nv_mcp5x_ops, -+ .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht), -+ }, - /* SWNCQ */ - { - .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | -@@ -1530,6 +1556,17 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) - return 0; - } - -+static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class, -+ unsigned long deadline) -+{ -+ bool online; -+ int rc; -+ -+ rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, -+ &online, NULL); -+ return online ? -EAGAIN : rc; -+} -+ - static void nv_nf2_freeze(struct ata_port *ap) - { - void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr; -@@ -1554,17 +1591,6 @@ static void nv_nf2_thaw(struct ata_port *ap) - iowrite8(mask, scr_addr + NV_INT_ENABLE); - } - --static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, -- unsigned long deadline) --{ -- bool online; -- int rc; -- -- rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, -- &online, NULL); -- return online ? -EAGAIN : rc; --} -- - static void nv_ck804_freeze(struct ata_port *ap) - { - void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; -@@ -2355,14 +2381,9 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - if (type == CK804 && adma_enabled) { - dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n"); - type = ADMA; -- } -- -- if (type == SWNCQ) { -- if (swncq_enabled) -- dev_printk(KERN_NOTICE, &pdev->dev, -- "Using SWNCQ mode\n"); -- else -- type = GENERIC; -+ } else if (type == MCP5x && swncq_enabled) { -+ dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n"); -+ type = SWNCQ; - } - - ppi[0] = &nv_port_info[type]; -diff --git a/drivers/char/selection.c b/drivers/char/selection.c -index 2978a49..caf3fa2 100644 ---- a/drivers/char/selection.c -+++ b/drivers/char/selection.c -@@ -268,7 +268,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t - - /* Allocate a new buffer before freeing the old one ... */ - multiplier = use_unicode ? 3 : 1; /* chars can take up to 3 bytes */ -- bp = kmalloc((sel_end-sel_start)/2*multiplier+1, GFP_KERNEL); -+ bp = kmalloc(((sel_end-sel_start)/2+1)*multiplier, GFP_KERNEL); - if (!bp) { - printk(KERN_WARNING "selection: kmalloc() failed\n"); - clear_selection(); -diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c -index 8d7cf3f..f1df59f 100644 ---- a/drivers/cpuidle/governors/menu.c -+++ b/drivers/cpuidle/governors/menu.c -@@ -15,12 +15,14 @@ - #include - - #define BREAK_FUZZ 4 /* 4 us */ -+#define PRED_HISTORY_PCT 50 - - struct menu_device { - int last_state_idx; - - unsigned int expected_us; - unsigned int predicted_us; -+ unsigned int current_predicted_us; - unsigned int last_measured_us; - unsigned int elapsed_us; - }; -@@ -47,6 +49,12 @@ static int menu_select(struct cpuidle_device *dev) - data->expected_us = - (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; - -+ /* Recalculate predicted_us based on prediction_history_pct */ -+ data->predicted_us *= PRED_HISTORY_PCT; -+ data->predicted_us += (100 - PRED_HISTORY_PCT) * -+ data->current_predicted_us; -+ data->predicted_us /= 100; -+ - /* find the deepest idle state that satisfies our constraints */ - for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { - struct cpuidle_state *s = &dev->states[i]; -@@ -97,7 +105,7 @@ static void menu_reflect(struct cpuidle_device *dev) - measured_us = -1; - - /* Predict time until next break event */ -- data->predicted_us = max(measured_us, data->last_measured_us); -+ data->current_predicted_us = max(measured_us, data->last_measured_us); - - if (last_idle_us + BREAK_FUZZ < - data->expected_us - target->exit_latency) { -diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c -index 379b7ff..159dbb6 100644 ---- a/drivers/input/keyboard/atkbd.c -+++ b/drivers/input/keyboard/atkbd.c -@@ -884,6 +884,22 @@ static void atkbd_inventec_keymap_fixup(struct atkbd *atkbd) - } - - /* -+ * Samsung NC10 with Fn+F? key release not working -+ */ -+static void atkbd_samsung_keymap_fixup(struct atkbd *atkbd) -+{ -+ const unsigned int forced_release_keys[] = { -+ 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9, -+ }; -+ int i; -+ -+ if (atkbd->set == 2) -+ for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) -+ __set_bit(forced_release_keys[i], -+ atkbd->force_release_mask); -+} -+ -+/* - * atkbd_set_keycode_table() initializes keyboard's keycode table - * according to the selected scancode set - */ -@@ -1493,6 +1509,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { - .callback = atkbd_setup_fixup, - .driver_data = atkbd_inventec_keymap_fixup, - }, -+ { -+ .ident = "Samsung NC10", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), -+ DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), -+ }, -+ .callback = atkbd_setup_fixup, -+ .driver_data = atkbd_samsung_keymap_fixup, -+ }, - { } - }; - -diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c -index 6fc5e73..6500599 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c -+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c -@@ -647,12 +647,16 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, - s8 scale_action = 0; - unsigned long flags; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -- u16 fc, rate_mask; -+ u16 fc; -+ u16 rate_mask = 0; - struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; - DECLARE_MAC_BUF(mac); - - IWL_DEBUG_RATE("enter\n"); - -+ if (sta) -+ rate_mask = sta->supp_rates[sband->band]; -+ - /* Send management frames and broadcast/multicast data using lowest - * rate. */ - fc = le16_to_cpu(hdr->frame_control); -@@ -660,11 +664,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, - is_multicast_ether_addr(hdr->addr1) || - !sta || !priv_sta) { - IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); -- sel->rate_idx = rate_lowest_index(sband, sta); -+ if (!rate_mask) -+ sel->rate_idx = rate_lowest_index(sband, NULL); -+ else -+ sel->rate_idx = rate_lowest_index(sband, sta); - return; - } - -- rate_mask = sta->supp_rates[sband->band]; - index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); - - if (sband->band == IEEE80211_BAND_5GHZ) -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c -index e2a58e4..af2354d 100644 ---- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c -+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c -@@ -951,7 +951,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, - } - - /* See if there's a better rate or modulation mode to try. */ -- rs_rate_scale_perform(priv, hdr, sta, lq_sta); -+ if (sta && sta->supp_rates[sband->band]) -+ rs_rate_scale_perform(priv, hdr, sta, lq_sta); - out: - return; - } -@@ -2114,15 +2115,22 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc; - struct iwl_lq_sta *lq_sta; -+ u64 mask_bit = 0; - - IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); - -+ if (sta) -+ mask_bit = sta->supp_rates[sband->band]; -+ - /* Send management frames and broadcast/multicast data using lowest - * rate. */ - fc = hdr->frame_control; - if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || - !sta || !priv_sta) { -- sel->rate_idx = rate_lowest_index(sband, sta); -+ if (!mask_bit) -+ sel->rate_idx = rate_lowest_index(sband, NULL); -+ else -+ sel->rate_idx = rate_lowest_index(sband, sta); - return; - } - -diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c -index e0512e4..65c4faf 100644 ---- a/drivers/net/wireless/orinoco.c -+++ b/drivers/net/wireless/orinoco.c -@@ -4938,32 +4938,29 @@ static int orinoco_ioctl_set_genie(struct net_device *dev, - struct orinoco_private *priv = netdev_priv(dev); - u8 *buf; - unsigned long flags; -- int err = 0; - - if ((wrqu->data.length > MAX_WPA_IE_LEN) || - (wrqu->data.length && (extra == NULL))) - return -EINVAL; - -- if (orinoco_lock(priv, &flags) != 0) -- return -EBUSY; -- - if (wrqu->data.length) { - buf = kmalloc(wrqu->data.length, GFP_KERNEL); -- if (buf == NULL) { -- err = -ENOMEM; -- goto out; -- } -+ if (buf == NULL) -+ return -ENOMEM; - - memcpy(buf, extra, wrqu->data.length); -- kfree(priv->wpa_ie); -- priv->wpa_ie = buf; -- priv->wpa_ie_len = wrqu->data.length; -- } else { -- kfree(priv->wpa_ie); -- priv->wpa_ie = NULL; -- priv->wpa_ie_len = 0; -+ } else -+ buf = NULL; -+ -+ if (orinoco_lock(priv, &flags) != 0) { -+ kfree(buf); -+ return -EBUSY; - } - -+ kfree(priv->wpa_ie); -+ priv->wpa_ie = buf; -+ priv->wpa_ie_len = wrqu->data.length; -+ - if (priv->wpa_ie) { - /* Looks like wl_lkm wants to check the auth alg, and - * somehow pass it to the firmware. -@@ -4972,9 +4969,8 @@ static int orinoco_ioctl_set_genie(struct net_device *dev, - */ - } - --out: - orinoco_unlock(priv, &flags); -- return err; -+ return 0; - } - - static int orinoco_ioctl_get_genie(struct net_device *dev, -diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c -index 827ca03..b4831fd 100644 ---- a/drivers/net/wireless/p54/p54common.c -+++ b/drivers/net/wireless/p54/p54common.c -@@ -741,17 +741,19 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, - int p54_read_eeprom(struct ieee80211_hw *dev) - { - struct p54_common *priv = dev->priv; -- struct p54_control_hdr *hdr = NULL; -+ struct p54_control_hdr *hdr = NULL, *org_hdr; - struct p54_eeprom_lm86 *eeprom_hdr; - size_t eeprom_size = 0x2020, offset = 0, blocksize; - int ret = -ENOMEM; - void *eeprom = NULL; - -- hdr = (struct p54_control_hdr *)kzalloc(sizeof(*hdr) + -- sizeof(*eeprom_hdr) + EEPROM_READBACK_LEN, GFP_KERNEL); -- if (!hdr) -+ org_hdr = kzalloc(priv->tx_hdr_len + sizeof(*hdr) + -+ sizeof(*eeprom_hdr) + EEPROM_READBACK_LEN, -+ GFP_KERNEL); -+ if (!org_hdr) - goto free; - -+ hdr = (void *) org_hdr + priv->tx_hdr_len; - priv->eeprom = kzalloc(EEPROM_READBACK_LEN, GFP_KERNEL); - if (!priv->eeprom) - goto free; -@@ -790,7 +792,7 @@ int p54_read_eeprom(struct ieee80211_hw *dev) - free: - kfree(priv->eeprom); - priv->eeprom = NULL; -- kfree(hdr); -+ kfree(org_hdr); - kfree(eeprom); - - return ret; -diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c -index 8a2e32d..c61d8bd 100644 ---- a/drivers/net/wireless/p54/p54usb.c -+++ b/drivers/net/wireless/p54/p54usb.c -@@ -85,13 +85,13 @@ static void p54u_rx_cb(struct urb *urb) - struct ieee80211_hw *dev = info->dev; - struct p54u_priv *priv = dev->priv; - -+ skb_unlink(skb, &priv->rx_queue); -+ - if (unlikely(urb->status)) { -- info->urb = NULL; -- usb_free_urb(urb); -+ dev_kfree_skb_irq(skb); - return; - } - -- skb_unlink(skb, &priv->rx_queue); - skb_put(skb, urb->actual_length); - - if (priv->hw_type == P54U_NET2280) -@@ -104,7 +104,6 @@ static void p54u_rx_cb(struct urb *urb) - if (p54_rx(dev, skb)) { - skb = dev_alloc_skb(priv->common.rx_mtu + 32); - if (unlikely(!skb)) { -- usb_free_urb(urb); - /* TODO check rx queue length and refill *somewhere* */ - return; - } -@@ -114,7 +113,6 @@ static void p54u_rx_cb(struct urb *urb) - info->dev = dev; - urb->transfer_buffer = skb_tail_pointer(skb); - urb->context = skb; -- skb_queue_tail(&priv->rx_queue, skb); - } else { - if (priv->hw_type == P54U_NET2280) - skb_push(skb, priv->common.tx_hdr_len); -@@ -129,22 +127,23 @@ static void p54u_rx_cb(struct urb *urb) - WARN_ON(1); - urb->transfer_buffer = skb_tail_pointer(skb); - } -- -- skb_queue_tail(&priv->rx_queue, skb); - } - -- usb_submit_urb(urb, GFP_ATOMIC); -+ usb_anchor_urb(urb, &priv->submitted); -+ if (usb_submit_urb(urb, GFP_ATOMIC)) { -+ usb_unanchor_urb(urb); -+ dev_kfree_skb_irq(skb); -+ } else -+ skb_queue_tail(&priv->rx_queue, skb); - } - --static void p54u_tx_cb(struct urb *urb) --{ -- usb_free_urb(urb); --} -+static void p54u_tx_cb(struct urb *urb) { } - --static void p54u_tx_free_cb(struct urb *urb) -+static void p54u_free_urbs(struct ieee80211_hw *dev) - { -- kfree(urb->transfer_buffer); -- usb_free_urb(urb); -+ struct p54u_priv *priv = dev->priv; -+ -+ usb_kill_anchored_urbs(&priv->submitted); - } - - static int p54u_init_urbs(struct ieee80211_hw *dev) -@@ -153,15 +152,18 @@ static int p54u_init_urbs(struct ieee80211_hw *dev) - struct urb *entry; - struct sk_buff *skb; - struct p54u_rx_info *info; -+ int ret = 0; - - while (skb_queue_len(&priv->rx_queue) < 32) { - skb = __dev_alloc_skb(priv->common.rx_mtu + 32, GFP_KERNEL); -- if (!skb) -- break; -+ if (!skb) { -+ ret = -ENOMEM; -+ goto err; -+ } - entry = usb_alloc_urb(0, GFP_KERNEL); - if (!entry) { -- kfree_skb(skb); -- break; -+ ret = -ENOMEM; -+ goto err; - } - usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), -@@ -171,26 +173,25 @@ static int p54u_init_urbs(struct ieee80211_hw *dev) - info->urb = entry; - info->dev = dev; - skb_queue_tail(&priv->rx_queue, skb); -- usb_submit_urb(entry, GFP_KERNEL); -+ -+ usb_anchor_urb(entry, &priv->submitted); -+ ret = usb_submit_urb(entry, GFP_KERNEL); -+ if (ret) { -+ skb_unlink(skb, &priv->rx_queue); -+ usb_unanchor_urb(entry); -+ goto err; -+ } -+ usb_free_urb(entry); -+ entry = NULL; - } - - return 0; --} - --static void p54u_free_urbs(struct ieee80211_hw *dev) --{ -- struct p54u_priv *priv = dev->priv; -- struct p54u_rx_info *info; -- struct sk_buff *skb; -- -- while ((skb = skb_dequeue(&priv->rx_queue))) { -- info = (struct p54u_rx_info *) skb->cb; -- if (!info->urb) -- continue; -- -- usb_kill_urb(info->urb); -- kfree_skb(skb); -- } -+err: -+ usb_free_urb(entry); -+ kfree_skb(skb); -+ p54u_free_urbs(dev); -+ return ret; - } - - static void p54u_tx_3887(struct ieee80211_hw *dev, struct p54_control_hdr *data, -@@ -210,25 +211,38 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct p54_control_hdr *data, - } - - usb_fill_bulk_urb(addr_urb, priv->udev, -- usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), &data->req_id, -- sizeof(data->req_id), p54u_tx_cb, dev); -+ usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), -+ &data->req_id, sizeof(data->req_id), p54u_tx_cb, -+ dev); - usb_fill_bulk_urb(data_urb, priv->udev, -- usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), data, len, -- free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev); -+ usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), -+ data, len, p54u_tx_cb, dev); - addr_urb->transfer_flags |= URB_ZERO_PACKET; -- data_urb->transfer_flags |= URB_ZERO_PACKET; -+ data_urb->transfer_flags |= URB_ZERO_PACKET | -+ (free_on_tx ? URB_FREE_BUFFER : 0); -+ -+ usb_anchor_urb(addr_urb, &priv->submitted); -+ if (usb_submit_urb(addr_urb, GFP_ATOMIC)) { -+ usb_unanchor_urb(addr_urb); -+ goto out; -+ } -+ -+ usb_anchor_urb(data_urb, &priv->submitted); -+ if (usb_submit_urb(data_urb, GFP_ATOMIC)) -+ usb_unanchor_urb(data_urb); - -- usb_submit_urb(addr_urb, GFP_ATOMIC); -- usb_submit_urb(data_urb, GFP_ATOMIC); -+out: -+ usb_free_urb(addr_urb); -+ usb_free_urb(data_urb); - } - --static __le32 p54u_lm87_chksum(const u32 *data, size_t length) -+static __le32 p54u_lm87_chksum(const __le32 *data, size_t length) - { - u32 chk = 0; - - length >>= 2; - while (length--) { -- chk ^= *data++; -+ chk ^= le32_to_cpu(*data++); - chk = (chk >> 5) ^ (chk << 3); - } - -@@ -247,16 +261,20 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, - if (!data_urb) - return; - -- hdr->chksum = p54u_lm87_chksum((u32 *)data, len); -+ hdr->chksum = p54u_lm87_chksum((__le32 *) data, len); - hdr->device_addr = data->req_id; - - usb_fill_bulk_urb(data_urb, priv->udev, -- usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, -- len + sizeof(*hdr), free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, -- dev); -- data_urb->transfer_flags |= URB_ZERO_PACKET; -+ usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, -+ len + sizeof(*hdr), p54u_tx_cb, dev); -+ data_urb->transfer_flags |= URB_ZERO_PACKET | -+ (free_on_tx ? URB_FREE_BUFFER : 0); - -- usb_submit_urb(data_urb, GFP_ATOMIC); -+ usb_anchor_urb(data_urb, &priv->submitted); -+ if (usb_submit_urb(data_urb, GFP_ATOMIC)) -+ usb_unanchor_urb(data_urb); -+ -+ usb_free_urb(data_urb); - } - - static void p54u_tx_net2280(struct ieee80211_hw *dev, struct p54_control_hdr *data, -@@ -295,16 +313,30 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct p54_control_hdr *da - hdr->len = cpu_to_le16(len); - - usb_fill_bulk_urb(int_urb, priv->udev, -- usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), -- p54u_tx_free_cb, dev); -- int_urb->transfer_flags |= URB_ZERO_PACKET; -- usb_submit_urb(int_urb, GFP_ATOMIC); -+ usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), -+ reg, sizeof(*reg), p54u_tx_cb, dev); -+ int_urb->transfer_flags |= URB_ZERO_PACKET | URB_FREE_BUFFER; -+ usb_anchor_urb(int_urb, &priv->submitted); -+ if (usb_submit_urb(int_urb, GFP_ATOMIC)) { -+ usb_unanchor_urb(int_urb); -+ goto out; -+ } - - usb_fill_bulk_urb(data_urb, priv->udev, -- usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, len + sizeof(*hdr), -- free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev); -- data_urb->transfer_flags |= URB_ZERO_PACKET; -- usb_submit_urb(data_urb, GFP_ATOMIC); -+ usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, -+ len + sizeof(*hdr), p54u_tx_cb, dev); -+ data_urb->transfer_flags |= URB_ZERO_PACKET | -+ (free_on_tx ? URB_FREE_BUFFER : 0); -+ -+ usb_anchor_urb(int_urb, &priv->submitted); -+ if (usb_submit_urb(data_urb, GFP_ATOMIC)) { -+ usb_unanchor_urb(data_urb); -+ goto out; -+ } -+ -+out: -+ usb_free_urb(int_urb); -+ usb_free_urb(data_urb); - } - - static int p54u_write(struct p54u_priv *priv, -@@ -805,6 +837,7 @@ static int __devinit p54u_probe(struct usb_interface *intf, - SET_IEEE80211_DEV(dev, &intf->dev); - usb_set_intfdata(intf, dev); - priv->udev = udev; -+ init_usb_anchor(&priv->submitted); - - usb_get_dev(udev); - -diff --git a/drivers/net/wireless/p54/p54usb.h b/drivers/net/wireless/p54/p54usb.h -index 5b8fe91..54ee738 100644 ---- a/drivers/net/wireless/p54/p54usb.h -+++ b/drivers/net/wireless/p54/p54usb.h -@@ -133,6 +133,7 @@ struct p54u_priv { - - spinlock_t lock; - struct sk_buff_head rx_queue; -+ struct usb_anchor submitted; - }; - - #endif /* P54USB_H */ -diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c -index 74801f7..5aee7ee 100644 ---- a/drivers/pci/msi.c -+++ b/drivers/pci/msi.c -@@ -378,21 +378,19 @@ static int msi_capability_init(struct pci_dev *dev) - entry->msi_attrib.masked = 1; - entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ - entry->msi_attrib.pos = pos; -- if (entry->msi_attrib.maskbit) { -- entry->mask_base = (void __iomem *)(long)msi_mask_bits_reg(pos, -- entry->msi_attrib.is_64); -- } - entry->dev = dev; - if (entry->msi_attrib.maskbit) { -- unsigned int maskbits, temp; -+ unsigned int base, maskbits, temp; -+ -+ base = msi_mask_bits_reg(pos, entry->msi_attrib.is_64); -+ entry->mask_base = (void __iomem *)(long)base; -+ - /* All MSIs are unmasked by default, Mask them all */ -- pci_read_config_dword(dev, -- msi_mask_bits_reg(pos, entry->msi_attrib.is_64), -- &maskbits); -+ pci_read_config_dword(dev, base, &maskbits); - temp = (1 << multi_msi_capable(control)); - temp = ((temp - 1) & ~temp); - maskbits |= temp; -- pci_write_config_dword(dev, entry->msi_attrib.is_64, maskbits); -+ pci_write_config_dword(dev, base, maskbits); - entry->msi_attrib.maskbits_mask = temp; - } - list_add_tail(&entry->list, &dev->msi_list); -diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c -index a697914..3fc7e0f 100644 ---- a/drivers/serial/jsm/jsm_tty.c -+++ b/drivers/serial/jsm/jsm_tty.c -@@ -161,6 +161,11 @@ static void jsm_tty_stop_rx(struct uart_port *port) - channel->ch_bd->bd_ops->disable_receiver(channel); - } - -+static void jsm_tty_enable_ms(struct uart_port *port) -+{ -+ /* Nothing needed */ -+} -+ - static void jsm_tty_break(struct uart_port *port, int break_state) - { - unsigned long lock_flags; -@@ -345,6 +350,7 @@ static struct uart_ops jsm_ops = { - .start_tx = jsm_tty_start_tx, - .send_xchar = jsm_tty_send_xchar, - .stop_rx = jsm_tty_stop_rx, -+ .enable_ms = jsm_tty_enable_ms, - .break_ctl = jsm_tty_break, - .startup = jsm_tty_open, - .shutdown = jsm_tty_close, -diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c -index c50c7cf..2745b85 100644 ---- a/drivers/video/aty/mach64_ct.c -+++ b/drivers/video/aty/mach64_ct.c -@@ -8,6 +8,9 @@ - #include - #include