Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

Conflicts:
arch/sh/kernel/process_32.c

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+1857 -1009
+4
Documentation/laptops/thinkpad-acpi.txt
··· 1024 1024 backlight brightness control interface if it detects that the standard 1025 1025 ACPI interface is available in the ThinkPad. 1026 1026 1027 + If you want to use the thinkpad-acpi backlight brightness control 1028 + instead of the generic ACPI video backlight brightness control for some 1029 + reason, you should use the acpi_backlight=vendor kernel parameter. 1030 + 1027 1031 The brightness_enable module parameter can be used to control whether 1028 1032 the LCD brightness control feature will be enabled when available. 1029 1033 brightness_enable=0 forces it to be disabled. brightness_enable=1
+2 -29
Documentation/powerpc/booting-without-of.txt
··· 49 49 f) MDIO on GPIOs 50 50 g) SPI busses 51 51 52 - VII - Marvell Discovery mv64[345]6x System Controller chips 53 - 1) The /system-controller node 54 - 2) Child nodes of /system-controller 55 - a) Marvell Discovery MDIO bus 56 - b) Marvell Discovery ethernet controller 57 - c) Marvell Discovery PHY nodes 58 - d) Marvell Discovery SDMA nodes 59 - e) Marvell Discovery BRG nodes 60 - f) Marvell Discovery CUNIT nodes 61 - g) Marvell Discovery MPSCROUTING nodes 62 - h) Marvell Discovery MPSCINTR nodes 63 - i) Marvell Discovery MPSC nodes 64 - j) Marvell Discovery Watch Dog Timer nodes 65 - k) Marvell Discovery I2C nodes 66 - l) Marvell Discovery PIC (Programmable Interrupt Controller) nodes 67 - m) Marvell Discovery MPP (Multipurpose Pins) multiplexing nodes 68 - n) Marvell Discovery GPP (General Purpose Pins) nodes 69 - o) Marvell Discovery PCI host bridge node 70 - p) Marvell Discovery CPU Error nodes 71 - q) Marvell Discovery SRAM Controller nodes 72 - r) Marvell Discovery PCI Error Handler nodes 73 - s) Marvell Discovery Memory Controller nodes 74 - 75 - VIII - Specifying interrupt information for devices 52 + VII - Specifying interrupt information for devices 76 53 1) interrupts property 77 54 2) interrupt-parent property 78 55 3) OpenPIC Interrupt Controllers 79 56 4) ISA Interrupt Controllers 80 57 81 - IX - Specifying GPIO information for devices 82 - 1) gpios property 83 - 2) gpio-controller nodes 84 - 85 - X - Specifying device power management information (sleep property) 58 + VIII - Specifying device power management information (sleep property) 86 59 87 60 Appendix A - Sample SOC node for MPC8540 88 61
+3 -2
arch/alpha/kernel/process.c
··· 387 387 * sys_execve() executes a new program. 388 388 */ 389 389 asmlinkage int 390 - do_sys_execve(const char __user *ufilename, char __user * __user *argv, 391 - char __user * __user *envp, struct pt_regs *regs) 390 + do_sys_execve(const char __user *ufilename, 391 + const char __user *const __user *argv, 392 + const char __user *const __user *envp, struct pt_regs *regs) 392 393 { 393 394 int error; 394 395 char *filename;
+3
arch/arm/Makefile
··· 21 21 # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: 22 22 KBUILD_CFLAGS +=$(call cc-option,-marm,) 23 23 24 + # Never generate .eh_frame 25 + KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) 26 + 24 27 # Do not use arch/arm/defconfig - it's always outdated. 25 28 # Select a platform tht is kept up-to-date 26 29 KBUILD_DEFCONFIG := versatile_defconfig
+13 -4
arch/arm/include/asm/ptrace.h
··· 158 158 */ 159 159 static inline int valid_user_regs(struct pt_regs *regs) 160 160 { 161 - if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) { 162 - regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT); 163 - return 1; 161 + unsigned long mode = regs->ARM_cpsr & MODE_MASK; 162 + 163 + /* 164 + * Always clear the F (FIQ) and A (delayed abort) bits 165 + */ 166 + regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT); 167 + 168 + if ((regs->ARM_cpsr & PSR_I_BIT) == 0) { 169 + if (mode == USR_MODE) 170 + return 1; 171 + if (elf_hwcap & HWCAP_26BIT && mode == USR26_MODE) 172 + return 1; 164 173 } 165 174 166 175 /* 167 176 * Force CPSR to something logical... 168 177 */ 169 - regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT; 178 + regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | PSR_T_BIT | MODE32_BIT; 170 179 if (!(elf_hwcap & HWCAP_26BIT)) 171 180 regs->ARM_cpsr |= USR_MODE; 172 181
+1
arch/arm/include/asm/unistd.h
··· 392 392 #define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) 393 393 #define __NR_perf_event_open (__NR_SYSCALL_BASE+364) 394 394 #define __NR_recvmmsg (__NR_SYSCALL_BASE+365) 395 + #define __NR_accept4 (__NR_SYSCALL_BASE+366) 395 396 396 397 /* 397 398 * The following SWIs are ARM private.
+1
arch/arm/kernel/calls.S
··· 375 375 CALL(sys_rt_tgsigqueueinfo) 376 376 CALL(sys_perf_event_open) 377 377 /* 365 */ CALL(sys_recvmmsg) 378 + CALL(sys_accept4) 378 379 #ifndef syscalls_counted 379 380 .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 380 381 #define syscalls_counted
+1 -1
arch/arm/kernel/kgdb.c
··· 79 79 return; 80 80 81 81 /* Initialize to zero */ 82 - for (regno = 0; regno < GDB_MAX_REGS; regno++) 82 + for (regno = 0; regno < DBG_MAX_REG_NUM; regno++) 83 83 gdb_regs[regno] = 0; 84 84 85 85 /* Otherwise, we have only some registers from switch_to() */
+9 -5
arch/arm/kernel/sys_arm.c
··· 62 62 /* sys_execve() executes a new program. 63 63 * This is called indirectly via a small wrapper 64 64 */ 65 - asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv, 66 - char __user * __user *envp, struct pt_regs *regs) 65 + asmlinkage int sys_execve(const char __user *filenamei, 66 + const char __user *const __user *argv, 67 + const char __user *const __user *envp, struct pt_regs *regs) 67 68 { 68 69 int error; 69 70 char * filename; ··· 79 78 return error; 80 79 } 81 80 82 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 81 + int kernel_execve(const char *filename, 82 + const char *const argv[], 83 + const char *const envp[]) 83 84 { 84 85 struct pt_regs regs; 85 86 int ret; 86 87 87 88 memset(&regs, 0, sizeof(struct pt_regs)); 88 - ret = do_execve(filename, (char __user * __user *)argv, 89 - (char __user * __user *)envp, &regs); 89 + ret = do_execve(filename, 90 + (const char __user *const __user *)argv, 91 + (const char __user *const __user *)envp, &regs); 90 92 if (ret < 0) 91 93 goto out; 92 94
+3 -2
arch/avr32/kernel/process.c
··· 384 384 } 385 385 386 386 asmlinkage int sys_execve(const char __user *ufilename, 387 - char __user *__user *uargv, 388 - char __user *__user *uenvp, struct pt_regs *regs) 387 + const char __user *const __user *uargv, 388 + const char __user *const __user *uenvp, 389 + struct pt_regs *regs) 389 390 { 390 391 int error; 391 392 char *filename;
+3 -1
arch/avr32/kernel/sys_avr32.c
··· 7 7 */ 8 8 #include <linux/unistd.h> 9 9 10 - int kernel_execve(const char *file, char **argv, char **envp) 10 + int kernel_execve(const char *file, 11 + const char *const *argv, 12 + const char *const *envp) 11 13 { 12 14 register long scno asm("r8") = __NR_execve; 13 15 register long sc1 asm("r12") = (long)file;
+3 -1
arch/blackfin/kernel/process.c
··· 209 209 /* 210 210 * sys_execve() executes a new program. 211 211 */ 212 - asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) 212 + asmlinkage int sys_execve(const char __user *name, 213 + const char __user *const __user *argv, 214 + const char __user *const __user *envp) 213 215 { 214 216 int error; 215 217 char *filename;
+3 -1
arch/cris/arch-v10/kernel/process.c
··· 204 204 /* 205 205 * sys_execve() executes a new program. 206 206 */ 207 - asmlinkage int sys_execve(const char *fname, char **argv, char **envp, 207 + asmlinkage int sys_execve(const char *fname, 208 + const char *const *argv, 209 + const char *const *envp, 208 210 long r13, long mof, long srp, 209 211 struct pt_regs *regs) 210 212 {
+4 -2
arch/cris/arch-v32/kernel/process.c
··· 218 218 219 219 /* sys_execve() executes a new program. */ 220 220 asmlinkage int 221 - sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp, 222 - struct pt_regs *regs) 221 + sys_execve(const char *fname, 222 + const char *const *argv, 223 + const char *const *envp, long r13, long mof, long srp, 224 + struct pt_regs *regs) 223 225 { 224 226 int error; 225 227 char *filename;
+3 -2
arch/frv/kernel/process.c
··· 250 250 /* 251 251 * sys_execve() executes a new program. 252 252 */ 253 - asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, 254 - char __user * __user *envp) 253 + asmlinkage int sys_execve(const char __user *name, 254 + const char __user *const __user *argv, 255 + const char __user *const __user *envp) 255 256 { 256 257 int error; 257 258 char * filename;
+4 -1
arch/h8300/kernel/process.c
··· 212 212 /* 213 213 * sys_execve() executes a new program. 214 214 */ 215 - asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...) 215 + asmlinkage int sys_execve(const char *name, 216 + const char *const *argv, 217 + const char *const *envp, 218 + int dummy, ...) 216 219 { 217 220 int error; 218 221 char * filename;
+3 -1
arch/h8300/kernel/sys_h8300.c
··· 51 51 * Do a system call from kernel instead of calling sys_execve so we 52 52 * end up with proper pt_regs. 53 53 */ 54 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54 + int kernel_execve(const char *filename, 55 + const char *const argv[], 56 + const char *const envp[]) 55 57 { 56 58 register long res __asm__("er0"); 57 59 register char *const *_c __asm__("er3") = envp;
-2
arch/ia64/include/asm/unistd.h
··· 356 356 int fd, long pgoff); 357 357 struct pt_regs; 358 358 struct sigaction; 359 - long sys_execve(const char __user *filename, char __user * __user *argv, 360 - char __user * __user *envp, struct pt_regs *regs); 361 359 asmlinkage long sys_ia64_pipe(void); 362 360 asmlinkage long sys_rt_sigaction(int sig, 363 361 const struct sigaction __user *act,
+3 -1
arch/ia64/kernel/process.c
··· 633 633 } 634 634 635 635 long 636 - sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp, 636 + sys_execve (const char __user *filename, 637 + const char __user *const __user *argv, 638 + const char __user *const __user *envp, 637 639 struct pt_regs *regs) 638 640 { 639 641 char *fname;
+2 -2
arch/m32r/kernel/process.c
··· 289 289 * sys_execve() executes a new program. 290 290 */ 291 291 asmlinkage int sys_execve(const char __user *ufilename, 292 - char __user * __user *uargv, 293 - char __user * __user *uenvp, 292 + const char __user *const __user *uargv, 293 + const char __user *const __user *uenvp, 294 294 unsigned long r3, unsigned long r4, unsigned long r5, 295 295 unsigned long r6, struct pt_regs regs) 296 296 {
+3 -1
arch/m32r/kernel/sys_m32r.c
··· 93 93 * Do a system call from kernel instead of calling sys_execve so we 94 94 * end up with proper pt_regs. 95 95 */ 96 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 96 + int kernel_execve(const char *filename, 97 + const char *const argv[], 98 + const char *const envp[]) 97 99 { 98 100 register long __scno __asm__ ("r7") = __NR_execve; 99 101 register long __arg3 __asm__ ("r2") = (long)(envp);
+11 -2
arch/m68k/include/asm/ide.h
··· 1 1 /* 2 - * linux/include/asm-m68k/ide.h 3 - * 4 2 * Copyright (C) 1994-1996 Linus Torvalds & authors 5 3 */ 6 4 ··· 32 34 #include <asm/io.h> 33 35 #include <asm/irq.h> 34 36 37 + #ifdef CONFIG_MMU 38 + 35 39 /* 36 40 * Get rid of defs from io.h - ide has its private and conflicting versions 37 41 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we ··· 52 52 #define writew(val, port) out_be16(port, val) 53 53 #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) 54 54 #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) 55 + 56 + #else 57 + 58 + #define __ide_mm_insw(port, addr, n) io_insw((unsigned int)port, addr, n) 59 + #define __ide_mm_insl(port, addr, n) io_insl((unsigned int)port, addr, n) 60 + #define __ide_mm_outsw(port, addr, n) io_outsw((unsigned int)port, addr, n) 61 + #define __ide_mm_outsl(port, addr, n) io_outsl((unsigned int)port, addr, n) 62 + 63 + #endif /* CONFIG_MMU */ 55 64 56 65 #endif /* __KERNEL__ */ 57 66 #endif /* _M68K_IDE_H */
+3 -1
arch/m68k/kernel/process.c
··· 315 315 /* 316 316 * sys_execve() executes a new program. 317 317 */ 318 - asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) 318 + asmlinkage int sys_execve(const char __user *name, 319 + const char __user *const __user *argv, 320 + const char __user *const __user *envp) 319 321 { 320 322 int error; 321 323 char * filename;
+3 -1
arch/m68k/kernel/sys_m68k.c
··· 459 459 * Do a system call from kernel instead of calling sys_execve so we 460 460 * end up with proper pt_regs. 461 461 */ 462 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 462 + int kernel_execve(const char *filename, 463 + const char *const argv[], 464 + const char *const envp[]) 463 465 { 464 466 register long __res asm ("%d0") = __NR_execve; 465 467 register long __a asm ("%d1") = (long)(filename);
+8 -6
arch/m68knommu/kernel/process.c
··· 316 316 fp->d0, fp->d1, fp->d2, fp->d3); 317 317 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 318 318 fp->d4, fp->d5, fp->a0, fp->a1); 319 - printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %08x\n", 320 - (unsigned int) rdusp(), (unsigned int) fp); 319 + printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %p\n", 320 + (unsigned int) rdusp(), fp); 321 321 322 322 printk(KERN_EMERG "\nCODE:"); 323 323 tp = ((unsigned char *) fp->pc) - 0x20; 324 324 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { 325 325 if ((i % 0x10) == 0) 326 - printk(KERN_EMERG "%08x: ", (int) (tp + i)); 326 + printk(KERN_EMERG "%p: ", tp + i); 327 327 printk("%08x ", (int) *sp++); 328 328 } 329 329 printk(KERN_EMERG "\n"); ··· 332 332 tp = ((unsigned char *) fp) - 0x40; 333 333 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { 334 334 if ((i % 0x10) == 0) 335 - printk(KERN_EMERG "%08x: ", (int) (tp + i)); 335 + printk(KERN_EMERG "%p: ", tp + i); 336 336 printk("%08x ", (int) *sp++); 337 337 } 338 338 printk(KERN_EMERG "\n"); ··· 341 341 tp = (unsigned char *) (rdusp() - 0x10); 342 342 for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) { 343 343 if ((i % 0x10) == 0) 344 - printk(KERN_EMERG "%08x: ", (int) (tp + i)); 344 + printk(KERN_EMERG "%p: ", tp + i); 345 345 printk("%08x ", (int) *sp++); 346 346 } 347 347 printk(KERN_EMERG "\n"); ··· 350 350 /* 351 351 * sys_execve() executes a new program. 352 352 */ 353 - asmlinkage int sys_execve(const char *name, char **argv, char **envp) 353 + asmlinkage int sys_execve(const char *name, 354 + const char *const *argv, 355 + const char *const *envp) 354 356 { 355 357 int error; 356 358 char * filename;
+3 -1
arch/m68knommu/kernel/sys_m68k.c
··· 44 44 * Do a system call from kernel instead of calling sys_execve so we 45 45 * end up with proper pt_regs. 46 46 */ 47 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 47 + int kernel_execve(const char *filename, 48 + const char *const argv[], 49 + const char *const envp[]) 48 50 { 49 51 register long __res asm ("%d0") = __NR_execve; 50 52 register long __a asm ("%d1") = (long)(filename);
+1 -1
arch/microblaze/kernel/prom_parse.c
··· 73 73 /* We can only get here if we hit a P2P bridge with no node, 74 74 * let's do standard swizzling and try again 75 75 */ 76 - lspec = of_irq_pci_swizzle(PCI_SLOT(pdev->devfn), lspec); 76 + lspec = pci_swizzle_interrupt_pin(pdev, lspec); 77 77 pdev = ppdev; 78 78 } 79 79
+7 -3
arch/microblaze/kernel/sys_microblaze.c
··· 47 47 return do_fork(flags, stack, regs, 0, NULL, NULL); 48 48 } 49 49 50 - asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv, 51 - char __user *__user *envp, struct pt_regs *regs) 50 + asmlinkage long microblaze_execve(const char __user *filenamei, 51 + const char __user *const __user *argv, 52 + const char __user *const __user *envp, 53 + struct pt_regs *regs) 52 54 { 53 55 int error; 54 56 char *filename; ··· 79 77 * Do a system call from kernel instead of calling sys_execve so we 80 78 * end up with proper pt_regs. 81 79 */ 82 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 80 + int kernel_execve(const char *filename, 81 + const char *const argv[], 82 + const char *const envp[]) 83 83 { 84 84 register const char *__a __asm__("r5") = filename; 85 85 register const void *__b __asm__("r6") = argv;
+3 -2
arch/microblaze/pci/pci-common.c
··· 27 27 #include <linux/irq.h> 28 28 #include <linux/vmalloc.h> 29 29 #include <linux/slab.h> 30 + #include <linux/of.h> 31 + #include <linux/of_address.h> 30 32 31 33 #include <asm/processor.h> 32 34 #include <asm/io.h> 33 - #include <asm/prom.h> 34 35 #include <asm/pci-bridge.h> 35 36 #include <asm/byteorder.h> 36 37 ··· 1078 1077 struct dev_archdata *sd = &dev->dev.archdata; 1079 1078 1080 1079 /* Setup OF node pointer in archdata */ 1081 - sd->of_node = pci_device_to_OF_node(dev); 1080 + dev->dev.of_node = pci_device_to_OF_node(dev); 1082 1081 1083 1082 /* Fixup NUMA node as it may not be setup yet by the generic 1084 1083 * code and is needed by the DMA init
+1
arch/microblaze/pci/xilinx_pci.c
··· 16 16 17 17 #include <linux/ioport.h> 18 18 #include <linux/of.h> 19 + #include <linux/of_address.h> 19 20 #include <linux/pci.h> 20 21 #include <asm/io.h> 21 22
+7 -3
arch/mips/kernel/syscall.c
··· 258 258 error = PTR_ERR(filename); 259 259 if (IS_ERR(filename)) 260 260 goto out; 261 - error = do_execve(filename, (char __user *__user *) (long)regs.regs[5], 262 - (char __user *__user *) (long)regs.regs[6], &regs); 261 + error = do_execve(filename, 262 + (const char __user *const __user *) (long)regs.regs[5], 263 + (const char __user *const __user *) (long)regs.regs[6], 264 + &regs); 263 265 putname(filename); 264 266 265 267 out: ··· 438 436 * Do a system call from kernel instead of calling sys_execve so we 439 437 * end up with proper pt_regs. 440 438 */ 441 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 439 + int kernel_execve(const char *filename, 440 + const char *const argv[], 441 + const char *const envp[]) 442 442 { 443 443 register unsigned long __a0 asm("$4") = (unsigned long) filename; 444 444 register unsigned long __a1 asm("$5") = (unsigned long) argv;
+2 -2
arch/mn10300/kernel/process.c
··· 269 269 } 270 270 271 271 asmlinkage long sys_execve(const char __user *name, 272 - char __user * __user *argv, 273 - char __user * __user *envp) 272 + const char __user *const __user *argv, 273 + const char __user *const __user *envp) 274 274 { 275 275 char *filename; 276 276 int error;
+4 -2
arch/parisc/hpux/fs.c
··· 41 41 if (IS_ERR(filename)) 42 42 goto out; 43 43 44 - error = do_execve(filename, (char __user * __user *) regs->gr[25], 45 - (char __user * __user *) regs->gr[24], regs); 44 + error = do_execve(filename, 45 + (const char __user *const __user *) regs->gr[25], 46 + (const char __user *const __user *) regs->gr[24], 47 + regs); 46 48 47 49 putname(filename); 48 50
+10 -5
arch/parisc/kernel/process.c
··· 348 348 error = PTR_ERR(filename); 349 349 if (IS_ERR(filename)) 350 350 goto out; 351 - error = do_execve(filename, (char __user * __user *) regs->gr[25], 352 - (char __user * __user *) regs->gr[24], regs); 351 + error = do_execve(filename, 352 + (const char __user *const __user *) regs->gr[25], 353 + (const char __user *const __user *) regs->gr[24], 354 + regs); 353 355 putname(filename); 354 356 out: 355 357 356 358 return error; 357 359 } 358 360 359 - extern int __execve(const char *filename, char *const argv[], 360 - char *const envp[], struct task_struct *task); 361 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 361 + extern int __execve(const char *filename, 362 + const char *const argv[], 363 + const char *const envp[], struct task_struct *task); 364 + int kernel_execve(const char *filename, 365 + const char *const argv[], 366 + const char *const envp[]) 362 367 { 363 368 return __execve(filename, argv, envp, current); 364 369 }
+3 -2
arch/powerpc/kernel/process.c
··· 1034 1034 flush_fp_to_thread(current); 1035 1035 flush_altivec_to_thread(current); 1036 1036 flush_spe_to_thread(current); 1037 - error = do_execve(filename, (char __user * __user *) a1, 1038 - (char __user * __user *) a2, regs); 1037 + error = do_execve(filename, 1038 + (const char __user *const __user *) a1, 1039 + (const char __user *const __user *) a2, regs); 1039 1040 putname(filename); 1040 1041 out: 1041 1042 return error;
+3 -2
arch/s390/kernel/process.c
··· 267 267 /* 268 268 * sys_execve() executes a new program. 269 269 */ 270 - SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv, 271 - char __user * __user *, envp) 270 + SYSCALL_DEFINE3(execve, const char __user *, name, 271 + const char __user *const __user *, argv, 272 + const char __user *const __user *, envp) 272 273 { 273 274 struct pt_regs *regs = task_pt_regs(current); 274 275 char *filename;
+7 -3
arch/score/kernel/sys_score.c
··· 99 99 if (IS_ERR(filename)) 100 100 return error; 101 101 102 - error = do_execve(filename, (char __user *__user*)regs->regs[5], 103 - (char __user *__user *) regs->regs[6], regs); 102 + error = do_execve(filename, 103 + (const char __user *const __user *)regs->regs[5], 104 + (const char __user *const __user *)regs->regs[6], 105 + regs); 104 106 105 107 putname(filename); 106 108 return error; ··· 112 110 * Do a system call from kernel instead of calling sys_execve so we 113 111 * end up with proper pt_regs. 114 112 */ 115 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 113 + int kernel_execve(const char *filename, 114 + const char *const argv[], 115 + const char *const envp[]) 116 116 { 117 117 register unsigned long __r4 asm("r4") = (unsigned long) filename; 118 118 register unsigned long __r5 asm("r5") = (unsigned long) argv;
+4 -3
arch/sh/include/asm/syscalls_32.h
··· 19 19 asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, 20 20 unsigned long r6, unsigned long r7, 21 21 struct pt_regs __regs); 22 - asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv, 23 - char __user * __user *uenvp, unsigned long r7, 24 - struct pt_regs __regs); 22 + asmlinkage int sys_execve(const char __user *ufilename, 23 + const char __user *const __user *uargv, 24 + const char __user *const __user *uenvp, 25 + unsigned long r7, struct pt_regs __regs); 25 26 asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, 26 27 unsigned long r6, unsigned long r7, 27 28 struct pt_regs __regs);
+3 -3
arch/sh/kernel/process_32.c
··· 297 297 * sys_execve() executes a new program. 298 298 */ 299 299 asmlinkage int sys_execve(const char __user *ufilename, 300 - char __user * __user *uargv, 301 - char __user * __user *uenvp, unsigned long r7, 302 - struct pt_regs __regs) 300 + const char __user *const __user *uargv, 301 + const char __user *const __user *uenvp, 302 + unsigned long r7, struct pt_regs __regs) 303 303 { 304 304 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 305 305 int error;
+2 -2
arch/sh/kernel/process_64.c
··· 497 497 goto out; 498 498 499 499 error = do_execve(filename, 500 - (char __user * __user *)uargv, 501 - (char __user * __user *)uenvp, 500 + (const char __user *const __user *)uargv, 501 + (const char __user *const __user *)uenvp, 502 502 pregs); 503 503 putname(filename); 504 504 out:
+3 -1
arch/sh/kernel/sys_sh32.c
··· 71 71 * Do a system call from kernel instead of calling sys_execve so we 72 72 * end up with proper pt_regs. 73 73 */ 74 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 74 + int kernel_execve(const char *filename, 75 + const char *const argv[], 76 + const char *const envp[]) 75 77 { 76 78 register long __sc0 __asm__ ("r3") = __NR_execve; 77 79 register long __sc4 __asm__ ("r4") = (long) filename;
+3 -1
arch/sh/kernel/sys_sh64.c
··· 33 33 * Do a system call from kernel instead of calling sys_execve so we 34 34 * end up with proper pt_regs. 35 35 */ 36 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 36 + int kernel_execve(const char *filename, 37 + const char *const argv[], 38 + const char *const envp[]) 37 39 { 38 40 register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve); 39 41 register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename;
+3 -3
arch/sparc/include/asm/atomic_64.h
··· 25 25 extern void atomic64_sub(int, atomic64_t *); 26 26 27 27 extern int atomic_add_ret(int, atomic_t *); 28 - extern int atomic64_add_ret(int, atomic64_t *); 28 + extern long atomic64_add_ret(int, atomic64_t *); 29 29 extern int atomic_sub_ret(int, atomic_t *); 30 - extern int atomic64_sub_ret(int, atomic64_t *); 30 + extern long atomic64_sub_ret(int, atomic64_t *); 31 31 32 32 #define atomic_dec_return(v) atomic_sub_ret(1, v) 33 33 #define atomic64_dec_return(v) atomic64_sub_ret(1, v) ··· 91 91 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) 92 92 #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 93 93 94 - static inline int atomic64_add_unless(atomic64_t *v, long a, long u) 94 + static inline long atomic64_add_unless(atomic64_t *v, long a, long u) 95 95 { 96 96 long c, old; 97 97 c = atomic64_read(v);
+4
arch/sparc/include/asm/fb.h
··· 1 1 #ifndef _SPARC_FB_H_ 2 2 #define _SPARC_FB_H_ 3 + #include <linux/console.h> 3 4 #include <linux/fb.h> 4 5 #include <linux/fs.h> 5 6 #include <asm/page.h> ··· 18 17 { 19 18 struct device *dev = info->device; 20 19 struct device_node *node; 20 + 21 + if (console_set_on_cmdline) 22 + return 0; 21 23 22 24 node = dev->of_node; 23 25 if (node &&
+1 -1
arch/sparc/include/asm/rwsem-const.h
··· 5 5 #define RWSEM_UNLOCKED_VALUE 0x00000000 6 6 #define RWSEM_ACTIVE_BIAS 0x00000001 7 7 #define RWSEM_ACTIVE_MASK 0x0000ffff 8 - #define RWSEM_WAITING_BIAS 0xffff0000 8 + #define RWSEM_WAITING_BIAS (-0x00010000) 9 9 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 10 10 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 11 11
+4 -1
arch/sparc/include/asm/unistd.h
··· 397 397 #define __NR_rt_tgsigqueueinfo 326 398 398 #define __NR_perf_event_open 327 399 399 #define __NR_recvmmsg 328 400 + #define __NR_fanotify_init 329 401 + #define __NR_fanotify_mark 330 402 + #define __NR_prlimit64 331 400 403 401 - #define NR_syscalls 329 404 + #define NR_syscalls 332 402 405 403 406 #ifdef __32bit_syscall_numbers__ 404 407 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
+4 -2
arch/sparc/kernel/process_32.c
··· 633 633 if(IS_ERR(filename)) 634 634 goto out; 635 635 error = do_execve(filename, 636 - (char __user * __user *)regs->u_regs[base + UREG_I1], 637 - (char __user * __user *)regs->u_regs[base + UREG_I2], 636 + (const char __user *const __user *) 637 + regs->u_regs[base + UREG_I1], 638 + (const char __user *const __user *) 639 + regs->u_regs[base + UREG_I2], 638 640 regs); 639 641 putname(filename); 640 642 out:
+2 -2
arch/sparc/kernel/process_64.c
··· 739 739 if (IS_ERR(filename)) 740 740 goto out; 741 741 error = do_execve(filename, 742 - (char __user * __user *) 742 + (const char __user *const __user *) 743 743 regs->u_regs[base + UREG_I1], 744 - (char __user * __user *) 744 + (const char __user *const __user *) 745 745 regs->u_regs[base + UREG_I2], regs); 746 746 putname(filename); 747 747 if (!error) {
+9
arch/sparc/kernel/sys32.S
··· 330 330 nop 331 331 nop 332 332 333 + .globl sys32_fanotify_mark 334 + sys32_fanotify_mark: 335 + sethi %hi(sys_fanotify_mark), %g1 336 + sllx %o2, 32, %o2 337 + or %o2, %o3, %o2 338 + mov %o4, %o3 339 + jmpl %g1 + %lo(sys_fanotify_mark), %g0 340 + mov %o5, %o4 341 + 333 342 .section __ex_table,"a" 334 343 .align 4 335 344 .word 1b, __retl_efault, 2b, __retl_efault
+3 -1
arch/sparc/kernel/sys_sparc_32.c
··· 282 282 * Do a system call from kernel instead of calling sys_execve so we 283 283 * end up with proper pt_regs. 284 284 */ 285 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 285 + int kernel_execve(const char *filename, 286 + const char *const argv[], 287 + const char *const envp[]) 286 288 { 287 289 long __res; 288 290 register long __g1 __asm__ ("g1") = __NR_execve;
+3 -1
arch/sparc/kernel/sys_sparc_64.c
··· 758 758 * Do a system call from kernel instead of calling sys_execve so we 759 759 * end up with proper pt_regs. 760 760 */ 761 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 761 + int kernel_execve(const char *filename, 762 + const char *const argv[], 763 + const char *const envp[]) 762 764 { 763 765 long __res; 764 766 register long __g1 __asm__ ("g1") = __NR_execve;
+2 -1
arch/sparc/kernel/systbls_32.S
··· 82 82 /*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 83 83 /*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 84 84 /*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 85 - /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg 85 + /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 86 + /*330*/ .long sys_fanotify_mark, sys_prlimit64 86 87
+4 -2
arch/sparc/kernel/systbls_64.S
··· 83 83 /*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate 84 84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1 85 85 /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv 86 - .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg 86 + .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init 87 + /*330*/ .word sys32_fanotify_mark, sys_prlimit64 87 88 88 89 #endif /* CONFIG_COMPAT */ 89 90 ··· 159 158 /*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 160 159 .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 161 160 /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 162 - .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg 161 + .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 162 + /*330*/ .word sys_fanotify_mark, sys_prlimit64
+3 -2
arch/tile/kernel/process.c
··· 543 543 /* 544 544 * sys_execve() executes a new program. 545 545 */ 546 - long _sys_execve(char __user *path, char __user *__user *argv, 547 - char __user *__user *envp, struct pt_regs *regs) 546 + long _sys_execve(const char __user *path, 547 + const char __user *const __user *argv, 548 + const char __user *const __user *envp, struct pt_regs *regs) 548 549 { 549 550 long error; 550 551 char *filename;
+3 -2
arch/um/kernel/exec.c
··· 44 44 PT_REGS_SP(regs) = esp; 45 45 } 46 46 47 - static long execve1(const char *file, char __user * __user *argv, 48 - char __user *__user *env) 47 + static long execve1(const char *file, 48 + const char __user *const __user *argv, 49 + const char __user *const __user *env) 49 50 { 50 51 long error; 51 52
+3 -1
arch/um/kernel/syscall.c
··· 51 51 return err; 52 52 } 53 53 54 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54 + int kernel_execve(const char *filename, 55 + const char *const argv[], 56 + const char *const envp[]) 55 57 { 56 58 mm_segment_t fs; 57 59 int ret;
+3 -2
arch/x86/include/asm/syscalls.h
··· 23 23 /* kernel/process.c */ 24 24 int sys_fork(struct pt_regs *); 25 25 int sys_vfork(struct pt_regs *); 26 - long sys_execve(const char __user *, char __user * __user *, 27 - char __user * __user *, struct pt_regs *); 26 + long sys_execve(const char __user *, 27 + const char __user *const __user *, 28 + const char __user *const __user *, struct pt_regs *); 28 29 long sys_clone(unsigned long, unsigned long, void __user *, 29 30 void __user *, struct pt_regs *); 30 31
+1 -1
arch/x86/kernel/kgdb.c
··· 194 194 unsigned long addr; 195 195 int len; 196 196 int type; 197 - struct perf_event **pev; 197 + struct perf_event * __percpu *pev; 198 198 } breakinfo[HBP_NUM]; 199 199 200 200 static unsigned long early_dr7;
+3 -2
arch/x86/kernel/process.c
··· 301 301 /* 302 302 * sys_execve() executes a new program. 303 303 */ 304 - long sys_execve(const char __user *name, char __user * __user *argv, 305 - char __user * __user *envp, struct pt_regs *regs) 304 + long sys_execve(const char __user *name, 305 + const char __user *const __user *argv, 306 + const char __user *const __user *envp, struct pt_regs *regs) 306 307 { 307 308 long error; 308 309 char *filename;
+3 -1
arch/x86/kernel/sys_i386_32.c
··· 28 28 * Do a system call from kernel instead of calling sys_execve so we 29 29 * end up with proper pt_regs. 30 30 */ 31 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 31 + int kernel_execve(const char *filename, 32 + const char *const argv[], 33 + const char *const envp[]) 32 34 { 33 35 long __res; 34 36 asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
+3 -2
arch/xtensa/kernel/process.c
··· 318 318 */ 319 319 320 320 asmlinkage 321 - long xtensa_execve(const char __user *name, char __user * __user *argv, 322 - char __user * __user *envp, 321 + long xtensa_execve(const char __user *name, 322 + const char __user *const __user *argv, 323 + const char __user *const __user *envp, 323 324 long a3, long a4, long a5, 324 325 struct pt_regs *regs) 325 326 {
+2 -2
drivers/ata/sata_dwc_460ex.c
··· 1588 1588 }, 1589 1589 }; 1590 1590 1591 - static int sata_dwc_probe(struct of_device *ofdev, 1591 + static int sata_dwc_probe(struct platform_device *ofdev, 1592 1592 const struct of_device_id *match) 1593 1593 { 1594 1594 struct sata_dwc_device *hsdev; ··· 1702 1702 return err; 1703 1703 } 1704 1704 1705 - static int sata_dwc_remove(struct of_device *ofdev) 1705 + static int sata_dwc_remove(struct platform_device *ofdev) 1706 1706 { 1707 1707 struct device *dev = &ofdev->dev; 1708 1708 struct ata_host *host = dev_get_drvdata(dev);
+1
drivers/block/xsysace.c
··· 94 94 #include <linux/hdreg.h> 95 95 #include <linux/platform_device.h> 96 96 #if defined(CONFIG_OF) 97 + #include <linux/of_address.h> 97 98 #include <linux/of_device.h> 98 99 #include <linux/of_platform.h> 99 100 #endif
+2 -2
drivers/char/pty.c
··· 675 675 } 676 676 677 677 set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ 678 - filp->private_data = tty; 679 - file_move(filp, &tty->tty_files); 678 + 679 + tty_add_file(tty, filp); 680 680 681 681 retval = devpts_pty_new(inode, tty->link); 682 682 if (retval)
+63 -29
drivers/char/tty_io.c
··· 136 136 DEFINE_MUTEX(tty_mutex); 137 137 EXPORT_SYMBOL(tty_mutex); 138 138 139 + /* Spinlock to protect the tty->tty_files list */ 140 + DEFINE_SPINLOCK(tty_files_lock); 141 + 139 142 static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *); 140 143 static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *); 141 144 ssize_t redirected_tty_write(struct file *, const char __user *, ··· 187 184 tty_buffer_free_all(tty); 188 185 kfree(tty); 189 186 } 187 + 188 + static inline struct tty_struct *file_tty(struct file *file) 189 + { 190 + return ((struct tty_file_private *)file->private_data)->tty; 191 + } 192 + 193 + /* Associate a new file with the tty structure */ 194 + void tty_add_file(struct tty_struct *tty, struct file *file) 195 + { 196 + struct tty_file_private *priv; 197 + 198 + /* XXX: must implement proper error handling in callers */ 199 + priv = kmalloc(sizeof(*priv), GFP_KERNEL|__GFP_NOFAIL); 200 + 201 + priv->tty = tty; 202 + priv->file = file; 203 + file->private_data = priv; 204 + 205 + spin_lock(&tty_files_lock); 206 + list_add(&priv->list, &tty->tty_files); 207 + spin_unlock(&tty_files_lock); 208 + } 209 + 210 + /* Delete file from its tty */ 211 + void tty_del_file(struct file *file) 212 + { 213 + struct tty_file_private *priv = file->private_data; 214 + 215 + spin_lock(&tty_files_lock); 216 + list_del(&priv->list); 217 + spin_unlock(&tty_files_lock); 218 + file->private_data = NULL; 219 + kfree(priv); 220 + } 221 + 190 222 191 223 #define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base) 192 224 ··· 273 235 struct list_head *p; 274 236 int count = 0; 275 237 276 - file_list_lock(); 238 + spin_lock(&tty_files_lock); 277 239 list_for_each(p, &tty->tty_files) { 278 240 count++; 279 241 } 280 - file_list_unlock(); 242 + spin_unlock(&tty_files_lock); 281 243 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 282 244 tty->driver->subtype == PTY_TYPE_SLAVE && 283 245 tty->link && tty->link->count) ··· 535 497 struct file *cons_filp = NULL; 536 498 struct file *filp, *f = NULL; 537 499 struct task_struct *p; 500 + struct tty_file_private *priv; 538 501 int closecount = 0, n; 539 502 unsigned long flags; 540 503 int refs = 0; ··· 545 506 546 507 547 508 spin_lock(&redirect_lock); 548 - if (redirect && redirect->private_data == tty) { 509 + if (redirect && file_tty(redirect) == tty) { 549 510 f = redirect; 550 511 redirect = NULL; 551 512 } ··· 558 519 workqueue with the lock held */ 559 520 check_tty_count(tty, "tty_hangup"); 560 521 561 - file_list_lock(); 522 + spin_lock(&tty_files_lock); 562 523 /* This breaks for file handles being sent over AF_UNIX sockets ? */ 563 - list_for_each_entry(filp, &tty->tty_files, f_u.fu_list) { 524 + list_for_each_entry(priv, &tty->tty_files, list) { 525 + filp = priv->file; 564 526 if (filp->f_op->write == redirected_tty_write) 565 527 cons_filp = filp; 566 528 if (filp->f_op->write != tty_write) ··· 570 530 __tty_fasync(-1, filp, 0); /* can't block */ 571 531 filp->f_op = &hung_up_tty_fops; 572 532 } 573 - file_list_unlock(); 533 + spin_unlock(&tty_files_lock); 574 534 575 535 tty_ldisc_hangup(tty); 576 536 ··· 929 889 loff_t *ppos) 930 890 { 931 891 int i; 932 - struct tty_struct *tty; 933 - struct inode *inode; 892 + struct inode *inode = file->f_path.dentry->d_inode; 893 + struct tty_struct *tty = file_tty(file); 934 894 struct tty_ldisc *ld; 935 895 936 - tty = file->private_data; 937 - inode = file->f_path.dentry->d_inode; 938 896 if (tty_paranoia_check(tty, inode, "tty_read")) 939 897 return -EIO; 940 898 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags))) ··· 1103 1065 static ssize_t tty_write(struct file *file, const char __user *buf, 1104 1066 size_t count, loff_t *ppos) 1105 1067 { 1106 - struct tty_struct *tty; 1107 1068 struct inode *inode = file->f_path.dentry->d_inode; 1069 + struct tty_struct *tty = file_tty(file); 1070 + struct tty_ldisc *ld; 1108 1071 ssize_t ret; 1109 - struct tty_ldisc *ld; 1110 1072 1111 - tty = file->private_data; 1112 1073 if (tty_paranoia_check(tty, inode, "tty_write")) 1113 1074 return -EIO; 1114 1075 if (!tty || !tty->ops->write || ··· 1461 1424 tty_driver_kref_put(driver); 1462 1425 module_put(driver->owner); 1463 1426 1464 - file_list_lock(); 1427 + spin_lock(&tty_files_lock); 1465 1428 list_del_init(&tty->tty_files); 1466 - file_list_unlock(); 1429 + spin_unlock(&tty_files_lock); 1467 1430 1468 1431 put_pid(tty->pgrp); 1469 1432 put_pid(tty->session); ··· 1544 1507 1545 1508 int tty_release(struct inode *inode, struct file *filp) 1546 1509 { 1547 - struct tty_struct *tty, *o_tty; 1510 + struct tty_struct *tty = file_tty(filp); 1511 + struct tty_struct *o_tty; 1548 1512 int pty_master, tty_closing, o_tty_closing, do_sleep; 1549 1513 int devpts; 1550 1514 int idx; 1551 1515 char buf[64]; 1552 1516 1553 - tty = filp->private_data; 1554 1517 if (tty_paranoia_check(tty, inode, "tty_release_dev")) 1555 1518 return 0; 1556 1519 ··· 1708 1671 * - do_tty_hangup no longer sees this file descriptor as 1709 1672 * something that needs to be handled for hangups. 1710 1673 */ 1711 - file_kill(filp); 1712 - filp->private_data = NULL; 1674 + tty_del_file(filp); 1713 1675 1714 1676 /* 1715 1677 * Perform some housekeeping before deciding whether to return. ··· 1875 1839 return PTR_ERR(tty); 1876 1840 } 1877 1841 1878 - filp->private_data = tty; 1879 - file_move(filp, &tty->tty_files); 1842 + tty_add_file(tty, filp); 1843 + 1880 1844 check_tty_count(tty, "tty_open"); 1881 1845 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 1882 1846 tty->driver->subtype == PTY_TYPE_MASTER) ··· 1952 1916 1953 1917 static unsigned int tty_poll(struct file *filp, poll_table *wait) 1954 1918 { 1955 - struct tty_struct *tty; 1919 + struct tty_struct *tty = file_tty(filp); 1956 1920 struct tty_ldisc *ld; 1957 1921 int ret = 0; 1958 1922 1959 - tty = filp->private_data; 1960 1923 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll")) 1961 1924 return 0; 1962 1925 ··· 1968 1933 1969 1934 static int __tty_fasync(int fd, struct file *filp, int on) 1970 1935 { 1971 - struct tty_struct *tty; 1936 + struct tty_struct *tty = file_tty(filp); 1972 1937 unsigned long flags; 1973 1938 int retval = 0; 1974 1939 1975 - tty = filp->private_data; 1976 1940 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) 1977 1941 goto out; 1978 1942 ··· 2525 2491 */ 2526 2492 long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2527 2493 { 2528 - struct tty_struct *tty, *real_tty; 2494 + struct tty_struct *tty = file_tty(file); 2495 + struct tty_struct *real_tty; 2529 2496 void __user *p = (void __user *)arg; 2530 2497 int retval; 2531 2498 struct tty_ldisc *ld; 2532 2499 struct inode *inode = file->f_dentry->d_inode; 2533 2500 2534 - tty = file->private_data; 2535 2501 if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2536 2502 return -EINVAL; 2537 2503 ··· 2653 2619 unsigned long arg) 2654 2620 { 2655 2621 struct inode *inode = file->f_dentry->d_inode; 2656 - struct tty_struct *tty = file->private_data; 2622 + struct tty_struct *tty = file_tty(file); 2657 2623 struct tty_ldisc *ld; 2658 2624 int retval = -ENOIOCTLCMD; 2659 2625 ··· 2745 2711 if (!filp) 2746 2712 continue; 2747 2713 if (filp->f_op->read == tty_read && 2748 - filp->private_data == tty) { 2714 + file_tty(filp) == tty) { 2749 2715 printk(KERN_NOTICE "SAK: killed process %d" 2750 2716 " (%s): fd#%d opened to the tty\n", 2751 2717 task_pid_nr(p), p->comm, i);
+7 -4
drivers/char/vt.c
··· 194 194 int fg_console; 195 195 int last_console; 196 196 int want_console = -1; 197 - int saved_fg_console; 198 - int saved_last_console; 199 - int saved_want_console; 200 - int saved_vc_mode; 197 + static int saved_fg_console; 198 + static int saved_last_console; 199 + static int saved_want_console; 200 + static int saved_vc_mode; 201 + static int saved_console_blanked; 201 202 202 203 /* 203 204 * For each existing display, we have a pointer to console currently visible ··· 3450 3449 saved_last_console = last_console; 3451 3450 saved_want_console = want_console; 3452 3451 saved_vc_mode = vc->vc_mode; 3452 + saved_console_blanked = console_blanked; 3453 3453 vc->vc_mode = KD_TEXT; 3454 3454 console_blanked = 0; 3455 3455 if (vc->vc_sw->con_debug_enter) ··· 3494 3492 fg_console = saved_fg_console; 3495 3493 last_console = saved_last_console; 3496 3494 want_console = saved_want_console; 3495 + console_blanked = saved_console_blanked; 3497 3496 vc_cons[fg_console].d->vc_mode = saved_vc_mode; 3498 3497 3499 3498 vc = vc_cons[fg_console].d;
+1
drivers/char/xilinx_hwicap/xilinx_hwicap.c
··· 94 94 95 95 #ifdef CONFIG_OF 96 96 /* For open firmware. */ 97 + #include <linux/of_address.h> 97 98 #include <linux/of_device.h> 98 99 #include <linux/of_platform.h> 99 100 #endif
+1
drivers/hid/hid-core.c
··· 1299 1299 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1300 1300 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1301 1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1302 + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 1302 1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1303 1304 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1304 1305 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
+9
drivers/hid/hid-egalax.c
··· 159 159 { 160 160 struct egalax_data *td = hid_get_drvdata(hid); 161 161 162 + /* Note, eGalax has two product lines: the first is resistive and 163 + * uses a standard parallel multitouch protocol (product ID == 164 + * 48xx). The second is capacitive and uses an unusual "serial" 165 + * protocol with a different message for each multitouch finger 166 + * (product ID == 72xx). We do not yet generate a correct event 167 + * sequence for the capacitive/serial protocol. 168 + */ 162 169 if (hid->claimed & HID_CLAIMED_INPUT) { 163 170 struct input_dev *input = field->hidinput->input; 164 171 ··· 253 246 static const struct hid_device_id egalax_devices[] = { 254 247 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, 255 248 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 249 + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, 250 + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 256 251 { } 257 252 }; 258 253 MODULE_DEVICE_TABLE(hid, egalax_devices);
+1
drivers/hid/hid-ids.h
··· 188 188 #define USB_VENDOR_ID_DWAV 0x0eef 189 189 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 190 190 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d 191 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1 0x720c 191 192 192 193 #define USB_VENDOR_ID_ELECOM 0x056e 193 194 #define USB_DEVICE_ID_ELECOM_BM084 0x0061
+2 -2
drivers/hid/hid-picolcd.c
··· 547 547 ref_cnt--; 548 548 mutex_lock(&info->lock); 549 549 (*ref_cnt)--; 550 - may_release = !ref_cnt; 550 + may_release = !*ref_cnt; 551 551 mutex_unlock(&info->lock); 552 552 if (may_release) { 553 - framebuffer_release(info); 554 553 vfree((u8 *)info->fix.smem_start); 554 + framebuffer_release(info); 555 555 } 556 556 } 557 557
+7 -4
drivers/hid/usbhid/hiddev.c
··· 266 266 { 267 267 struct hiddev_list *list; 268 268 struct usb_interface *intf; 269 + struct hid_device *hid; 269 270 struct hiddev *hiddev; 270 271 int res; 271 272 272 273 intf = usb_find_interface(&hiddev_driver, iminor(inode)); 273 274 if (!intf) 274 275 return -ENODEV; 275 - hiddev = usb_get_intfdata(intf); 276 + hid = usb_get_intfdata(intf); 277 + hiddev = hid->hiddev; 276 278 277 279 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL))) 278 280 return -ENOMEM; ··· 589 587 struct hiddev_list *list = file->private_data; 590 588 struct hiddev *hiddev = list->hiddev; 591 589 struct hid_device *hid = hiddev->hid; 592 - struct usb_device *dev = hid_to_usb_dev(hid); 590 + struct usb_device *dev; 593 591 struct hiddev_collection_info cinfo; 594 592 struct hiddev_report_info rinfo; 595 593 struct hiddev_field_info finfo; ··· 603 601 /* Called without BKL by compat methods so no BKL taken */ 604 602 605 603 /* FIXME: Who or what stop this racing with a disconnect ?? */ 606 - if (!hiddev->exist) 604 + if (!hiddev->exist || !hid) 607 605 return -EIO; 606 + 607 + dev = hid_to_usb_dev(hid); 608 608 609 609 switch (cmd) { 610 610 ··· 892 888 hid->hiddev = hiddev; 893 889 hiddev->hid = hid; 894 890 hiddev->exist = 1; 895 - usb_set_intfdata(usbhid->intf, usbhid); 896 891 retval = usb_register_dev(usbhid->intf, &hiddev_class); 897 892 if (retval) { 898 893 err_hid("Not able to get a minor for this device.");
+18 -26
drivers/md/md.c
··· 2136 2136 * with the rest of the array) 2137 2137 */ 2138 2138 mdk_rdev_t *rdev; 2139 - 2140 - /* First make sure individual recovery_offsets are correct */ 2141 - list_for_each_entry(rdev, &mddev->disks, same_set) { 2142 - if (rdev->raid_disk >= 0 && 2143 - mddev->delta_disks >= 0 && 2144 - !test_bit(In_sync, &rdev->flags) && 2145 - mddev->curr_resync_completed > rdev->recovery_offset) 2146 - rdev->recovery_offset = mddev->curr_resync_completed; 2147 - 2148 - } 2149 2139 list_for_each_entry(rdev, &mddev->disks, same_set) { 2150 2140 if (rdev->sb_events == mddev->events || 2151 2141 (nospares && ··· 2157 2167 int sync_req; 2158 2168 int nospares = 0; 2159 2169 2160 - mddev->utime = get_seconds(); 2161 - if (mddev->external) 2162 - return; 2163 2170 repeat: 2171 + /* First make sure individual recovery_offsets are correct */ 2172 + list_for_each_entry(rdev, &mddev->disks, same_set) { 2173 + if (rdev->raid_disk >= 0 && 2174 + mddev->delta_disks >= 0 && 2175 + !test_bit(In_sync, &rdev->flags) && 2176 + mddev->curr_resync_completed > rdev->recovery_offset) 2177 + rdev->recovery_offset = mddev->curr_resync_completed; 2178 + 2179 + } 2180 + if (mddev->external || !mddev->persistent) { 2181 + clear_bit(MD_CHANGE_DEVS, &mddev->flags); 2182 + clear_bit(MD_CHANGE_CLEAN, &mddev->flags); 2183 + wake_up(&mddev->sb_wait); 2184 + return; 2185 + } 2186 + 2164 2187 spin_lock_irq(&mddev->write_lock); 2188 + 2189 + mddev->utime = get_seconds(); 2165 2190 2166 2191 set_bit(MD_CHANGE_PENDING, &mddev->flags); 2167 2192 if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags)) ··· 2225 2220 */ 2226 2221 MD_BUG(); 2227 2222 mddev->events --; 2228 - } 2229 - 2230 - /* 2231 - * do not write anything to disk if using 2232 - * nonpersistent superblocks 2233 - */ 2234 - if (!mddev->persistent) { 2235 - if (!mddev->external) 2236 - clear_bit(MD_CHANGE_PENDING, &mddev->flags); 2237 - 2238 - spin_unlock_irq(&mddev->write_lock); 2239 - wake_up(&mddev->sb_wait); 2240 - return; 2241 2223 } 2242 2224 sync_sbs(mddev, nospares); 2243 2225 spin_unlock_irq(&mddev->write_lock);
+12 -9
drivers/md/raid1.c
··· 787 787 struct bio_list bl; 788 788 struct page **behind_pages = NULL; 789 789 const int rw = bio_data_dir(bio); 790 - const bool do_sync = (bio->bi_rw & REQ_SYNC); 791 - bool do_barriers; 790 + const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); 791 + unsigned long do_barriers; 792 792 mdk_rdev_t *blocked_rdev; 793 793 794 794 /* ··· 1120 1120 { 1121 1121 int i; 1122 1122 conf_t *conf = mddev->private; 1123 + int count = 0; 1124 + unsigned long flags; 1123 1125 1124 1126 /* 1125 1127 * Find all failed disks within the RAID1 configuration ··· 1133 1131 if (rdev 1134 1132 && !test_bit(Faulty, &rdev->flags) 1135 1133 && !test_and_set_bit(In_sync, &rdev->flags)) { 1136 - unsigned long flags; 1137 - spin_lock_irqsave(&conf->device_lock, flags); 1138 - mddev->degraded--; 1139 - spin_unlock_irqrestore(&conf->device_lock, flags); 1134 + count++; 1135 + sysfs_notify_dirent(rdev->sysfs_state); 1140 1136 } 1141 1137 } 1138 + spin_lock_irqsave(&conf->device_lock, flags); 1139 + mddev->degraded -= count; 1140 + spin_unlock_irqrestore(&conf->device_lock, flags); 1142 1141 1143 1142 print_conf(conf); 1144 - return 0; 1143 + return count; 1145 1144 } 1146 1145 1147 1146 ··· 1643 1640 * We already have a nr_pending reference on these rdevs. 1644 1641 */ 1645 1642 int i; 1646 - const bool do_sync = (r1_bio->master_bio->bi_rw & REQ_SYNC); 1643 + const unsigned long do_sync = (r1_bio->master_bio->bi_rw & REQ_SYNC); 1647 1644 clear_bit(R1BIO_BarrierRetry, &r1_bio->state); 1648 1645 clear_bit(R1BIO_Barrier, &r1_bio->state); 1649 1646 for (i=0; i < conf->raid_disks; i++) ··· 1699 1696 (unsigned long long)r1_bio->sector); 1700 1697 raid_end_bio_io(r1_bio); 1701 1698 } else { 1702 - const bool do_sync = r1_bio->master_bio->bi_rw & REQ_SYNC; 1699 + const unsigned long do_sync = r1_bio->master_bio->bi_rw & REQ_SYNC; 1703 1700 r1_bio->bios[r1_bio->read_disk] = 1704 1701 mddev->ro ? IO_BLOCKED : NULL; 1705 1702 r1_bio->read_disk = disk;
+10 -7
drivers/md/raid10.c
··· 799 799 int i; 800 800 int chunk_sects = conf->chunk_mask + 1; 801 801 const int rw = bio_data_dir(bio); 802 - const bool do_sync = (bio->bi_rw & REQ_SYNC); 802 + const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); 803 803 struct bio_list bl; 804 804 unsigned long flags; 805 805 mdk_rdev_t *blocked_rdev; ··· 1116 1116 int i; 1117 1117 conf_t *conf = mddev->private; 1118 1118 mirror_info_t *tmp; 1119 + int count = 0; 1120 + unsigned long flags; 1119 1121 1120 1122 /* 1121 1123 * Find all non-in_sync disks within the RAID10 configuration ··· 1128 1126 if (tmp->rdev 1129 1127 && !test_bit(Faulty, &tmp->rdev->flags) 1130 1128 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { 1131 - unsigned long flags; 1132 - spin_lock_irqsave(&conf->device_lock, flags); 1133 - mddev->degraded--; 1134 - spin_unlock_irqrestore(&conf->device_lock, flags); 1129 + count++; 1130 + sysfs_notify_dirent(tmp->rdev->sysfs_state); 1135 1131 } 1136 1132 } 1133 + spin_lock_irqsave(&conf->device_lock, flags); 1134 + mddev->degraded -= count; 1135 + spin_unlock_irqrestore(&conf->device_lock, flags); 1137 1136 1138 1137 print_conf(conf); 1139 - return 0; 1138 + return count; 1140 1139 } 1141 1140 1142 1141 ··· 1737 1734 raid_end_bio_io(r10_bio); 1738 1735 bio_put(bio); 1739 1736 } else { 1740 - const bool do_sync = (r10_bio->master_bio->bi_rw & REQ_SYNC); 1737 + const unsigned long do_sync = (r10_bio->master_bio->bi_rw & REQ_SYNC); 1741 1738 bio_put(bio); 1742 1739 rdev = conf->mirrors[mirror].rdev; 1743 1740 if (printk_ratelimit())
+8 -5
drivers/md/raid5.c
··· 5330 5330 int i; 5331 5331 raid5_conf_t *conf = mddev->private; 5332 5332 struct disk_info *tmp; 5333 + int count = 0; 5334 + unsigned long flags; 5333 5335 5334 5336 for (i = 0; i < conf->raid_disks; i++) { 5335 5337 tmp = conf->disks + i; ··· 5339 5337 && tmp->rdev->recovery_offset == MaxSector 5340 5338 && !test_bit(Faulty, &tmp->rdev->flags) 5341 5339 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { 5342 - unsigned long flags; 5343 - spin_lock_irqsave(&conf->device_lock, flags); 5344 - mddev->degraded--; 5345 - spin_unlock_irqrestore(&conf->device_lock, flags); 5340 + count++; 5341 + sysfs_notify_dirent(tmp->rdev->sysfs_state); 5346 5342 } 5347 5343 } 5344 + spin_lock_irqsave(&conf->device_lock, flags); 5345 + mddev->degraded -= count; 5346 + spin_unlock_irqrestore(&conf->device_lock, flags); 5348 5347 print_raid5_conf(conf); 5349 - return 0; 5348 + return count; 5350 5349 } 5351 5350 5352 5351 static int raid5_remove_disk(mddev_t *mddev, int number)
+2
drivers/mmc/core/host.c
··· 86 86 init_waitqueue_head(&host->wq); 87 87 INIT_DELAYED_WORK(&host->detect, mmc_rescan); 88 88 INIT_DELAYED_WORK_DEFERRABLE(&host->disable, mmc_host_deeper_disable); 89 + #ifdef CONFIG_PM 89 90 host->pm_notify.notifier_call = mmc_pm_notify; 91 + #endif 90 92 91 93 /* 92 94 * By default, hosts do not support SGIO or large requests.
+1
drivers/mtd/maps/physmap_of.c
··· 22 22 #include <linux/mtd/partitions.h> 23 23 #include <linux/mtd/concat.h> 24 24 #include <linux/of.h> 25 + #include <linux/of_address.h> 25 26 #include <linux/of_platform.h> 26 27 #include <linux/slab.h> 27 28
+21
drivers/net/wireless/ath/ath5k/base.c
··· 48 48 #include <linux/netdevice.h> 49 49 #include <linux/cache.h> 50 50 #include <linux/pci.h> 51 + #include <linux/pci-aspm.h> 51 52 #include <linux/ethtool.h> 52 53 #include <linux/uaccess.h> 53 54 #include <linux/slab.h> ··· 476 475 struct ieee80211_hw *hw; 477 476 int ret; 478 477 u8 csz; 478 + 479 + /* 480 + * L0s needs to be disabled on all ath5k cards. 481 + * 482 + * For distributions shipping with CONFIG_PCIEASPM (this will be enabled 483 + * by default in the future in 2.6.36) this will also mean both L1 and 484 + * L0s will be disabled when a pre 1.1 PCIe device is detected. We do 485 + * know L1 works correctly even for all ath5k pre 1.1 PCIe devices 486 + * though but cannot currently undue the effect of a blacklist, for 487 + * details you can read pcie_aspm_sanity_check() and see how it adjusts 488 + * the device link capability. 489 + * 490 + * It may be possible in the future to implement some PCI API to allow 491 + * drivers to override blacklists for pre 1.1 PCIe but for now it is 492 + * best to accept that both L0s and L1 will be disabled completely for 493 + * distributions shipping with CONFIG_PCIEASPM rather than having this 494 + * issue present. Motivation for adding this new API will be to help 495 + * with power consumption for some of these devices. 496 + */ 497 + pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); 479 498 480 499 ret = pci_enable_device(pdev); 481 500 if (ret) {
+1
drivers/net/wireless/ath/ath9k/eeprom.h
··· 191 191 #define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 192 192 193 193 #define AR9287_EEP_START_LOC 128 194 + #define AR9287_HTC_EEP_START_LOC 256 194 195 #define AR9287_NUM_2G_CAL_PIERS 3 195 196 #define AR9287_NUM_2G_CCK_TARGET_POWERS 3 196 197 #define AR9287_NUM_2G_20_TARGET_POWERS 3
+6 -1
drivers/net/wireless/ath/ath9k/eeprom_9287.c
··· 34 34 struct ar9287_eeprom *eep = &ah->eeprom.map9287; 35 35 struct ath_common *common = ath9k_hw_common(ah); 36 36 u16 *eep_data; 37 - int addr, eep_start_loc = AR9287_EEP_START_LOC; 37 + int addr, eep_start_loc; 38 38 eep_data = (u16 *)eep; 39 + 40 + if (ah->hw_version.devid == 0x7015) 41 + eep_start_loc = AR9287_HTC_EEP_START_LOC; 42 + else 43 + eep_start_loc = AR9287_EEP_START_LOC; 39 44 40 45 if (!ath9k_hw_use_flash(ah)) { 41 46 ath_print(common, ATH_DBG_EEPROM,
+2 -6
drivers/net/wireless/ath/ath9k/hif_usb.c
··· 799 799 } 800 800 kfree(buf); 801 801 802 - if (hif_dev->device_id == 0x7010) 802 + if ((hif_dev->device_id == 0x7010) || (hif_dev->device_id == 0x7015)) 803 803 firm_offset = AR7010_FIRMWARE_TEXT; 804 804 else 805 805 firm_offset = AR9271_FIRMWARE_TEXT; ··· 901 901 902 902 switch(hif_dev->device_id) { 903 903 case 0x7010: 904 + case 0x7015: 904 905 case 0x9018: 905 906 if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) 906 907 hif_dev->fw_name = FIRMWARE_AR7010_1_1; ··· 911 910 default: 912 911 hif_dev->fw_name = FIRMWARE_AR9271; 913 912 break; 914 - } 915 - 916 - if (!hif_dev->fw_name) { 917 - dev_err(&udev->dev, "Can't determine firmware !\n"); 918 - goto err_htc_hw_alloc; 919 913 } 920 914 921 915 ret = ath9k_hif_usb_dev_init(hif_dev);
+1
drivers/net/wireless/ath/ath9k/htc_drv_init.c
··· 245 245 246 246 switch(devid) { 247 247 case 0x7010: 248 + case 0x7015: 248 249 case 0x9018: 249 250 priv->htc->credits = 45; 250 251 break;
+2 -1
drivers/net/wireless/ath/ath9k/htc_drv_main.c
··· 366 366 caps = WLAN_RC_HT_FLAG; 367 367 if (sta->ht_cap.mcs.rx_mask[1]) 368 368 caps |= WLAN_RC_DS_FLAG; 369 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) 369 + if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && 370 + (conf_is_ht40(&priv->hw->conf))) 370 371 caps |= WLAN_RC_40_FLAG; 371 372 if (conf_is_ht40(&priv->hw->conf) && 372 373 (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40))
+10 -5
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
··· 78 78 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 79 79 struct ieee80211_sta *sta = tx_info->control.sta; 80 80 struct ath9k_htc_sta *ista; 81 - struct ath9k_htc_vif *avp; 82 81 struct ath9k_htc_tx_ctl tx_ctl; 83 82 enum htc_endpoint_id epid; 84 83 u16 qnum; 85 84 __le16 fc; 86 85 u8 *tx_fhdr; 87 - u8 sta_idx; 86 + u8 sta_idx, vif_idx; 88 87 89 88 hdr = (struct ieee80211_hdr *) skb->data; 90 89 fc = hdr->frame_control; 91 90 92 - avp = (struct ath9k_htc_vif *) tx_info->control.vif->drv_priv; 91 + if (tx_info->control.vif && 92 + (struct ath9k_htc_vif *) tx_info->control.vif->drv_priv) 93 + vif_idx = ((struct ath9k_htc_vif *) 94 + tx_info->control.vif->drv_priv)->index; 95 + else 96 + vif_idx = priv->nvifs; 97 + 93 98 if (sta) { 94 99 ista = (struct ath9k_htc_sta *) sta->drv_priv; 95 100 sta_idx = ista->index; ··· 111 106 memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr)); 112 107 113 108 tx_hdr.node_idx = sta_idx; 114 - tx_hdr.vif_idx = avp->index; 109 + tx_hdr.vif_idx = vif_idx; 115 110 116 111 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { 117 112 tx_ctl.type = ATH9K_HTC_AMPDU; ··· 174 169 tx_ctl.type = ATH9K_HTC_NORMAL; 175 170 176 171 mgmt_hdr.node_idx = sta_idx; 177 - mgmt_hdr.vif_idx = avp->index; 172 + mgmt_hdr.vif_idx = vif_idx; 178 173 mgmt_hdr.tidno = 0; 179 174 mgmt_hdr.flags = 0; 180 175
+1
drivers/net/wireless/ath/ath9k/reg.h
··· 899 899 900 900 #define AR_DEVID_7010(_ah) \ 901 901 (((_ah)->hw_version.devid == 0x7010) || \ 902 + ((_ah)->hw_version.devid == 0x7015) || \ 902 903 ((_ah)->hw_version.devid == 0x9018)) 903 904 904 905 #define AR_RADIO_SREV_MAJOR 0xf0
+3 -2
drivers/net/wireless/ipw2x00/ipw2100.c
··· 6665 6665 printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 6666 6666 printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); 6667 6667 6668 + pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 6669 + PM_QOS_DEFAULT_VALUE); 6670 + 6668 6671 ret = pci_register_driver(&ipw2100_pci_driver); 6669 6672 if (ret) 6670 6673 goto out; 6671 6674 6672 - pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 6673 - PM_QOS_DEFAULT_VALUE); 6674 6675 #ifdef CONFIG_IPW2100_DEBUG 6675 6676 ipw2100_debug_level = debug; 6676 6677 ret = driver_create_file(&ipw2100_pci_driver.driver,
+1 -1
drivers/net/wireless/wl12xx/wl1251_cmd.c
··· 484 484 485 485 cmd->timeout = timeout; 486 486 487 - ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd)); 487 + ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, cmd, sizeof(*cmd)); 488 488 if (ret < 0) { 489 489 wl1251_error("cmd trigger scan to failed: %d", ret); 490 490 goto out;
+4 -2
drivers/platform/x86/asus_acpi.c
··· 938 938 /* SPLV laptop */ 939 939 if (hotk->methods->brightness_set) { 940 940 if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, 941 - value, NULL)) 941 + value, NULL)) { 942 942 printk(KERN_WARNING 943 943 "Asus ACPI: Error changing brightness\n"); 944 944 ret = -EIO; 945 + } 945 946 goto out; 946 947 } 947 948 ··· 954 953 hotk->methods->brightness_down, 955 954 NULL, NULL); 956 955 (value > 0) ? value-- : value++; 957 - if (ACPI_FAILURE(status)) 956 + if (ACPI_FAILURE(status)) { 958 957 printk(KERN_WARNING 959 958 "Asus ACPI: Error changing brightness\n"); 960 959 ret = -EIO; 960 + } 961 961 } 962 962 out: 963 963 return ret;
+9
drivers/platform/x86/compal-laptop.c
··· 841 841 .callback = dmi_check_cb 842 842 }, 843 843 { 844 + .ident = "Dell Mini 1012", 845 + .matches = { 846 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 847 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"), 848 + }, 849 + .callback = dmi_check_cb 850 + }, 851 + { 844 852 .ident = "Dell Inspiron 11z", 845 853 .matches = { 846 854 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ··· 1100 1092 MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron910:*"); 1101 1093 MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1010:*"); 1102 1094 MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1011:*"); 1095 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1012:*"); 1103 1096 MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1110:*"); 1104 1097 MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1210:*");
+7
drivers/platform/x86/dell-laptop.c
··· 122 122 }, 123 123 }, 124 124 { 125 + .ident = "Dell Mini 1012", 126 + .matches = { 127 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 128 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"), 129 + }, 130 + }, 131 + { 125 132 .ident = "Dell Inspiron 11z", 126 133 .matches = { 127 134 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+9 -6
drivers/platform/x86/intel_ips.c
··· 1342 1342 limits = &ips_lv_limits; 1343 1343 else if (strstr(boot_cpu_data.x86_model_id, "CPU U")) 1344 1344 limits = &ips_ulv_limits; 1345 - else 1345 + else { 1346 1346 dev_info(&ips->dev->dev, "No CPUID match found.\n"); 1347 + goto out; 1348 + } 1347 1349 1348 1350 rdmsrl(TURBO_POWER_CURRENT_LIMIT, turbo_power); 1349 1351 tdp = turbo_power & TURBO_TDP_MASK; ··· 1434 1432 1435 1433 spin_lock_init(&ips->turbo_status_lock); 1436 1434 1435 + ret = pci_enable_device(dev); 1436 + if (ret) { 1437 + dev_err(&dev->dev, "can't enable PCI device, aborting\n"); 1438 + goto error_free; 1439 + } 1440 + 1437 1441 if (!pci_resource_start(dev, 0)) { 1438 1442 dev_err(&dev->dev, "TBAR not assigned, aborting\n"); 1439 1443 ret = -ENXIO; ··· 1452 1444 goto error_free; 1453 1445 } 1454 1446 1455 - ret = pci_enable_device(dev); 1456 - if (ret) { 1457 - dev_err(&dev->dev, "can't enable PCI device, aborting\n"); 1458 - goto error_free; 1459 - } 1460 1447 1461 1448 ips->regmap = ioremap(pci_resource_start(dev, 0), 1462 1449 pci_resource_len(dev, 0));
+88 -83
drivers/platform/x86/thinkpad_acpi.c
··· 1911 1911 TP_ACPI_HOTKEYSCAN_VOLUMEDOWN, 1912 1912 TP_ACPI_HOTKEYSCAN_MUTE, 1913 1913 TP_ACPI_HOTKEYSCAN_THINKPAD, 1914 + TP_ACPI_HOTKEYSCAN_UNK1, 1915 + TP_ACPI_HOTKEYSCAN_UNK2, 1916 + TP_ACPI_HOTKEYSCAN_UNK3, 1917 + TP_ACPI_HOTKEYSCAN_UNK4, 1918 + TP_ACPI_HOTKEYSCAN_UNK5, 1919 + TP_ACPI_HOTKEYSCAN_UNK6, 1920 + TP_ACPI_HOTKEYSCAN_UNK7, 1921 + TP_ACPI_HOTKEYSCAN_UNK8, 1922 + 1923 + /* Hotkey keymap size */ 1924 + TPACPI_HOTKEY_MAP_LEN 1914 1925 }; 1915 1926 1916 1927 enum { /* Keys/events available through NVRAM polling */ ··· 3093 3082 TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ 3094 3083 }; 3095 3084 3085 + typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; 3086 + 3096 3087 static int __init hotkey_init(struct ibm_init_struct *iibm) 3097 3088 { 3098 3089 /* Requirements for changing the default keymaps: ··· 3126 3113 * If the above is too much to ask, don't change the keymap. 3127 3114 * Ask the thinkpad-acpi maintainer to do it, instead. 3128 3115 */ 3129 - static u16 ibm_keycode_map[] __initdata = { 3116 + 3117 + enum keymap_index { 3118 + TPACPI_KEYMAP_IBM_GENERIC = 0, 3119 + TPACPI_KEYMAP_LENOVO_GENERIC, 3120 + }; 3121 + 3122 + static const tpacpi_keymap_t tpacpi_keymaps[] __initconst = { 3123 + /* Generic keymap for IBM ThinkPads */ 3124 + [TPACPI_KEYMAP_IBM_GENERIC] = { 3130 3125 /* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */ 3131 - KEY_FN_F1, KEY_FN_F2, KEY_COFFEE, KEY_SLEEP, 3126 + KEY_FN_F1, KEY_BATTERY, KEY_COFFEE, KEY_SLEEP, 3132 3127 KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8, 3133 3128 KEY_FN_F9, KEY_FN_F10, KEY_FN_F11, KEY_SUSPEND, 3134 3129 ··· 3167 3146 /* (assignments unknown, please report if found) */ 3168 3147 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 3169 3148 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 3170 - }; 3171 - static u16 lenovo_keycode_map[] __initdata = { 3149 + }, 3150 + 3151 + /* Generic keymap for Lenovo ThinkPads */ 3152 + [TPACPI_KEYMAP_LENOVO_GENERIC] = { 3172 3153 /* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */ 3173 3154 KEY_FN_F1, KEY_COFFEE, KEY_BATTERY, KEY_SLEEP, 3174 - KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8, 3155 + KEY_WLAN, KEY_CAMERA, KEY_SWITCHVIDEOMODE, KEY_FN_F8, 3175 3156 KEY_FN_F9, KEY_FN_F10, KEY_FN_F11, KEY_SUSPEND, 3176 3157 3177 3158 /* Scan codes 0x0C to 0x1F: Other ACPI HKEY hot keys */ ··· 3212 3189 /* (assignments unknown, please report if found) */ 3213 3190 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 3214 3191 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 3192 + }, 3215 3193 }; 3216 3194 3217 - #define TPACPI_HOTKEY_MAP_LEN ARRAY_SIZE(ibm_keycode_map) 3218 - #define TPACPI_HOTKEY_MAP_SIZE sizeof(ibm_keycode_map) 3219 - #define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(ibm_keycode_map[0]) 3195 + static const struct tpacpi_quirk tpacpi_keymap_qtable[] __initconst = { 3196 + /* Generic maps (fallback) */ 3197 + { 3198 + .vendor = PCI_VENDOR_ID_IBM, 3199 + .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY, 3200 + .quirks = TPACPI_KEYMAP_IBM_GENERIC, 3201 + }, 3202 + { 3203 + .vendor = PCI_VENDOR_ID_LENOVO, 3204 + .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY, 3205 + .quirks = TPACPI_KEYMAP_LENOVO_GENERIC, 3206 + }, 3207 + }; 3208 + 3209 + #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) 3210 + #define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0]) 3220 3211 3221 3212 int res, i; 3222 3213 int status; ··· 3239 3202 bool tabletsw_state = false; 3240 3203 3241 3204 unsigned long quirks; 3205 + unsigned long keymap_id; 3242 3206 3243 3207 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3244 3208 "initializing hotkey subdriver\n"); ··· 3380 3342 goto err_exit; 3381 3343 3382 3344 /* Set up key map */ 3383 - 3384 3345 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 3385 3346 GFP_KERNEL); 3386 3347 if (!hotkey_keycode_map) { ··· 3389 3352 goto err_exit; 3390 3353 } 3391 3354 3392 - if (tpacpi_is_lenovo()) { 3393 - dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3394 - "using Lenovo default hot key map\n"); 3395 - memcpy(hotkey_keycode_map, &lenovo_keycode_map, 3396 - TPACPI_HOTKEY_MAP_SIZE); 3397 - } else { 3398 - dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3399 - "using IBM default hot key map\n"); 3400 - memcpy(hotkey_keycode_map, &ibm_keycode_map, 3401 - TPACPI_HOTKEY_MAP_SIZE); 3402 - } 3355 + keymap_id = tpacpi_check_quirks(tpacpi_keymap_qtable, 3356 + ARRAY_SIZE(tpacpi_keymap_qtable)); 3357 + BUG_ON(keymap_id >= ARRAY_SIZE(tpacpi_keymaps)); 3358 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3359 + "using keymap number %lu\n", keymap_id); 3360 + 3361 + memcpy(hotkey_keycode_map, &tpacpi_keymaps[keymap_id], 3362 + TPACPI_HOTKEY_MAP_SIZE); 3403 3363 3404 3364 input_set_capability(tpacpi_inputdev, EV_MSC, MSC_SCAN); 3405 3365 tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE; ··· 3503 3469 *send_acpi_ev = true; 3504 3470 *ignore_acpi_ev = false; 3505 3471 3506 - if (scancode > 0 && scancode < 0x21) { 3472 + /* HKEY event 0x1001 is scancode 0x00 */ 3473 + if (scancode > 0 && scancode <= TPACPI_HOTKEY_MAP_LEN) { 3507 3474 scancode--; 3508 3475 if (!(hotkey_source_mask & (1 << scancode))) { 3509 3476 tpacpi_input_send_key_masked(scancode); ··· 6115 6080 6116 6081 /* --------------------------------------------------------------------- */ 6117 6082 6083 + /* 6084 + * Call _BCL method of video device. On some ThinkPads this will 6085 + * switch the firmware to the ACPI brightness control mode. 6086 + */ 6087 + 6118 6088 static int __init tpacpi_query_bcl_levels(acpi_handle handle) 6119 6089 { 6120 6090 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 6121 6091 union acpi_object *obj; 6122 6092 int rc; 6123 6093 6124 - if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { 6094 + if (ACPI_SUCCESS(acpi_evaluate_object(handle, "_BCL", NULL, &buffer))) { 6125 6095 obj = (union acpi_object *)buffer.pointer; 6126 6096 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { 6127 6097 printk(TPACPI_ERR "Unknown _BCL data, " ··· 6143 6103 return rc; 6144 6104 } 6145 6105 6146 - static acpi_status __init tpacpi_acpi_walk_find_bcl(acpi_handle handle, 6147 - u32 lvl, void *context, void **rv) 6148 - { 6149 - char name[ACPI_PATH_SEGMENT_LENGTH]; 6150 - struct acpi_buffer buffer = { sizeof(name), &name }; 6151 - 6152 - if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && 6153 - !strncmp("_BCL", name, sizeof(name) - 1)) { 6154 - BUG_ON(!rv || !*rv); 6155 - **(int **)rv = tpacpi_query_bcl_levels(handle); 6156 - return AE_CTRL_TERMINATE; 6157 - } else { 6158 - return AE_OK; 6159 - } 6160 - } 6161 6106 6162 6107 /* 6163 6108 * Returns 0 (no ACPI _BCL or _BCL invalid), or size of brightness map 6164 6109 */ 6165 6110 static unsigned int __init tpacpi_check_std_acpi_brightness_support(void) 6166 6111 { 6167 - int status; 6112 + acpi_handle video_device; 6168 6113 int bcl_levels = 0; 6169 - void *bcl_ptr = &bcl_levels; 6170 6114 6171 - if (!vid_handle) 6172 - TPACPI_ACPIHANDLE_INIT(vid); 6115 + tpacpi_acpi_handle_locate("video", ACPI_VIDEO_HID, &video_device); 6116 + if (video_device) 6117 + bcl_levels = tpacpi_query_bcl_levels(video_device); 6173 6118 6174 - if (!vid_handle) 6175 - return 0; 6119 + tp_features.bright_acpimode = (bcl_levels > 0); 6176 6120 6177 - /* 6178 - * Search for a _BCL method, and execute it. This is safe on all 6179 - * ThinkPads, and as a side-effect, _BCL will place a Lenovo Vista 6180 - * BIOS in ACPI backlight control mode. We do NOT have to care 6181 - * about calling the _BCL method in an enabled video device, any 6182 - * will do for our purposes. 6183 - */ 6184 - 6185 - status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, 6186 - tpacpi_acpi_walk_find_bcl, NULL, NULL, 6187 - &bcl_ptr); 6188 - 6189 - if (ACPI_SUCCESS(status) && bcl_levels > 2) { 6190 - tp_features.bright_acpimode = 1; 6191 - return bcl_levels - 2; 6192 - } 6193 - 6194 - return 0; 6121 + return (bcl_levels > 2) ? (bcl_levels - 2) : 0; 6195 6122 } 6196 6123 6197 6124 /* ··· 6251 6244 if (tp_features.bright_unkfw) 6252 6245 return 1; 6253 6246 6254 - if (tp_features.bright_acpimode) { 6255 - if (acpi_video_backlight_support()) { 6256 - if (brightness_enable > 1) { 6257 - printk(TPACPI_NOTICE 6258 - "Standard ACPI backlight interface " 6259 - "available, not loading native one.\n"); 6260 - return 1; 6261 - } else if (brightness_enable == 1) { 6262 - printk(TPACPI_NOTICE 6263 - "Backlight control force enabled, even if standard " 6264 - "ACPI backlight interface is available\n"); 6265 - } 6266 - } else { 6267 - if (brightness_enable > 1) { 6268 - printk(TPACPI_NOTICE 6269 - "Standard ACPI backlight interface not " 6270 - "available, thinkpad_acpi native " 6271 - "brightness control enabled\n"); 6272 - } 6273 - } 6274 - } 6275 - 6276 6247 if (!brightness_enable) { 6277 6248 dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, 6278 6249 "brightness support disabled by " 6279 6250 "module parameter\n"); 6280 6251 return 1; 6252 + } 6253 + 6254 + if (acpi_video_backlight_support()) { 6255 + if (brightness_enable > 1) { 6256 + printk(TPACPI_INFO 6257 + "Standard ACPI backlight interface " 6258 + "available, not loading native one.\n"); 6259 + return 1; 6260 + } else if (brightness_enable == 1) { 6261 + printk(TPACPI_WARN 6262 + "Cannot enable backlight brightness support, " 6263 + "ACPI is already handling it. Refer to the " 6264 + "acpi_backlight kernel parameter\n"); 6265 + return 1; 6266 + } 6267 + } else if (tp_features.bright_acpimode && brightness_enable > 1) { 6268 + printk(TPACPI_NOTICE 6269 + "Standard ACPI backlight interface not " 6270 + "available, thinkpad_acpi native " 6271 + "brightness control enabled\n"); 6281 6272 } 6282 6273 6283 6274 /*
+1
drivers/scsi/arcmsr/arcmsr_hba.c
··· 56 56 #include <linux/delay.h> 57 57 #include <linux/dma-mapping.h> 58 58 #include <linux/timer.h> 59 + #include <linux/slab.h> 59 60 #include <linux/pci.h> 60 61 #include <linux/aer.h> 61 62 #include <asm/dma.h>
+1 -2
drivers/serial/of_serial.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/serial_core.h> 16 16 #include <linux/serial_8250.h> 17 + #include <linux/of_address.h> 17 18 #include <linux/of_platform.h> 18 19 #include <linux/nwpserial.h> 19 - 20 - #include <asm/prom.h> 21 20 22 21 struct of_serial_info { 23 22 int type;
+9 -6
drivers/serial/suncore.c
··· 55 55 int sunserial_console_match(struct console *con, struct device_node *dp, 56 56 struct uart_driver *drv, int line, bool ignore_line) 57 57 { 58 - if (!con || of_console_device != dp) 58 + if (!con) 59 + return 0; 60 + 61 + drv->cons = con; 62 + 63 + if (of_console_device != dp) 59 64 return 0; 60 65 61 66 if (!ignore_line) { ··· 74 69 return 0; 75 70 } 76 71 77 - con->index = line; 78 - drv->cons = con; 79 - 80 - if (!console_set_on_cmdline) 72 + if (!console_set_on_cmdline) { 73 + con->index = line; 81 74 add_preferred_console(con->name, line, NULL); 82 - 75 + } 83 76 return 1; 84 77 } 85 78 EXPORT_SYMBOL(sunserial_console_match);
+1
drivers/spi/coldfire_qspi.c
··· 24 24 #include <linux/interrupt.h> 25 25 #include <linux/errno.h> 26 26 #include <linux/platform_device.h> 27 + #include <linux/sched.h> 27 28 #include <linux/workqueue.h> 28 29 #include <linux/delay.h> 29 30 #include <linux/io.h>
+4 -4
drivers/staging/pohmelfs/path_entry.c
··· 44 44 return -ENOENT; 45 45 } 46 46 47 - read_lock(&current->fs->lock); 47 + spin_lock(&current->fs->lock); 48 48 path.mnt = mntget(current->fs->root.mnt); 49 - read_unlock(&current->fs->lock); 49 + spin_unlock(&current->fs->lock); 50 50 51 51 path.dentry = d; 52 52 ··· 91 91 return -ENOENT; 92 92 } 93 93 94 - read_lock(&current->fs->lock); 94 + spin_lock(&current->fs->lock); 95 95 root = dget(current->fs->root.dentry); 96 - read_unlock(&current->fs->lock); 96 + spin_unlock(&current->fs->lock); 97 97 98 98 spin_lock(&dcache_lock); 99 99
+8 -2
drivers/video/amba-clcd.c
··· 80 80 /* 81 81 * Disable CLCD clock source. 82 82 */ 83 - clk_disable(fb->clk); 83 + if (fb->clk_enabled) { 84 + fb->clk_enabled = false; 85 + clk_disable(fb->clk); 86 + } 84 87 } 85 88 86 89 static void clcdfb_enable(struct clcd_fb *fb, u32 cntl) ··· 91 88 /* 92 89 * Enable the CLCD clock source. 93 90 */ 94 - clk_enable(fb->clk); 91 + if (!fb->clk_enabled) { 92 + fb->clk_enabled = true; 93 + clk_enable(fb->clk); 94 + } 95 95 96 96 /* 97 97 * Bring up by first enabling..
+1 -1
fs/binfmt_misc.c
··· 108 108 Node *fmt; 109 109 struct file * interp_file = NULL; 110 110 char iname[BINPRM_BUF_SIZE]; 111 - char *iname_addr = iname; 111 + const char *iname_addr = iname; 112 112 int retval; 113 113 int fd_binary = -1; 114 114
+2 -1
fs/binfmt_script.c
··· 16 16 17 17 static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) 18 18 { 19 - char *cp, *i_name, *i_arg; 19 + const char *i_arg, *i_name; 20 + char *cp; 20 21 struct file *file; 21 22 char interp[BINPRM_BUF_SIZE]; 22 23 int retval;
+37 -32
fs/buffer.c
··· 770 770 spin_unlock(lock); 771 771 /* 772 772 * Ensure any pending I/O completes so that 773 - * ll_rw_block() actually writes the current 774 - * contents - it is a noop if I/O is still in 775 - * flight on potentially older contents. 773 + * write_dirty_buffer() actually writes the 774 + * current contents - it is a noop if I/O is 775 + * still in flight on potentially older 776 + * contents. 776 777 */ 777 - ll_rw_block(SWRITE_SYNC_PLUG, 1, &bh); 778 + write_dirty_buffer(bh, WRITE_SYNC_PLUG); 778 779 779 780 /* 780 781 * Kick off IO for the previous mapping. Note ··· 2913 2912 BUG_ON(buffer_unwritten(bh)); 2914 2913 2915 2914 /* 2916 - * Mask in barrier bit for a write (could be either a WRITE or a 2917 - * WRITE_SYNC 2918 - */ 2919 - if (buffer_ordered(bh) && (rw & WRITE)) 2920 - rw |= WRITE_BARRIER; 2921 - 2922 - /* 2923 2915 * Only clear out a write error when rewriting 2924 2916 */ 2925 2917 if (test_set_buffer_req(bh) && (rw & WRITE)) ··· 2950 2956 2951 2957 /** 2952 2958 * ll_rw_block: low-level access to block devices (DEPRECATED) 2953 - * @rw: whether to %READ or %WRITE or %SWRITE or maybe %READA (readahead) 2959 + * @rw: whether to %READ or %WRITE or maybe %READA (readahead) 2954 2960 * @nr: number of &struct buffer_heads in the array 2955 2961 * @bhs: array of pointers to &struct buffer_head 2956 2962 * 2957 2963 * ll_rw_block() takes an array of pointers to &struct buffer_heads, and 2958 2964 * requests an I/O operation on them, either a %READ or a %WRITE. The third 2959 - * %SWRITE is like %WRITE only we make sure that the *current* data in buffers 2960 - * are sent to disk. The fourth %READA option is described in the documentation 2961 - * for generic_make_request() which ll_rw_block() calls. 2965 + * %READA option is described in the documentation for generic_make_request() 2966 + * which ll_rw_block() calls. 2962 2967 * 2963 2968 * This function drops any buffer that it cannot get a lock on (with the 2964 - * BH_Lock state bit) unless SWRITE is required, any buffer that appears to be 2965 - * clean when doing a write request, and any buffer that appears to be 2966 - * up-to-date when doing read request. Further it marks as clean buffers that 2967 - * are processed for writing (the buffer cache won't assume that they are 2968 - * actually clean until the buffer gets unlocked). 2969 + * BH_Lock state bit), any buffer that appears to be clean when doing a write 2970 + * request, and any buffer that appears to be up-to-date when doing read 2971 + * request. Further it marks as clean buffers that are processed for 2972 + * writing (the buffer cache won't assume that they are actually clean 2973 + * until the buffer gets unlocked). 2969 2974 * 2970 2975 * ll_rw_block sets b_end_io to simple completion handler that marks 2971 2976 * the buffer up-to-date (if approriate), unlocks the buffer and wakes ··· 2980 2987 for (i = 0; i < nr; i++) { 2981 2988 struct buffer_head *bh = bhs[i]; 2982 2989 2983 - if (rw == SWRITE || rw == SWRITE_SYNC || rw == SWRITE_SYNC_PLUG) 2984 - lock_buffer(bh); 2985 - else if (!trylock_buffer(bh)) 2990 + if (!trylock_buffer(bh)) 2986 2991 continue; 2987 - 2988 - if (rw == WRITE || rw == SWRITE || rw == SWRITE_SYNC || 2989 - rw == SWRITE_SYNC_PLUG) { 2992 + if (rw == WRITE) { 2990 2993 if (test_clear_buffer_dirty(bh)) { 2991 2994 bh->b_end_io = end_buffer_write_sync; 2992 2995 get_bh(bh); 2993 - if (rw == SWRITE_SYNC) 2994 - submit_bh(WRITE_SYNC, bh); 2995 - else 2996 - submit_bh(WRITE, bh); 2996 + submit_bh(WRITE, bh); 2997 2997 continue; 2998 2998 } 2999 2999 } else { ··· 3002 3016 } 3003 3017 EXPORT_SYMBOL(ll_rw_block); 3004 3018 3019 + void write_dirty_buffer(struct buffer_head *bh, int rw) 3020 + { 3021 + lock_buffer(bh); 3022 + if (!test_clear_buffer_dirty(bh)) { 3023 + unlock_buffer(bh); 3024 + return; 3025 + } 3026 + bh->b_end_io = end_buffer_write_sync; 3027 + get_bh(bh); 3028 + submit_bh(rw, bh); 3029 + } 3030 + EXPORT_SYMBOL(write_dirty_buffer); 3031 + 3005 3032 /* 3006 3033 * For a data-integrity writeout, we need to wait upon any in-progress I/O 3007 3034 * and then start new I/O and then wait upon it. The caller must have a ref on 3008 3035 * the buffer_head. 3009 3036 */ 3010 - int sync_dirty_buffer(struct buffer_head *bh) 3037 + int __sync_dirty_buffer(struct buffer_head *bh, int rw) 3011 3038 { 3012 3039 int ret = 0; 3013 3040 ··· 3029 3030 if (test_clear_buffer_dirty(bh)) { 3030 3031 get_bh(bh); 3031 3032 bh->b_end_io = end_buffer_write_sync; 3032 - ret = submit_bh(WRITE_SYNC, bh); 3033 + ret = submit_bh(rw, bh); 3033 3034 wait_on_buffer(bh); 3034 3035 if (buffer_eopnotsupp(bh)) { 3035 3036 clear_buffer_eopnotsupp(bh); ··· 3041 3042 unlock_buffer(bh); 3042 3043 } 3043 3044 return ret; 3045 + } 3046 + EXPORT_SYMBOL(__sync_dirty_buffer); 3047 + 3048 + int sync_dirty_buffer(struct buffer_head *bh) 3049 + { 3050 + return __sync_dirty_buffer(bh, WRITE_SYNC); 3044 3051 } 3045 3052 EXPORT_SYMBOL(sync_dirty_buffer); 3046 3053
+1 -1
fs/cramfs/inode.c
··· 80 80 } 81 81 } else { 82 82 inode = iget_locked(sb, CRAMINO(cramfs_inode)); 83 - if (inode) { 83 + if (inode && (inode->i_state & I_NEW)) { 84 84 setup_inode(inode, cramfs_inode); 85 85 unlock_new_inode(inode); 86 86 }
+41 -30
fs/dcache.c
··· 1332 1332 * d_lookup - search for a dentry 1333 1333 * @parent: parent dentry 1334 1334 * @name: qstr of name we wish to find 1335 + * Returns: dentry, or NULL 1335 1336 * 1336 - * Searches the children of the parent dentry for the name in question. If 1337 - * the dentry is found its reference count is incremented and the dentry 1338 - * is returned. The caller must use dput to free the entry when it has 1339 - * finished using it. %NULL is returned on failure. 1340 - * 1341 - * __d_lookup is dcache_lock free. The hash list is protected using RCU. 1342 - * Memory barriers are used while updating and doing lockless traversal. 1343 - * To avoid races with d_move while rename is happening, d_lock is used. 1344 - * 1345 - * Overflows in memcmp(), while d_move, are avoided by keeping the length 1346 - * and name pointer in one structure pointed by d_qstr. 1347 - * 1348 - * rcu_read_lock() and rcu_read_unlock() are used to disable preemption while 1349 - * lookup is going on. 1350 - * 1351 - * The dentry unused LRU is not updated even if lookup finds the required dentry 1352 - * in there. It is updated in places such as prune_dcache, shrink_dcache_sb, 1353 - * select_parent and __dget_locked. This laziness saves lookup from dcache_lock 1354 - * acquisition. 1355 - * 1356 - * d_lookup() is protected against the concurrent renames in some unrelated 1357 - * directory using the seqlockt_t rename_lock. 1337 + * d_lookup searches the children of the parent dentry for the name in 1338 + * question. If the dentry is found its reference count is incremented and the 1339 + * dentry is returned. The caller must use dput to free the entry when it has 1340 + * finished using it. %NULL is returned if the dentry does not exist. 1358 1341 */ 1359 - 1360 1342 struct dentry * d_lookup(struct dentry * parent, struct qstr * name) 1361 1343 { 1362 1344 struct dentry * dentry = NULL; ··· 1354 1372 } 1355 1373 EXPORT_SYMBOL(d_lookup); 1356 1374 1375 + /* 1376 + * __d_lookup - search for a dentry (racy) 1377 + * @parent: parent dentry 1378 + * @name: qstr of name we wish to find 1379 + * Returns: dentry, or NULL 1380 + * 1381 + * __d_lookup is like d_lookup, however it may (rarely) return a 1382 + * false-negative result due to unrelated rename activity. 1383 + * 1384 + * __d_lookup is slightly faster by avoiding rename_lock read seqlock, 1385 + * however it must be used carefully, eg. with a following d_lookup in 1386 + * the case of failure. 1387 + * 1388 + * __d_lookup callers must be commented. 1389 + */ 1357 1390 struct dentry * __d_lookup(struct dentry * parent, struct qstr * name) 1358 1391 { 1359 1392 unsigned int len = name->len; ··· 1379 1382 struct hlist_node *node; 1380 1383 struct dentry *dentry; 1381 1384 1385 + /* 1386 + * The hash list is protected using RCU. 1387 + * 1388 + * Take d_lock when comparing a candidate dentry, to avoid races 1389 + * with d_move(). 1390 + * 1391 + * It is possible that concurrent renames can mess up our list 1392 + * walk here and result in missing our dentry, resulting in the 1393 + * false-negative result. d_lookup() protects against concurrent 1394 + * renames using rename_lock seqlock. 1395 + * 1396 + * See Documentation/vfs/dcache-locking.txt for more details. 1397 + */ 1382 1398 rcu_read_lock(); 1383 1399 1384 1400 hlist_for_each_entry_rcu(dentry, node, head, d_hash) { ··· 1406 1396 1407 1397 /* 1408 1398 * Recheck the dentry after taking the lock - d_move may have 1409 - * changed things. Don't bother checking the hash because we're 1410 - * about to compare the whole name anyway. 1399 + * changed things. Don't bother checking the hash because 1400 + * we're about to compare the whole name anyway. 1411 1401 */ 1412 1402 if (dentry->d_parent != parent) 1413 1403 goto next; ··· 1935 1925 bool slash = false; 1936 1926 int error = 0; 1937 1927 1938 - spin_lock(&vfsmount_lock); 1928 + br_read_lock(vfsmount_lock); 1939 1929 while (dentry != root->dentry || vfsmnt != root->mnt) { 1940 1930 struct dentry * parent; 1941 1931 ··· 1964 1954 if (!error && !slash) 1965 1955 error = prepend(buffer, buflen, "/", 1); 1966 1956 1967 - spin_unlock(&vfsmount_lock); 1957 + br_read_unlock(vfsmount_lock); 1968 1958 return error; 1969 1959 1970 1960 global_root: ··· 2302 2292 struct vfsmount *mnt = path1->mnt; 2303 2293 struct dentry *dentry = path1->dentry; 2304 2294 int res; 2305 - spin_lock(&vfsmount_lock); 2295 + 2296 + br_read_lock(vfsmount_lock); 2306 2297 if (mnt != path2->mnt) { 2307 2298 for (;;) { 2308 2299 if (mnt->mnt_parent == mnt) { 2309 - spin_unlock(&vfsmount_lock); 2300 + br_read_unlock(vfsmount_lock); 2310 2301 return 0; 2311 2302 } 2312 2303 if (mnt->mnt_parent == path2->mnt) ··· 2317 2306 dentry = mnt->mnt_mountpoint; 2318 2307 } 2319 2308 res = is_subdir(dentry, path2->dentry); 2320 - spin_unlock(&vfsmount_lock); 2309 + br_read_unlock(vfsmount_lock); 2321 2310 return res; 2322 2311 } 2323 2312 EXPORT_SYMBOL(path_is_under);
+13 -12
fs/exec.c
··· 361 361 /* 362 362 * count() counts the number of strings in array ARGV. 363 363 */ 364 - static int count(char __user * __user * argv, int max) 364 + static int count(const char __user * const __user * argv, int max) 365 365 { 366 366 int i = 0; 367 367 368 368 if (argv != NULL) { 369 369 for (;;) { 370 - char __user * p; 370 + const char __user * p; 371 371 372 372 if (get_user(p, argv)) 373 373 return -EFAULT; ··· 387 387 * processes's memory to the new process's stack. The call to get_user_pages() 388 388 * ensures the destination page is created and not swapped out. 389 389 */ 390 - static int copy_strings(int argc, char __user * __user * argv, 390 + static int copy_strings(int argc, const char __user *const __user *argv, 391 391 struct linux_binprm *bprm) 392 392 { 393 393 struct page *kmapped_page = NULL; ··· 396 396 int ret; 397 397 398 398 while (argc-- > 0) { 399 - char __user *str; 399 + const char __user *str; 400 400 int len; 401 401 unsigned long pos; 402 402 ··· 470 470 /* 471 471 * Like copy_strings, but get argv and its values from kernel memory. 472 472 */ 473 - int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm) 473 + int copy_strings_kernel(int argc, const char *const *argv, 474 + struct linux_binprm *bprm) 474 475 { 475 476 int r; 476 477 mm_segment_t oldfs = get_fs(); 477 478 set_fs(KERNEL_DS); 478 - r = copy_strings(argc, (char __user * __user *)argv, bprm); 479 + r = copy_strings(argc, (const char __user *const __user *)argv, bprm); 479 480 set_fs(oldfs); 480 481 return r; 481 482 } ··· 998 997 void setup_new_exec(struct linux_binprm * bprm) 999 998 { 1000 999 int i, ch; 1001 - char * name; 1000 + const char *name; 1002 1001 char tcomm[sizeof(current->comm)]; 1003 1002 1004 1003 arch_pick_mmap_layout(current->mm); ··· 1118 1117 bprm->unsafe = tracehook_unsafe_exec(p); 1119 1118 1120 1119 n_fs = 1; 1121 - write_lock(&p->fs->lock); 1120 + spin_lock(&p->fs->lock); 1122 1121 rcu_read_lock(); 1123 1122 for (t = next_thread(p); t != p; t = next_thread(t)) { 1124 1123 if (t->fs == p->fs) ··· 1135 1134 res = 1; 1136 1135 } 1137 1136 } 1138 - write_unlock(&p->fs->lock); 1137 + spin_unlock(&p->fs->lock); 1139 1138 1140 1139 return res; 1141 1140 } ··· 1317 1316 /* 1318 1317 * sys_execve() executes a new program. 1319 1318 */ 1320 - int do_execve(char * filename, 1321 - char __user *__user *argv, 1322 - char __user *__user *envp, 1319 + int do_execve(const char * filename, 1320 + const char __user *const __user *argv, 1321 + const char __user *const __user *envp, 1323 1322 struct pt_regs * regs) 1324 1323 { 1325 1324 struct linux_binprm *bprm;
+3 -1
fs/fat/misc.c
··· 250 250 { 251 251 int i, err = 0; 252 252 253 - ll_rw_block(SWRITE, nr_bhs, bhs); 253 + for (i = 0; i < nr_bhs; i++) 254 + write_dirty_buffer(bhs[i], WRITE); 255 + 254 256 for (i = 0; i < nr_bhs; i++) { 255 257 wait_on_buffer(bhs[i]); 256 258 if (buffer_eopnotsupp(bhs[i])) {
+95 -29
fs/file_table.c
··· 20 20 #include <linux/cdev.h> 21 21 #include <linux/fsnotify.h> 22 22 #include <linux/sysctl.h> 23 + #include <linux/lglock.h> 23 24 #include <linux/percpu_counter.h> 25 + #include <linux/percpu.h> 24 26 #include <linux/ima.h> 25 27 26 28 #include <asm/atomic.h> ··· 34 32 .max_files = NR_FILE 35 33 }; 36 34 37 - /* public. Not pretty! */ 38 - __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock); 35 + DECLARE_LGLOCK(files_lglock); 36 + DEFINE_LGLOCK(files_lglock); 39 37 40 38 /* SLAB cache for file structures */ 41 39 static struct kmem_cache *filp_cachep __read_mostly; ··· 251 249 cdev_put(inode->i_cdev); 252 250 fops_put(file->f_op); 253 251 put_pid(file->f_owner.pid); 254 - file_kill(file); 252 + file_sb_list_del(file); 255 253 if (file->f_mode & FMODE_WRITE) 256 254 drop_file_write_access(file); 257 255 file->f_path.dentry = NULL; ··· 330 328 return file; 331 329 } 332 330 333 - 334 331 void put_filp(struct file *file) 335 332 { 336 333 if (atomic_long_dec_and_test(&file->f_count)) { 337 334 security_file_free(file); 338 - file_kill(file); 335 + file_sb_list_del(file); 339 336 file_free(file); 340 337 } 341 338 } 342 339 343 - void file_move(struct file *file, struct list_head *list) 340 + static inline int file_list_cpu(struct file *file) 344 341 { 345 - if (!list) 346 - return; 347 - file_list_lock(); 348 - list_move(&file->f_u.fu_list, list); 349 - file_list_unlock(); 342 + #ifdef CONFIG_SMP 343 + return file->f_sb_list_cpu; 344 + #else 345 + return smp_processor_id(); 346 + #endif 350 347 } 351 348 352 - void file_kill(struct file *file) 349 + /* helper for file_sb_list_add to reduce ifdefs */ 350 + static inline void __file_sb_list_add(struct file *file, struct super_block *sb) 351 + { 352 + struct list_head *list; 353 + #ifdef CONFIG_SMP 354 + int cpu; 355 + cpu = smp_processor_id(); 356 + file->f_sb_list_cpu = cpu; 357 + list = per_cpu_ptr(sb->s_files, cpu); 358 + #else 359 + list = &sb->s_files; 360 + #endif 361 + list_add(&file->f_u.fu_list, list); 362 + } 363 + 364 + /** 365 + * file_sb_list_add - add a file to the sb's file list 366 + * @file: file to add 367 + * @sb: sb to add it to 368 + * 369 + * Use this function to associate a file with the superblock of the inode it 370 + * refers to. 371 + */ 372 + void file_sb_list_add(struct file *file, struct super_block *sb) 373 + { 374 + lg_local_lock(files_lglock); 375 + __file_sb_list_add(file, sb); 376 + lg_local_unlock(files_lglock); 377 + } 378 + 379 + /** 380 + * file_sb_list_del - remove a file from the sb's file list 381 + * @file: file to remove 382 + * @sb: sb to remove it from 383 + * 384 + * Use this function to remove a file from its superblock. 385 + */ 386 + void file_sb_list_del(struct file *file) 353 387 { 354 388 if (!list_empty(&file->f_u.fu_list)) { 355 - file_list_lock(); 389 + lg_local_lock_cpu(files_lglock, file_list_cpu(file)); 356 390 list_del_init(&file->f_u.fu_list); 357 - file_list_unlock(); 391 + lg_local_unlock_cpu(files_lglock, file_list_cpu(file)); 358 392 } 359 393 } 394 + 395 + #ifdef CONFIG_SMP 396 + 397 + /* 398 + * These macros iterate all files on all CPUs for a given superblock. 399 + * files_lglock must be held globally. 400 + */ 401 + #define do_file_list_for_each_entry(__sb, __file) \ 402 + { \ 403 + int i; \ 404 + for_each_possible_cpu(i) { \ 405 + struct list_head *list; \ 406 + list = per_cpu_ptr((__sb)->s_files, i); \ 407 + list_for_each_entry((__file), list, f_u.fu_list) 408 + 409 + #define while_file_list_for_each_entry \ 410 + } \ 411 + } 412 + 413 + #else 414 + 415 + #define do_file_list_for_each_entry(__sb, __file) \ 416 + { \ 417 + struct list_head *list; \ 418 + list = &(sb)->s_files; \ 419 + list_for_each_entry((__file), list, f_u.fu_list) 420 + 421 + #define while_file_list_for_each_entry \ 422 + } 423 + 424 + #endif 360 425 361 426 int fs_may_remount_ro(struct super_block *sb) 362 427 { 363 428 struct file *file; 364 - 365 429 /* Check that no files are currently opened for writing. */ 366 - file_list_lock(); 367 - list_for_each_entry(file, &sb->s_files, f_u.fu_list) { 430 + lg_global_lock(files_lglock); 431 + do_file_list_for_each_entry(sb, file) { 368 432 struct inode *inode = file->f_path.dentry->d_inode; 369 433 370 434 /* File with pending delete? */ ··· 440 372 /* Writeable file? */ 441 373 if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE)) 442 374 goto too_bad; 443 - } 444 - file_list_unlock(); 375 + } while_file_list_for_each_entry; 376 + lg_global_unlock(files_lglock); 445 377 return 1; /* Tis' cool bro. */ 446 378 too_bad: 447 - file_list_unlock(); 379 + lg_global_unlock(files_lglock); 448 380 return 0; 449 381 } 450 382 ··· 460 392 struct file *f; 461 393 462 394 retry: 463 - file_list_lock(); 464 - list_for_each_entry(f, &sb->s_files, f_u.fu_list) { 395 + lg_global_lock(files_lglock); 396 + do_file_list_for_each_entry(sb, f) { 465 397 struct vfsmount *mnt; 466 398 if (!S_ISREG(f->f_path.dentry->d_inode->i_mode)) 467 399 continue; ··· 476 408 continue; 477 409 file_release_write(f); 478 410 mnt = mntget(f->f_path.mnt); 479 - file_list_unlock(); 480 - /* 481 - * This can sleep, so we can't hold 482 - * the file_list_lock() spinlock. 483 - */ 411 + /* This can sleep, so we can't hold the spinlock. */ 412 + lg_global_unlock(files_lglock); 484 413 mnt_drop_write(mnt); 485 414 mntput(mnt); 486 415 goto retry; 487 - } 488 - file_list_unlock(); 416 + } while_file_list_for_each_entry; 417 + lg_global_unlock(files_lglock); 489 418 } 490 419 491 420 void __init files_init(unsigned long mempages) ··· 502 437 if (files_stat.max_files < NR_FILE) 503 438 files_stat.max_files = NR_FILE; 504 439 files_defer_init(); 440 + lg_lock_init(files_lglock); 505 441 percpu_counter_init(&nr_files, 0); 506 442 }
+16 -16
fs/fs_struct.c
··· 13 13 { 14 14 struct path old_root; 15 15 16 - write_lock(&fs->lock); 16 + spin_lock(&fs->lock); 17 17 old_root = fs->root; 18 18 fs->root = *path; 19 19 path_get(path); 20 - write_unlock(&fs->lock); 20 + spin_unlock(&fs->lock); 21 21 if (old_root.dentry) 22 22 path_put(&old_root); 23 23 } ··· 30 30 { 31 31 struct path old_pwd; 32 32 33 - write_lock(&fs->lock); 33 + spin_lock(&fs->lock); 34 34 old_pwd = fs->pwd; 35 35 fs->pwd = *path; 36 36 path_get(path); 37 - write_unlock(&fs->lock); 37 + spin_unlock(&fs->lock); 38 38 39 39 if (old_pwd.dentry) 40 40 path_put(&old_pwd); ··· 51 51 task_lock(p); 52 52 fs = p->fs; 53 53 if (fs) { 54 - write_lock(&fs->lock); 54 + spin_lock(&fs->lock); 55 55 if (fs->root.dentry == old_root->dentry 56 56 && fs->root.mnt == old_root->mnt) { 57 57 path_get(new_root); ··· 64 64 fs->pwd = *new_root; 65 65 count++; 66 66 } 67 - write_unlock(&fs->lock); 67 + spin_unlock(&fs->lock); 68 68 } 69 69 task_unlock(p); 70 70 } while_each_thread(g, p); ··· 87 87 if (fs) { 88 88 int kill; 89 89 task_lock(tsk); 90 - write_lock(&fs->lock); 90 + spin_lock(&fs->lock); 91 91 tsk->fs = NULL; 92 92 kill = !--fs->users; 93 - write_unlock(&fs->lock); 93 + spin_unlock(&fs->lock); 94 94 task_unlock(tsk); 95 95 if (kill) 96 96 free_fs_struct(fs); ··· 104 104 if (fs) { 105 105 fs->users = 1; 106 106 fs->in_exec = 0; 107 - rwlock_init(&fs->lock); 107 + spin_lock_init(&fs->lock); 108 108 fs->umask = old->umask; 109 109 get_fs_root_and_pwd(old, &fs->root, &fs->pwd); 110 110 } ··· 121 121 return -ENOMEM; 122 122 123 123 task_lock(current); 124 - write_lock(&fs->lock); 124 + spin_lock(&fs->lock); 125 125 kill = !--fs->users; 126 126 current->fs = new_fs; 127 - write_unlock(&fs->lock); 127 + spin_unlock(&fs->lock); 128 128 task_unlock(current); 129 129 130 130 if (kill) ··· 143 143 /* to be mentioned only in INIT_TASK */ 144 144 struct fs_struct init_fs = { 145 145 .users = 1, 146 - .lock = __RW_LOCK_UNLOCKED(init_fs.lock), 146 + .lock = __SPIN_LOCK_UNLOCKED(init_fs.lock), 147 147 .umask = 0022, 148 148 }; 149 149 ··· 156 156 157 157 task_lock(current); 158 158 159 - write_lock(&init_fs.lock); 159 + spin_lock(&init_fs.lock); 160 160 init_fs.users++; 161 - write_unlock(&init_fs.lock); 161 + spin_unlock(&init_fs.lock); 162 162 163 - write_lock(&fs->lock); 163 + spin_lock(&fs->lock); 164 164 current->fs = &init_fs; 165 165 kill = !--fs->users; 166 - write_unlock(&fs->lock); 166 + spin_unlock(&fs->lock); 167 167 168 168 task_unlock(current); 169 169 if (kill)
+1
fs/generic_acl.c
··· 94 94 if (error < 0) 95 95 goto failed; 96 96 inode->i_mode = mode; 97 + inode->i_ctime = CURRENT_TIME; 97 98 if (error == 0) { 98 99 posix_acl_release(acl); 99 100 acl = NULL;
+2 -2
fs/hostfs/hostfs_kern.c
··· 104 104 __putname(name); 105 105 return NULL; 106 106 } 107 - strncpy(name, root, PATH_MAX); 107 + strlcpy(name, root, PATH_MAX); 108 108 if (len > p - name) { 109 109 __putname(name); 110 110 return NULL; ··· 876 876 char *path = dentry_name(dentry); 877 877 int err = -ENOMEM; 878 878 if (path) { 879 - int err = hostfs_do_readlink(path, link, PATH_MAX); 879 + err = hostfs_do_readlink(path, link, PATH_MAX); 880 880 if (err == PATH_MAX) 881 881 err = -E2BIG; 882 882 __putname(path);
+6 -1
fs/internal.h
··· 9 9 * 2 of the License, or (at your option) any later version. 10 10 */ 11 11 12 + #include <linux/lglock.h> 13 + 12 14 struct super_block; 13 15 struct linux_binprm; 14 16 struct path; ··· 72 70 73 71 extern void __init mnt_init(void); 74 72 75 - extern spinlock_t vfsmount_lock; 73 + DECLARE_BRLOCK(vfsmount_lock); 74 + 76 75 77 76 /* 78 77 * fs_struct.c ··· 83 80 /* 84 81 * file_table.c 85 82 */ 83 + extern void file_sb_list_add(struct file *f, struct super_block *sb); 84 + extern void file_sb_list_del(struct file *f); 86 85 extern void mark_files_ro(struct super_block *); 87 86 extern struct file *get_empty_filp(void); 88 87
+3 -1
fs/jbd/checkpoint.c
··· 254 254 { 255 255 int i; 256 256 257 - ll_rw_block(SWRITE, *batch_count, bhs); 257 + for (i = 0; i < *batch_count; i++) 258 + write_dirty_buffer(bhs[i], WRITE); 259 + 258 260 for (i = 0; i < *batch_count; i++) { 259 261 struct buffer_head *bh = bhs[i]; 260 262 clear_buffer_jwrite(bh);
+25 -24
fs/jbd/commit.c
··· 119 119 struct buffer_head *bh; 120 120 journal_header_t *header; 121 121 int ret; 122 - int barrier_done = 0; 123 122 124 123 if (is_journal_aborted(journal)) 125 124 return 0; ··· 136 137 137 138 JBUFFER_TRACE(descriptor, "write commit block"); 138 139 set_buffer_dirty(bh); 140 + 139 141 if (journal->j_flags & JFS_BARRIER) { 140 - set_buffer_ordered(bh); 141 - barrier_done = 1; 142 - } 143 - ret = sync_dirty_buffer(bh); 144 - if (barrier_done) 145 - clear_buffer_ordered(bh); 146 - /* is it possible for another commit to fail at roughly 147 - * the same time as this one? If so, we don't want to 148 - * trust the barrier flag in the super, but instead want 149 - * to remember if we sent a barrier request 150 - */ 151 - if (ret == -EOPNOTSUPP && barrier_done) { 152 - char b[BDEVNAME_SIZE]; 142 + ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER); 153 143 154 - printk(KERN_WARNING 155 - "JBD: barrier-based sync failed on %s - " 156 - "disabling barriers\n", 157 - bdevname(journal->j_dev, b)); 158 - spin_lock(&journal->j_state_lock); 159 - journal->j_flags &= ~JFS_BARRIER; 160 - spin_unlock(&journal->j_state_lock); 144 + /* 145 + * Is it possible for another commit to fail at roughly 146 + * the same time as this one? If so, we don't want to 147 + * trust the barrier flag in the super, but instead want 148 + * to remember if we sent a barrier request 149 + */ 150 + if (ret == -EOPNOTSUPP) { 151 + char b[BDEVNAME_SIZE]; 161 152 162 - /* And try again, without the barrier */ 163 - set_buffer_uptodate(bh); 164 - set_buffer_dirty(bh); 153 + printk(KERN_WARNING 154 + "JBD: barrier-based sync failed on %s - " 155 + "disabling barriers\n", 156 + bdevname(journal->j_dev, b)); 157 + spin_lock(&journal->j_state_lock); 158 + journal->j_flags &= ~JFS_BARRIER; 159 + spin_unlock(&journal->j_state_lock); 160 + 161 + /* And try again, without the barrier */ 162 + set_buffer_uptodate(bh); 163 + set_buffer_dirty(bh); 164 + ret = sync_dirty_buffer(bh); 165 + } 166 + } else { 165 167 ret = sync_dirty_buffer(bh); 166 168 } 169 + 167 170 put_bh(bh); /* One for getblk() */ 168 171 journal_put_journal_head(descriptor); 169 172
+1 -1
fs/jbd/journal.c
··· 1024 1024 if (wait) 1025 1025 sync_dirty_buffer(bh); 1026 1026 else 1027 - ll_rw_block(SWRITE, 1, &bh); 1027 + write_dirty_buffer(bh, WRITE); 1028 1028 1029 1029 out: 1030 1030 /* If we have just flushed the log (by marking s_start==0), then
+1 -1
fs/jbd/revoke.c
··· 617 617 set_buffer_jwrite(bh); 618 618 BUFFER_TRACE(bh, "write"); 619 619 set_buffer_dirty(bh); 620 - ll_rw_block((write_op == WRITE) ? SWRITE : SWRITE_SYNC_PLUG, 1, &bh); 620 + write_dirty_buffer(bh, write_op); 621 621 } 622 622 #endif 623 623
+3 -1
fs/jbd2/checkpoint.c
··· 255 255 { 256 256 int i; 257 257 258 - ll_rw_block(SWRITE, *batch_count, journal->j_chkpt_bhs); 258 + for (i = 0; i < *batch_count; i++) 259 + write_dirty_buffer(journal->j_chkpt_bhs[i], WRITE); 260 + 259 261 for (i = 0; i < *batch_count; i++) { 260 262 struct buffer_head *bh = journal->j_chkpt_bhs[i]; 261 263 clear_buffer_jwrite(bh);
+15 -24
fs/jbd2/commit.c
··· 101 101 struct commit_header *tmp; 102 102 struct buffer_head *bh; 103 103 int ret; 104 - int barrier_done = 0; 105 104 struct timespec now = current_kernel_time(); 106 105 107 106 if (is_journal_aborted(journal)) ··· 135 136 if (journal->j_flags & JBD2_BARRIER && 136 137 !JBD2_HAS_INCOMPAT_FEATURE(journal, 137 138 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { 138 - set_buffer_ordered(bh); 139 - barrier_done = 1; 140 - } 141 - ret = submit_bh(WRITE_SYNC_PLUG, bh); 142 - if (barrier_done) 143 - clear_buffer_ordered(bh); 139 + ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh); 140 + if (ret == -EOPNOTSUPP) { 141 + printk(KERN_WARNING 142 + "JBD2: Disabling barriers on %s, " 143 + "not supported by device\n", journal->j_devname); 144 + write_lock(&journal->j_state_lock); 145 + journal->j_flags &= ~JBD2_BARRIER; 146 + write_unlock(&journal->j_state_lock); 144 147 145 - /* is it possible for another commit to fail at roughly 146 - * the same time as this one? If so, we don't want to 147 - * trust the barrier flag in the super, but instead want 148 - * to remember if we sent a barrier request 149 - */ 150 - if (ret == -EOPNOTSUPP && barrier_done) { 151 - printk(KERN_WARNING 152 - "JBD2: Disabling barriers on %s, " 153 - "not supported by device\n", journal->j_devname); 154 - write_lock(&journal->j_state_lock); 155 - journal->j_flags &= ~JBD2_BARRIER; 156 - write_unlock(&journal->j_state_lock); 157 - 158 - /* And try again, without the barrier */ 159 - lock_buffer(bh); 160 - set_buffer_uptodate(bh); 161 - clear_buffer_dirty(bh); 148 + /* And try again, without the barrier */ 149 + lock_buffer(bh); 150 + set_buffer_uptodate(bh); 151 + clear_buffer_dirty(bh); 152 + ret = submit_bh(WRITE_SYNC_PLUG, bh); 153 + } 154 + } else { 162 155 ret = submit_bh(WRITE_SYNC_PLUG, bh); 163 156 } 164 157 *cbh = bh;
+1 -1
fs/jbd2/journal.c
··· 1124 1124 set_buffer_uptodate(bh); 1125 1125 } 1126 1126 } else 1127 - ll_rw_block(SWRITE, 1, &bh); 1127 + write_dirty_buffer(bh, WRITE); 1128 1128 1129 1129 out: 1130 1130 /* If we have just flushed the log (by marking s_start==0), then
+1 -1
fs/jbd2/revoke.c
··· 625 625 set_buffer_jwrite(bh); 626 626 BUFFER_TRACE(bh, "write"); 627 627 set_buffer_dirty(bh); 628 - ll_rw_block((write_op == WRITE) ? SWRITE : SWRITE_SYNC_PLUG, 1, &bh); 628 + write_dirty_buffer(bh, write_op); 629 629 } 630 630 #endif 631 631
+23 -5
fs/mbcache.c
··· 80 80 struct list_head c_cache_list; 81 81 const char *c_name; 82 82 atomic_t c_entry_count; 83 + int c_max_entries; 83 84 int c_bucket_bits; 84 85 struct kmem_cache *c_entry_cache; 85 86 struct list_head *c_block_hash; ··· 244 243 if (!cache->c_entry_cache) 245 244 goto fail2; 246 245 246 + /* 247 + * Set an upper limit on the number of cache entries so that the hash 248 + * chains won't grow too long. 249 + */ 250 + cache->c_max_entries = bucket_count << 4; 251 + 247 252 spin_lock(&mb_cache_spinlock); 248 253 list_add(&cache->c_cache_list, &mb_cache_list); 249 254 spin_unlock(&mb_cache_spinlock); ··· 340 333 kfree(cache); 341 334 } 342 335 343 - 344 336 /* 345 337 * mb_cache_entry_alloc() 346 338 * ··· 351 345 struct mb_cache_entry * 352 346 mb_cache_entry_alloc(struct mb_cache *cache, gfp_t gfp_flags) 353 347 { 354 - struct mb_cache_entry *ce; 348 + struct mb_cache_entry *ce = NULL; 355 349 356 - ce = kmem_cache_alloc(cache->c_entry_cache, gfp_flags); 357 - if (ce) { 350 + if (atomic_read(&cache->c_entry_count) >= cache->c_max_entries) { 351 + spin_lock(&mb_cache_spinlock); 352 + if (!list_empty(&mb_cache_lru_list)) { 353 + ce = list_entry(mb_cache_lru_list.next, 354 + struct mb_cache_entry, e_lru_list); 355 + list_del_init(&ce->e_lru_list); 356 + __mb_cache_entry_unhash(ce); 357 + } 358 + spin_unlock(&mb_cache_spinlock); 359 + } 360 + if (!ce) { 361 + ce = kmem_cache_alloc(cache->c_entry_cache, gfp_flags); 362 + if (!ce) 363 + return NULL; 358 364 atomic_inc(&cache->c_entry_count); 359 365 INIT_LIST_HEAD(&ce->e_lru_list); 360 366 INIT_LIST_HEAD(&ce->e_block_list); 361 367 ce->e_cache = cache; 362 - ce->e_used = 1 + MB_CACHE_WRITER; 363 368 ce->e_queued = 0; 364 369 } 370 + ce->e_used = 1 + MB_CACHE_WRITER; 365 371 return ce; 366 372 } 367 373
+55 -64
fs/namei.c
··· 595 595 { 596 596 struct vfsmount *parent; 597 597 struct dentry *mountpoint; 598 - spin_lock(&vfsmount_lock); 598 + 599 + br_read_lock(vfsmount_lock); 599 600 parent = path->mnt->mnt_parent; 600 601 if (parent == path->mnt) { 601 - spin_unlock(&vfsmount_lock); 602 + br_read_unlock(vfsmount_lock); 602 603 return 0; 603 604 } 604 605 mntget(parent); 605 606 mountpoint = dget(path->mnt->mnt_mountpoint); 606 - spin_unlock(&vfsmount_lock); 607 + br_read_unlock(vfsmount_lock); 607 608 dput(path->dentry); 608 609 path->dentry = mountpoint; 609 610 mntput(path->mnt); ··· 687 686 } 688 687 689 688 /* 689 + * Allocate a dentry with name and parent, and perform a parent 690 + * directory ->lookup on it. Returns the new dentry, or ERR_PTR 691 + * on error. parent->d_inode->i_mutex must be held. d_lookup must 692 + * have verified that no child exists while under i_mutex. 693 + */ 694 + static struct dentry *d_alloc_and_lookup(struct dentry *parent, 695 + struct qstr *name, struct nameidata *nd) 696 + { 697 + struct inode *inode = parent->d_inode; 698 + struct dentry *dentry; 699 + struct dentry *old; 700 + 701 + /* Don't create child dentry for a dead directory. */ 702 + if (unlikely(IS_DEADDIR(inode))) 703 + return ERR_PTR(-ENOENT); 704 + 705 + dentry = d_alloc(parent, name); 706 + if (unlikely(!dentry)) 707 + return ERR_PTR(-ENOMEM); 708 + 709 + old = inode->i_op->lookup(inode, dentry, nd); 710 + if (unlikely(old)) { 711 + dput(dentry); 712 + dentry = old; 713 + } 714 + return dentry; 715 + } 716 + 717 + /* 690 718 * It's more convoluted than I'd like it to be, but... it's still fairly 691 719 * small and for now I'd prefer to have fast path as straight as possible. 692 720 * It _is_ time-critical. ··· 736 706 return err; 737 707 } 738 708 709 + /* 710 + * Rename seqlock is not required here because in the off chance 711 + * of a false negative due to a concurrent rename, we're going to 712 + * do the non-racy lookup, below. 713 + */ 739 714 dentry = __d_lookup(nd->path.dentry, name); 740 715 if (!dentry) 741 716 goto need_lookup; 717 + found: 742 718 if (dentry->d_op && dentry->d_op->d_revalidate) 743 719 goto need_revalidate; 744 720 done: ··· 760 724 mutex_lock(&dir->i_mutex); 761 725 /* 762 726 * First re-do the cached lookup just in case it was created 763 - * while we waited for the directory semaphore.. 727 + * while we waited for the directory semaphore, or the first 728 + * lookup failed due to an unrelated rename. 764 729 * 765 - * FIXME! This could use version numbering or similar to 766 - * avoid unnecessary cache lookups. 767 - * 768 - * The "dcache_lock" is purely to protect the RCU list walker 769 - * from concurrent renames at this point (we mustn't get false 770 - * negatives from the RCU list walk here, unlike the optimistic 771 - * fast walk). 772 - * 773 - * so doing d_lookup() (with seqlock), instead of lockfree __d_lookup 730 + * This could use version numbering or similar to avoid unnecessary 731 + * cache lookups, but then we'd have to do the first lookup in the 732 + * non-racy way. However in the common case here, everything should 733 + * be hot in cache, so would it be a big win? 774 734 */ 775 735 dentry = d_lookup(parent, name); 776 - if (!dentry) { 777 - struct dentry *new; 778 - 779 - /* Don't create child dentry for a dead directory. */ 780 - dentry = ERR_PTR(-ENOENT); 781 - if (IS_DEADDIR(dir)) 782 - goto out_unlock; 783 - 784 - new = d_alloc(parent, name); 785 - dentry = ERR_PTR(-ENOMEM); 786 - if (new) { 787 - dentry = dir->i_op->lookup(dir, new, nd); 788 - if (dentry) 789 - dput(new); 790 - else 791 - dentry = new; 792 - } 793 - out_unlock: 736 + if (likely(!dentry)) { 737 + dentry = d_alloc_and_lookup(parent, name, nd); 794 738 mutex_unlock(&dir->i_mutex); 795 739 if (IS_ERR(dentry)) 796 740 goto fail; 797 741 goto done; 798 742 } 799 - 800 743 /* 801 744 * Uhhuh! Nasty case: the cache was re-populated while 802 745 * we waited on the semaphore. Need to revalidate. 803 746 */ 804 747 mutex_unlock(&dir->i_mutex); 805 - if (dentry->d_op && dentry->d_op->d_revalidate) { 806 - dentry = do_revalidate(dentry, nd); 807 - if (!dentry) 808 - dentry = ERR_PTR(-ENOENT); 809 - } 810 - if (IS_ERR(dentry)) 811 - goto fail; 812 - goto done; 748 + goto found; 813 749 814 750 need_revalidate: 815 751 dentry = do_revalidate(dentry, nd); ··· 1138 1130 goto out; 1139 1131 } 1140 1132 1141 - dentry = __d_lookup(base, name); 1142 - 1143 - /* lockess __d_lookup may fail due to concurrent d_move() 1144 - * in some unrelated directory, so try with d_lookup 1133 + /* 1134 + * Don't bother with __d_lookup: callers are for creat as 1135 + * well as unlink, so a lot of the time it would cost 1136 + * a double lookup. 1145 1137 */ 1146 - if (!dentry) 1147 - dentry = d_lookup(base, name); 1138 + dentry = d_lookup(base, name); 1148 1139 1149 1140 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) 1150 1141 dentry = do_revalidate(dentry, nd); 1151 1142 1152 - if (!dentry) { 1153 - struct dentry *new; 1154 - 1155 - /* Don't create child dentry for a dead directory. */ 1156 - dentry = ERR_PTR(-ENOENT); 1157 - if (IS_DEADDIR(inode)) 1158 - goto out; 1159 - 1160 - new = d_alloc(base, name); 1161 - dentry = ERR_PTR(-ENOMEM); 1162 - if (!new) 1163 - goto out; 1164 - dentry = inode->i_op->lookup(inode, new, nd); 1165 - if (!dentry) 1166 - dentry = new; 1167 - else 1168 - dput(new); 1169 - } 1143 + if (!dentry) 1144 + dentry = d_alloc_and_lookup(base, name, nd); 1170 1145 out: 1171 1146 return dentry; 1172 1147 }
+111 -66
fs/namespace.c
··· 11 11 #include <linux/syscalls.h> 12 12 #include <linux/slab.h> 13 13 #include <linux/sched.h> 14 + #include <linux/spinlock.h> 15 + #include <linux/percpu.h> 14 16 #include <linux/smp_lock.h> 15 17 #include <linux/init.h> 16 18 #include <linux/kernel.h> ··· 40 38 #define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head)) 41 39 #define HASH_SIZE (1UL << HASH_SHIFT) 42 40 43 - /* spinlock for vfsmount related operations, inplace of dcache_lock */ 44 - __cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock); 45 - 46 41 static int event; 47 42 static DEFINE_IDA(mnt_id_ida); 48 43 static DEFINE_IDA(mnt_group_ida); 44 + static DEFINE_SPINLOCK(mnt_id_lock); 49 45 static int mnt_id_start = 0; 50 46 static int mnt_group_start = 1; 51 47 ··· 55 55 struct kobject *fs_kobj; 56 56 EXPORT_SYMBOL_GPL(fs_kobj); 57 57 58 + /* 59 + * vfsmount lock may be taken for read to prevent changes to the 60 + * vfsmount hash, ie. during mountpoint lookups or walking back 61 + * up the tree. 62 + * 63 + * It should be taken for write in all cases where the vfsmount 64 + * tree or hash is modified or when a vfsmount structure is modified. 65 + */ 66 + DEFINE_BRLOCK(vfsmount_lock); 67 + 58 68 static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry) 59 69 { 60 70 unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES); ··· 75 65 76 66 #define MNT_WRITER_UNDERFLOW_LIMIT -(1<<16) 77 67 78 - /* allocation is serialized by namespace_sem */ 68 + /* 69 + * allocation is serialized by namespace_sem, but we need the spinlock to 70 + * serialize with freeing. 71 + */ 79 72 static int mnt_alloc_id(struct vfsmount *mnt) 80 73 { 81 74 int res; 82 75 83 76 retry: 84 77 ida_pre_get(&mnt_id_ida, GFP_KERNEL); 85 - spin_lock(&vfsmount_lock); 78 + spin_lock(&mnt_id_lock); 86 79 res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt_id); 87 80 if (!res) 88 81 mnt_id_start = mnt->mnt_id + 1; 89 - spin_unlock(&vfsmount_lock); 82 + spin_unlock(&mnt_id_lock); 90 83 if (res == -EAGAIN) 91 84 goto retry; 92 85 ··· 99 86 static void mnt_free_id(struct vfsmount *mnt) 100 87 { 101 88 int id = mnt->mnt_id; 102 - spin_lock(&vfsmount_lock); 89 + spin_lock(&mnt_id_lock); 103 90 ida_remove(&mnt_id_ida, id); 104 91 if (mnt_id_start > id) 105 92 mnt_id_start = id; 106 - spin_unlock(&vfsmount_lock); 93 + spin_unlock(&mnt_id_lock); 107 94 } 108 95 109 96 /* ··· 361 348 { 362 349 int ret = 0; 363 350 364 - spin_lock(&vfsmount_lock); 351 + br_write_lock(vfsmount_lock); 365 352 mnt->mnt_flags |= MNT_WRITE_HOLD; 366 353 /* 367 354 * After storing MNT_WRITE_HOLD, we'll read the counters. This store ··· 395 382 */ 396 383 smp_wmb(); 397 384 mnt->mnt_flags &= ~MNT_WRITE_HOLD; 398 - spin_unlock(&vfsmount_lock); 385 + br_write_unlock(vfsmount_lock); 399 386 return ret; 400 387 } 401 388 402 389 static void __mnt_unmake_readonly(struct vfsmount *mnt) 403 390 { 404 - spin_lock(&vfsmount_lock); 391 + br_write_lock(vfsmount_lock); 405 392 mnt->mnt_flags &= ~MNT_READONLY; 406 - spin_unlock(&vfsmount_lock); 393 + br_write_unlock(vfsmount_lock); 407 394 } 408 395 409 396 void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) ··· 427 414 /* 428 415 * find the first or last mount at @dentry on vfsmount @mnt depending on 429 416 * @dir. If @dir is set return the first mount else return the last mount. 417 + * vfsmount_lock must be held for read or write. 430 418 */ 431 419 struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, 432 420 int dir) ··· 457 443 struct vfsmount *lookup_mnt(struct path *path) 458 444 { 459 445 struct vfsmount *child_mnt; 460 - spin_lock(&vfsmount_lock); 446 + 447 + br_read_lock(vfsmount_lock); 461 448 if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1))) 462 449 mntget(child_mnt); 463 - spin_unlock(&vfsmount_lock); 450 + br_read_unlock(vfsmount_lock); 464 451 return child_mnt; 465 452 } 466 453 ··· 470 455 return mnt->mnt_ns == current->nsproxy->mnt_ns; 471 456 } 472 457 458 + /* 459 + * vfsmount lock must be held for write 460 + */ 473 461 static void touch_mnt_namespace(struct mnt_namespace *ns) 474 462 { 475 463 if (ns) { ··· 481 463 } 482 464 } 483 465 466 + /* 467 + * vfsmount lock must be held for write 468 + */ 484 469 static void __touch_mnt_namespace(struct mnt_namespace *ns) 485 470 { 486 471 if (ns && ns->event != event) { ··· 492 471 } 493 472 } 494 473 474 + /* 475 + * vfsmount lock must be held for write 476 + */ 495 477 static void detach_mnt(struct vfsmount *mnt, struct path *old_path) 496 478 { 497 479 old_path->dentry = mnt->mnt_mountpoint; ··· 506 482 old_path->dentry->d_mounted--; 507 483 } 508 484 485 + /* 486 + * vfsmount lock must be held for write 487 + */ 509 488 void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, 510 489 struct vfsmount *child_mnt) 511 490 { ··· 517 490 dentry->d_mounted++; 518 491 } 519 492 493 + /* 494 + * vfsmount lock must be held for write 495 + */ 520 496 static void attach_mnt(struct vfsmount *mnt, struct path *path) 521 497 { 522 498 mnt_set_mountpoint(path->mnt, path->dentry, mnt); ··· 529 499 } 530 500 531 501 /* 532 - * the caller must hold vfsmount_lock 502 + * vfsmount lock must be held for write 533 503 */ 534 504 static void commit_tree(struct vfsmount *mnt) 535 505 { ··· 653 623 void mntput_no_expire(struct vfsmount *mnt) 654 624 { 655 625 repeat: 656 - if (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) { 657 - if (likely(!mnt->mnt_pinned)) { 658 - spin_unlock(&vfsmount_lock); 659 - __mntput(mnt); 660 - return; 661 - } 662 - atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count); 663 - mnt->mnt_pinned = 0; 664 - spin_unlock(&vfsmount_lock); 665 - acct_auto_close_mnt(mnt); 666 - goto repeat; 626 + if (atomic_add_unless(&mnt->mnt_count, -1, 1)) 627 + return; 628 + br_write_lock(vfsmount_lock); 629 + if (!atomic_dec_and_test(&mnt->mnt_count)) { 630 + br_write_unlock(vfsmount_lock); 631 + return; 667 632 } 633 + if (likely(!mnt->mnt_pinned)) { 634 + br_write_unlock(vfsmount_lock); 635 + __mntput(mnt); 636 + return; 637 + } 638 + atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count); 639 + mnt->mnt_pinned = 0; 640 + br_write_unlock(vfsmount_lock); 641 + acct_auto_close_mnt(mnt); 642 + goto repeat; 668 643 } 669 - 670 644 EXPORT_SYMBOL(mntput_no_expire); 671 645 672 646 void mnt_pin(struct vfsmount *mnt) 673 647 { 674 - spin_lock(&vfsmount_lock); 648 + br_write_lock(vfsmount_lock); 675 649 mnt->mnt_pinned++; 676 - spin_unlock(&vfsmount_lock); 650 + br_write_unlock(vfsmount_lock); 677 651 } 678 652 679 653 EXPORT_SYMBOL(mnt_pin); 680 654 681 655 void mnt_unpin(struct vfsmount *mnt) 682 656 { 683 - spin_lock(&vfsmount_lock); 657 + br_write_lock(vfsmount_lock); 684 658 if (mnt->mnt_pinned) { 685 659 atomic_inc(&mnt->mnt_count); 686 660 mnt->mnt_pinned--; 687 661 } 688 - spin_unlock(&vfsmount_lock); 662 + br_write_unlock(vfsmount_lock); 689 663 } 690 664 691 665 EXPORT_SYMBOL(mnt_unpin); ··· 780 746 struct mnt_namespace *ns = p->ns; 781 747 int res = 0; 782 748 783 - spin_lock(&vfsmount_lock); 749 + br_read_lock(vfsmount_lock); 784 750 if (p->event != ns->event) { 785 751 p->event = ns->event; 786 752 res = 1; 787 753 } 788 - spin_unlock(&vfsmount_lock); 754 + br_read_unlock(vfsmount_lock); 789 755 790 756 return res; 791 757 } ··· 986 952 int minimum_refs = 0; 987 953 struct vfsmount *p; 988 954 989 - spin_lock(&vfsmount_lock); 955 + br_read_lock(vfsmount_lock); 990 956 for (p = mnt; p; p = next_mnt(p, mnt)) { 991 957 actual_refs += atomic_read(&p->mnt_count); 992 958 minimum_refs += 2; 993 959 } 994 - spin_unlock(&vfsmount_lock); 960 + br_read_unlock(vfsmount_lock); 995 961 996 962 if (actual_refs > minimum_refs) 997 963 return 0; ··· 1018 984 { 1019 985 int ret = 1; 1020 986 down_read(&namespace_sem); 1021 - spin_lock(&vfsmount_lock); 987 + br_read_lock(vfsmount_lock); 1022 988 if (propagate_mount_busy(mnt, 2)) 1023 989 ret = 0; 1024 - spin_unlock(&vfsmount_lock); 990 + br_read_unlock(vfsmount_lock); 1025 991 up_read(&namespace_sem); 1026 992 return ret; 1027 993 } ··· 1037 1003 if (mnt->mnt_parent != mnt) { 1038 1004 struct dentry *dentry; 1039 1005 struct vfsmount *m; 1040 - spin_lock(&vfsmount_lock); 1006 + 1007 + br_write_lock(vfsmount_lock); 1041 1008 dentry = mnt->mnt_mountpoint; 1042 1009 m = mnt->mnt_parent; 1043 1010 mnt->mnt_mountpoint = mnt->mnt_root; 1044 1011 mnt->mnt_parent = mnt; 1045 1012 m->mnt_ghosts--; 1046 - spin_unlock(&vfsmount_lock); 1013 + br_write_unlock(vfsmount_lock); 1047 1014 dput(dentry); 1048 1015 mntput(m); 1049 1016 } ··· 1052 1017 } 1053 1018 } 1054 1019 1020 + /* 1021 + * vfsmount lock must be held for write 1022 + * namespace_sem must be held for write 1023 + */ 1055 1024 void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 1056 1025 { 1057 1026 struct vfsmount *p; ··· 1146 1107 } 1147 1108 1148 1109 down_write(&namespace_sem); 1149 - spin_lock(&vfsmount_lock); 1110 + br_write_lock(vfsmount_lock); 1150 1111 event++; 1151 1112 1152 1113 if (!(flags & MNT_DETACH)) ··· 1158 1119 umount_tree(mnt, 1, &umount_list); 1159 1120 retval = 0; 1160 1121 } 1161 - spin_unlock(&vfsmount_lock); 1122 + br_write_unlock(vfsmount_lock); 1162 1123 up_write(&namespace_sem); 1163 1124 release_mounts(&umount_list); 1164 1125 return retval; ··· 1270 1231 q = clone_mnt(p, p->mnt_root, flag); 1271 1232 if (!q) 1272 1233 goto Enomem; 1273 - spin_lock(&vfsmount_lock); 1234 + br_write_lock(vfsmount_lock); 1274 1235 list_add_tail(&q->mnt_list, &res->mnt_list); 1275 1236 attach_mnt(q, &path); 1276 - spin_unlock(&vfsmount_lock); 1237 + br_write_unlock(vfsmount_lock); 1277 1238 } 1278 1239 } 1279 1240 return res; 1280 1241 Enomem: 1281 1242 if (res) { 1282 1243 LIST_HEAD(umount_list); 1283 - spin_lock(&vfsmount_lock); 1244 + br_write_lock(vfsmount_lock); 1284 1245 umount_tree(res, 0, &umount_list); 1285 - spin_unlock(&vfsmount_lock); 1246 + br_write_unlock(vfsmount_lock); 1286 1247 release_mounts(&umount_list); 1287 1248 } 1288 1249 return NULL; ··· 1301 1262 { 1302 1263 LIST_HEAD(umount_list); 1303 1264 down_write(&namespace_sem); 1304 - spin_lock(&vfsmount_lock); 1265 + br_write_lock(vfsmount_lock); 1305 1266 umount_tree(mnt, 0, &umount_list); 1306 - spin_unlock(&vfsmount_lock); 1267 + br_write_unlock(vfsmount_lock); 1307 1268 up_write(&namespace_sem); 1308 1269 release_mounts(&umount_list); 1309 1270 } ··· 1431 1392 if (err) 1432 1393 goto out_cleanup_ids; 1433 1394 1434 - spin_lock(&vfsmount_lock); 1395 + br_write_lock(vfsmount_lock); 1435 1396 1436 1397 if (IS_MNT_SHARED(dest_mnt)) { 1437 1398 for (p = source_mnt; p; p = next_mnt(p, source_mnt)) ··· 1450 1411 list_del_init(&child->mnt_hash); 1451 1412 commit_tree(child); 1452 1413 } 1453 - spin_unlock(&vfsmount_lock); 1414 + br_write_unlock(vfsmount_lock); 1415 + 1454 1416 return 0; 1455 1417 1456 1418 out_cleanup_ids: ··· 1506 1466 goto out_unlock; 1507 1467 } 1508 1468 1509 - spin_lock(&vfsmount_lock); 1469 + br_write_lock(vfsmount_lock); 1510 1470 for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL)) 1511 1471 change_mnt_propagation(m, type); 1512 - spin_unlock(&vfsmount_lock); 1472 + br_write_unlock(vfsmount_lock); 1513 1473 1514 1474 out_unlock: 1515 1475 up_write(&namespace_sem); ··· 1553 1513 err = graft_tree(mnt, path); 1554 1514 if (err) { 1555 1515 LIST_HEAD(umount_list); 1556 - spin_lock(&vfsmount_lock); 1516 + 1517 + br_write_lock(vfsmount_lock); 1557 1518 umount_tree(mnt, 0, &umount_list); 1558 - spin_unlock(&vfsmount_lock); 1519 + br_write_unlock(vfsmount_lock); 1559 1520 release_mounts(&umount_list); 1560 1521 } 1561 1522 ··· 1609 1568 else 1610 1569 err = do_remount_sb(sb, flags, data, 0); 1611 1570 if (!err) { 1612 - spin_lock(&vfsmount_lock); 1571 + br_write_lock(vfsmount_lock); 1613 1572 mnt_flags |= path->mnt->mnt_flags & MNT_PROPAGATION_MASK; 1614 1573 path->mnt->mnt_flags = mnt_flags; 1615 - spin_unlock(&vfsmount_lock); 1574 + br_write_unlock(vfsmount_lock); 1616 1575 } 1617 1576 up_write(&sb->s_umount); 1618 1577 if (!err) { 1619 - spin_lock(&vfsmount_lock); 1578 + br_write_lock(vfsmount_lock); 1620 1579 touch_mnt_namespace(path->mnt->mnt_ns); 1621 - spin_unlock(&vfsmount_lock); 1580 + br_write_unlock(vfsmount_lock); 1622 1581 } 1623 1582 return err; 1624 1583 } ··· 1795 1754 return; 1796 1755 1797 1756 down_write(&namespace_sem); 1798 - spin_lock(&vfsmount_lock); 1757 + br_write_lock(vfsmount_lock); 1799 1758 1800 1759 /* extract from the expiration list every vfsmount that matches the 1801 1760 * following criteria: ··· 1814 1773 touch_mnt_namespace(mnt->mnt_ns); 1815 1774 umount_tree(mnt, 1, &umounts); 1816 1775 } 1817 - spin_unlock(&vfsmount_lock); 1776 + br_write_unlock(vfsmount_lock); 1818 1777 up_write(&namespace_sem); 1819 1778 1820 1779 release_mounts(&umounts); ··· 1871 1830 /* 1872 1831 * process a list of expirable mountpoints with the intent of discarding any 1873 1832 * submounts of a specific parent mountpoint 1833 + * 1834 + * vfsmount_lock must be held for write 1874 1835 */ 1875 1836 static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts) 1876 1837 { ··· 2091 2048 kfree(new_ns); 2092 2049 return ERR_PTR(-ENOMEM); 2093 2050 } 2094 - spin_lock(&vfsmount_lock); 2051 + br_write_lock(vfsmount_lock); 2095 2052 list_add_tail(&new_ns->list, &new_ns->root->mnt_list); 2096 - spin_unlock(&vfsmount_lock); 2053 + br_write_unlock(vfsmount_lock); 2097 2054 2098 2055 /* 2099 2056 * Second pass: switch the tsk->fs->* elements and mark new vfsmounts ··· 2287 2244 goto out2; /* not attached */ 2288 2245 /* make sure we can reach put_old from new_root */ 2289 2246 tmp = old.mnt; 2290 - spin_lock(&vfsmount_lock); 2247 + br_write_lock(vfsmount_lock); 2291 2248 if (tmp != new.mnt) { 2292 2249 for (;;) { 2293 2250 if (tmp->mnt_parent == tmp) ··· 2307 2264 /* mount new_root on / */ 2308 2265 attach_mnt(new.mnt, &root_parent); 2309 2266 touch_mnt_namespace(current->nsproxy->mnt_ns); 2310 - spin_unlock(&vfsmount_lock); 2267 + br_write_unlock(vfsmount_lock); 2311 2268 chroot_fs_refs(&root, &new); 2312 2269 error = 0; 2313 2270 path_put(&root_parent); ··· 2322 2279 out0: 2323 2280 return error; 2324 2281 out3: 2325 - spin_unlock(&vfsmount_lock); 2282 + br_write_unlock(vfsmount_lock); 2326 2283 goto out2; 2327 2284 } 2328 2285 ··· 2369 2326 for (u = 0; u < HASH_SIZE; u++) 2370 2327 INIT_LIST_HEAD(&mount_hashtable[u]); 2371 2328 2329 + br_lock_init(vfsmount_lock); 2330 + 2372 2331 err = sysfs_init(); 2373 2332 if (err) 2374 2333 printk(KERN_WARNING "%s: sysfs_init error: %d\n", ··· 2389 2344 if (!atomic_dec_and_test(&ns->count)) 2390 2345 return; 2391 2346 down_write(&namespace_sem); 2392 - spin_lock(&vfsmount_lock); 2347 + br_write_lock(vfsmount_lock); 2393 2348 umount_tree(ns->root, 0, &umount_list); 2394 - spin_unlock(&vfsmount_lock); 2349 + br_write_unlock(vfsmount_lock); 2395 2350 up_write(&namespace_sem); 2396 2351 release_mounts(&umount_list); 2397 2352 kfree(ns);
-1
fs/nfs/Kconfig
··· 63 63 config NFS_V4 64 64 bool "NFS client support for NFS version 4" 65 65 depends on NFS_FS 66 - select RPCSEC_GSS_KRB5 67 66 help 68 67 This option enables support for version 4 of the NFS protocol 69 68 (RFC 3530) in the kernel's NFS client.
+8 -1
fs/nfs/dir.c
··· 140 140 141 141 /* Call generic open code in order to cache credentials */ 142 142 res = nfs_open(inode, filp); 143 + if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { 144 + /* This is a mountpoint, so d_revalidate will never 145 + * have been called, so we need to refresh the 146 + * inode (for close-open consistency) ourselves. 147 + */ 148 + __nfs_revalidate_inode(NFS_SERVER(inode), inode); 149 + } 143 150 return res; 144 151 } 145 152 ··· 1110 1103 if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) 1111 1104 goto no_open_dput; 1112 1105 /* We can't create new files, or truncate existing ones here */ 1113 - openflags &= ~(O_CREAT|O_TRUNC); 1106 + openflags &= ~(O_CREAT|O_EXCL|O_TRUNC); 1114 1107 1115 1108 /* 1116 1109 * Note: we're not holding inode->i_mutex and so may be racing with
+1 -1
fs/nfs/file.c
··· 323 323 have_error |= test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags); 324 324 if (have_error) 325 325 ret = xchg(&ctx->error, 0); 326 - if (!ret) 326 + if (!ret && status < 0) 327 327 ret = status; 328 328 return ret; 329 329 }
+6 -5
fs/nfs/nfs4proc.c
··· 2036 2036 struct rpc_cred *cred; 2037 2037 struct nfs4_state *state; 2038 2038 struct dentry *res; 2039 - fmode_t fmode = nd->intent.open.flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); 2039 + int open_flags = nd->intent.open.flags; 2040 + fmode_t fmode = open_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); 2040 2041 2041 2042 if (nd->flags & LOOKUP_CREATE) { 2042 2043 attr.ia_mode = nd->intent.open.create_mode; ··· 2045 2044 if (!IS_POSIXACL(dir)) 2046 2045 attr.ia_mode &= ~current_umask(); 2047 2046 } else { 2047 + open_flags &= ~O_EXCL; 2048 2048 attr.ia_valid = 0; 2049 - BUG_ON(nd->intent.open.flags & O_CREAT); 2049 + BUG_ON(open_flags & O_CREAT); 2050 2050 } 2051 2051 2052 2052 cred = rpc_lookup_cred(); ··· 2056 2054 parent = dentry->d_parent; 2057 2055 /* Protect against concurrent sillydeletes */ 2058 2056 nfs_block_sillyrename(parent); 2059 - state = nfs4_do_open(dir, &path, fmode, nd->intent.open.flags, &attr, cred); 2057 + state = nfs4_do_open(dir, &path, fmode, open_flags, &attr, cred); 2060 2058 put_rpccred(cred); 2061 2059 if (IS_ERR(state)) { 2062 2060 if (PTR_ERR(state) == -ENOENT) { ··· 2275 2273 out: 2276 2274 if (page) 2277 2275 __free_page(page); 2278 - if (locations) 2279 - kfree(locations); 2276 + kfree(locations); 2280 2277 return status; 2281 2278 } 2282 2279
+7
fs/nfs/super.c
··· 655 655 656 656 if (nfss->options & NFS_OPTION_FSCACHE) 657 657 seq_printf(m, ",fsc"); 658 + 659 + if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) { 660 + if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE) 661 + seq_printf(m, ",lookupcache=none"); 662 + else 663 + seq_printf(m, ",lookupcache=pos"); 664 + } 658 665 } 659 666 660 667 /*
-1
fs/nfsd/Kconfig
··· 69 69 depends on NFSD && PROC_FS && EXPERIMENTAL 70 70 select NFSD_V3 71 71 select FS_POSIX_ACL 72 - select RPCSEC_GSS_KRB5 73 72 help 74 73 This option enables support in your system's NFS server for 75 74 version 4 of the NFS protocol (RFC 3530).
+17 -15
fs/nilfs2/super.c
··· 175 175 { 176 176 struct the_nilfs *nilfs = sbi->s_nilfs; 177 177 int err; 178 - int barrier_done = 0; 179 178 180 - if (nilfs_test_opt(sbi, BARRIER)) { 181 - set_buffer_ordered(nilfs->ns_sbh[0]); 182 - barrier_done = 1; 183 - } 184 179 retry: 185 180 set_buffer_dirty(nilfs->ns_sbh[0]); 186 - err = sync_dirty_buffer(nilfs->ns_sbh[0]); 187 - if (err == -EOPNOTSUPP && barrier_done) { 188 - nilfs_warning(sbi->s_super, __func__, 189 - "barrier-based sync failed. " 190 - "disabling barriers\n"); 191 - nilfs_clear_opt(sbi, BARRIER); 192 - barrier_done = 0; 193 - clear_buffer_ordered(nilfs->ns_sbh[0]); 194 - goto retry; 181 + 182 + if (nilfs_test_opt(sbi, BARRIER)) { 183 + err = __sync_dirty_buffer(nilfs->ns_sbh[0], 184 + WRITE_SYNC | WRITE_BARRIER); 185 + if (err == -EOPNOTSUPP) { 186 + nilfs_warning(sbi->s_super, __func__, 187 + "barrier-based sync failed. " 188 + "disabling barriers\n"); 189 + nilfs_clear_opt(sbi, BARRIER); 190 + goto retry; 191 + } 192 + } else { 193 + err = sync_dirty_buffer(nilfs->ns_sbh[0]); 195 194 } 195 + 196 196 if (unlikely(err)) { 197 197 printk(KERN_ERR 198 198 "NILFS: unable to write superblock (err=%d)\n", err); ··· 400 400 list_add(&sbi->s_list, &nilfs->ns_supers); 401 401 up_write(&nilfs->ns_super_sem); 402 402 403 + err = -ENOMEM; 403 404 sbi->s_ifile = nilfs_ifile_new(sbi, nilfs->ns_inode_size); 404 405 if (!sbi->s_ifile) 405 - return -ENOMEM; 406 + goto delist; 406 407 407 408 down_read(&nilfs->ns_segctor_sem); 408 409 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, ··· 434 433 nilfs_mdt_destroy(sbi->s_ifile); 435 434 sbi->s_ifile = NULL; 436 435 436 + delist: 437 437 down_write(&nilfs->ns_super_sem); 438 438 list_del_init(&sbi->s_list); 439 439 up_write(&nilfs->ns_super_sem);
+2 -2
fs/nilfs2/the_nilfs.c
··· 608 608 return -EINVAL; 609 609 } 610 610 611 - if (swp) { 611 + if (!valid[!swp]) 612 612 printk(KERN_WARNING "NILFS warning: broken superblock. " 613 613 "using spare superblock.\n"); 614 + if (swp) 614 615 nilfs_swap_super_block(nilfs); 615 - } 616 616 617 617 nilfs->ns_sbwcount = 0; 618 618 nilfs->ns_sbwtime = le64_to_cpu(sbp[0]->s_wtime);
+2 -2
fs/open.c
··· 675 675 f->f_path.mnt = mnt; 676 676 f->f_pos = 0; 677 677 f->f_op = fops_get(inode->i_fop); 678 - file_move(f, &inode->i_sb->s_files); 678 + file_sb_list_add(f, inode->i_sb); 679 679 680 680 error = security_dentry_open(f, cred); 681 681 if (error) ··· 721 721 mnt_drop_write(mnt); 722 722 } 723 723 } 724 - file_kill(f); 724 + file_sb_list_del(f); 725 725 f->f_path.dentry = NULL; 726 726 f->f_path.mnt = NULL; 727 727 cleanup_file:
+9 -2
fs/pnode.c
··· 126 126 return 0; 127 127 } 128 128 129 + /* 130 + * vfsmount lock must be held for write 131 + */ 129 132 void change_mnt_propagation(struct vfsmount *mnt, int type) 130 133 { 131 134 if (type == MS_SHARED) { ··· 273 270 prev_src_mnt = child; 274 271 } 275 272 out: 276 - spin_lock(&vfsmount_lock); 273 + br_write_lock(vfsmount_lock); 277 274 while (!list_empty(&tmp_list)) { 278 275 child = list_first_entry(&tmp_list, struct vfsmount, mnt_hash); 279 276 umount_tree(child, 0, &umount_list); 280 277 } 281 - spin_unlock(&vfsmount_lock); 278 + br_write_unlock(vfsmount_lock); 282 279 release_mounts(&umount_list); 283 280 return ret; 284 281 } ··· 299 296 * other mounts its parent propagates to. 300 297 * Check if any of these mounts that **do not have submounts** 301 298 * have more references than 'refcnt'. If so return busy. 299 + * 300 + * vfsmount lock must be held for read or write 302 301 */ 303 302 int propagate_mount_busy(struct vfsmount *mnt, int refcnt) 304 303 { ··· 358 353 * collect all mounts that receive propagation from the mount in @list, 359 354 * and return these additional mounts in the same list. 360 355 * @list: the list of mounts to be unmounted. 356 + * 357 + * vfsmount lock must be held for write 361 358 */ 362 359 int propagate_umount(struct list_head *list) 363 360 {
+1
fs/reiserfs/inode.c
··· 83 83 dquot_drop(inode); 84 84 inode->i_blocks = 0; 85 85 reiserfs_write_unlock_once(inode->i_sb, depth); 86 + return; 86 87 87 88 no_delete: 88 89 end_writeback(inode);
+1 -1
fs/reiserfs/journal.c
··· 2311 2311 /* flush out the real blocks */ 2312 2312 for (i = 0; i < get_desc_trans_len(desc); i++) { 2313 2313 set_buffer_dirty(real_blocks[i]); 2314 - ll_rw_block(SWRITE, 1, real_blocks + i); 2314 + write_dirty_buffer(real_blocks[i], WRITE); 2315 2315 } 2316 2316 for (i = 0; i < get_desc_trans_len(desc); i++) { 2317 2317 wait_on_buffer(real_blocks[i]);
+18
fs/super.c
··· 54 54 s = NULL; 55 55 goto out; 56 56 } 57 + #ifdef CONFIG_SMP 58 + s->s_files = alloc_percpu(struct list_head); 59 + if (!s->s_files) { 60 + security_sb_free(s); 61 + kfree(s); 62 + s = NULL; 63 + goto out; 64 + } else { 65 + int i; 66 + 67 + for_each_possible_cpu(i) 68 + INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); 69 + } 70 + #else 57 71 INIT_LIST_HEAD(&s->s_files); 72 + #endif 58 73 INIT_LIST_HEAD(&s->s_instances); 59 74 INIT_HLIST_HEAD(&s->s_anon); 60 75 INIT_LIST_HEAD(&s->s_inodes); ··· 123 108 */ 124 109 static inline void destroy_super(struct super_block *s) 125 110 { 111 + #ifdef CONFIG_SMP 112 + free_percpu(s->s_files); 113 + #endif 126 114 security_sb_free(s); 127 115 kfree(s->s_subtype); 128 116 kfree(s->s_options);
+8 -16
fs/ufs/balloc.c
··· 114 114 115 115 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 116 116 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 117 - if (sb->s_flags & MS_SYNCHRONOUS) { 118 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 119 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 120 - } 117 + if (sb->s_flags & MS_SYNCHRONOUS) 118 + ubh_sync_block(UCPI_UBH(ucpi)); 121 119 sb->s_dirt = 1; 122 120 123 121 unlock_super (sb); ··· 205 207 206 208 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 207 209 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 208 - if (sb->s_flags & MS_SYNCHRONOUS) { 209 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 210 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 211 - } 210 + if (sb->s_flags & MS_SYNCHRONOUS) 211 + ubh_sync_block(UCPI_UBH(ucpi)); 212 212 213 213 if (overflow) { 214 214 fragment += count; ··· 554 558 555 559 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 556 560 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 557 - if (sb->s_flags & MS_SYNCHRONOUS) { 558 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 559 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 560 - } 561 + if (sb->s_flags & MS_SYNCHRONOUS) 562 + ubh_sync_block(UCPI_UBH(ucpi)); 561 563 sb->s_dirt = 1; 562 564 563 565 UFSD("EXIT, fragment %llu\n", (unsigned long long)fragment); ··· 674 680 succed: 675 681 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 676 682 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 677 - if (sb->s_flags & MS_SYNCHRONOUS) { 678 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 679 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 680 - } 683 + if (sb->s_flags & MS_SYNCHRONOUS) 684 + ubh_sync_block(UCPI_UBH(ucpi)); 681 685 sb->s_dirt = 1; 682 686 683 687 result += cgno * uspi->s_fpg;
+6 -12
fs/ufs/ialloc.c
··· 113 113 114 114 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 115 115 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 116 - if (sb->s_flags & MS_SYNCHRONOUS) { 117 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 118 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 119 - } 116 + if (sb->s_flags & MS_SYNCHRONOUS) 117 + ubh_sync_block(UCPI_UBH(ucpi)); 120 118 121 119 sb->s_dirt = 1; 122 120 unlock_super (sb); ··· 154 156 155 157 fs32_add(sb, &ucg->cg_u.cg_u2.cg_initediblk, uspi->s_inopb); 156 158 ubh_mark_buffer_dirty(UCPI_UBH(ucpi)); 157 - if (sb->s_flags & MS_SYNCHRONOUS) { 158 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 159 - ubh_wait_on_buffer(UCPI_UBH(ucpi)); 160 - } 159 + if (sb->s_flags & MS_SYNCHRONOUS) 160 + ubh_sync_block(UCPI_UBH(ucpi)); 161 161 162 162 UFSD("EXIT\n"); 163 163 } ··· 286 290 } 287 291 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 288 292 ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); 289 - if (sb->s_flags & MS_SYNCHRONOUS) { 290 - ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi)); 291 - ubh_wait_on_buffer (UCPI_UBH(ucpi)); 292 - } 293 + if (sb->s_flags & MS_SYNCHRONOUS) 294 + ubh_sync_block(UCPI_UBH(ucpi)); 293 295 sb->s_dirt = 1; 294 296 295 297 inode->i_ino = cg * uspi->s_ipg + bit;
+6 -12
fs/ufs/truncate.c
··· 243 243 ubh_bforget(ind_ubh); 244 244 ind_ubh = NULL; 245 245 } 246 - if (IS_SYNC(inode) && ind_ubh && ubh_buffer_dirty(ind_ubh)) { 247 - ubh_ll_rw_block(SWRITE, ind_ubh); 248 - ubh_wait_on_buffer (ind_ubh); 249 - } 246 + if (IS_SYNC(inode) && ind_ubh && ubh_buffer_dirty(ind_ubh)) 247 + ubh_sync_block(ind_ubh); 250 248 ubh_brelse (ind_ubh); 251 249 252 250 UFSD("EXIT: ino %lu\n", inode->i_ino); ··· 305 307 ubh_bforget(dind_bh); 306 308 dind_bh = NULL; 307 309 } 308 - if (IS_SYNC(inode) && dind_bh && ubh_buffer_dirty(dind_bh)) { 309 - ubh_ll_rw_block(SWRITE, dind_bh); 310 - ubh_wait_on_buffer (dind_bh); 311 - } 310 + if (IS_SYNC(inode) && dind_bh && ubh_buffer_dirty(dind_bh)) 311 + ubh_sync_block(dind_bh); 312 312 ubh_brelse (dind_bh); 313 313 314 314 UFSD("EXIT: ino %lu\n", inode->i_ino); ··· 363 367 ubh_bforget(tind_bh); 364 368 tind_bh = NULL; 365 369 } 366 - if (IS_SYNC(inode) && tind_bh && ubh_buffer_dirty(tind_bh)) { 367 - ubh_ll_rw_block(SWRITE, tind_bh); 368 - ubh_wait_on_buffer (tind_bh); 369 - } 370 + if (IS_SYNC(inode) && tind_bh && ubh_buffer_dirty(tind_bh)) 371 + ubh_sync_block(tind_bh); 370 372 ubh_brelse (tind_bh); 371 373 372 374 UFSD("EXIT: ino %lu\n", inode->i_ino);
+8 -12
fs/ufs/util.c
··· 113 113 } 114 114 } 115 115 116 - void ubh_ll_rw_block(int rw, struct ufs_buffer_head *ubh) 116 + void ubh_sync_block(struct ufs_buffer_head *ubh) 117 117 { 118 - if (!ubh) 119 - return; 118 + if (ubh) { 119 + unsigned i; 120 120 121 - ll_rw_block(rw, ubh->count, ubh->bh); 122 - } 121 + for (i = 0; i < ubh->count; i++) 122 + write_dirty_buffer(ubh->bh[i], WRITE); 123 123 124 - void ubh_wait_on_buffer (struct ufs_buffer_head * ubh) 125 - { 126 - unsigned i; 127 - if (!ubh) 128 - return; 129 - for ( i = 0; i < ubh->count; i++ ) 130 - wait_on_buffer (ubh->bh[i]); 124 + for (i = 0; i < ubh->count; i++) 125 + wait_on_buffer(ubh->bh[i]); 126 + } 131 127 } 132 128 133 129 void ubh_bforget (struct ufs_buffer_head * ubh)
+1 -2
fs/ufs/util.h
··· 269 269 extern void ubh_brelse_uspi (struct ufs_sb_private_info *); 270 270 extern void ubh_mark_buffer_dirty (struct ufs_buffer_head *); 271 271 extern void ubh_mark_buffer_uptodate (struct ufs_buffer_head *, int); 272 - extern void ubh_ll_rw_block(int, struct ufs_buffer_head *); 273 - extern void ubh_wait_on_buffer (struct ufs_buffer_head *); 272 + extern void ubh_sync_block(struct ufs_buffer_head *); 274 273 extern void ubh_bforget (struct ufs_buffer_head *); 275 274 extern int ubh_buffer_dirty (struct ufs_buffer_head *); 276 275 #define ubh_ubhcpymem(mem,ubh,size) _ubh_ubhcpymem_(uspi,mem,ubh,size)
+4 -2
include/asm-generic/syscalls.h
··· 23 23 #endif 24 24 25 25 #ifndef sys_execve 26 - asmlinkage long sys_execve(char __user *filename, char __user * __user *argv, 27 - char __user * __user *envp, struct pt_regs *regs); 26 + asmlinkage long sys_execve(const char __user *filename, 27 + const char __user *const __user *argv, 28 + const char __user *const __user *envp, 29 + struct pt_regs *regs); 28 30 #endif 29 31 30 32 #ifndef sys_mmap2
+1
include/linux/amba/clcd.h
··· 150 150 u16 off_cntl; 151 151 u32 clcd_cntl; 152 152 u32 cmap[16]; 153 + bool clk_enabled; 153 154 }; 154 155 155 156 static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
+4 -3
include/linux/binfmts.h
··· 50 50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 51 51 unsigned int per_clear; /* bits to clear in current->personality */ 52 52 int argc, envc; 53 - char * filename; /* Name of binary as seen by procps */ 54 - char * interp; /* Name of the binary really executed. Most 53 + const char * filename; /* Name of binary as seen by procps */ 54 + const char * interp; /* Name of the binary really executed. Most 55 55 of the time same as filename, but could be 56 56 different for binfmt_{misc,script} */ 57 57 unsigned interp_flags; ··· 126 126 unsigned long stack_top, 127 127 int executable_stack); 128 128 extern int bprm_mm_init(struct linux_binprm *bprm); 129 - extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 129 + extern int copy_strings_kernel(int argc, const char *const *argv, 130 + struct linux_binprm *bprm); 130 131 extern int prepare_bprm_creds(struct linux_binprm *bprm); 131 132 extern void install_exec_creds(struct linux_binprm *bprm); 132 133 extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
+2 -2
include/linux/buffer_head.h
··· 32 32 BH_Delay, /* Buffer is not yet allocated on disk */ 33 33 BH_Boundary, /* Block is followed by a discontiguity */ 34 34 BH_Write_EIO, /* I/O error on write */ 35 - BH_Ordered, /* ordered write */ 36 35 BH_Eopnotsupp, /* operation not supported (barrier) */ 37 36 BH_Unwritten, /* Buffer is allocated on disk but not written */ 38 37 BH_Quiet, /* Buffer Error Prinks to be quiet */ ··· 124 125 BUFFER_FNS(Delay, delay) 125 126 BUFFER_FNS(Boundary, boundary) 126 127 BUFFER_FNS(Write_EIO, write_io_error) 127 - BUFFER_FNS(Ordered, ordered) 128 128 BUFFER_FNS(Eopnotsupp, eopnotsupp) 129 129 BUFFER_FNS(Unwritten, unwritten) 130 130 ··· 181 183 void __lock_buffer(struct buffer_head *bh); 182 184 void ll_rw_block(int, int, struct buffer_head * bh[]); 183 185 int sync_dirty_buffer(struct buffer_head *bh); 186 + int __sync_dirty_buffer(struct buffer_head *bh, int rw); 187 + void write_dirty_buffer(struct buffer_head *bh, int rw); 184 188 int submit_bh(int, struct buffer_head *); 185 189 void write_boundary_block(struct block_device *bdev, 186 190 sector_t bblock, unsigned blocksize);
+7 -14
include/linux/fs.h
··· 125 125 * block layer could (in theory) choose to ignore this 126 126 * request if it runs into resource problems. 127 127 * WRITE A normal async write. Device will be plugged. 128 - * SWRITE Like WRITE, but a special case for ll_rw_block() that 129 - * tells it to lock the buffer first. Normally a buffer 130 - * must be locked before doing IO. 131 128 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down 132 129 * the hint that someone will be waiting on this IO 133 130 * shortly. The device must still be unplugged explicitly, ··· 135 138 * immediately after submission. The write equivalent 136 139 * of READ_SYNC. 137 140 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. 138 - * SWRITE_SYNC 139 - * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. 140 - * See SWRITE. 141 141 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all 142 142 * previously submitted writes must be safely on storage 143 143 * before this one is started. Also guarantees that when ··· 149 155 #define READ 0 150 156 #define WRITE RW_MASK 151 157 #define READA RWA_MASK 152 - #define SWRITE (WRITE | READA) 153 158 154 159 #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) 155 160 #define READ_META (READ | REQ_META) ··· 158 165 #define WRITE_META (WRITE | REQ_META) 159 166 #define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 160 167 REQ_HARDBARRIER) 161 - #define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE) 162 - #define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) 163 168 164 169 /* 165 170 * These aren't really reads or writes, they pass down information about ··· 920 929 #define f_vfsmnt f_path.mnt 921 930 const struct file_operations *f_op; 922 931 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ 932 + #ifdef CONFIG_SMP 933 + int f_sb_list_cpu; 934 + #endif 923 935 atomic_long_t f_count; 924 936 unsigned int f_flags; 925 937 fmode_t f_mode; ··· 947 953 unsigned long f_mnt_write_state; 948 954 #endif 949 955 }; 950 - extern spinlock_t files_lock; 951 - #define file_list_lock() spin_lock(&files_lock); 952 - #define file_list_unlock() spin_unlock(&files_lock); 953 956 954 957 #define get_file(x) atomic_long_inc(&(x)->f_count) 955 958 #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) ··· 1337 1346 1338 1347 struct list_head s_inodes; /* all inodes */ 1339 1348 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1349 + #ifdef CONFIG_SMP 1350 + struct list_head __percpu *s_files; 1351 + #else 1340 1352 struct list_head s_files; 1353 + #endif 1341 1354 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1342 1355 struct list_head s_dentry_lru; /* unused dentry lru */ 1343 1356 int s_nr_dentry_unused; /* # of dentry on lru */ ··· 2192 2197 __insert_inode_hash(inode, inode->i_ino); 2193 2198 } 2194 2199 2195 - extern void file_move(struct file *f, struct list_head *list); 2196 - extern void file_kill(struct file *f); 2197 2200 #ifdef CONFIG_BLOCK 2198 2201 extern void submit_bio(int, struct bio *); 2199 2202 extern int bdev_read_only(struct block_device *);
+7 -7
include/linux/fs_struct.h
··· 5 5 6 6 struct fs_struct { 7 7 int users; 8 - rwlock_t lock; 8 + spinlock_t lock; 9 9 int umask; 10 10 int in_exec; 11 11 struct path root, pwd; ··· 23 23 24 24 static inline void get_fs_root(struct fs_struct *fs, struct path *root) 25 25 { 26 - read_lock(&fs->lock); 26 + spin_lock(&fs->lock); 27 27 *root = fs->root; 28 28 path_get(root); 29 - read_unlock(&fs->lock); 29 + spin_unlock(&fs->lock); 30 30 } 31 31 32 32 static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd) 33 33 { 34 - read_lock(&fs->lock); 34 + spin_lock(&fs->lock); 35 35 *pwd = fs->pwd; 36 36 path_get(pwd); 37 - read_unlock(&fs->lock); 37 + spin_unlock(&fs->lock); 38 38 } 39 39 40 40 static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root, 41 41 struct path *pwd) 42 42 { 43 - read_lock(&fs->lock); 43 + spin_lock(&fs->lock); 44 44 *root = fs->root; 45 45 path_get(root); 46 46 *pwd = fs->pwd; 47 47 path_get(pwd); 48 - read_unlock(&fs->lock); 48 + spin_unlock(&fs->lock); 49 49 } 50 50 51 51 #endif /* _LINUX_FS_STRUCT_H */
+172
include/linux/lglock.h
··· 1 + /* 2 + * Specialised local-global spinlock. Can only be declared as global variables 3 + * to avoid overhead and keep things simple (and we don't want to start using 4 + * these inside dynamically allocated structures). 5 + * 6 + * "local/global locks" (lglocks) can be used to: 7 + * 8 + * - Provide fast exclusive access to per-CPU data, with exclusive access to 9 + * another CPU's data allowed but possibly subject to contention, and to 10 + * provide very slow exclusive access to all per-CPU data. 11 + * - Or to provide very fast and scalable read serialisation, and to provide 12 + * very slow exclusive serialisation of data (not necessarily per-CPU data). 13 + * 14 + * Brlocks are also implemented as a short-hand notation for the latter use 15 + * case. 16 + * 17 + * Copyright 2009, 2010, Nick Piggin, Novell Inc. 18 + */ 19 + #ifndef __LINUX_LGLOCK_H 20 + #define __LINUX_LGLOCK_H 21 + 22 + #include <linux/spinlock.h> 23 + #include <linux/lockdep.h> 24 + #include <linux/percpu.h> 25 + 26 + /* can make br locks by using local lock for read side, global lock for write */ 27 + #define br_lock_init(name) name##_lock_init() 28 + #define br_read_lock(name) name##_local_lock() 29 + #define br_read_unlock(name) name##_local_unlock() 30 + #define br_write_lock(name) name##_global_lock_online() 31 + #define br_write_unlock(name) name##_global_unlock_online() 32 + 33 + #define DECLARE_BRLOCK(name) DECLARE_LGLOCK(name) 34 + #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) 35 + 36 + 37 + #define lg_lock_init(name) name##_lock_init() 38 + #define lg_local_lock(name) name##_local_lock() 39 + #define lg_local_unlock(name) name##_local_unlock() 40 + #define lg_local_lock_cpu(name, cpu) name##_local_lock_cpu(cpu) 41 + #define lg_local_unlock_cpu(name, cpu) name##_local_unlock_cpu(cpu) 42 + #define lg_global_lock(name) name##_global_lock() 43 + #define lg_global_unlock(name) name##_global_unlock() 44 + #define lg_global_lock_online(name) name##_global_lock_online() 45 + #define lg_global_unlock_online(name) name##_global_unlock_online() 46 + 47 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 48 + #define LOCKDEP_INIT_MAP lockdep_init_map 49 + 50 + #define DEFINE_LGLOCK_LOCKDEP(name) \ 51 + struct lock_class_key name##_lock_key; \ 52 + struct lockdep_map name##_lock_dep_map; \ 53 + EXPORT_SYMBOL(name##_lock_dep_map) 54 + 55 + #else 56 + #define LOCKDEP_INIT_MAP(a, b, c, d) 57 + 58 + #define DEFINE_LGLOCK_LOCKDEP(name) 59 + #endif 60 + 61 + 62 + #define DECLARE_LGLOCK(name) \ 63 + extern void name##_lock_init(void); \ 64 + extern void name##_local_lock(void); \ 65 + extern void name##_local_unlock(void); \ 66 + extern void name##_local_lock_cpu(int cpu); \ 67 + extern void name##_local_unlock_cpu(int cpu); \ 68 + extern void name##_global_lock(void); \ 69 + extern void name##_global_unlock(void); \ 70 + extern void name##_global_lock_online(void); \ 71 + extern void name##_global_unlock_online(void); \ 72 + 73 + #define DEFINE_LGLOCK(name) \ 74 + \ 75 + DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ 76 + DEFINE_LGLOCK_LOCKDEP(name); \ 77 + \ 78 + void name##_lock_init(void) { \ 79 + int i; \ 80 + LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ 81 + for_each_possible_cpu(i) { \ 82 + arch_spinlock_t *lock; \ 83 + lock = &per_cpu(name##_lock, i); \ 84 + *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ 85 + } \ 86 + } \ 87 + EXPORT_SYMBOL(name##_lock_init); \ 88 + \ 89 + void name##_local_lock(void) { \ 90 + arch_spinlock_t *lock; \ 91 + preempt_disable(); \ 92 + rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \ 93 + lock = &__get_cpu_var(name##_lock); \ 94 + arch_spin_lock(lock); \ 95 + } \ 96 + EXPORT_SYMBOL(name##_local_lock); \ 97 + \ 98 + void name##_local_unlock(void) { \ 99 + arch_spinlock_t *lock; \ 100 + rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \ 101 + lock = &__get_cpu_var(name##_lock); \ 102 + arch_spin_unlock(lock); \ 103 + preempt_enable(); \ 104 + } \ 105 + EXPORT_SYMBOL(name##_local_unlock); \ 106 + \ 107 + void name##_local_lock_cpu(int cpu) { \ 108 + arch_spinlock_t *lock; \ 109 + preempt_disable(); \ 110 + rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \ 111 + lock = &per_cpu(name##_lock, cpu); \ 112 + arch_spin_lock(lock); \ 113 + } \ 114 + EXPORT_SYMBOL(name##_local_lock_cpu); \ 115 + \ 116 + void name##_local_unlock_cpu(int cpu) { \ 117 + arch_spinlock_t *lock; \ 118 + rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \ 119 + lock = &per_cpu(name##_lock, cpu); \ 120 + arch_spin_unlock(lock); \ 121 + preempt_enable(); \ 122 + } \ 123 + EXPORT_SYMBOL(name##_local_unlock_cpu); \ 124 + \ 125 + void name##_global_lock_online(void) { \ 126 + int i; \ 127 + preempt_disable(); \ 128 + rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ 129 + for_each_online_cpu(i) { \ 130 + arch_spinlock_t *lock; \ 131 + lock = &per_cpu(name##_lock, i); \ 132 + arch_spin_lock(lock); \ 133 + } \ 134 + } \ 135 + EXPORT_SYMBOL(name##_global_lock_online); \ 136 + \ 137 + void name##_global_unlock_online(void) { \ 138 + int i; \ 139 + rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ 140 + for_each_online_cpu(i) { \ 141 + arch_spinlock_t *lock; \ 142 + lock = &per_cpu(name##_lock, i); \ 143 + arch_spin_unlock(lock); \ 144 + } \ 145 + preempt_enable(); \ 146 + } \ 147 + EXPORT_SYMBOL(name##_global_unlock_online); \ 148 + \ 149 + void name##_global_lock(void) { \ 150 + int i; \ 151 + preempt_disable(); \ 152 + rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ 153 + for_each_online_cpu(i) { \ 154 + arch_spinlock_t *lock; \ 155 + lock = &per_cpu(name##_lock, i); \ 156 + arch_spin_lock(lock); \ 157 + } \ 158 + } \ 159 + EXPORT_SYMBOL(name##_global_lock); \ 160 + \ 161 + void name##_global_unlock(void) { \ 162 + int i; \ 163 + rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ 164 + for_each_online_cpu(i) { \ 165 + arch_spinlock_t *lock; \ 166 + lock = &per_cpu(name##_lock, i); \ 167 + arch_spin_unlock(lock); \ 168 + } \ 169 + preempt_enable(); \ 170 + } \ 171 + EXPORT_SYMBOL(name##_global_unlock); 172 + #endif
+3 -1
include/linux/sched.h
··· 2109 2109 extern int allow_signal(int); 2110 2110 extern int disallow_signal(int); 2111 2111 2112 - extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 2112 + extern int do_execve(const char *, 2113 + const char __user * const __user *, 2114 + const char __user * const __user *, struct pt_regs *); 2113 2115 extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2114 2116 struct task_struct *fork_idle(int); 2115 2117
+3
include/linux/spi/spi.h
··· 213 213 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 214 214 * @mode_bits: flags understood by this controller driver 215 215 * @flags: other constraints relevant to this driver 216 + * @bus_lock_spinlock: spinlock for SPI bus locking 217 + * @bus_lock_mutex: mutex for SPI bus locking 218 + * @bus_lock_flag: indicates that the SPI bus is locked for exclusive use 216 219 * @setup: updates the device mode and clocking records used by a 217 220 * device's SPI controller; protocol code may call this. This 218 221 * must fail if an unrecognized or unsupported mode is requested.
+1 -1
include/linux/syscalls.h
··· 820 820 u64 mask, int fd, 821 821 const char __user *pathname); 822 822 823 - int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823 + int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 824 824 825 825 826 826 asmlinkage long sys_perf_event_open(
+9
include/linux/tty.h
··· 329 329 struct tty_port *port; 330 330 }; 331 331 332 + /* Each of a tty's open files has private_data pointing to tty_file_private */ 333 + struct tty_file_private { 334 + struct tty_struct *tty; 335 + struct file *file; 336 + struct list_head list; 337 + }; 338 + 332 339 /* tty magic number */ 333 340 #define TTY_MAGIC 0x5401 334 341 ··· 465 458 extern struct tty_struct *get_current_tty(void); 466 459 extern void tty_default_fops(struct file_operations *fops); 467 460 extern struct tty_struct *alloc_tty_struct(void); 461 + extern void tty_add_file(struct tty_struct *tty, struct file *file); 468 462 extern void free_tty_struct(struct tty_struct *tty); 469 463 extern void initialize_tty_struct(struct tty_struct *tty, 470 464 struct tty_driver *driver, int idx); ··· 478 470 extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); 479 471 480 472 extern struct mutex tty_mutex; 473 + extern spinlock_t tty_files_lock; 481 474 482 475 extern void tty_write_unlock(struct tty_struct *tty); 483 476 extern int tty_write_lock(struct tty_struct *tty, int ndelay);
+1
include/sound/emu10k1.h
··· 1707 1707 unsigned int card_type; /* EMU10K1_CARD_* */ 1708 1708 unsigned int ecard_ctrl; /* ecard control bits */ 1709 1709 unsigned long dma_mask; /* PCI DMA mask */ 1710 + unsigned int delay_pcm_irq; /* in samples */ 1710 1711 int max_cache_pages; /* max memory size / PAGE_SIZE */ 1711 1712 struct snd_dma_buffer silent_page; /* silent page */ 1712 1713 struct snd_dma_buffer ptb_pages; /* page table pages */
+4 -3
init/do_mounts_initrd.c
··· 24 24 25 25 __setup("noinitrd", no_initrd); 26 26 27 - static int __init do_linuxrc(void * shell) 27 + static int __init do_linuxrc(void *_shell) 28 28 { 29 - static char *argv[] = { "linuxrc", NULL, }; 30 - extern char * envp_init[]; 29 + static const char *argv[] = { "linuxrc", NULL, }; 30 + extern const char *envp_init[]; 31 + const char *shell = _shell; 31 32 32 33 sys_close(old_fd);sys_close(root_fd); 33 34 sys_setsid();
+3 -3
init/main.c
··· 197 197 198 198 __setup("reset_devices", set_reset_devices); 199 199 200 - static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; 201 - char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; 200 + static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; 201 + const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; 202 202 static const char *panic_later, *panic_param; 203 203 204 204 extern const struct obs_kernel_param __setup_start[], __setup_end[]; ··· 809 809 do_one_initcall(*fn); 810 810 } 811 811 812 - static void run_init_process(char *init_filename) 812 + static void run_init_process(const char *init_filename) 813 813 { 814 814 argv_init[0] = init_filename; 815 815 kernel_execve(init_filename, argv_init, envp_init);
+7
kernel/debug/kdb/kdb_private.h
··· 255 255 extern void kdb_print_nameval(const char *name, unsigned long val); 256 256 extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); 257 257 extern void kdb_meminfo_proc_show(void); 258 + #ifdef CONFIG_KALLSYMS 258 259 extern const char *kdb_walk_kallsyms(loff_t *pos); 260 + #else /* ! CONFIG_KALLSYMS */ 261 + static inline const char *kdb_walk_kallsyms(loff_t *pos) 262 + { 263 + return NULL; 264 + } 265 + #endif /* ! CONFIG_KALLSYMS */ 259 266 extern char *kdb_getstr(char *, size_t, char *); 260 267 261 268 /* Defines for kdb_symbol_print */
+2 -2
kernel/debug/kdb/kdb_support.c
··· 82 82 int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) 83 83 { 84 84 int ret = 0; 85 - unsigned long symbolsize; 86 - unsigned long offset; 85 + unsigned long symbolsize = 0; 86 + unsigned long offset = 0; 87 87 #define knt1_size 128 /* must be >= kallsyms table size */ 88 88 char *knt1 = NULL; 89 89
+2 -3
kernel/exit.c
··· 1386 1386 if (!unlikely(wo->wo_flags & WNOWAIT)) 1387 1387 *p_code = 0; 1388 1388 1389 - /* don't need the RCU readlock here as we're holding a spinlock */ 1390 - uid = __task_cred(p)->uid; 1389 + uid = task_uid(p); 1391 1390 unlock_sig: 1392 1391 spin_unlock_irq(&p->sighand->siglock); 1393 1392 if (!exit_code) ··· 1459 1460 } 1460 1461 if (!unlikely(wo->wo_flags & WNOWAIT)) 1461 1462 p->signal->flags &= ~SIGNAL_STOP_CONTINUED; 1462 - uid = __task_cred(p)->uid; 1463 + uid = task_uid(p); 1463 1464 spin_unlock_irq(&p->sighand->siglock); 1464 1465 1465 1466 pid = task_pid_vnr(p);
+5 -5
kernel/fork.c
··· 752 752 struct fs_struct *fs = current->fs; 753 753 if (clone_flags & CLONE_FS) { 754 754 /* tsk->fs is already what we want */ 755 - write_lock(&fs->lock); 755 + spin_lock(&fs->lock); 756 756 if (fs->in_exec) { 757 - write_unlock(&fs->lock); 757 + spin_unlock(&fs->lock); 758 758 return -EAGAIN; 759 759 } 760 760 fs->users++; 761 - write_unlock(&fs->lock); 761 + spin_unlock(&fs->lock); 762 762 return 0; 763 763 } 764 764 tsk->fs = copy_fs_struct(fs); ··· 1676 1676 1677 1677 if (new_fs) { 1678 1678 fs = current->fs; 1679 - write_lock(&fs->lock); 1679 + spin_lock(&fs->lock); 1680 1680 current->fs = new_fs; 1681 1681 if (--fs->users) 1682 1682 new_fs = NULL; 1683 1683 else 1684 1684 new_fs = fs; 1685 - write_unlock(&fs->lock); 1685 + spin_unlock(&fs->lock); 1686 1686 } 1687 1687 1688 1688 if (new_mm) {
+3 -1
kernel/kmod.c
··· 153 153 goto fail; 154 154 } 155 155 156 - retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); 156 + retval = kernel_execve(sub_info->path, 157 + (const char *const *)sub_info->argv, 158 + (const char *const *)sub_info->envp); 157 159 158 160 /* Exec failed? */ 159 161 fail:
+3
kernel/trace/ring_buffer.c
··· 3846 3846 rpos = reader->read; 3847 3847 pos += size; 3848 3848 3849 + if (rpos >= commit) 3850 + break; 3851 + 3849 3852 event = rb_reader_event(cpu_buffer); 3850 3853 size = rb_event_length(event); 3851 3854 } while (len > size);
+8 -3
kernel/trace/trace.c
··· 3463 3463 size_t cnt, loff_t *fpos) 3464 3464 { 3465 3465 char *buf; 3466 + size_t written; 3466 3467 3467 3468 if (tracing_disabled) 3468 3469 return -EINVAL; ··· 3485 3484 } else 3486 3485 buf[cnt] = '\0'; 3487 3486 3488 - cnt = mark_printk("%s", buf); 3487 + written = mark_printk("%s", buf); 3489 3488 kfree(buf); 3490 - *fpos += cnt; 3489 + *fpos += written; 3491 3490 3492 - return cnt; 3491 + /* don't tell userspace we wrote more - it might confuse them */ 3492 + if (written > cnt) 3493 + written = cnt; 3494 + 3495 + return written; 3493 3496 } 3494 3497 3495 3498 static int tracing_clock_show(struct seq_file *m, void *v)
+149 -70
kernel/trace/trace_events.c
··· 598 598 return ret; 599 599 } 600 600 601 - static void print_event_fields(struct trace_seq *s, struct list_head *head) 601 + enum { 602 + FORMAT_HEADER = 1, 603 + FORMAT_PRINTFMT = 2, 604 + }; 605 + 606 + static void *f_next(struct seq_file *m, void *v, loff_t *pos) 602 607 { 608 + struct ftrace_event_call *call = m->private; 603 609 struct ftrace_event_field *field; 610 + struct list_head *head; 604 611 605 - list_for_each_entry_reverse(field, head, link) { 606 - /* 607 - * Smartly shows the array type(except dynamic array). 608 - * Normal: 609 - * field:TYPE VAR 610 - * If TYPE := TYPE[LEN], it is shown: 611 - * field:TYPE VAR[LEN] 612 - */ 613 - const char *array_descriptor = strchr(field->type, '['); 612 + (*pos)++; 614 613 615 - if (!strncmp(field->type, "__data_loc", 10)) 616 - array_descriptor = NULL; 614 + switch ((unsigned long)v) { 615 + case FORMAT_HEADER: 616 + head = &ftrace_common_fields; 617 617 618 - if (!array_descriptor) { 619 - trace_seq_printf(s, "\tfield:%s %s;\toffset:%u;" 620 - "\tsize:%u;\tsigned:%d;\n", 621 - field->type, field->name, field->offset, 622 - field->size, !!field->is_signed); 623 - } else { 624 - trace_seq_printf(s, "\tfield:%.*s %s%s;\toffset:%u;" 625 - "\tsize:%u;\tsigned:%d;\n", 626 - (int)(array_descriptor - field->type), 627 - field->type, field->name, 628 - array_descriptor, field->offset, 629 - field->size, !!field->is_signed); 630 - } 618 + if (unlikely(list_empty(head))) 619 + return NULL; 620 + 621 + field = list_entry(head->prev, struct ftrace_event_field, link); 622 + return field; 623 + 624 + case FORMAT_PRINTFMT: 625 + /* all done */ 626 + return NULL; 631 627 } 628 + 629 + head = trace_get_fields(call); 630 + 631 + /* 632 + * To separate common fields from event fields, the 633 + * LSB is set on the first event field. Clear it in case. 634 + */ 635 + v = (void *)((unsigned long)v & ~1L); 636 + 637 + field = v; 638 + /* 639 + * If this is a common field, and at the end of the list, then 640 + * continue with main list. 641 + */ 642 + if (field->link.prev == &ftrace_common_fields) { 643 + if (unlikely(list_empty(head))) 644 + return NULL; 645 + field = list_entry(head->prev, struct ftrace_event_field, link); 646 + /* Set the LSB to notify f_show to print an extra newline */ 647 + field = (struct ftrace_event_field *) 648 + ((unsigned long)field | 1); 649 + return field; 650 + } 651 + 652 + /* If we are done tell f_show to print the format */ 653 + if (field->link.prev == head) 654 + return (void *)FORMAT_PRINTFMT; 655 + 656 + field = list_entry(field->link.prev, struct ftrace_event_field, link); 657 + 658 + return field; 632 659 } 633 660 634 - static ssize_t 635 - event_format_read(struct file *filp, char __user *ubuf, size_t cnt, 636 - loff_t *ppos) 661 + static void *f_start(struct seq_file *m, loff_t *pos) 637 662 { 638 - struct ftrace_event_call *call = filp->private_data; 639 - struct list_head *head; 640 - struct trace_seq *s; 641 - char *buf; 642 - int r; 663 + loff_t l = 0; 664 + void *p; 643 665 644 - if (*ppos) 666 + /* Start by showing the header */ 667 + if (!*pos) 668 + return (void *)FORMAT_HEADER; 669 + 670 + p = (void *)FORMAT_HEADER; 671 + do { 672 + p = f_next(m, p, &l); 673 + } while (p && l < *pos); 674 + 675 + return p; 676 + } 677 + 678 + static int f_show(struct seq_file *m, void *v) 679 + { 680 + struct ftrace_event_call *call = m->private; 681 + struct ftrace_event_field *field; 682 + const char *array_descriptor; 683 + 684 + switch ((unsigned long)v) { 685 + case FORMAT_HEADER: 686 + seq_printf(m, "name: %s\n", call->name); 687 + seq_printf(m, "ID: %d\n", call->event.type); 688 + seq_printf(m, "format:\n"); 645 689 return 0; 646 690 647 - s = kmalloc(sizeof(*s), GFP_KERNEL); 648 - if (!s) 649 - return -ENOMEM; 650 - 651 - trace_seq_init(s); 652 - 653 - trace_seq_printf(s, "name: %s\n", call->name); 654 - trace_seq_printf(s, "ID: %d\n", call->event.type); 655 - trace_seq_printf(s, "format:\n"); 656 - 657 - /* print common fields */ 658 - print_event_fields(s, &ftrace_common_fields); 659 - 660 - trace_seq_putc(s, '\n'); 661 - 662 - /* print event specific fields */ 663 - head = trace_get_fields(call); 664 - print_event_fields(s, head); 665 - 666 - r = trace_seq_printf(s, "\nprint fmt: %s\n", call->print_fmt); 667 - 668 - if (!r) { 669 - /* 670 - * ug! The format output is bigger than a PAGE!! 671 - */ 672 - buf = "FORMAT TOO BIG\n"; 673 - r = simple_read_from_buffer(ubuf, cnt, ppos, 674 - buf, strlen(buf)); 675 - goto out; 691 + case FORMAT_PRINTFMT: 692 + seq_printf(m, "\nprint fmt: %s\n", 693 + call->print_fmt); 694 + return 0; 676 695 } 677 696 678 - r = simple_read_from_buffer(ubuf, cnt, ppos, 679 - s->buffer, s->len); 680 - out: 681 - kfree(s); 682 - return r; 697 + /* 698 + * To separate common fields from event fields, the 699 + * LSB is set on the first event field. Clear it and 700 + * print a newline if it is set. 701 + */ 702 + if ((unsigned long)v & 1) { 703 + seq_putc(m, '\n'); 704 + v = (void *)((unsigned long)v & ~1L); 705 + } 706 + 707 + field = v; 708 + 709 + /* 710 + * Smartly shows the array type(except dynamic array). 711 + * Normal: 712 + * field:TYPE VAR 713 + * If TYPE := TYPE[LEN], it is shown: 714 + * field:TYPE VAR[LEN] 715 + */ 716 + array_descriptor = strchr(field->type, '['); 717 + 718 + if (!strncmp(field->type, "__data_loc", 10)) 719 + array_descriptor = NULL; 720 + 721 + if (!array_descriptor) 722 + seq_printf(m, "\tfield:%s %s;\toffset:%u;\tsize:%u;\tsigned:%d;\n", 723 + field->type, field->name, field->offset, 724 + field->size, !!field->is_signed); 725 + else 726 + seq_printf(m, "\tfield:%.*s %s%s;\toffset:%u;\tsize:%u;\tsigned:%d;\n", 727 + (int)(array_descriptor - field->type), 728 + field->type, field->name, 729 + array_descriptor, field->offset, 730 + field->size, !!field->is_signed); 731 + 732 + return 0; 733 + } 734 + 735 + static void f_stop(struct seq_file *m, void *p) 736 + { 737 + } 738 + 739 + static const struct seq_operations trace_format_seq_ops = { 740 + .start = f_start, 741 + .next = f_next, 742 + .stop = f_stop, 743 + .show = f_show, 744 + }; 745 + 746 + static int trace_format_open(struct inode *inode, struct file *file) 747 + { 748 + struct ftrace_event_call *call = inode->i_private; 749 + struct seq_file *m; 750 + int ret; 751 + 752 + ret = seq_open(file, &trace_format_seq_ops); 753 + if (ret < 0) 754 + return ret; 755 + 756 + m = file->private_data; 757 + m->private = call; 758 + 759 + return 0; 683 760 } 684 761 685 762 static ssize_t ··· 954 877 }; 955 878 956 879 static const struct file_operations ftrace_event_format_fops = { 957 - .open = tracing_open_generic, 958 - .read = event_format_read, 880 + .open = trace_format_open, 881 + .read = seq_read, 882 + .llseek = seq_lseek, 883 + .release = seq_release, 959 884 }; 960 885 961 886 static const struct file_operations ftrace_event_id_fops = {
+9 -1
kernel/trace/trace_functions_graph.c
··· 507 507 * if the output fails. 508 508 */ 509 509 data->ent = *curr; 510 - data->ret = *next; 510 + /* 511 + * If the next event is not a return type, then 512 + * we only care about what type it is. Otherwise we can 513 + * safely copy the entire event. 514 + */ 515 + if (next->ent.type == TRACE_GRAPH_RET) 516 + data->ret = *next; 517 + else 518 + data->ret.ent.type = next->ent.type; 511 519 } 512 520 } 513 521
+4 -1
lib/Kconfig.debug
··· 994 994 995 995 config LATENCYTOP 996 996 bool "Latency measuring infrastructure" 997 + depends on HAVE_LATENCYTOP_SUPPORT 998 + depends on DEBUG_KERNEL 999 + depends on STACKTRACE_SUPPORT 1000 + depends on PROC_FS 997 1001 select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE 998 1002 select KALLSYMS 999 1003 select KALLSYMS_ALL 1000 1004 select STACKTRACE 1001 1005 select SCHEDSTATS 1002 1006 select SCHED_DEBUG 1003 - depends on HAVE_LATENCYTOP_SUPPORT 1004 1007 help 1005 1008 Enable this option if you want to use the LatencyTOP tool 1006 1009 to find out which userspace is blocking on what kernel operations.
+6 -2
mm/shmem.c
··· 2325 2325 2326 2326 static void shmem_put_super(struct super_block *sb) 2327 2327 { 2328 - kfree(sb->s_fs_info); 2328 + struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 2329 + 2330 + percpu_counter_destroy(&sbinfo->used_blocks); 2331 + kfree(sbinfo); 2329 2332 sb->s_fs_info = NULL; 2330 2333 } 2331 2334 ··· 2370 2367 #endif 2371 2368 2372 2369 spin_lock_init(&sbinfo->stat_lock); 2373 - percpu_counter_init(&sbinfo->used_blocks, 0); 2370 + if (percpu_counter_init(&sbinfo->used_blocks, 0)) 2371 + goto failed; 2374 2372 sbinfo->free_inodes = sbinfo->max_inodes; 2375 2373 2376 2374 sb->s_maxbytes = SHMEM_MAX_BYTES;
+1 -1
net/core/dev.c
··· 3143 3143 put_page(skb_shinfo(skb)->frags[0].page); 3144 3144 memmove(skb_shinfo(skb)->frags, 3145 3145 skb_shinfo(skb)->frags + 1, 3146 - --skb_shinfo(skb)->nr_frags); 3146 + --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); 3147 3147 } 3148 3148 } 3149 3149
+2
net/ipv4/netfilter/arp_tables.c
··· 735 735 if (cpu == curcpu) 736 736 continue; 737 737 i = 0; 738 + local_bh_disable(); 738 739 xt_info_wrlock(cpu); 739 740 xt_entry_foreach(iter, t->entries[cpu], t->size) { 740 741 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 743 742 ++i; 744 743 } 745 744 xt_info_wrunlock(cpu); 745 + local_bh_enable(); 746 746 } 747 747 put_cpu(); 748 748 }
+2
net/ipv4/netfilter/ip_tables.c
··· 909 909 if (cpu == curcpu) 910 910 continue; 911 911 i = 0; 912 + local_bh_disable(); 912 913 xt_info_wrlock(cpu); 913 914 xt_entry_foreach(iter, t->entries[cpu], t->size) { 914 915 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 917 916 ++i; /* macro does multi eval of i */ 918 917 } 919 918 xt_info_wrunlock(cpu); 919 + local_bh_enable(); 920 920 } 921 921 put_cpu(); 922 922 }
+2
net/ipv6/netfilter/ip6_tables.c
··· 922 922 if (cpu == curcpu) 923 923 continue; 924 924 i = 0; 925 + local_bh_disable(); 925 926 xt_info_wrlock(cpu); 926 927 xt_entry_foreach(iter, t->entries[cpu], t->size) { 927 928 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 930 929 ++i; 931 930 } 932 931 xt_info_wrunlock(cpu); 932 + local_bh_enable(); 933 933 } 934 934 put_cpu(); 935 935 }
+2 -2
net/ipv6/route.c
··· 2580 2580 .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity, 2581 2581 .maxlen = sizeof(int), 2582 2582 .mode = 0644, 2583 - .proc_handler = proc_dointvec_jiffies, 2583 + .proc_handler = proc_dointvec, 2584 2584 }, 2585 2585 { 2586 2586 .procname = "mtu_expires", ··· 2594 2594 .data = &init_net.ipv6.sysctl.ip6_rt_min_advmss, 2595 2595 .maxlen = sizeof(int), 2596 2596 .mode = 0644, 2597 - .proc_handler = proc_dointvec_jiffies, 2597 + .proc_handler = proc_dointvec, 2598 2598 }, 2599 2599 { 2600 2600 .procname = "gc_min_interval_ms",
+6 -16
net/netlink/af_netlink.c
··· 1406 1406 struct netlink_sock *nlk = nlk_sk(sk); 1407 1407 int noblock = flags&MSG_DONTWAIT; 1408 1408 size_t copied; 1409 - struct sk_buff *skb; 1409 + struct sk_buff *skb, *frag __maybe_unused = NULL; 1410 1410 int err; 1411 1411 1412 1412 if (flags&MSG_OOB) ··· 1441 1441 kfree_skb(skb); 1442 1442 skb = compskb; 1443 1443 } else { 1444 - /* 1445 - * Before setting frag_list to NULL, we must get a 1446 - * private copy of skb if shared (because of MSG_PEEK) 1447 - */ 1448 - if (skb_shared(skb)) { 1449 - struct sk_buff *nskb; 1450 - 1451 - nskb = pskb_copy(skb, GFP_KERNEL); 1452 - kfree_skb(skb); 1453 - skb = nskb; 1454 - err = -ENOMEM; 1455 - if (!skb) 1456 - goto out; 1457 - } 1458 - kfree_skb(skb_shinfo(skb)->frag_list); 1444 + frag = skb_shinfo(skb)->frag_list; 1459 1445 skb_shinfo(skb)->frag_list = NULL; 1460 1446 } 1461 1447 } ··· 1477 1491 siocb->scm->creds = *NETLINK_CREDS(skb); 1478 1492 if (flags & MSG_TRUNC) 1479 1493 copied = skb->len; 1494 + 1495 + #ifdef CONFIG_COMPAT_NETLINK_MESSAGES 1496 + skb_shinfo(skb)->frag_list = frag; 1497 + #endif 1480 1498 1481 1499 skb_free_datagram(sk, skb); 1482 1500
+12 -9
net/sched/act_gact.c
··· 152 152 static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 153 153 { 154 154 unsigned char *b = skb_tail_pointer(skb); 155 - struct tc_gact opt; 156 155 struct tcf_gact *gact = a->priv; 156 + struct tc_gact opt = { 157 + .index = gact->tcf_index, 158 + .refcnt = gact->tcf_refcnt - ref, 159 + .bindcnt = gact->tcf_bindcnt - bind, 160 + .action = gact->tcf_action, 161 + }; 157 162 struct tcf_t t; 158 163 159 - opt.index = gact->tcf_index; 160 - opt.refcnt = gact->tcf_refcnt - ref; 161 - opt.bindcnt = gact->tcf_bindcnt - bind; 162 - opt.action = gact->tcf_action; 163 164 NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt); 164 165 #ifdef CONFIG_GACT_PROB 165 166 if (gact->tcfg_ptype) { 166 - struct tc_gact_p p_opt; 167 - p_opt.paction = gact->tcfg_paction; 168 - p_opt.pval = gact->tcfg_pval; 169 - p_opt.ptype = gact->tcfg_ptype; 167 + struct tc_gact_p p_opt = { 168 + .paction = gact->tcfg_paction, 169 + .pval = gact->tcfg_pval, 170 + .ptype = gact->tcfg_ptype, 171 + }; 172 + 170 173 NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt); 171 174 } 172 175 #endif
+8 -7
net/sched/act_mirred.c
··· 219 219 { 220 220 unsigned char *b = skb_tail_pointer(skb); 221 221 struct tcf_mirred *m = a->priv; 222 - struct tc_mirred opt; 222 + struct tc_mirred opt = { 223 + .index = m->tcf_index, 224 + .action = m->tcf_action, 225 + .refcnt = m->tcf_refcnt - ref, 226 + .bindcnt = m->tcf_bindcnt - bind, 227 + .eaction = m->tcfm_eaction, 228 + .ifindex = m->tcfm_ifindex, 229 + }; 223 230 struct tcf_t t; 224 231 225 - opt.index = m->tcf_index; 226 - opt.action = m->tcf_action; 227 - opt.refcnt = m->tcf_refcnt - ref; 228 - opt.bindcnt = m->tcf_bindcnt - bind; 229 - opt.eaction = m->tcfm_eaction; 230 - opt.ifindex = m->tcfm_ifindex; 231 232 NLA_PUT(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt); 232 233 t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); 233 234 t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
+11 -11
net/sched/act_nat.c
··· 272 272 { 273 273 unsigned char *b = skb_tail_pointer(skb); 274 274 struct tcf_nat *p = a->priv; 275 - struct tc_nat opt; 275 + struct tc_nat opt = { 276 + .old_addr = p->old_addr, 277 + .new_addr = p->new_addr, 278 + .mask = p->mask, 279 + .flags = p->flags, 280 + 281 + .index = p->tcf_index, 282 + .action = p->tcf_action, 283 + .refcnt = p->tcf_refcnt - ref, 284 + .bindcnt = p->tcf_bindcnt - bind, 285 + }; 276 286 struct tcf_t t; 277 - 278 - opt.old_addr = p->old_addr; 279 - opt.new_addr = p->new_addr; 280 - opt.mask = p->mask; 281 - opt.flags = p->flags; 282 - 283 - opt.index = p->tcf_index; 284 - opt.action = p->tcf_action; 285 - opt.refcnt = p->tcf_refcnt - ref; 286 - opt.bindcnt = p->tcf_bindcnt - bind; 287 287 288 288 NLA_PUT(skb, TCA_NAT_PARMS, sizeof(opt), &opt); 289 289 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
+6 -5
net/sched/act_simple.c
··· 164 164 { 165 165 unsigned char *b = skb_tail_pointer(skb); 166 166 struct tcf_defact *d = a->priv; 167 - struct tc_defact opt; 167 + struct tc_defact opt = { 168 + .index = d->tcf_index, 169 + .refcnt = d->tcf_refcnt - ref, 170 + .bindcnt = d->tcf_bindcnt - bind, 171 + .action = d->tcf_action, 172 + }; 168 173 struct tcf_t t; 169 174 170 - opt.index = d->tcf_index; 171 - opt.refcnt = d->tcf_refcnt - ref; 172 - opt.bindcnt = d->tcf_bindcnt - bind; 173 - opt.action = d->tcf_action; 174 175 NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); 175 176 NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); 176 177 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
+6 -5
net/sched/act_skbedit.c
··· 159 159 { 160 160 unsigned char *b = skb_tail_pointer(skb); 161 161 struct tcf_skbedit *d = a->priv; 162 - struct tc_skbedit opt; 162 + struct tc_skbedit opt = { 163 + .index = d->tcf_index, 164 + .refcnt = d->tcf_refcnt - ref, 165 + .bindcnt = d->tcf_bindcnt - bind, 166 + .action = d->tcf_action, 167 + }; 163 168 struct tcf_t t; 164 169 165 - opt.index = d->tcf_index; 166 - opt.refcnt = d->tcf_refcnt - ref; 167 - opt.bindcnt = d->tcf_bindcnt - bind; 168 - opt.action = d->tcf_action; 169 170 NLA_PUT(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt); 170 171 if (d->flags & SKBEDIT_F_PRIORITY) 171 172 NLA_PUT(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority),
+5 -4
net/sunrpc/Kconfig
··· 18 18 If unsure, say N. 19 19 20 20 config RPCSEC_GSS_KRB5 21 - tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)" 22 - depends on SUNRPC && EXPERIMENTAL 21 + tristate 22 + depends on SUNRPC && CRYPTO 23 + prompt "Secure RPC: Kerberos V mechanism" if !(NFS_V4 || NFSD_V4) 24 + default y 23 25 select SUNRPC_GSS 24 - select CRYPTO 25 26 select CRYPTO_MD5 26 27 select CRYPTO_DES 27 28 select CRYPTO_CBC ··· 35 34 available from http://linux-nfs.org/. In addition, user-space 36 35 Kerberos support should be installed. 37 36 38 - If unsure, say N. 37 + If unsure, say Y. 39 38 40 39 config RPCSEC_GSS_SPKM3 41 40 tristate "Secure RPC: SPKM3 mechanism (EXPERIMENTAL)"
+2
net/sunrpc/xprtrdma/rpc_rdma.c
··· 249 249 req->rl_nchunks = nchunks; 250 250 251 251 BUG_ON(nchunks == 0); 252 + BUG_ON((r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR) 253 + && (nchunks > 3)); 252 254 253 255 /* 254 256 * finish off header. If write, marshal discrim and nchunks.
+17 -5
net/sunrpc/xprtrdma/verbs.c
··· 650 650 ep->rep_attr.cap.max_send_wr = cdata->max_requests; 651 651 switch (ia->ri_memreg_strategy) { 652 652 case RPCRDMA_FRMR: 653 - /* Add room for frmr register and invalidate WRs */ 654 - ep->rep_attr.cap.max_send_wr *= 3; 655 - if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) 656 - return -EINVAL; 653 + /* Add room for frmr register and invalidate WRs. 654 + * 1. FRMR reg WR for head 655 + * 2. FRMR invalidate WR for head 656 + * 3. FRMR reg WR for pagelist 657 + * 4. FRMR invalidate WR for pagelist 658 + * 5. FRMR reg WR for tail 659 + * 6. FRMR invalidate WR for tail 660 + * 7. The RDMA_SEND WR 661 + */ 662 + ep->rep_attr.cap.max_send_wr *= 7; 663 + if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) { 664 + cdata->max_requests = devattr.max_qp_wr / 7; 665 + if (!cdata->max_requests) 666 + return -EINVAL; 667 + ep->rep_attr.cap.max_send_wr = cdata->max_requests * 7; 668 + } 657 669 break; 658 670 case RPCRDMA_MEMWINDOWS_ASYNC: 659 671 case RPCRDMA_MEMWINDOWS: ··· 1502 1490 memset(&frmr_wr, 0, sizeof frmr_wr); 1503 1491 frmr_wr.opcode = IB_WR_FAST_REG_MR; 1504 1492 frmr_wr.send_flags = 0; /* unsignaled */ 1505 - frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma; 1493 + frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma; 1506 1494 frmr_wr.wr.fast_reg.page_list = seg1->mr_chunk.rl_mw->r.frmr.fr_pgl; 1507 1495 frmr_wr.wr.fast_reg.page_list_len = i; 1508 1496 frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
+22 -6
net/sunrpc/xprtsock.c
··· 1305 1305 if (!(xprt = xprt_from_sock(sk))) 1306 1306 goto out; 1307 1307 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); 1308 - dprintk("RPC: state %x conn %d dead %d zapped %d\n", 1308 + dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n", 1309 1309 sk->sk_state, xprt_connected(xprt), 1310 1310 sock_flag(sk, SOCK_DEAD), 1311 - sock_flag(sk, SOCK_ZAPPED)); 1311 + sock_flag(sk, SOCK_ZAPPED), 1312 + sk->sk_shutdown); 1312 1313 1313 1314 switch (sk->sk_state) { 1314 1315 case TCP_ESTABLISHED: ··· 1780 1779 { 1781 1780 unsigned int state = transport->inet->sk_state; 1782 1781 1783 - if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) 1784 - return; 1785 - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) 1786 - return; 1782 + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) { 1783 + /* we don't need to abort the connection if the socket 1784 + * hasn't undergone a shutdown 1785 + */ 1786 + if (transport->inet->sk_shutdown == 0) 1787 + return; 1788 + dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set to %d\n", 1789 + __func__, transport->inet->sk_shutdown); 1790 + } 1791 + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) { 1792 + /* we don't need to abort the connection if the socket 1793 + * hasn't undergone a shutdown 1794 + */ 1795 + if (transport->inet->sk_shutdown == 0) 1796 + return; 1797 + dprintk("RPC: %s: ESTABLISHED/SYN_SENT " 1798 + "sk_shutdown set to %d\n", 1799 + __func__, transport->inet->sk_shutdown); 1800 + } 1787 1801 xs_abort_connection(xprt, transport); 1788 1802 } 1789 1803
+1 -1
net/xfrm/xfrm_user.c
··· 2504 2504 if (p->dir > XFRM_POLICY_OUT) 2505 2505 return NULL; 2506 2506 2507 - xp = xfrm_policy_alloc(net, GFP_KERNEL); 2507 + xp = xfrm_policy_alloc(net, GFP_ATOMIC); 2508 2508 if (xp == NULL) { 2509 2509 *dir = -ENOBUFS; 2510 2510 return NULL;
+6 -1
scripts/recordmcount.pl
··· 159 159 my $function_regex; # Find the name of a function 160 160 # (return offset and func name) 161 161 my $mcount_regex; # Find the call site to mcount (return offset) 162 + my $mcount_adjust; # Address adjustment to mcount offset 162 163 my $alignment; # The .align value to use for $mcount_section 163 164 my $section_type; # Section header plus possible alignment command 164 165 my $can_use_local = 0; # If we can use local function references ··· 214 213 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 215 214 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; 216 215 $section_type = '@progbits'; 216 + $mcount_adjust = 0; 217 217 $type = ".long"; 218 218 219 219 if ($arch eq "x86_64") { ··· 353 351 } elsif ($arch eq "microblaze") { 354 352 # Microblaze calls '_mcount' instead of plain 'mcount'. 355 353 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; 354 + } elsif ($arch eq "blackfin") { 355 + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; 356 + $mcount_adjust = -4; 356 357 } else { 357 358 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; 358 359 } ··· 516 511 } 517 512 # is this a call site to mcount? If so, record it to print later 518 513 if ($text_found && /$mcount_regex/) { 519 - push(@offsets, hex $1); 514 + push(@offsets, (hex $1) + $mcount_adjust); 520 515 } 521 516 } 522 517
+2 -2
security/apparmor/lsm.c
··· 607 607 return error; 608 608 } 609 609 610 - static int apparmor_task_setrlimit(unsigned int resource, 611 - struct rlimit *new_rlim) 610 + static int apparmor_task_setrlimit(struct task_struct *task, 611 + unsigned int resource, struct rlimit *new_rlim) 612 612 { 613 613 struct aa_profile *profile = aa_current_profile(); 614 614 int error = 0;
+2 -7
security/apparmor/path.c
··· 62 62 int deleted, connected; 63 63 int error = 0; 64 64 65 - /* Get the root we want to resolve too */ 65 + /* Get the root we want to resolve too, released below */ 66 66 if (flags & PATH_CHROOT_REL) { 67 67 /* resolve paths relative to chroot */ 68 - read_lock(&current->fs->lock); 69 - root = current->fs->root; 70 - /* released below */ 71 - path_get(&root); 72 - read_unlock(&current->fs->lock); 68 + get_fs_root(current->fs, &root); 73 69 } else { 74 70 /* resolve paths relative to namespace */ 75 71 root.mnt = current->nsproxy->mnt_ns->root; 76 72 root.dentry = root.mnt->mnt_root; 77 - /* released below */ 78 73 path_get(&root); 79 74 } 80 75
+1 -1
security/commoncap.c
··· 40 40 * 41 41 * Warn if that happens, once per boot. 42 42 */ 43 - static void warn_setuid_and_fcaps_mixed(char *fname) 43 + static void warn_setuid_and_fcaps_mixed(const char *fname) 44 44 { 45 45 static int warned; 46 46 if (!warned) {
+6 -3
security/selinux/hooks.c
··· 2170 2170 2171 2171 tty = get_current_tty(); 2172 2172 if (tty) { 2173 - file_list_lock(); 2173 + spin_lock(&tty_files_lock); 2174 2174 if (!list_empty(&tty->tty_files)) { 2175 + struct tty_file_private *file_priv; 2175 2176 struct inode *inode; 2176 2177 2177 2178 /* Revalidate access to controlling tty. ··· 2180 2179 than using file_has_perm, as this particular open 2181 2180 file may belong to another process and we are only 2182 2181 interested in the inode-based check here. */ 2183 - file = list_first_entry(&tty->tty_files, struct file, f_u.fu_list); 2182 + file_priv = list_first_entry(&tty->tty_files, 2183 + struct tty_file_private, list); 2184 + file = file_priv->file; 2184 2185 inode = file->f_path.dentry->d_inode; 2185 2186 if (inode_has_perm(cred, inode, 2186 2187 FILE__READ | FILE__WRITE, NULL)) { 2187 2188 drop_tty = 1; 2188 2189 } 2189 2190 } 2190 - file_list_unlock(); 2191 + spin_unlock(&tty_files_lock); 2191 2192 tty_kref_put(tty); 2192 2193 } 2193 2194 /* Reset controlling tty. */
+4
sound/core/pcm_native.c
··· 978 978 { 979 979 if (substream->runtime->trigger_master != substream) 980 980 return 0; 981 + /* some drivers might use hw_ptr to recover from the pause - 982 + update the hw_ptr now */ 983 + if (push) 984 + snd_pcm_update_hw_ptr(substream); 981 985 /* The jiffies check in snd_pcm_update_hw_ptr*() is done by 982 986 * a delta betwen the current jiffies, this gives a large enough 983 987 * delta, effectively to skip the check once.
+4
sound/pci/emu10k1/emu10k1.c
··· 52 52 static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 53 53 static int enable_ir[SNDRV_CARDS]; 54 54 static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 55 + static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 55 56 56 57 module_param_array(index, int, NULL, 0444); 57 58 MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); ··· 74 73 MODULE_PARM_DESC(enable_ir, "Enable IR."); 75 74 module_param_array(subsystem, uint, NULL, 0444); 76 75 MODULE_PARM_DESC(subsystem, "Force card subsystem model."); 76 + module_param_array(delay_pcm_irq, uint, NULL, 0444); 77 + MODULE_PARM_DESC(delay_pcm_irq, "Delay PCM interrupt by specified number of samples (default 0)."); 77 78 /* 78 79 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 79 80 */ ··· 130 127 &emu)) < 0) 131 128 goto error; 132 129 card->private_data = emu; 130 + emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f; 133 131 if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0) 134 132 goto error; 135 133 if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0)
+26 -4
sound/pci/emu10k1/emupcm.c
··· 332 332 evoice->epcm->ccca_start_addr = start_addr + ccis; 333 333 if (extra) { 334 334 start_addr += ccis; 335 - end_addr += ccis; 335 + end_addr += ccis + emu->delay_pcm_irq; 336 336 } 337 337 if (stereo && !extra) { 338 338 snd_emu10k1_ptr_write(emu, CPF, voice, CPF_STEREO_MASK); ··· 360 360 /* Assumption that PT is already 0 so no harm overwriting */ 361 361 snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]); 362 362 snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24)); 363 - snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24)); 363 + snd_emu10k1_ptr_write(emu, PSST, voice, 364 + (start_addr + (extra ? emu->delay_pcm_irq : 0)) | 365 + (send_amount[2] << 24)); 364 366 if (emu->card_capabilities->emu_model) 365 367 pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */ 366 368 else ··· 734 732 snd_emu10k1_ptr_write(emu, IP, voice, 0); 735 733 } 736 734 735 + static inline void snd_emu10k1_playback_mangle_extra(struct snd_emu10k1 *emu, 736 + struct snd_emu10k1_pcm *epcm, 737 + struct snd_pcm_substream *substream, 738 + struct snd_pcm_runtime *runtime) 739 + { 740 + unsigned int ptr, period_pos; 741 + 742 + /* try to sychronize the current position for the interrupt 743 + source voice */ 744 + period_pos = runtime->status->hw_ptr - runtime->hw_ptr_interrupt; 745 + period_pos %= runtime->period_size; 746 + ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number); 747 + ptr &= ~0x00ffffff; 748 + ptr |= epcm->ccca_start_addr + period_pos; 749 + snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr); 750 + } 751 + 737 752 static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, 738 753 int cmd) 739 754 { ··· 772 753 /* follow thru */ 773 754 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 774 755 case SNDRV_PCM_TRIGGER_RESUME: 756 + if (cmd == SNDRV_PCM_TRIGGER_PAUSE_RELEASE) 757 + snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime); 775 758 mix = &emu->pcm_mixer[substream->number]; 776 759 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix); 777 760 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix); ··· 890 869 #endif 891 870 /* 892 871 printk(KERN_DEBUG 893 - "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", 894 - ptr, runtime->buffer_size, runtime->period_size); 872 + "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n", 873 + (long)ptr, (long)runtime->buffer_size, 874 + (long)runtime->period_size); 895 875 */ 896 876 return ptr; 897 877 }
+3 -1
sound/pci/emu10k1/memory.c
··· 310 310 if (snd_BUG_ON(!hdr)) 311 311 return NULL; 312 312 313 + idx = runtime->period_size >= runtime->buffer_size ? 314 + (emu->delay_pcm_irq * 2) : 0; 313 315 mutex_lock(&hdr->block_mutex); 314 - blk = search_empty(emu, runtime->dma_bytes); 316 + blk = search_empty(emu, runtime->dma_bytes + idx); 315 317 if (blk == NULL) { 316 318 mutex_unlock(&hdr->block_mutex); 317 319 return NULL;
+1
sound/pci/hda/patch_conexant.c
··· 3049 3049 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", 3050 3050 CXT5066_DELL_LAPTOP), 3051 3051 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), 3052 + SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTO), 3052 3053 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), 3053 3054 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), 3054 3055 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
+144 -32
sound/pci/hda/patch_realtek.c
··· 19030 19030 /* 19031 19031 * ALC680 support 19032 19032 */ 19033 + #define ALC680_DIGIN_NID ALC880_DIGIN_NID 19033 19034 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID 19034 19035 #define alc680_modes alc260_modes 19035 19036 ··· 19045 19044 0x07, 0x08, 0x09 19046 19045 }; 19047 19046 19047 + /* 19048 + * Analog capture ADC cgange 19049 + */ 19050 + static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, 19051 + struct hda_codec *codec, 19052 + unsigned int stream_tag, 19053 + unsigned int format, 19054 + struct snd_pcm_substream *substream) 19055 + { 19056 + struct alc_spec *spec = codec->spec; 19057 + struct auto_pin_cfg *cfg = &spec->autocfg; 19058 + unsigned int pre_mic, pre_line; 19059 + 19060 + pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); 19061 + pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]); 19062 + 19063 + spec->cur_adc_stream_tag = stream_tag; 19064 + spec->cur_adc_format = format; 19065 + 19066 + if (pre_mic || pre_line) { 19067 + if (pre_mic) 19068 + snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0, 19069 + format); 19070 + else 19071 + snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0, 19072 + format); 19073 + } else 19074 + snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format); 19075 + return 0; 19076 + } 19077 + 19078 + static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, 19079 + struct hda_codec *codec, 19080 + struct snd_pcm_substream *substream) 19081 + { 19082 + snd_hda_codec_cleanup_stream(codec, 0x07); 19083 + snd_hda_codec_cleanup_stream(codec, 0x08); 19084 + snd_hda_codec_cleanup_stream(codec, 0x09); 19085 + return 0; 19086 + } 19087 + 19088 + static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { 19089 + .substreams = 1, /* can be overridden */ 19090 + .channels_min = 2, 19091 + .channels_max = 2, 19092 + /* NID is set in alc_build_pcms */ 19093 + .ops = { 19094 + .prepare = alc680_capture_pcm_prepare, 19095 + .cleanup = alc680_capture_pcm_cleanup 19096 + }, 19097 + }; 19098 + 19048 19099 static struct snd_kcontrol_new alc680_base_mixer[] = { 19049 19100 /* output mixer control */ 19050 19101 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 19051 19102 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 19052 19103 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), 19053 19104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), 19105 + HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), 19054 19106 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 19107 + HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), 19055 19108 { } 19056 19109 }; 19057 19110 19058 - static struct snd_kcontrol_new alc680_capture_mixer[] = { 19059 - HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 19060 - HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 19061 - HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), 19062 - HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), 19063 - HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), 19064 - HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), 19111 + static struct hda_bind_ctls alc680_bind_cap_vol = { 19112 + .ops = &snd_hda_bind_vol, 19113 + .values = { 19114 + HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), 19115 + HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), 19116 + HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), 19117 + 0 19118 + }, 19119 + }; 19120 + 19121 + static struct hda_bind_ctls alc680_bind_cap_switch = { 19122 + .ops = &snd_hda_bind_sw, 19123 + .values = { 19124 + HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), 19125 + HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), 19126 + HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), 19127 + 0 19128 + }, 19129 + }; 19130 + 19131 + static struct snd_kcontrol_new alc680_master_capture_mixer[] = { 19132 + HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), 19133 + HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), 19065 19134 { } /* end */ 19066 19135 }; 19067 19136 ··· 19139 19068 * generic initialization of ADC, input mixers and output mixers 19140 19069 */ 19141 19070 static struct hda_verb alc680_init_verbs[] = { 19142 - /* Unmute DAC0-1 and set vol = 0 */ 19143 - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19144 - {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19145 - {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19071 + {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19072 + {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19073 + {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19146 19074 19147 - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19148 - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19149 - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 19150 - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 19151 - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 19075 + {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 19076 + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 19077 + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 19078 + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 19079 + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 19080 + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 19152 19081 19153 19082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19154 19083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19155 19084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19156 19085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19157 19086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19087 + 19088 + {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 19089 + {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, 19090 + 19158 19091 { } 19159 19092 }; 19093 + 19094 + /* toggle speaker-output according to the hp-jack state */ 19095 + static void alc680_base_setup(struct hda_codec *codec) 19096 + { 19097 + struct alc_spec *spec = codec->spec; 19098 + 19099 + spec->autocfg.hp_pins[0] = 0x16; 19100 + spec->autocfg.speaker_pins[0] = 0x14; 19101 + spec->autocfg.speaker_pins[1] = 0x15; 19102 + spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18; 19103 + spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19; 19104 + } 19105 + 19106 + static void alc680_rec_autoswitch(struct hda_codec *codec) 19107 + { 19108 + struct alc_spec *spec = codec->spec; 19109 + struct auto_pin_cfg *cfg = &spec->autocfg; 19110 + unsigned int present; 19111 + hda_nid_t new_adc; 19112 + 19113 + present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); 19114 + 19115 + new_adc = present ? 0x8 : 0x7; 19116 + __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1); 19117 + snd_hda_codec_setup_stream(codec, new_adc, 19118 + spec->cur_adc_stream_tag, 0, 19119 + spec->cur_adc_format); 19120 + 19121 + } 19122 + 19123 + static void alc680_unsol_event(struct hda_codec *codec, 19124 + unsigned int res) 19125 + { 19126 + if ((res >> 26) == ALC880_HP_EVENT) 19127 + alc_automute_amp(codec); 19128 + if ((res >> 26) == ALC880_MIC_EVENT) 19129 + alc680_rec_autoswitch(codec); 19130 + } 19131 + 19132 + static void alc680_inithook(struct hda_codec *codec) 19133 + { 19134 + alc_automute_amp(codec); 19135 + alc680_rec_autoswitch(codec); 19136 + } 19160 19137 19161 19138 /* create input playback/capture controls for the given pin */ 19162 19139 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, ··· 19316 19197 #define alc680_pcm_analog_capture alc880_pcm_analog_capture 19317 19198 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture 19318 19199 #define alc680_pcm_digital_playback alc880_pcm_digital_playback 19319 - 19320 - static struct hda_input_mux alc680_capture_source = { 19321 - .num_items = 1, 19322 - .items = { 19323 - { "Mic", 0x0 }, 19324 - }, 19325 - }; 19200 + #define alc680_pcm_digital_capture alc880_pcm_digital_capture 19326 19201 19327 19202 /* 19328 19203 * BIOS auto configuration ··· 19331 19218 alc680_ignore); 19332 19219 if (err < 0) 19333 19220 return err; 19221 + 19334 19222 if (!spec->autocfg.line_outs) { 19335 19223 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { 19336 19224 spec->multiout.max_channels = 2; ··· 19353 19239 add_mixer(spec, spec->kctls.list); 19354 19240 19355 19241 add_verb(spec, alc680_init_verbs); 19356 - spec->num_mux_defs = 1; 19357 - spec->input_mux = &alc680_capture_source; 19358 19242 19359 19243 err = alc_auto_add_mic_boost(codec); 19360 19244 if (err < 0) ··· 19391 19279 static struct alc_config_preset alc680_presets[] = { 19392 19280 [ALC680_BASE] = { 19393 19281 .mixers = { alc680_base_mixer }, 19394 - .cap_mixer = alc680_capture_mixer, 19282 + .cap_mixer = alc680_master_capture_mixer, 19395 19283 .init_verbs = { alc680_init_verbs }, 19396 19284 .num_dacs = ARRAY_SIZE(alc680_dac_nids), 19397 19285 .dac_nids = alc680_dac_nids, 19398 - .num_adc_nids = ARRAY_SIZE(alc680_adc_nids), 19399 - .adc_nids = alc680_adc_nids, 19400 - .hp_nid = 0x04, 19401 19286 .dig_out_nid = ALC680_DIGOUT_NID, 19402 19287 .num_channel_mode = ARRAY_SIZE(alc680_modes), 19403 19288 .channel_mode = alc680_modes, 19404 - .input_mux = &alc680_capture_source, 19289 + .unsol_event = alc680_unsol_event, 19290 + .setup = alc680_base_setup, 19291 + .init_hook = alc680_inithook, 19292 + 19405 19293 }, 19406 19294 }; 19407 19295 ··· 19445 19333 setup_preset(codec, &alc680_presets[board_config]); 19446 19334 19447 19335 spec->stream_analog_playback = &alc680_pcm_analog_playback; 19448 - spec->stream_analog_capture = &alc680_pcm_analog_capture; 19449 - spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture; 19336 + spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; 19450 19337 spec->stream_digital_playback = &alc680_pcm_digital_playback; 19338 + spec->stream_digital_capture = &alc680_pcm_digital_capture; 19451 19339 19452 19340 if (!spec->adc_nids) { 19453 19341 spec->adc_nids = alc680_adc_nids;
+5 -6
sound/pci/riptide/riptide.c
··· 1224 1224 firmware.firmware.ASIC, firmware.firmware.CODEC, 1225 1225 firmware.firmware.AUXDSP, firmware.firmware.PROG); 1226 1226 1227 + if (!chip) 1228 + return 1; 1229 + 1227 1230 for (i = 0; i < FIRMWARE_VERSIONS; i++) { 1228 1231 if (!memcmp(&firmware_versions[i], &firmware, sizeof(firmware))) 1229 - break; 1230 - } 1231 - if (i >= FIRMWARE_VERSIONS) 1232 - return 0; /* no match */ 1232 + return 1; /* OK */ 1233 1233 1234 - if (!chip) 1235 - return 1; /* OK */ 1234 + } 1236 1235 1237 1236 snd_printdd("Writing Firmware\n"); 1238 1237 if (!chip->fw_entry) {
-7
sound/soc/codecs/wm8776.c
··· 178 178 case SND_SOC_DAIFMT_LEFT_J: 179 179 iface |= 0x0001; 180 180 break; 181 - /* FIXME: CHECK A/B */ 182 - case SND_SOC_DAIFMT_DSP_A: 183 - iface |= 0x0003; 184 - break; 185 - case SND_SOC_DAIFMT_DSP_B: 186 - iface |= 0x0007; 187 - break; 188 181 default: 189 182 return -EINVAL; 190 183 }
+10 -6
tools/perf/Makefile
··· 157 157 # 158 158 # Define NO_DWARF if you do not want debug-info analysis feature at all. 159 159 160 - $(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null) 161 - $(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null) 162 - $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null) 163 - 164 160 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 165 161 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 166 162 -include $(OUTPUT)PERF-VERSION-FILE ··· 181 185 ifeq ($(ARCH),x86_64) 182 186 ARCH := x86 183 187 endif 184 - 185 - $(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null) 186 188 187 189 # CFLAGS and LDFLAGS are for the users to override from the command line. 188 190 ··· 262 268 CC = $(CROSS_COMPILE)gcc 263 269 AR = $(CROSS_COMPILE)ar 264 270 RM = rm -f 271 + MKDIR = mkdir 265 272 TAR = tar 266 273 FIND = find 267 274 INSTALL = install ··· 833 838 QUIET_CC = @echo ' ' CC $@; 834 839 QUIET_AR = @echo ' ' AR $@; 835 840 QUIET_LINK = @echo ' ' LINK $@; 841 + QUIET_MKDIR = @echo ' ' MKDIR $@; 836 842 QUIET_BUILT_IN = @echo ' ' BUILTIN $@; 837 843 QUIET_GEN = @echo ' ' GEN $@; 838 844 QUIET_SUBDIR0 = +@subdir= ··· 1007 1011 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) 1008 1012 $(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) 1009 1013 builtin-revert.o wt-status.o: wt-status.h 1014 + 1015 + # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So 1016 + # we depend the various files onto their directories. 1017 + DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h 1018 + $(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS))) 1019 + # In the second step, we make a rule to actually create these directories 1020 + $(sort $(dir $(DIRECTORY_DEPS))): 1021 + $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null 1010 1022 1011 1023 $(LIB_FILE): $(LIB_OBJS) 1012 1024 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
+2 -1
tools/perf/util/ui/browsers/annotate.c
··· 146 146 return -1; 147 147 148 148 newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); 149 + newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT); 149 150 150 151 nd = self->curr_hot; 151 152 if (nd) { ··· 179 178 } 180 179 out: 181 180 ui_browser__hide(&self->b); 182 - return 0; 181 + return es->u.key; 183 182 } 184 183 185 184 int hist_entry__tui_annotate(struct hist_entry *self)