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

Merge branch 'linus' into sched/devel

+2439 -1438
+1 -1
Documentation/DMA-mapping.txt
··· 740 740 dma_addr_t dma_handle; 741 741 742 742 dma_handle = pci_map_single(pdev, addr, size, direction); 743 - if (pci_dma_mapping_error(dma_handle)) { 743 + if (pci_dma_mapping_error(pdev, dma_handle)) { 744 744 /* 745 745 * reduce current DMA mapping usage, 746 746 * delay and try again later or
+2 -1
Documentation/HOWTO
··· 77 77 When a kernel change causes the interface that the kernel exposes to 78 78 userspace to change, it is recommended that you send the information or 79 79 a patch to the manual pages explaining the change to the manual pages 80 - maintainer at mtk.manpages@gmail.com. 80 + maintainer at mtk.manpages@gmail.com, and CC the list 81 + linux-api@vger.kernel.org. 81 82 82 83 Here is a list of files that are in the kernel source tree that are 83 84 required reading:
+2
Documentation/SubmitChecklist
··· 67 67 68 68 19: All new userspace interfaces are documented in Documentation/ABI/. 69 69 See Documentation/ABI/README for more information. 70 + Patches that change userspace interfaces should be CCed to 71 + linux-api@vger.kernel.org. 70 72 71 73 20: Check that it all passes `make headers_check'. 72 74
+2 -2
Documentation/ioctl/cdrom.txt
··· 271 271 272 272 usage: 273 273 274 - ioctl(fd, CDROMEJECT, 0); 274 + ioctl(fd, CDROMCLOSETRAY, 0); 275 275 276 276 inputs: none 277 277 278 278 outputs: none 279 279 280 280 error returns: 281 - ENOSYS cd drive not capable of ejecting 281 + ENOSYS cd drive not capable of closing the tray 282 282 EBUSY other processes are accessing drive, or door is locked 283 283 284 284 notes:
+4 -3
Documentation/sysctl/kernel.txt
··· 351 351 352 352 softlockup_thresh: 353 353 354 - This value can be used to lower the softlockup tolerance 355 - threshold. The default threshold is 10s. If a cpu is locked up 356 - for 10s, the kernel complains. Valid values are 1-60s. 354 + This value can be used to lower the softlockup tolerance threshold. The 355 + default threshold is 60 seconds. If a cpu is locked up for 60 seconds, 356 + the kernel complains. Valid values are 1-60 seconds. Setting this 357 + tunable to zero will disable the softlockup detection altogether. 357 358 358 359 ============================================================== 359 360
+12
Documentation/usb/anchors.txt
··· 42 42 are called in the reverse temporal order they were submitted. 43 43 This way no data can be reordered. 44 44 45 + usb_unlink_anchored_urbs() 46 + -------------------------- 47 + 48 + This function unlinks all URBs associated with an anchor. The URBs 49 + are processed in the reverse temporal order they were submitted. 50 + This is similar to usb_kill_anchored_urbs(), but it will not sleep. 51 + Therefore no guarantee is made that the URBs have been unlinked when 52 + the call returns. They may be unlinked later but will be unlinked in 53 + finite time. 54 + 45 55 usb_wait_anchor_empty_timeout() 46 56 ------------------------------- 47 57 48 58 This function waits for all URBs associated with an anchor to finish 49 59 or a timeout, whichever comes first. Its return value will tell you 50 60 whether the timeout was reached. 61 + 62 +
+5 -5
MAINTAINERS
··· 1198 1198 S: Maintained 1199 1199 1200 1200 CPUSETS 1201 - P: Paul Jackson 1202 1201 P: Paul Menage 1203 - M: pj@sgi.com 1204 1202 M: menage@google.com 1205 1203 L: linux-kernel@vger.kernel.org 1206 1204 W: http://www.bullopensource.org/cpuset/ ··· 1982 1984 I2C/SMBUS STUB DRIVER 1983 1985 P: Mark M. Hoffman 1984 1986 M: mhoffman@lightlink.com 1985 - L: lm-sensors@lm-sensors.org 1987 + L: i2c@lm-sensors.org 1986 1988 S: Maintained 1987 1989 1988 1990 I2C SUBSYSTEM ··· 2704 2706 P: Michael Kerrisk 2705 2707 M: mtk.manpages@gmail.com 2706 2708 W: http://www.kernel.org/doc/man-pages 2709 + L: linux-man@vger.kernel.org 2707 2710 S: Supported 2708 2711 2709 2712 MARVELL LIBERTAS WIRELESS DRIVER ··· 3725 3726 SIS 96X I2C/SMBUS DRIVER 3726 3727 P: Mark M. Hoffman 3727 3728 M: mhoffman@lightlink.com 3728 - L: lm-sensors@lm-sensors.org 3729 + L: i2c@lm-sensors.org 3729 3730 S: Maintained 3730 3731 3731 3732 SIS FRAMEBUFFER DRIVER ··· 3832 3833 3833 3834 SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT 3834 3835 P: Liam Girdwood 3835 - M: liam.girdwood@wolfsonmicro.com 3836 + M: lrg@slimlogic.co.uk 3836 3837 P: Mark Brown 3837 3838 M: broonie@opensource.wolfsonmicro.com 3838 3839 T: git opensource.wolfsonmicro.com/linux-2.6-asoc 3839 3840 L: alsa-devel@alsa-project.org (subscribers-only) 3841 + W: http://alsa-project.org/main/index.php/ASoC 3840 3842 S: Supported 3841 3843 3842 3844 SPI SUBSYSTEM
+1 -1
Makefile
··· 1 1 VERSION = 2 2 2 PATCHLEVEL = 6 3 3 SUBLEVEL = 27 4 - EXTRAVERSION = -rc7 4 + EXTRAVERSION = -rc8 5 5 NAME = Rotary Wombat 6 6 7 7 # *DOCUMENTATION*
+24 -22
arch/arm/include/asm/cnt32_to_63.h include/linux/cnt32_to_63.h
··· 1 1 /* 2 - * include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits 2 + * Extend a 32-bit counter to 63 bits 3 3 * 4 4 * Author: Nicolas Pitre 5 5 * Created: December 3, 2006 ··· 10 10 * as published by the Free Software Foundation. 11 11 */ 12 12 13 - #ifndef __INCLUDE_CNT32_TO_63_H__ 14 - #define __INCLUDE_CNT32_TO_63_H__ 13 + #ifndef __LINUX_CNT32_TO_63_H__ 14 + #define __LINUX_CNT32_TO_63_H__ 15 15 16 16 #include <linux/compiler.h> 17 - #include <asm/types.h> 17 + #include <linux/types.h> 18 18 #include <asm/byteorder.h> 19 19 20 - /* 21 - * Prototype: u64 cnt32_to_63(u32 cnt) 20 + /* this is used only to give gcc a clue about good code generation */ 21 + union cnt32_to_63 { 22 + struct { 23 + #if defined(__LITTLE_ENDIAN) 24 + u32 lo, hi; 25 + #elif defined(__BIG_ENDIAN) 26 + u32 hi, lo; 27 + #endif 28 + }; 29 + u64 val; 30 + }; 31 + 32 + 33 + /** 34 + * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter 35 + * @cnt_lo: The low part of the counter 36 + * 22 37 * Many hardware clock counters are only 32 bits wide and therefore have 23 38 * a relatively short period making wrap-arounds rather frequent. This 24 39 * is a problem when implementing sched_clock() for example, where a 64-bit ··· 66 51 * clear-bit instruction. Otherwise caller must remember to clear the top 67 52 * bit explicitly. 68 53 */ 69 - 70 - /* this is used only to give gcc a clue about good code generation */ 71 - typedef union { 72 - struct { 73 - #if defined(__LITTLE_ENDIAN) 74 - u32 lo, hi; 75 - #elif defined(__BIG_ENDIAN) 76 - u32 hi, lo; 77 - #endif 78 - }; 79 - u64 val; 80 - } cnt32_to_63_t; 81 - 82 54 #define cnt32_to_63(cnt_lo) \ 83 55 ({ \ 84 - static volatile u32 __m_cnt_hi = 0; \ 85 - cnt32_to_63_t __x; \ 56 + static volatile u32 __m_cnt_hi; \ 57 + union cnt32_to_63 __x; \ 86 58 __x.hi = __m_cnt_hi; \ 87 59 __x.lo = (cnt_lo); \ 88 - if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ 60 + if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ 89 61 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ 90 62 __x.val; \ 91 63 })
-2
arch/arm/kernel/kgdb.c
··· 111 111 case 'D': 112 112 case 'k': 113 113 case 'c': 114 - kgdb_contthread = NULL; 115 - 116 114 /* 117 115 * Try to read optional parameter, pc unchanged if no parm. 118 116 * If this was a compiled breakpoint, we need to move
+1 -1
arch/arm/mach-pxa/time.c
··· 17 17 #include <linux/interrupt.h> 18 18 #include <linux/clockchips.h> 19 19 #include <linux/sched.h> 20 + #include <linux/cnt32_to_63.h> 20 21 21 22 #include <asm/div64.h> 22 - #include <asm/cnt32_to_63.h> 23 23 #include <asm/mach/irq.h> 24 24 #include <asm/mach/time.h> 25 25 #include <mach/pxa-regs.h>
+1 -1
arch/arm/mach-sa1100/generic.c
··· 18 18 #include <linux/ioport.h> 19 19 #include <linux/sched.h> /* just for sched_clock() - funny that */ 20 20 #include <linux/platform_device.h> 21 + #include <linux/cnt32_to_63.h> 21 22 22 23 #include <asm/div64.h> 23 - #include <asm/cnt32_to_63.h> 24 24 #include <mach/hardware.h> 25 25 #include <asm/system.h> 26 26 #include <asm/pgtable.h>
+1 -1
arch/arm/mach-versatile/core.c
··· 28 28 #include <linux/amba/clcd.h> 29 29 #include <linux/clocksource.h> 30 30 #include <linux/clockchips.h> 31 + #include <linux/cnt32_to_63.h> 31 32 32 - #include <asm/cnt32_to_63.h> 33 33 #include <asm/system.h> 34 34 #include <mach/hardware.h> 35 35 #include <asm/io.h>
+3
arch/ia64/include/asm/sections.h
··· 11 11 #include <asm-generic/sections.h> 12 12 13 13 extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[]; 14 + #ifdef CONFIG_SMP 15 + extern char __cpu0_per_cpu[]; 16 + #endif 14 17 extern char __start___vtop_patchlist[], __end___vtop_patchlist[]; 15 18 extern char __start___rse_patchlist[], __end___rse_patchlist[]; 16 19 extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[];
+3 -2
arch/ia64/kernel/efi.c
··· 1232 1232 if (md->attribute & EFI_MEMORY_WP) { 1233 1233 name = "System ROM"; 1234 1234 flags |= IORESOURCE_READONLY; 1235 - } else { 1235 + } else if (md->attribute == EFI_MEMORY_UC) 1236 + name = "Uncached RAM"; 1237 + else 1236 1238 name = "System RAM"; 1237 - } 1238 1239 break; 1239 1240 1240 1241 case EFI_ACPI_MEMORY_NVS:
+5 -4
arch/ia64/kernel/head.S
··· 367 367 ;; 368 368 #else 369 369 (isAP) br.few 2f 370 - mov r20=r19 371 - sub r19=r19,r18 370 + movl r20=__cpu0_per_cpu 372 371 ;; 373 372 shr.u r18=r18,3 374 373 1: 375 - ld8 r21=[r20],8;; 376 - st8[r19]=r21,8 374 + ld8 r21=[r19],8;; 375 + st8[r20]=r21,8 377 376 adds r18=-1,r18;; 378 377 cmp4.lt p7,p6=0,r18 379 378 (p7) br.cond.dptk.few 1b 379 + mov r19=r20 380 + ;; 380 381 2: 381 382 #endif 382 383 tpa r19=r19
+2
arch/ia64/kernel/setup.c
··· 616 616 ia64_mca_init(); 617 617 618 618 platform_setup(cmdline_p); 619 + #ifndef CONFIG_IA64_HP_SIM 619 620 check_sal_cache_flush(); 621 + #endif 620 622 paging_init(); 621 623 } 622 624
+5 -3
arch/ia64/kernel/vmlinux.lds.S
··· 215 215 /* Per-cpu data: */ 216 216 percpu : { } :percpu 217 217 . = ALIGN(PERCPU_PAGE_SIZE); 218 - #ifdef CONFIG_SMP 219 - . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ 220 - #endif 221 218 __phys_per_cpu_start = .; 222 219 .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET) 223 220 { ··· 230 233 data : { } :data 231 234 .data : AT(ADDR(.data) - LOAD_OFFSET) 232 235 { 236 + #ifdef CONFIG_SMP 237 + . = ALIGN(PERCPU_PAGE_SIZE); 238 + __cpu0_per_cpu = .; 239 + . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ 240 + #endif 233 241 DATA_DATA 234 242 *(.data1) 235 243 *(.gnu.linkonce.d*)
+1 -1
arch/ia64/mm/contig.c
··· 163 163 * get_zeroed_page(). 164 164 */ 165 165 if (first_time) { 166 - void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE; 166 + void *cpu0_data = __cpu0_per_cpu; 167 167 168 168 first_time=0; 169 169
+1 -1
arch/ia64/mm/discontig.c
··· 144 144 145 145 for_each_possible_early_cpu(cpu) { 146 146 if (cpu == 0) { 147 - void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE; 147 + void *cpu0_data = __cpu0_per_cpu; 148 148 __per_cpu_offset[cpu] = (char*)cpu0_data - 149 149 __per_cpu_start; 150 150 } else if (node == node_cpuid[cpu].nid) {
+1 -9
arch/m32r/Kconfig
··· 216 216 default "01000000" if PLAT_M32104UT 217 217 default "00800000" if PLAT_OAKS32R 218 218 219 - config NOHIGHMEM 220 - bool 221 - default y 222 - 223 219 config ARCH_DISCONTIGMEM_ENABLE 224 220 bool "Internal RAM Support" 225 221 depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104 ··· 406 410 source "drivers/pci/Kconfig" 407 411 408 412 config ISA 409 - bool "ISA support" 410 - help 411 - Find out whether you have ISA slots on your motherboard. ISA is the 412 - name of a bus system, i.e. the way the CPU talks to the other stuff 413 - inside your box. If you have ISA, say Y, otherwise N. 413 + bool 414 414 415 415 source "drivers/pcmcia/Kconfig" 416 416
+1 -1
arch/m32r/kernel/entry.S
··· 143 143 and3 r4, r4, #0x8000 ; check BSM bit 144 144 #endif 145 145 beqz r4, resume_kernel 146 - ENTRY(resume_userspace) 146 + resume_userspace: 147 147 DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt 148 148 ; setting need_resched or sigpending 149 149 ; between sampling and the iret
-1
arch/m32r/kernel/head.S
··· 29 29 .global _end 30 30 ENTRY(stext) 31 31 ENTRY(_stext) 32 - ENTRY(startup_32) 33 32 /* Setup up the stack pointer */ 34 33 LDIMM (r0, spi_stack_top) 35 34 LDIMM (r1, spu_stack_top)
-6
arch/m32r/kernel/irq.c
··· 22 22 #include <linux/module.h> 23 23 #include <asm/uaccess.h> 24 24 25 - atomic_t irq_err_count; 26 - atomic_t irq_mis_count; 27 - 28 25 /* 29 26 * Generic, controller-independent functions: 30 27 */ ··· 60 63 seq_putc(p, '\n'); 61 64 skip: 62 65 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 63 - } else if (i == NR_IRQS) { 64 - seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 65 - seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); 66 66 } 67 67 return 0; 68 68 }
+2
arch/m32r/kernel/m32r_ksyms.c
··· 14 14 #include <asm/delay.h> 15 15 #include <asm/irq.h> 16 16 #include <asm/tlbflush.h> 17 + #include <asm/pgtable.h> 17 18 18 19 /* platform dependent support */ 19 20 EXPORT_SYMBOL(boot_cpu_data); ··· 66 65 EXPORT_SYMBOL(copy_page); 67 66 EXPORT_SYMBOL(clear_page); 68 67 EXPORT_SYMBOL(strlen); 68 + EXPORT_SYMBOL(empty_zero_page); 69 69 70 70 EXPORT_SYMBOL(_inb); 71 71 EXPORT_SYMBOL(_inw);
+2 -28
arch/m32r/kernel/process.c
··· 35 35 36 36 #include <linux/err.h> 37 37 38 - static int hlt_counter=0; 39 - 40 38 /* 41 39 * Return saved PC of a blocked thread. 42 40 */ ··· 46 48 /* 47 49 * Powermanagement idle function, if any.. 48 50 */ 49 - void (*pm_idle)(void) = NULL; 50 - EXPORT_SYMBOL(pm_idle); 51 + static void (*pm_idle)(void) = NULL; 51 52 52 53 void (*pm_power_off)(void) = NULL; 53 54 EXPORT_SYMBOL(pm_power_off); 54 - 55 - void disable_hlt(void) 56 - { 57 - hlt_counter++; 58 - } 59 - 60 - EXPORT_SYMBOL(disable_hlt); 61 - 62 - void enable_hlt(void) 63 - { 64 - hlt_counter--; 65 - } 66 - 67 - EXPORT_SYMBOL(enable_hlt); 68 55 69 56 /* 70 57 * We use this is we don't have any better 71 58 * idle routine.. 72 59 */ 73 - void default_idle(void) 60 + static void default_idle(void) 74 61 { 75 62 /* M32R_FIXME: Please use "cpu_sleep" mode. */ 76 63 cpu_relax(); ··· 241 258 tsk->thread.lr = (unsigned long)ret_from_fork; 242 259 243 260 return 0; 244 - } 245 - 246 - /* 247 - * Capture the user space registers if the task is not running (in user space) 248 - */ 249 - int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) 250 - { 251 - /* M32R_FIXME */ 252 - return 1; 253 261 } 254 262 255 263 asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
+2 -2
arch/m32r/kernel/smp.c
··· 84 84 void smp_ipi_timer_interrupt(struct pt_regs *); 85 85 void smp_local_timer_interrupt(void); 86 86 87 - void send_IPI_allbutself(int, int); 87 + static void send_IPI_allbutself(int, int); 88 88 static void send_IPI_mask(cpumask_t, int, int); 89 89 unsigned long send_IPI_mask_phys(cpumask_t, int, int); 90 90 ··· 722 722 * ---------- --- -------------------------------------------------------- 723 723 * 724 724 *==========================================================================*/ 725 - void send_IPI_allbutself(int ipi_num, int try) 725 + static void send_IPI_allbutself(int ipi_num, int try) 726 726 { 727 727 cpumask_t cpumask; 728 728
+2 -3
arch/m32r/kernel/time.c
··· 34 34 #include <asm/hw_irq.h> 35 35 36 36 #ifdef CONFIG_SMP 37 - extern void send_IPI_allbutself(int, int); 38 37 extern void smp_local_timer_interrupt(void); 39 38 #endif 40 39 ··· 187 188 * timer_interrupt() needs to keep up the real-time clock, 188 189 * as well as call the "do_timer()" routine every clocktick 189 190 */ 190 - irqreturn_t timer_interrupt(int irq, void *dev_id) 191 + static irqreturn_t timer_interrupt(int irq, void *dev_id) 191 192 { 192 193 #ifndef CONFIG_SMP 193 194 profile_tick(CPU_PROFILING); ··· 227 228 return IRQ_HANDLED; 228 229 } 229 230 230 - struct irqaction irq0 = { 231 + static struct irqaction irq0 = { 231 232 .handler = timer_interrupt, 232 233 .flags = IRQF_DISABLED, 233 234 .mask = CPU_MASK_NONE,
+4 -4
arch/m32r/kernel/traps.c
··· 61 61 ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ 62 62 + 0xff000000UL 63 63 64 - void set_eit_vector_entries(void) 64 + static void set_eit_vector_entries(void) 65 65 { 66 66 extern void default_eit_handler(void); 67 67 extern void system_call(void); ··· 121 121 cpu_init(); 122 122 } 123 123 124 - int kstack_depth_to_print = 24; 124 + static int kstack_depth_to_print = 24; 125 125 126 - void show_trace(struct task_struct *task, unsigned long *stack) 126 + static void show_trace(struct task_struct *task, unsigned long *stack) 127 127 { 128 128 unsigned long addr; 129 129 ··· 224 224 printk("\n"); 225 225 } 226 226 227 - DEFINE_SPINLOCK(die_lock); 227 + static DEFINE_SPINLOCK(die_lock); 228 228 229 229 void die(const char * str, struct pt_regs * regs, long err) 230 230 {
+2
arch/m32r/lib/delay.c
··· 6 6 */ 7 7 8 8 #include <linux/param.h> 9 + #include <linux/module.h> 9 10 #ifdef CONFIG_SMP 10 11 #include <linux/sched.h> 11 12 #include <asm/current.h> ··· 122 121 { 123 122 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ 124 123 } 124 + EXPORT_SYMBOL(__ndelay);
+4 -22
arch/mips/Kconfig
··· 1403 1403 depends on CPU_MIPS32_R2 1404 1404 #depends on CPU_MIPS64_R2 # once there is hardware ... 1405 1405 depends on SYS_SUPPORTS_MULTITHREADING 1406 - select GENERIC_CLOCKEVENTS_BROADCAST 1407 1406 select CPU_MIPSR2_IRQ_VI 1408 1407 select CPU_MIPSR2_IRQ_EI 1409 1408 select MIPS_MT ··· 1450 1451 Includes a loader for loading an elf relocatable object 1451 1452 onto another VPE and running it. 1452 1453 1453 - config MIPS_MT_SMTC_INSTANT_REPLAY 1454 - bool "Low-latency Dispatch of Deferred SMTC IPIs" 1455 - depends on MIPS_MT_SMTC && !PREEMPT 1456 - default y 1457 - help 1458 - SMTC pseudo-interrupts between TCs are deferred and queued 1459 - if the target TC is interrupt-inhibited (IXMT). In the first 1460 - SMTC prototypes, these queued IPIs were serviced on return 1461 - to user mode, or on entry into the kernel idle loop. The 1462 - INSTANT_REPLAY option dispatches them as part of local_irq_restore() 1463 - processing, which adds runtime overhead (hence the option to turn 1464 - it off), but ensures that IPIs are handled promptly even under 1465 - heavy I/O interrupt load. 1466 - 1467 1454 config MIPS_MT_SMTC_IM_BACKSTOP 1468 1455 bool "Use per-TC register bits as backstop for inhibited IM bits" 1469 1456 depends on MIPS_MT_SMTC 1470 - default y 1457 + default n 1471 1458 help 1472 1459 To support multiple TC microthreads acting as "CPUs" within 1473 1460 a VPE, VPE-wide interrupt mask bits must be specially manipulated 1474 1461 during interrupt handling. To support legacy drivers and interrupt 1475 1462 controller management code, SMTC has a "backstop" to track and 1476 1463 if necessary restore the interrupt mask. This has some performance 1477 - impact on interrupt service overhead. Disable it only if you know 1478 - what you are doing. 1464 + impact on interrupt service overhead. 1479 1465 1480 1466 config MIPS_MT_SMTC_IRQAFF 1481 1467 bool "Support IRQ affinity API" ··· 1470 1486 Enables SMP IRQ affinity API (/proc/irq/*/smp_affinity, etc.) 1471 1487 for SMTC Linux kernel. Requires platform support, of which 1472 1488 an example can be found in the MIPS kernel i8259 and Malta 1473 - platform code. It is recommended that MIPS_MT_SMTC_INSTANT_REPLAY 1474 - be enabled if MIPS_MT_SMTC_IRQAFF is used. Adds overhead to 1475 - interrupt dispatch, and should be used only if you know what 1476 - you are doing. 1489 + platform code. Adds some overhead to interrupt dispatch, and 1490 + should be used only if you know what you are doing. 1477 1491 1478 1492 config MIPS_VPE_LOADER_TOM 1479 1493 bool "Load VPE program into memory hidden from linux"
+4 -2
arch/mips/au1000/common/gpio.c
··· 48 48 { 49 49 gpio -= AU1XXX_GPIO_BASE; 50 50 51 - gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio); 51 + gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio); 52 52 } 53 53 54 54 static int au1xxx_gpio2_direction_input(unsigned gpio) ··· 61 61 static int au1xxx_gpio2_direction_output(unsigned gpio, int value) 62 62 { 63 63 gpio -= AU1XXX_GPIO_BASE; 64 - gpio2->dir = (0x01 << gpio) | (value << gpio); 64 + gpio2->dir |= 0x01 << gpio; 65 + gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio); 65 66 return 0; 66 67 } 67 68 ··· 91 90 static int au1xxx_gpio1_direction_output(unsigned gpio, int value) 92 91 { 93 92 gpio1->trioutclr = (0x01 & gpio); 93 + au1xxx_gpio1_write(gpio, value); 94 94 return 0; 95 95 } 96 96
+1
arch/mips/kernel/Makefile
··· 10 10 11 11 obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o 12 12 obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o 13 + obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o 13 14 obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o 14 15 obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o 15 16 obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
+48 -125
arch/mips/kernel/cevt-r4k.c
··· 12 12 13 13 #include <asm/smtc_ipi.h> 14 14 #include <asm/time.h> 15 + #include <asm/cevt-r4k.h> 16 + 17 + /* 18 + * The SMTC Kernel for the 34K, 1004K, et. al. replaces several 19 + * of these routines with SMTC-specific variants. 20 + */ 21 + 22 + #ifndef CONFIG_MIPS_MT_SMTC 15 23 16 24 static int mips_next_event(unsigned long delta, 17 25 struct clock_event_device *evt) ··· 27 19 unsigned int cnt; 28 20 int res; 29 21 30 - #ifdef CONFIG_MIPS_MT_SMTC 31 - { 32 - unsigned long flags, vpflags; 33 - local_irq_save(flags); 34 - vpflags = dvpe(); 35 - #endif 36 22 cnt = read_c0_count(); 37 23 cnt += delta; 38 24 write_c0_compare(cnt); 39 25 res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0; 40 - #ifdef CONFIG_MIPS_MT_SMTC 41 - evpe(vpflags); 42 - local_irq_restore(flags); 43 - } 44 - #endif 45 26 return res; 46 27 } 47 28 48 - static void mips_set_mode(enum clock_event_mode mode, 49 - struct clock_event_device *evt) 29 + #endif /* CONFIG_MIPS_MT_SMTC */ 30 + 31 + void mips_set_clock_mode(enum clock_event_mode mode, 32 + struct clock_event_device *evt) 50 33 { 51 34 /* Nothing to do ... */ 52 35 } 53 36 54 - static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device); 55 - static int cp0_timer_irq_installed; 37 + DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device); 38 + int cp0_timer_irq_installed; 56 39 57 - /* 58 - * Timer ack for an R4k-compatible timer of a known frequency. 59 - */ 60 - static void c0_timer_ack(void) 61 - { 62 - write_c0_compare(read_c0_compare()); 63 - } 40 + #ifndef CONFIG_MIPS_MT_SMTC 64 41 65 - /* 66 - * Possibly handle a performance counter interrupt. 67 - * Return true if the timer interrupt should not be checked 68 - */ 69 - static inline int handle_perf_irq(int r2) 70 - { 71 - /* 72 - * The performance counter overflow interrupt may be shared with the 73 - * timer interrupt (cp0_perfcount_irq < 0). If it is and a 74 - * performance counter has overflowed (perf_irq() == IRQ_HANDLED) 75 - * and we can't reliably determine if a counter interrupt has also 76 - * happened (!r2) then don't check for a timer interrupt. 77 - */ 78 - return (cp0_perfcount_irq < 0) && 79 - perf_irq() == IRQ_HANDLED && 80 - !r2; 81 - } 82 - 83 - static irqreturn_t c0_compare_interrupt(int irq, void *dev_id) 42 + irqreturn_t c0_compare_interrupt(int irq, void *dev_id) 84 43 { 85 44 const int r2 = cpu_has_mips_r2; 86 45 struct clock_event_device *cd; ··· 68 93 * interrupt. Being the paranoiacs we are we check anyway. 69 94 */ 70 95 if (!r2 || (read_c0_cause() & (1 << 30))) { 71 - c0_timer_ack(); 72 - #ifdef CONFIG_MIPS_MT_SMTC 73 - if (cpu_data[cpu].vpe_id) 74 - goto out; 75 - cpu = 0; 76 - #endif 96 + /* Clear Count/Compare Interrupt */ 97 + write_c0_compare(read_c0_compare()); 77 98 cd = &per_cpu(mips_clockevent_device, cpu); 78 99 cd->event_handler(cd); 79 100 } ··· 78 107 return IRQ_HANDLED; 79 108 } 80 109 81 - static struct irqaction c0_compare_irqaction = { 110 + #endif /* Not CONFIG_MIPS_MT_SMTC */ 111 + 112 + struct irqaction c0_compare_irqaction = { 82 113 .handler = c0_compare_interrupt, 83 - #ifdef CONFIG_MIPS_MT_SMTC 84 - .flags = IRQF_DISABLED, 85 - #else 86 114 .flags = IRQF_DISABLED | IRQF_PERCPU, 87 - #endif 88 115 .name = "timer", 89 116 }; 90 117 91 - #ifdef CONFIG_MIPS_MT_SMTC 92 - DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device); 93 118 94 - static void smtc_set_mode(enum clock_event_mode mode, 95 - struct clock_event_device *evt) 96 - { 97 - } 98 - 99 - static void mips_broadcast(cpumask_t mask) 100 - { 101 - unsigned int cpu; 102 - 103 - for_each_cpu_mask(cpu, mask) 104 - smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0); 105 - } 106 - 107 - static void setup_smtc_dummy_clockevent_device(void) 108 - { 109 - //uint64_t mips_freq = mips_hpt_^frequency; 110 - unsigned int cpu = smp_processor_id(); 111 - struct clock_event_device *cd; 112 - 113 - cd = &per_cpu(smtc_dummy_clockevent_device, cpu); 114 - 115 - cd->name = "SMTC"; 116 - cd->features = CLOCK_EVT_FEAT_DUMMY; 117 - 118 - /* Calculate the min / max delta */ 119 - cd->mult = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32); 120 - cd->shift = 0; //32; 121 - cd->max_delta_ns = 0; //clockevent_delta2ns(0x7fffffff, cd); 122 - cd->min_delta_ns = 0; //clockevent_delta2ns(0x30, cd); 123 - 124 - cd->rating = 200; 125 - cd->irq = 17; //-1; 126 - // if (cpu) 127 - // cd->cpumask = CPU_MASK_ALL; // cpumask_of_cpu(cpu); 128 - // else 129 - cd->cpumask = cpumask_of_cpu(cpu); 130 - 131 - cd->set_mode = smtc_set_mode; 132 - 133 - cd->broadcast = mips_broadcast; 134 - 135 - clockevents_register_device(cd); 136 - } 137 - #endif 138 - 139 - static void mips_event_handler(struct clock_event_device *dev) 119 + void mips_event_handler(struct clock_event_device *dev) 140 120 { 141 121 } 142 122 ··· 99 177 return (read_c0_cause() >> cp0_compare_irq) & 0x100; 100 178 } 101 179 102 - static int c0_compare_int_usable(void) 180 + /* 181 + * Compare interrupt can be routed and latched outside the core, 182 + * so a single execution hazard barrier may not be enough to give 183 + * it time to clear as seen in the Cause register. 4 time the 184 + * pipeline depth seems reasonably conservative, and empirically 185 + * works better in configurations with high CPU/bus clock ratios. 186 + */ 187 + 188 + #define compare_change_hazard() \ 189 + do { \ 190 + irq_disable_hazard(); \ 191 + irq_disable_hazard(); \ 192 + irq_disable_hazard(); \ 193 + irq_disable_hazard(); \ 194 + } while (0) 195 + 196 + int c0_compare_int_usable(void) 103 197 { 104 198 unsigned int delta; 105 199 unsigned int cnt; ··· 125 187 */ 126 188 if (c0_compare_int_pending()) { 127 189 write_c0_compare(read_c0_count()); 128 - irq_disable_hazard(); 190 + compare_change_hazard(); 129 191 if (c0_compare_int_pending()) 130 192 return 0; 131 193 } ··· 134 196 cnt = read_c0_count(); 135 197 cnt += delta; 136 198 write_c0_compare(cnt); 137 - irq_disable_hazard(); 199 + compare_change_hazard(); 138 200 if ((int)(read_c0_count() - cnt) < 0) 139 201 break; 140 202 /* increase delta if the timer was already expired */ ··· 143 205 while ((int)(read_c0_count() - cnt) <= 0) 144 206 ; /* Wait for expiry */ 145 207 208 + compare_change_hazard(); 146 209 if (!c0_compare_int_pending()) 147 210 return 0; 148 211 149 212 write_c0_compare(read_c0_count()); 150 - irq_disable_hazard(); 213 + compare_change_hazard(); 151 214 if (c0_compare_int_pending()) 152 215 return 0; 153 216 ··· 157 218 */ 158 219 return 1; 159 220 } 221 + 222 + #ifndef CONFIG_MIPS_MT_SMTC 160 223 161 224 int __cpuinit mips_clockevent_init(void) 162 225 { ··· 169 228 170 229 if (!cpu_has_counter || !mips_hpt_frequency) 171 230 return -ENXIO; 172 - 173 - #ifdef CONFIG_MIPS_MT_SMTC 174 - setup_smtc_dummy_clockevent_device(); 175 - 176 - /* 177 - * On SMTC we only register VPE0's compare interrupt as clockevent 178 - * device. 179 - */ 180 - if (cpu) 181 - return 0; 182 - #endif 183 231 184 232 if (!c0_compare_int_usable()) 185 233 return -ENXIO; ··· 195 265 196 266 cd->rating = 300; 197 267 cd->irq = irq; 198 - #ifdef CONFIG_MIPS_MT_SMTC 199 - cd->cpumask = CPU_MASK_ALL; 200 - #else 201 268 cd->cpumask = cpumask_of_cpu(cpu); 202 - #endif 203 269 cd->set_next_event = mips_next_event; 204 - cd->set_mode = mips_set_mode; 270 + cd->set_mode = mips_set_clock_mode; 205 271 cd->event_handler = mips_event_handler; 206 272 207 273 clockevents_register_device(cd); ··· 207 281 208 282 cp0_timer_irq_installed = 1; 209 283 210 - #ifdef CONFIG_MIPS_MT_SMTC 211 - #define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq) 212 - setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT); 213 - #else 214 284 setup_irq(irq, &c0_compare_irqaction); 215 - #endif 216 285 217 286 return 0; 218 287 } 288 + 289 + #endif /* Not CONFIG_MIPS_MT_SMTC */
+321
arch/mips/kernel/cevt-smtc.c
··· 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file "COPYING" in the main directory of this archive 4 + * for more details. 5 + * 6 + * Copyright (C) 2007 MIPS Technologies, Inc. 7 + * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org> 8 + * Copyright (C) 2008 Kevin D. Kissell, Paralogos sarl 9 + */ 10 + #include <linux/clockchips.h> 11 + #include <linux/interrupt.h> 12 + #include <linux/percpu.h> 13 + 14 + #include <asm/smtc_ipi.h> 15 + #include <asm/time.h> 16 + #include <asm/cevt-r4k.h> 17 + 18 + /* 19 + * Variant clock event timer support for SMTC on MIPS 34K, 1004K 20 + * or other MIPS MT cores. 21 + * 22 + * Notes on SMTC Support: 23 + * 24 + * SMTC has multiple microthread TCs pretending to be Linux CPUs. 25 + * But there's only one Count/Compare pair per VPE, and Compare 26 + * interrupts are taken opportunisitically by available TCs 27 + * bound to the VPE with the Count register. The new timer 28 + * framework provides for global broadcasts, but we really 29 + * want VPE-level multicasts for best behavior. So instead 30 + * of invoking the high-level clock-event broadcast code, 31 + * this version of SMTC support uses the historical SMTC 32 + * multicast mechanisms "under the hood", appearing to the 33 + * generic clock layer as if the interrupts are per-CPU. 34 + * 35 + * The approach taken here is to maintain a set of NR_CPUS 36 + * virtual timers, and track which "CPU" needs to be alerted 37 + * at each event. 38 + * 39 + * It's unlikely that we'll see a MIPS MT core with more than 40 + * 2 VPEs, but we *know* that we won't need to handle more 41 + * VPEs than we have "CPUs". So NCPUs arrays of NCPUs elements 42 + * is always going to be overkill, but always going to be enough. 43 + */ 44 + 45 + unsigned long smtc_nexttime[NR_CPUS][NR_CPUS]; 46 + static int smtc_nextinvpe[NR_CPUS]; 47 + 48 + /* 49 + * Timestamps stored are absolute values to be programmed 50 + * into Count register. Valid timestamps will never be zero. 51 + * If a Zero Count value is actually calculated, it is converted 52 + * to be a 1, which will introduce 1 or two CPU cycles of error 53 + * roughly once every four billion events, which at 1000 HZ means 54 + * about once every 50 days. If that's actually a problem, one 55 + * could alternate squashing 0 to 1 and to -1. 56 + */ 57 + 58 + #define MAKEVALID(x) (((x) == 0L) ? 1L : (x)) 59 + #define ISVALID(x) ((x) != 0L) 60 + 61 + /* 62 + * Time comparison is subtle, as it's really truncated 63 + * modular arithmetic. 64 + */ 65 + 66 + #define IS_SOONER(a, b, reference) \ 67 + (((a) - (unsigned long)(reference)) < ((b) - (unsigned long)(reference))) 68 + 69 + /* 70 + * CATCHUP_INCREMENT, used when the function falls behind the counter. 71 + * Could be an increasing function instead of a constant; 72 + */ 73 + 74 + #define CATCHUP_INCREMENT 64 75 + 76 + static int mips_next_event(unsigned long delta, 77 + struct clock_event_device *evt) 78 + { 79 + unsigned long flags; 80 + unsigned int mtflags; 81 + unsigned long timestamp, reference, previous; 82 + unsigned long nextcomp = 0L; 83 + int vpe = current_cpu_data.vpe_id; 84 + int cpu = smp_processor_id(); 85 + local_irq_save(flags); 86 + mtflags = dmt(); 87 + 88 + /* 89 + * Maintain the per-TC virtual timer 90 + * and program the per-VPE shared Count register 91 + * as appropriate here... 92 + */ 93 + reference = (unsigned long)read_c0_count(); 94 + timestamp = MAKEVALID(reference + delta); 95 + /* 96 + * To really model the clock, we have to catch the case 97 + * where the current next-in-VPE timestamp is the old 98 + * timestamp for the calling CPE, but the new value is 99 + * in fact later. In that case, we have to do a full 100 + * scan and discover the new next-in-VPE CPU id and 101 + * timestamp. 102 + */ 103 + previous = smtc_nexttime[vpe][cpu]; 104 + if (cpu == smtc_nextinvpe[vpe] && ISVALID(previous) 105 + && IS_SOONER(previous, timestamp, reference)) { 106 + int i; 107 + int soonest = cpu; 108 + 109 + /* 110 + * Update timestamp array here, so that new 111 + * value gets considered along with those of 112 + * other virtual CPUs on the VPE. 113 + */ 114 + smtc_nexttime[vpe][cpu] = timestamp; 115 + for_each_online_cpu(i) { 116 + if (ISVALID(smtc_nexttime[vpe][i]) 117 + && IS_SOONER(smtc_nexttime[vpe][i], 118 + smtc_nexttime[vpe][soonest], reference)) { 119 + soonest = i; 120 + } 121 + } 122 + smtc_nextinvpe[vpe] = soonest; 123 + nextcomp = smtc_nexttime[vpe][soonest]; 124 + /* 125 + * Otherwise, we don't have to process the whole array rank, 126 + * we just have to see if the event horizon has gotten closer. 127 + */ 128 + } else { 129 + if (!ISVALID(smtc_nexttime[vpe][smtc_nextinvpe[vpe]]) || 130 + IS_SOONER(timestamp, 131 + smtc_nexttime[vpe][smtc_nextinvpe[vpe]], reference)) { 132 + smtc_nextinvpe[vpe] = cpu; 133 + nextcomp = timestamp; 134 + } 135 + /* 136 + * Since next-in-VPE may me the same as the executing 137 + * virtual CPU, we update the array *after* checking 138 + * its value. 139 + */ 140 + smtc_nexttime[vpe][cpu] = timestamp; 141 + } 142 + 143 + /* 144 + * It may be that, in fact, we don't need to update Compare, 145 + * but if we do, we want to make sure we didn't fall into 146 + * a crack just behind Count. 147 + */ 148 + if (ISVALID(nextcomp)) { 149 + write_c0_compare(nextcomp); 150 + ehb(); 151 + /* 152 + * We never return an error, we just make sure 153 + * that we trigger the handlers as quickly as 154 + * we can if we fell behind. 155 + */ 156 + while ((nextcomp - (unsigned long)read_c0_count()) 157 + > (unsigned long)LONG_MAX) { 158 + nextcomp += CATCHUP_INCREMENT; 159 + write_c0_compare(nextcomp); 160 + ehb(); 161 + } 162 + } 163 + emt(mtflags); 164 + local_irq_restore(flags); 165 + return 0; 166 + } 167 + 168 + 169 + void smtc_distribute_timer(int vpe) 170 + { 171 + unsigned long flags; 172 + unsigned int mtflags; 173 + int cpu; 174 + struct clock_event_device *cd; 175 + unsigned long nextstamp = 0L; 176 + unsigned long reference; 177 + 178 + 179 + repeat: 180 + for_each_online_cpu(cpu) { 181 + /* 182 + * Find virtual CPUs within the current VPE who have 183 + * unserviced timer requests whose time is now past. 184 + */ 185 + local_irq_save(flags); 186 + mtflags = dmt(); 187 + if (cpu_data[cpu].vpe_id == vpe && 188 + ISVALID(smtc_nexttime[vpe][cpu])) { 189 + reference = (unsigned long)read_c0_count(); 190 + if ((smtc_nexttime[vpe][cpu] - reference) 191 + > (unsigned long)LONG_MAX) { 192 + smtc_nexttime[vpe][cpu] = 0L; 193 + emt(mtflags); 194 + local_irq_restore(flags); 195 + /* 196 + * We don't send IPIs to ourself. 197 + */ 198 + if (cpu != smp_processor_id()) { 199 + smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0); 200 + } else { 201 + cd = &per_cpu(mips_clockevent_device, cpu); 202 + cd->event_handler(cd); 203 + } 204 + } else { 205 + /* Local to VPE but Valid Time not yet reached. */ 206 + if (!ISVALID(nextstamp) || 207 + IS_SOONER(smtc_nexttime[vpe][cpu], nextstamp, 208 + reference)) { 209 + smtc_nextinvpe[vpe] = cpu; 210 + nextstamp = smtc_nexttime[vpe][cpu]; 211 + } 212 + emt(mtflags); 213 + local_irq_restore(flags); 214 + } 215 + } else { 216 + emt(mtflags); 217 + local_irq_restore(flags); 218 + 219 + } 220 + } 221 + /* Reprogram for interrupt at next soonest timestamp for VPE */ 222 + if (ISVALID(nextstamp)) { 223 + write_c0_compare(nextstamp); 224 + ehb(); 225 + if ((nextstamp - (unsigned long)read_c0_count()) 226 + > (unsigned long)LONG_MAX) 227 + goto repeat; 228 + } 229 + } 230 + 231 + 232 + irqreturn_t c0_compare_interrupt(int irq, void *dev_id) 233 + { 234 + int cpu = smp_processor_id(); 235 + 236 + /* If we're running SMTC, we've got MIPS MT and therefore MIPS32R2 */ 237 + handle_perf_irq(1); 238 + 239 + if (read_c0_cause() & (1 << 30)) { 240 + /* Clear Count/Compare Interrupt */ 241 + write_c0_compare(read_c0_compare()); 242 + smtc_distribute_timer(cpu_data[cpu].vpe_id); 243 + } 244 + return IRQ_HANDLED; 245 + } 246 + 247 + 248 + int __cpuinit mips_clockevent_init(void) 249 + { 250 + uint64_t mips_freq = mips_hpt_frequency; 251 + unsigned int cpu = smp_processor_id(); 252 + struct clock_event_device *cd; 253 + unsigned int irq; 254 + int i; 255 + int j; 256 + 257 + if (!cpu_has_counter || !mips_hpt_frequency) 258 + return -ENXIO; 259 + if (cpu == 0) { 260 + for (i = 0; i < num_possible_cpus(); i++) { 261 + smtc_nextinvpe[i] = 0; 262 + for (j = 0; j < num_possible_cpus(); j++) 263 + smtc_nexttime[i][j] = 0L; 264 + } 265 + /* 266 + * SMTC also can't have the usablility test 267 + * run by secondary TCs once Compare is in use. 268 + */ 269 + if (!c0_compare_int_usable()) 270 + return -ENXIO; 271 + } 272 + 273 + /* 274 + * With vectored interrupts things are getting platform specific. 275 + * get_c0_compare_int is a hook to allow a platform to return the 276 + * interrupt number of it's liking. 277 + */ 278 + irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 279 + if (get_c0_compare_int) 280 + irq = get_c0_compare_int(); 281 + 282 + cd = &per_cpu(mips_clockevent_device, cpu); 283 + 284 + cd->name = "MIPS"; 285 + cd->features = CLOCK_EVT_FEAT_ONESHOT; 286 + 287 + /* Calculate the min / max delta */ 288 + cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32); 289 + cd->shift = 32; 290 + cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 291 + cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 292 + 293 + cd->rating = 300; 294 + cd->irq = irq; 295 + cd->cpumask = cpumask_of_cpu(cpu); 296 + cd->set_next_event = mips_next_event; 297 + cd->set_mode = mips_set_clock_mode; 298 + cd->event_handler = mips_event_handler; 299 + 300 + clockevents_register_device(cd); 301 + 302 + /* 303 + * On SMTC we only want to do the data structure 304 + * initialization and IRQ setup once. 305 + */ 306 + if (cpu) 307 + return 0; 308 + /* 309 + * And we need the hwmask associated with the c0_compare 310 + * vector to be initialized. 311 + */ 312 + irq_hwmask[irq] = (0x100 << cp0_compare_irq); 313 + if (cp0_timer_irq_installed) 314 + return 0; 315 + 316 + cp0_timer_irq_installed = 1; 317 + 318 + setup_irq(irq, &c0_compare_irqaction); 319 + 320 + return 0; 321 + }
+7 -3
arch/mips/kernel/cpu-probe.c
··· 54 54 * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes 55 55 * using this version a gamble. 56 56 */ 57 - static void r4k_wait_irqoff(void) 57 + void r4k_wait_irqoff(void) 58 58 { 59 59 local_irq_disable(); 60 60 if (!need_resched()) 61 - __asm__(" .set mips3 \n" 61 + __asm__(" .set push \n" 62 + " .set mips3 \n" 62 63 " wait \n" 63 - " .set mips0 \n"); 64 + " .set pop \n"); 64 65 local_irq_enable(); 66 + __asm__(" .globl __pastwait \n" 67 + "__pastwait: \n"); 68 + return; 65 69 } 66 70 67 71 /*
+5 -5
arch/mips/kernel/entry.S
··· 79 79 80 80 FEXPORT(restore_all) # restore full frame 81 81 #ifdef CONFIG_MIPS_MT_SMTC 82 - /* Detect and execute deferred IPI "interrupts" */ 83 - LONG_L s0, TI_REGS($28) 84 - LONG_S sp, TI_REGS($28) 85 - jal deferred_smtc_ipi 86 - LONG_S s0, TI_REGS($28) 87 82 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 88 83 /* Re-arm any temporarily masked interrupts not explicitly "acked" */ 89 84 mfc0 v0, CP0_TCSTATUS ··· 107 112 xor t0, t0, t3 108 113 mtc0 t0, CP0_TCCONTEXT 109 114 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */ 115 + /* Detect and execute deferred IPI "interrupts" */ 116 + LONG_L s0, TI_REGS($28) 117 + LONG_S sp, TI_REGS($28) 118 + jal deferred_smtc_ipi 119 + LONG_S s0, TI_REGS($28) 110 120 #endif /* CONFIG_MIPS_MT_SMTC */ 111 121 .set noat 112 122 RESTORE_TEMP
+2 -2
arch/mips/kernel/genex.S
··· 282 282 and t0, a0, t1 283 283 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 284 284 mfc0 t2, CP0_TCCONTEXT 285 - or t0, t0, t2 286 - mtc0 t0, CP0_TCCONTEXT 285 + or t2, t0, t2 286 + mtc0 t2, CP0_TCCONTEXT 287 287 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */ 288 288 xor t1, t1, t0 289 289 mtc0 t1, CP0_STATUS
+1 -2
arch/mips/kernel/kgdb.c
··· 236 236 237 237 atomic_set(&kgdb_cpu_doing_single_step, -1); 238 238 if (remcom_in_buffer[0] == 's') 239 - if (kgdb_contthread) 240 - atomic_set(&kgdb_cpu_doing_single_step, cpu); 239 + atomic_set(&kgdb_cpu_doing_single_step, cpu); 241 240 242 241 return 0; 243 242 }
+1 -1
arch/mips/kernel/mips-mt-fpaff.c
··· 159 159 /* 160 160 * FPU Use Factor empirically derived from experiments on 34K 161 161 */ 162 - #define FPUSEFACTOR 333 162 + #define FPUSEFACTOR 2000 163 163 164 164 static __init int mt_fp_affinity_init(void) 165 165 {
+9 -10
arch/mips/kernel/process.c
··· 55 55 while (1) { 56 56 tick_nohz_stop_sched_tick(1); 57 57 while (!need_resched()) { 58 - #ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 58 + #ifdef CONFIG_MIPS_MT_SMTC 59 59 extern void smtc_idle_loop_hook(void); 60 60 61 61 smtc_idle_loop_hook(); ··· 145 145 */ 146 146 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1); 147 147 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); 148 + 149 + #ifdef CONFIG_MIPS_MT_SMTC 150 + /* 151 + * SMTC restores TCStatus after Status, and the CU bits 152 + * are aliased there. 153 + */ 154 + childregs->cp0_tcstatus &= ~(ST0_CU2|ST0_CU1); 155 + #endif 148 156 clear_tsk_thread_flag(p, TIF_USEDFPU); 149 157 150 158 #ifdef CONFIG_MIPS_MT_FPAFF 151 159 clear_tsk_thread_flag(p, TIF_FPUBOUND); 152 - 153 - /* 154 - * FPU affinity support is cleaner if we track the 155 - * user-visible CPU affinity from the very beginning. 156 - * The generic cpus_allowed mask will already have 157 - * been copied from the parent before copy_thread 158 - * is invoked. 159 - */ 160 - p->thread.user_cpus_allowed = p->cpus_allowed; 161 160 #endif /* CONFIG_MIPS_MT_FPAFF */ 162 161 163 162 if (clone_flags & CLONE_SETTLS)
+1 -1
arch/mips/kernel/ptrace.c
··· 238 238 case FPC_EIR: { /* implementation / version register */ 239 239 unsigned int flags; 240 240 #ifdef CONFIG_MIPS_MT_SMTC 241 - unsigned int irqflags; 241 + unsigned long irqflags; 242 242 unsigned int mtflags; 243 243 #endif /* CONFIG_MIPS_MT_SMTC */ 244 244
+136 -122
arch/mips/kernel/smtc.c
··· 1 - /* Copyright (C) 2004 Mips Technologies, Inc */ 1 + /* 2 + * This program is free software; you can redistribute it and/or 3 + * modify it under the terms of the GNU General Public License 4 + * as published by the Free Software Foundation; either version 2 5 + * of the License, or (at your option) any later version. 6 + * 7 + * This program is distributed in the hope that it will be useful, 8 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 + * GNU General Public License for more details. 11 + * 12 + * You should have received a copy of the GNU General Public License 13 + * along with this program; if not, write to the Free Software 14 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 + * 16 + * Copyright (C) 2004 Mips Technologies, Inc 17 + * Copyright (C) 2008 Kevin D. Kissell 18 + */ 2 19 3 20 #include <linux/clockchips.h> 4 21 #include <linux/kernel.h> ··· 38 21 #include <asm/time.h> 39 22 #include <asm/addrspace.h> 40 23 #include <asm/smtc.h> 41 - #include <asm/smtc_ipi.h> 42 24 #include <asm/smtc_proc.h> 43 25 44 26 /* ··· 74 58 75 59 asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; 76 60 77 - /* 78 - * Clock interrupt "latch" buffers, per "CPU" 79 - */ 80 - 81 - static atomic_t ipi_timer_latch[NR_CPUS]; 82 61 83 62 /* 84 63 * Number of InterProcessor Interrupt (IPI) message buffers to allocate ··· 81 70 82 71 #define IPIBUF_PER_CPU 4 83 72 84 - static struct smtc_ipi_q IPIQ[NR_CPUS]; 73 + struct smtc_ipi_q IPIQ[NR_CPUS]; 85 74 static struct smtc_ipi_q freeIPIq; 86 75 87 76 ··· 293 282 * phys_cpu_present_map and the logical/physical mappings. 294 283 */ 295 284 296 - int __init mipsmt_build_cpu_map(int start_cpu_slot) 285 + int __init smtc_build_cpu_map(int start_cpu_slot) 297 286 { 298 287 int i, ntcs; 299 288 ··· 336 325 write_tc_c0_tcstatus((read_tc_c0_tcstatus() 337 326 & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT)) 338 327 | TCSTATUS_A); 339 - write_tc_c0_tccontext(0); 328 + /* 329 + * TCContext gets an offset from the base of the IPIQ array 330 + * to be used in low-level code to detect the presence of 331 + * an active IPI queue 332 + */ 333 + write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16); 340 334 /* Bind tc to vpe */ 341 335 write_tc_c0_tcbind(vpe); 342 336 /* In general, all TCs should have the same cpu_data indications */ ··· 352 336 cpu_data[cpu].options &= ~MIPS_CPU_FPU; 353 337 cpu_data[cpu].vpe_id = vpe; 354 338 cpu_data[cpu].tc_id = tc; 339 + /* Multi-core SMTC hasn't been tested, but be prepared */ 340 + cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff; 355 341 } 356 342 343 + /* 344 + * Tweak to get Count registes in as close a sync as possible. 345 + * Value seems good for 34K-class cores. 346 + */ 357 347 358 - void mipsmt_prepare_cpus(void) 348 + #define CP0_SKEW 8 349 + 350 + void smtc_prepare_cpus(int cpus) 359 351 { 360 352 int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu; 361 353 unsigned long flags; ··· 387 363 IPIQ[i].head = IPIQ[i].tail = NULL; 388 364 spin_lock_init(&IPIQ[i].lock); 389 365 IPIQ[i].depth = 0; 390 - atomic_set(&ipi_timer_latch[i], 0); 391 366 } 392 367 393 368 /* cpu_data index starts at zero */ 394 369 cpu = 0; 395 370 cpu_data[cpu].vpe_id = 0; 396 371 cpu_data[cpu].tc_id = 0; 372 + cpu_data[cpu].core = (read_c0_ebase() >> 1) & 0xff; 397 373 cpu++; 398 374 399 375 /* Report on boot-time options */ ··· 508 484 write_vpe_c0_compare(0); 509 485 /* Propagate Config7 */ 510 486 write_vpe_c0_config7(read_c0_config7()); 511 - write_vpe_c0_count(read_c0_count()); 487 + write_vpe_c0_count(read_c0_count() + CP0_SKEW); 488 + ehb(); 512 489 } 513 490 /* enable multi-threading within VPE */ 514 491 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE); ··· 581 556 void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle) 582 557 { 583 558 extern u32 kernelsp[NR_CPUS]; 584 - long flags; 559 + unsigned long flags; 585 560 int mtflags; 586 561 587 562 LOCK_MT_PRA(); ··· 610 585 611 586 void smtc_init_secondary(void) 612 587 { 613 - /* 614 - * Start timer on secondary VPEs if necessary. 615 - * plat_timer_setup has already have been invoked by init/main 616 - * on "boot" TC. Like per_cpu_trap_init() hack, this assumes that 617 - * SMTC init code assigns TCs consdecutively and in ascending order 618 - * to across available VPEs. 619 - */ 620 - if (((read_c0_tcbind() & TCBIND_CURTC) != 0) && 621 - ((read_c0_tcbind() & TCBIND_CURVPE) 622 - != cpu_data[smp_processor_id() - 1].vpe_id)){ 623 - write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ); 624 - } 625 - 626 588 local_irq_enable(); 627 589 } 628 590 629 591 void smtc_smp_finish(void) 630 592 { 593 + int cpu = smp_processor_id(); 594 + 595 + /* 596 + * Lowest-numbered CPU per VPE starts a clock tick. 597 + * Like per_cpu_trap_init() hack, this assumes that 598 + * SMTC init code assigns TCs consdecutively and 599 + * in ascending order across available VPEs. 600 + */ 601 + if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id)) 602 + write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ); 603 + 631 604 printk("TC %d going on-line as CPU %d\n", 632 605 cpu_data[smp_processor_id()].tc_id, smp_processor_id()); 633 606 } ··· 776 753 { 777 754 int tcstatus; 778 755 struct smtc_ipi *pipi; 779 - long flags; 756 + unsigned long flags; 780 757 int mtflags; 758 + unsigned long tcrestart; 759 + extern void r4k_wait_irqoff(void), __pastwait(void); 781 760 782 761 if (cpu == smp_processor_id()) { 783 762 printk("Cannot Send IPI to self!\n"); ··· 796 771 pipi->arg = (void *)action; 797 772 pipi->dest = cpu; 798 773 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) { 799 - if (type == SMTC_CLOCK_TICK) 800 - atomic_inc(&ipi_timer_latch[cpu]); 801 774 /* If not on same VPE, enqueue and send cross-VPE interrupt */ 802 775 smtc_ipi_nq(&IPIQ[cpu], pipi); 803 776 LOCK_CORE_PRA(); ··· 823 800 824 801 if ((tcstatus & TCSTATUS_IXMT) != 0) { 825 802 /* 826 - * Spin-waiting here can deadlock, 827 - * so we queue the message for the target TC. 803 + * If we're in the the irq-off version of the wait 804 + * loop, we need to force exit from the wait and 805 + * do a direct post of the IPI. 806 + */ 807 + if (cpu_wait == r4k_wait_irqoff) { 808 + tcrestart = read_tc_c0_tcrestart(); 809 + if (tcrestart >= (unsigned long)r4k_wait_irqoff 810 + && tcrestart < (unsigned long)__pastwait) { 811 + write_tc_c0_tcrestart(__pastwait); 812 + tcstatus &= ~TCSTATUS_IXMT; 813 + write_tc_c0_tcstatus(tcstatus); 814 + goto postdirect; 815 + } 816 + } 817 + /* 818 + * Otherwise we queue the message for the target TC 819 + * to pick up when he does a local_irq_restore() 828 820 */ 829 821 write_tc_c0_tchalt(0); 830 822 UNLOCK_CORE_PRA(); 831 - /* Try to reduce redundant timer interrupt messages */ 832 - if (type == SMTC_CLOCK_TICK) { 833 - if (atomic_postincrement(&ipi_timer_latch[cpu])!=0){ 834 - smtc_ipi_nq(&freeIPIq, pipi); 835 - return; 836 - } 837 - } 838 823 smtc_ipi_nq(&IPIQ[cpu], pipi); 839 824 } else { 840 - if (type == SMTC_CLOCK_TICK) 841 - atomic_inc(&ipi_timer_latch[cpu]); 825 + postdirect: 842 826 post_direct_ipi(cpu, pipi); 843 827 write_tc_c0_tchalt(0); 844 828 UNLOCK_CORE_PRA(); ··· 913 883 smp_call_function_interrupt(); 914 884 } 915 885 916 - DECLARE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device); 886 + DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device); 917 887 918 888 void ipi_decode(struct smtc_ipi *pipi) 919 889 { ··· 921 891 struct clock_event_device *cd; 922 892 void *arg_copy = pipi->arg; 923 893 int type_copy = pipi->type; 924 - int ticks; 925 - 926 894 smtc_ipi_nq(&freeIPIq, pipi); 927 895 switch (type_copy) { 928 896 case SMTC_CLOCK_TICK: 929 897 irq_enter(); 930 898 kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++; 931 - cd = &per_cpu(smtc_dummy_clockevent_device, cpu); 932 - ticks = atomic_read(&ipi_timer_latch[cpu]); 933 - atomic_sub(ticks, &ipi_timer_latch[cpu]); 934 - while (ticks) { 935 - cd->event_handler(cd); 936 - ticks--; 937 - } 899 + cd = &per_cpu(mips_clockevent_device, cpu); 900 + cd->event_handler(cd); 938 901 irq_exit(); 939 902 break; 940 903 ··· 960 937 } 961 938 } 962 939 940 + /* 941 + * Similar to smtc_ipi_replay(), but invoked from context restore, 942 + * so it reuses the current exception frame rather than set up a 943 + * new one with self_ipi. 944 + */ 945 + 963 946 void deferred_smtc_ipi(void) 964 947 { 965 - struct smtc_ipi *pipi; 966 - unsigned long flags; 967 - /* DEBUG */ 968 - int q = smp_processor_id(); 948 + int cpu = smp_processor_id(); 969 949 970 950 /* 971 951 * Test is not atomic, but much faster than a dequeue, 972 952 * and the vast majority of invocations will have a null queue. 953 + * If irq_disabled when this was called, then any IPIs queued 954 + * after we test last will be taken on the next irq_enable/restore. 955 + * If interrupts were enabled, then any IPIs added after the 956 + * last test will be taken directly. 973 957 */ 974 - if (IPIQ[q].head != NULL) { 975 - while((pipi = smtc_ipi_dq(&IPIQ[q])) != NULL) { 976 - /* ipi_decode() should be called with interrupts off */ 977 - local_irq_save(flags); 958 + 959 + while (IPIQ[cpu].head != NULL) { 960 + struct smtc_ipi_q *q = &IPIQ[cpu]; 961 + struct smtc_ipi *pipi; 962 + unsigned long flags; 963 + 964 + /* 965 + * It may be possible we'll come in with interrupts 966 + * already enabled. 967 + */ 968 + local_irq_save(flags); 969 + 970 + spin_lock(&q->lock); 971 + pipi = __smtc_ipi_dq(q); 972 + spin_unlock(&q->lock); 973 + if (pipi != NULL) 978 974 ipi_decode(pipi); 979 - local_irq_restore(flags); 980 - } 975 + /* 976 + * The use of the __raw_local restore isn't 977 + * as obviously necessary here as in smtc_ipi_replay(), 978 + * but it's more efficient, given that we're already 979 + * running down the IPI queue. 980 + */ 981 + __raw_local_irq_restore(flags); 981 982 } 982 983 } 983 984 ··· 1022 975 struct smtc_ipi *pipi; 1023 976 unsigned long tcstatus; 1024 977 int sent; 1025 - long flags; 978 + unsigned long flags; 1026 979 unsigned int mtflags; 1027 980 unsigned int vpflags; 1028 981 ··· 1113 1066 1114 1067 /* 1115 1068 * SMTC-specific hacks invoked from elsewhere in the kernel. 1116 - * 1117 - * smtc_ipi_replay is called from raw_local_irq_restore which is only ever 1118 - * called with interrupts disabled. We do rely on interrupts being disabled 1119 - * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would 1120 - * result in a recursive call to raw_local_irq_restore(). 1121 1069 */ 1122 1070 1123 - static void __smtc_ipi_replay(void) 1071 + /* 1072 + * smtc_ipi_replay is called from raw_local_irq_restore 1073 + */ 1074 + 1075 + void smtc_ipi_replay(void) 1124 1076 { 1125 1077 unsigned int cpu = smp_processor_id(); 1126 1078 1127 1079 /* 1128 1080 * To the extent that we've ever turned interrupts off, 1129 1081 * we may have accumulated deferred IPIs. This is subtle. 1130 - * If we use the smtc_ipi_qdepth() macro, we'll get an 1131 - * exact number - but we'll also disable interrupts 1132 - * and create a window of failure where a new IPI gets 1133 - * queued after we test the depth but before we re-enable 1134 - * interrupts. So long as IXMT never gets set, however, 1135 1082 * we should be OK: If we pick up something and dispatch 1136 1083 * it here, that's great. If we see nothing, but concurrent 1137 1084 * with this operation, another TC sends us an IPI, IXMT 1138 1085 * is clear, and we'll handle it as a real pseudo-interrupt 1139 - * and not a pseudo-pseudo interrupt. 1086 + * and not a pseudo-pseudo interrupt. The important thing 1087 + * is to do the last check for queued message *after* the 1088 + * re-enabling of interrupts. 1140 1089 */ 1141 - if (IPIQ[cpu].depth > 0) { 1142 - while (1) { 1143 - struct smtc_ipi_q *q = &IPIQ[cpu]; 1144 - struct smtc_ipi *pipi; 1145 - extern void self_ipi(struct smtc_ipi *); 1090 + while (IPIQ[cpu].head != NULL) { 1091 + struct smtc_ipi_q *q = &IPIQ[cpu]; 1092 + struct smtc_ipi *pipi; 1093 + unsigned long flags; 1146 1094 1147 - spin_lock(&q->lock); 1148 - pipi = __smtc_ipi_dq(q); 1149 - spin_unlock(&q->lock); 1150 - if (!pipi) 1151 - break; 1095 + /* 1096 + * It's just possible we'll come in with interrupts 1097 + * already enabled. 1098 + */ 1099 + local_irq_save(flags); 1152 1100 1101 + spin_lock(&q->lock); 1102 + pipi = __smtc_ipi_dq(q); 1103 + spin_unlock(&q->lock); 1104 + /* 1105 + ** But use a raw restore here to avoid recursion. 1106 + */ 1107 + __raw_local_irq_restore(flags); 1108 + 1109 + if (pipi) { 1153 1110 self_ipi(pipi); 1154 1111 smtc_cpu_stats[cpu].selfipis++; 1155 1112 } 1156 1113 } 1157 - } 1158 - 1159 - void smtc_ipi_replay(void) 1160 - { 1161 - raw_local_irq_disable(); 1162 - __smtc_ipi_replay(); 1163 1114 } 1164 1115 1165 1116 EXPORT_SYMBOL(smtc_ipi_replay); ··· 1238 1193 } 1239 1194 } 1240 1195 1241 - /* 1242 - * Now that we limit outstanding timer IPIs, check for hung TC 1243 - */ 1244 - for (tc = 0; tc < NR_CPUS; tc++) { 1245 - /* Don't check ourself - we'll dequeue IPIs just below */ 1246 - if ((tc != smp_processor_id()) && 1247 - atomic_read(&ipi_timer_latch[tc]) > timerq_limit) { 1248 - if (clock_hang_reported[tc] == 0) { 1249 - pdb_msg += sprintf(pdb_msg, 1250 - "TC %d looks hung with timer latch at %d\n", 1251 - tc, atomic_read(&ipi_timer_latch[tc])); 1252 - clock_hang_reported[tc]++; 1253 - } 1254 - } 1255 - } 1256 1196 emt(mtflags); 1257 1197 local_irq_restore(flags); 1258 1198 if (pdb_msg != &id_ho_db_msg[0]) 1259 1199 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg); 1260 1200 #endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */ 1261 1201 1262 - /* 1263 - * Replay any accumulated deferred IPIs. If "Instant Replay" 1264 - * is in use, there should never be any. 1265 - */ 1266 - #ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY 1267 - { 1268 - unsigned long flags; 1269 - 1270 - local_irq_save(flags); 1271 - __smtc_ipi_replay(); 1272 - local_irq_restore(flags); 1273 - } 1274 - #endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */ 1202 + smtc_ipi_replay(); 1275 1203 } 1276 1204 1277 1205 void smtc_soft_dump(void) ··· 1260 1242 printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis); 1261 1243 } 1262 1244 smtc_ipi_qdump(); 1263 - printk("Timer IPI Backlogs:\n"); 1264 - for (i=0; i < NR_CPUS; i++) { 1265 - printk("%d: %d\n", i, atomic_read(&ipi_timer_latch[i])); 1266 - } 1267 1245 printk("%d Recoveries of \"stolen\" FPU\n", 1268 1246 atomic_read(&smtc_fpu_recoveries)); 1269 1247 }
+4 -2
arch/mips/kernel/traps.c
··· 825 825 if (cpus_intersects(current->cpus_allowed, mt_fpu_cpumask)) { 826 826 cpumask_t tmask; 827 827 828 - cpus_and(tmask, current->thread.user_cpus_allowed, 829 - mt_fpu_cpumask); 828 + current->thread.user_cpus_allowed 829 + = current->cpus_allowed; 830 + cpus_and(tmask, current->cpus_allowed, 831 + mt_fpu_cpumask); 830 832 set_cpus_allowed(current, tmask); 831 833 set_thread_flag(TIF_FPUBOUND); 832 834 }
+1 -1
arch/mips/mti-malta/Makefile
··· 15 15 obj-$(CONFIG_PCI) += malta-pci.o 16 16 17 17 # FIXME FIXME FIXME 18 - obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o 18 + obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o 19 19 20 20 EXTRA_CFLAGS += -Werror
+7 -2
arch/mips/mti-malta/malta-smtc.c
··· 84 84 85 85 static void __init msmtc_smp_setup(void) 86 86 { 87 - mipsmt_build_cpu_map(0); 87 + /* 88 + * we won't get the definitive value until 89 + * we've run smtc_prepare_cpus later, but 90 + * we would appear to need an upper bound now. 91 + */ 92 + smp_num_siblings = smtc_build_cpu_map(0); 88 93 } 89 94 90 95 static void __init msmtc_prepare_cpus(unsigned int max_cpus) 91 96 { 92 - mipsmt_prepare_cpus(); 97 + smtc_prepare_cpus(max_cpus); 93 98 } 94 99 95 100 struct plat_smp_ops msmtc_smp_ops = {
+1
arch/mips/pci/Makefile
··· 15 15 obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o 16 16 obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o 17 17 obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o 18 + obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o 18 19 19 20 # 20 21 # These are still pretty much in the old state, watch, go blind.
+60
arch/mips/pci/pci-bcm47xx.c
··· 1 + /* 2 + * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net> 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms of the GNU General Public License as published by the 6 + * Free Software Foundation; either version 2 of the License, or (at your 7 + * option) any later version. 8 + * 9 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 10 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 11 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 12 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 13 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 14 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 15 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 16 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 18 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 + * 20 + * You should have received a copy of the GNU General Public License along 21 + * with this program; if not, write to the Free Software Foundation, Inc., 22 + * 675 Mass Ave, Cambridge, MA 02139, USA. 23 + */ 24 + 25 + #include <linux/types.h> 26 + #include <linux/pci.h> 27 + #include <linux/ssb/ssb.h> 28 + 29 + int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 30 + { 31 + return 0; 32 + } 33 + 34 + int pcibios_plat_dev_init(struct pci_dev *dev) 35 + { 36 + int res; 37 + u8 slot, pin; 38 + 39 + res = ssb_pcibios_plat_dev_init(dev); 40 + if (res < 0) { 41 + printk(KERN_ALERT "PCI: Failed to init device %s\n", 42 + pci_name(dev)); 43 + return res; 44 + } 45 + 46 + pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 47 + slot = PCI_SLOT(dev->devfn); 48 + res = ssb_pcibios_map_irq(dev, slot, pin); 49 + 50 + /* IRQ-0 and IRQ-1 are software interrupts. */ 51 + if (res < 2) { 52 + printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n", 53 + pci_name(dev)); 54 + return res; 55 + } 56 + 57 + dev->irq = res; 58 + return 0; 59 + } 60 +
+33 -11
arch/mips/pci/pci-ip27.c
··· 143 143 */ 144 144 int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 145 145 { 146 - struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); 147 - int irq = bc->pci_int[slot]; 146 + return 0; 147 + } 148 148 149 - if (irq == -1) { 150 - irq = bc->pci_int[slot] = request_bridge_irq(bc); 151 - if (irq < 0) 152 - panic("Can't allocate interrupt for PCI device %s\n", 153 - pci_name(dev)); 149 + /* Most MIPS systems have straight-forward swizzling needs. */ 150 + static inline u8 bridge_swizzle(u8 pin, u8 slot) 151 + { 152 + return (((pin - 1) + slot) % 4) + 1; 153 + } 154 + 155 + static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev) 156 + { 157 + while (dev->bus->parent) { 158 + /* Move up the chain of bridges. */ 159 + dev = dev->bus->self; 154 160 } 155 161 156 - irq_to_bridge[irq] = bc; 157 - irq_to_slot[irq] = slot; 158 - 159 - return irq; 162 + return dev; 160 163 } 161 164 162 165 /* Do platform specific device initialization at pci_enable_device() time */ 163 166 int pcibios_plat_dev_init(struct pci_dev *dev) 164 167 { 168 + struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); 169 + struct pci_dev *rdev = bridge_root_dev(dev); 170 + int slot = PCI_SLOT(rdev->devfn); 171 + int irq; 172 + 173 + irq = bc->pci_int[slot]; 174 + if (irq == -1) { 175 + irq = request_bridge_irq(bc); 176 + if (irq < 0) 177 + return irq; 178 + 179 + bc->pci_int[slot] = irq; 180 + } 181 + 182 + irq_to_bridge[irq] = bc; 183 + irq_to_slot[irq] = slot; 184 + 185 + dev->irq = irq; 186 + 165 187 return 0; 166 188 } 167 189
+49 -30
arch/mn10300/kernel/irq.c
··· 20 20 atomic_t irq_err_count; 21 21 22 22 /* 23 - * MN10300 INTC controller operations 23 + * MN10300 interrupt controller operations 24 24 */ 25 - static void mn10300_cpupic_disable(unsigned int irq) 26 - { 27 - u16 tmp = GxICR(irq); 28 - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT; 29 - tmp = GxICR(irq); 30 - } 31 - 32 - static void mn10300_cpupic_enable(unsigned int irq) 33 - { 34 - u16 tmp = GxICR(irq); 35 - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE; 36 - tmp = GxICR(irq); 37 - } 38 - 39 25 static void mn10300_cpupic_ack(unsigned int irq) 40 26 { 41 27 u16 tmp; ··· 46 60 static void mn10300_cpupic_unmask(unsigned int irq) 47 61 { 48 62 u16 tmp = GxICR(irq); 49 - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT; 50 - tmp = GxICR(irq); 51 - } 52 - 53 - static void mn10300_cpupic_end(unsigned int irq) 54 - { 55 - u16 tmp = GxICR(irq); 56 63 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE; 57 64 tmp = GxICR(irq); 58 65 } 59 66 60 - static struct irq_chip mn10300_cpu_pic = { 61 - .name = "cpu", 62 - .disable = mn10300_cpupic_disable, 63 - .enable = mn10300_cpupic_enable, 67 + static void mn10300_cpupic_unmask_clear(unsigned int irq) 68 + { 69 + /* the MN10300 PIC latches its interrupt request bit, even after the 70 + * device has ceased to assert its interrupt line and the interrupt 71 + * channel has been disabled in the PIC, so for level-triggered 72 + * interrupts we need to clear the request bit when we re-enable */ 73 + u16 tmp = GxICR(irq); 74 + GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT; 75 + tmp = GxICR(irq); 76 + } 77 + 78 + /* 79 + * MN10300 PIC level-triggered IRQ handling. 80 + * 81 + * The PIC has no 'ACK' function per se. It is possible to clear individual 82 + * channel latches, but each latch relatches whether or not the channel is 83 + * masked, so we need to clear the latch when we unmask the channel. 84 + * 85 + * Also for this reason, we don't supply an ack() op (it's unused anyway if 86 + * mask_ack() is provided), and mask_ack() just masks. 87 + */ 88 + static struct irq_chip mn10300_cpu_pic_level = { 89 + .name = "cpu_l", 90 + .disable = mn10300_cpupic_mask, 91 + .enable = mn10300_cpupic_unmask_clear, 92 + .ack = NULL, 93 + .mask = mn10300_cpupic_mask, 94 + .mask_ack = mn10300_cpupic_mask, 95 + .unmask = mn10300_cpupic_unmask_clear, 96 + }; 97 + 98 + /* 99 + * MN10300 PIC edge-triggered IRQ handling. 100 + * 101 + * We use the latch clearing function of the PIC as the 'ACK' function. 102 + */ 103 + static struct irq_chip mn10300_cpu_pic_edge = { 104 + .name = "cpu_e", 105 + .disable = mn10300_cpupic_mask, 106 + .enable = mn10300_cpupic_unmask, 64 107 .ack = mn10300_cpupic_ack, 65 108 .mask = mn10300_cpupic_mask, 66 109 .mask_ack = mn10300_cpupic_mask_ack, 67 110 .unmask = mn10300_cpupic_unmask, 68 - .end = mn10300_cpupic_end, 69 111 }; 70 112 71 113 /* ··· 128 114 */ 129 115 void set_intr_postackable(int irq) 130 116 { 131 - set_irq_handler(irq, handle_level_irq); 117 + set_irq_chip_and_handler(irq, &mn10300_cpu_pic_level, 118 + handle_level_irq); 132 119 } 133 120 134 121 /* ··· 141 126 142 127 for (irq = 0; irq < NR_IRQS; irq++) 143 128 if (irq_desc[irq].chip == &no_irq_type) 144 - set_irq_chip_and_handler(irq, &mn10300_cpu_pic, 145 - handle_edge_irq); 129 + /* due to the PIC latching interrupt requests, even 130 + * when the IRQ is disabled, IRQ_PENDING is superfluous 131 + * and we can use handle_level_irq() for edge-triggered 132 + * interrupts */ 133 + set_irq_chip_and_handler(irq, &mn10300_cpu_pic_edge, 134 + handle_level_irq); 146 135 unit_init_IRQ(); 147 136 } 148 137
+41 -11
arch/mn10300/kernel/time.c
··· 1 1 /* MN10300 Low level time management 2 2 * 3 - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 3 + * Copyright (C) 2007-2008 Red Hat, Inc. All Rights Reserved. 4 4 * Written by David Howells (dhowells@redhat.com) 5 5 * - Derived from arch/i386/kernel/time.c 6 6 * ··· 16 16 #include <linux/init.h> 17 17 #include <linux/smp.h> 18 18 #include <linux/profile.h> 19 + #include <linux/cnt32_to_63.h> 19 20 #include <asm/irq.h> 20 21 #include <asm/div64.h> 21 22 #include <asm/processor.h> ··· 41 40 .name = "timer", 42 41 }; 43 42 43 + static unsigned long sched_clock_multiplier; 44 + 44 45 /* 45 46 * scheduler clock - returns current time in nanosec units. 46 47 */ 47 48 unsigned long long sched_clock(void) 48 49 { 49 50 union { 50 - unsigned long long l; 51 - u32 w[2]; 52 - } quot; 51 + unsigned long long ll; 52 + unsigned l[2]; 53 + } tsc64, result; 54 + unsigned long tsc, tmp; 55 + unsigned product[3]; /* 96-bit intermediate value */ 53 56 54 - quot.w[0] = mn10300_last_tsc - get_cycles(); 55 - quot.w[1] = 1000000000; 57 + /* read the TSC value 58 + */ 59 + tsc = 0 - get_cycles(); /* get_cycles() counts down */ 56 60 57 - asm("mulu %2,%3,%0,%1" 58 - : "=r"(quot.w[1]), "=r"(quot.w[0]) 59 - : "0"(quot.w[1]), "1"(quot.w[0]) 61 + /* expand to 64-bits. 62 + * - sched_clock() must be called once a minute or better or the 63 + * following will go horribly wrong - see cnt32_to_63() 64 + */ 65 + tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL; 66 + 67 + /* scale the 64-bit TSC value to a nanosecond value via a 96-bit 68 + * intermediate 69 + */ 70 + asm("mulu %2,%0,%3,%0 \n" /* LSW * mult -> 0:%3:%0 */ 71 + "mulu %2,%1,%2,%1 \n" /* MSW * mult -> %2:%1:0 */ 72 + "add %3,%1 \n" 73 + "addc 0,%2 \n" /* result in %2:%1:%0 */ 74 + : "=r"(product[0]), "=r"(product[1]), "=r"(product[2]), "=r"(tmp) 75 + : "0"(tsc64.l[0]), "1"(tsc64.l[1]), "2"(sched_clock_multiplier) 60 76 : "cc"); 61 77 62 - do_div(quot.l, MN10300_TSCCLK); 78 + result.l[0] = product[1] << 16 | product[0] >> 16; 79 + result.l[1] = product[2] << 16 | product[1] >> 16; 63 80 64 - return quot.l; 81 + return result.ll; 82 + } 83 + 84 + /* 85 + * initialise the scheduler clock 86 + */ 87 + static void __init mn10300_sched_clock_init(void) 88 + { 89 + sched_clock_multiplier = 90 + __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK); 65 91 } 66 92 67 93 /* ··· 156 128 /* start the watchdog timer */ 157 129 watchdog_go(); 158 130 #endif 131 + 132 + mn10300_sched_clock_init(); 159 133 }
+1 -1
arch/mn10300/unit-asb2303/unit-init.c
··· 51 51 switch (GET_XIRQ_TRIGGER(extnum)) { 52 52 case XIRQ_TRIGGER_HILEVEL: 53 53 case XIRQ_TRIGGER_LOWLEVEL: 54 - set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq); 54 + set_intr_postackable(XIRQ2IRQ(extnum)); 55 55 break; 56 56 default: 57 57 break;
+1 -1
arch/mn10300/unit-asb2305/unit-init.c
··· 52 52 switch (GET_XIRQ_TRIGGER(extnum)) { 53 53 case XIRQ_TRIGGER_HILEVEL: 54 54 case XIRQ_TRIGGER_LOWLEVEL: 55 - set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq); 55 + set_intr_postackable(XIRQ2IRQ(extnum)); 56 56 break; 57 57 default: 58 58 break;
+53 -53
arch/powerpc/boot/dts/holly.dts
··· 133 133 reg = <0x00007400 0x00000400>; 134 134 big-endian; 135 135 }; 136 + }; 136 137 137 - pci@1000 { 138 - device_type = "pci"; 139 - compatible = "tsi109-pci", "tsi108-pci"; 140 - #interrupt-cells = <1>; 141 - #size-cells = <2>; 142 - #address-cells = <3>; 143 - reg = <0x00001000 0x00001000>; 144 - bus-range = <0x0 0x0>; 145 - /*----------------------------------------------------+ 146 - | PCI memory range. 147 - | 01 denotes I/O space 148 - | 02 denotes 32-bit memory space 149 - +----------------------------------------------------*/ 150 - ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000 151 - 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>; 152 - clock-frequency = <133333332>; 153 - interrupt-parent = <&MPIC>; 138 + pci@c0001000 { 139 + device_type = "pci"; 140 + compatible = "tsi109-pci", "tsi108-pci"; 141 + #interrupt-cells = <1>; 142 + #size-cells = <2>; 143 + #address-cells = <3>; 144 + reg = <0xc0001000 0x00001000>; 145 + bus-range = <0x0 0x0>; 146 + /*----------------------------------------------------+ 147 + | PCI memory range. 148 + | 01 denotes I/O space 149 + | 02 denotes 32-bit memory space 150 + +----------------------------------------------------*/ 151 + ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000 152 + 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>; 153 + clock-frequency = <133333332>; 154 + interrupt-parent = <&MPIC>; 155 + interrupts = <0x17 0x2>; 156 + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 157 + /*----------------------------------------------------+ 158 + | The INTA, INTB, INTC, INTD are shared. 159 + +----------------------------------------------------*/ 160 + interrupt-map = < 161 + 0x800 0x0 0x0 0x1 &RT0 0x24 0x0 162 + 0x800 0x0 0x0 0x2 &RT0 0x25 0x0 163 + 0x800 0x0 0x0 0x3 &RT0 0x26 0x0 164 + 0x800 0x0 0x0 0x4 &RT0 0x27 0x0 165 + 166 + 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0 167 + 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0 168 + 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0 169 + 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0 170 + 171 + 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0 172 + 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0 173 + 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0 174 + 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0 175 + 176 + 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0 177 + 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0 178 + 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0 179 + 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0 180 + >; 181 + 182 + RT0: router@1180 { 183 + device_type = "pic-router"; 184 + interrupt-controller; 185 + big-endian; 186 + clock-frequency = <0>; 187 + #address-cells = <0>; 188 + #interrupt-cells = <2>; 154 189 interrupts = <0x17 0x2>; 155 - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 156 - /*----------------------------------------------------+ 157 - | The INTA, INTB, INTC, INTD are shared. 158 - +----------------------------------------------------*/ 159 - interrupt-map = < 160 - 0x800 0x0 0x0 0x1 &RT0 0x24 0x0 161 - 0x800 0x0 0x0 0x2 &RT0 0x25 0x0 162 - 0x800 0x0 0x0 0x3 &RT0 0x26 0x0 163 - 0x800 0x0 0x0 0x4 &RT0 0x27 0x0 164 - 165 - 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0 166 - 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0 167 - 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0 168 - 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0 169 - 170 - 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0 171 - 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0 172 - 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0 173 - 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0 174 - 175 - 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0 176 - 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0 177 - 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0 178 - 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0 179 - >; 180 - 181 - RT0: router@1180 { 182 - device_type = "pic-router"; 183 - interrupt-controller; 184 - big-endian; 185 - clock-frequency = <0>; 186 - #address-cells = <0>; 187 - #interrupt-cells = <2>; 188 - interrupts = <0x17 0x2>; 189 - interrupt-parent = <&MPIC>; 190 - }; 190 + interrupt-parent = <&MPIC>; 191 191 }; 192 192 }; 193 193
+1 -5
arch/powerpc/kernel/idle.c
··· 34 34 #include <asm/smp.h> 35 35 36 36 #ifdef CONFIG_HOTPLUG_CPU 37 - /* this is used for software suspend, and that shuts down 38 - * CPUs even while the system is still booting... */ 39 - #define cpu_should_die() (cpu_is_offline(smp_processor_id()) && \ 40 - (system_state == SYSTEM_RUNNING \ 41 - || system_state == SYSTEM_BOOTING)) 37 + #define cpu_should_die() cpu_is_offline(smp_processor_id()) 42 38 #else 43 39 #define cpu_should_die() 0 44 40 #endif
+2 -3
arch/powerpc/kernel/kgdb.c
··· 347 347 linux_regs->msr |= MSR_SE; 348 348 #endif 349 349 kgdb_single_step = 1; 350 - if (kgdb_contthread) 351 - atomic_set(&kgdb_cpu_doing_single_step, 352 - raw_smp_processor_id()); 350 + atomic_set(&kgdb_cpu_doing_single_step, 351 + raw_smp_processor_id()); 353 352 } 354 353 return 0; 355 354 }
+11 -1
arch/powerpc/platforms/fsl_uli1575.c
··· 219 219 int i; 220 220 u8 *dummy; 221 221 struct pci_bus *bus = dev->bus; 222 + resource_size_t end = 0; 223 + 224 + for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) { 225 + unsigned long flags = pci_resource_flags(dev, i); 226 + if ((flags & (IORESOURCE_MEM|IORESOURCE_PREFETCH)) == IORESOURCE_MEM) 227 + end = pci_resource_end(dev, i); 228 + } 222 229 223 230 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 224 231 if ((bus->resource[i]) && 225 232 (bus->resource[i]->flags & IORESOURCE_MEM)) { 226 - dummy = ioremap(bus->resource[i]->end - 3, 0x4); 233 + if (bus->resource[i]->end == end) 234 + dummy = ioremap(bus->resource[i]->start, 0x4); 235 + else 236 + dummy = ioremap(bus->resource[i]->end - 3, 0x4); 227 237 if (dummy) { 228 238 in_8(dummy); 229 239 iounmap(dummy);
+2
arch/s390/kernel/time.c
··· 169 169 170 170 static void clock_comparator_interrupt(__u16 code) 171 171 { 172 + if (S390_lowcore.clock_comparator == -1ULL) 173 + set_clock_comparator(S390_lowcore.clock_comparator); 172 174 } 173 175 174 176 static void etr_timing_alert(struct etr_irq_parm *);
+56 -36
arch/s390/lib/delay.c
··· 1 1 /* 2 - * arch/s390/lib/delay.c 3 2 * Precise Delay Loops for S390 4 3 * 5 - * S390 version 6 - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 7 - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 8 - * 9 - * Derived from "arch/i386/lib/delay.c" 10 - * Copyright (C) 1993 Linus Torvalds 11 - * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> 4 + * Copyright IBM Corp. 1999,2008 5 + * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, 6 + * Heiko Carstens <heiko.carstens@de.ibm.com>, 12 7 */ 13 8 14 9 #include <linux/sched.h> ··· 24 29 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1)); 25 30 } 26 31 27 - /* 28 - * Waits for 'usecs' microseconds using the TOD clock comparator. 29 - */ 30 - void __udelay(unsigned long usecs) 32 + static void __udelay_disabled(unsigned long usecs) 31 33 { 32 - u64 end, time, old_cc = 0; 33 - unsigned long flags, cr0, mask, dummy; 34 - int irq_context; 34 + unsigned long mask, cr0, cr0_saved; 35 + u64 clock_saved; 35 36 36 - irq_context = in_interrupt(); 37 - if (!irq_context) 38 - local_bh_disable(); 39 - local_irq_save(flags); 40 - if (raw_irqs_disabled_flags(flags)) { 41 - old_cc = local_tick_disable(); 42 - S390_lowcore.clock_comparator = -1ULL; 43 - __ctl_store(cr0, 0, 0); 44 - dummy = (cr0 & 0xffff00e0) | 0x00000800; 45 - __ctl_load(dummy , 0, 0); 46 - mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; 47 - } else 48 - mask = psw_kernel_bits | PSW_MASK_WAIT | 49 - PSW_MASK_EXT | PSW_MASK_IO; 37 + clock_saved = local_tick_disable(); 38 + set_clock_comparator(get_clock() + ((u64) usecs << 12)); 39 + __ctl_store(cr0_saved, 0, 0); 40 + cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; 41 + __ctl_load(cr0 , 0, 0); 42 + mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; 43 + trace_hardirqs_on(); 44 + __load_psw_mask(mask); 45 + local_irq_disable(); 46 + __ctl_load(cr0_saved, 0, 0); 47 + local_tick_enable(clock_saved); 48 + set_clock_comparator(S390_lowcore.clock_comparator); 49 + } 50 50 51 + static void __udelay_enabled(unsigned long usecs) 52 + { 53 + unsigned long mask; 54 + u64 end, time; 55 + 56 + mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO; 51 57 end = get_clock() + ((u64) usecs << 12); 52 58 do { 53 59 time = end < S390_lowcore.clock_comparator ? ··· 58 62 __load_psw_mask(mask); 59 63 local_irq_disable(); 60 64 } while (get_clock() < end); 61 - 62 - if (raw_irqs_disabled_flags(flags)) { 63 - __ctl_load(cr0, 0, 0); 64 - local_tick_enable(old_cc); 65 - } 66 - if (!irq_context) 67 - _local_bh_enable(); 68 65 set_clock_comparator(S390_lowcore.clock_comparator); 66 + } 67 + 68 + /* 69 + * Waits for 'usecs' microseconds using the TOD clock comparator. 70 + */ 71 + void __udelay(unsigned long usecs) 72 + { 73 + unsigned long flags; 74 + 75 + preempt_disable(); 76 + local_irq_save(flags); 77 + if (in_irq()) { 78 + __udelay_disabled(usecs); 79 + goto out; 80 + } 81 + if (in_softirq()) { 82 + if (raw_irqs_disabled_flags(flags)) 83 + __udelay_disabled(usecs); 84 + else 85 + __udelay_enabled(usecs); 86 + goto out; 87 + } 88 + if (raw_irqs_disabled_flags(flags)) { 89 + local_bh_disable(); 90 + __udelay_disabled(usecs); 91 + _local_bh_enable(); 92 + goto out; 93 + } 94 + __udelay_enabled(usecs); 95 + out: 69 96 local_irq_restore(flags); 97 + preempt_enable(); 70 98 }
+4 -5
arch/sparc64/kernel/of_device.c
··· 169 169 170 170 static int of_bus_pci_match(struct device_node *np) 171 171 { 172 - if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 172 + if (!strcmp(np->name, "pci")) { 173 173 const char *model = of_get_property(np, "model", NULL); 174 174 175 175 if (model && !strcmp(model, "SUNW,simba")) ··· 200 200 /* Treat PCI busses lacking ranges property just like 201 201 * simba. 202 202 */ 203 - if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 203 + if (!strcmp(np->name, "pci")) { 204 204 if (!of_find_property(np, "ranges", NULL)) 205 205 return 1; 206 206 } ··· 429 429 * it lacks a ranges property, and this will include 430 430 * cases like Simba. 431 431 */ 432 - if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex")) 432 + if (!strcmp(pp->name, "pci")) 433 433 return 0; 434 434 435 435 return 1; ··· 714 714 break; 715 715 } 716 716 } else { 717 - if (!strcmp(pp->type, "pci") || 718 - !strcmp(pp->type, "pciex")) { 717 + if (!strcmp(pp->name, "pci")) { 719 718 unsigned int this_orig_irq = irq; 720 719 721 720 irq = pci_irq_swizzle(dp, pp, irq);
+1 -1
arch/sparc64/kernel/pci.c
··· 425 425 dev->current_state = 4; /* unknown power state */ 426 426 dev->error_state = pci_channel_io_normal; 427 427 428 - if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 428 + if (!strcmp(node->name, "pci")) { 429 429 /* a PCI-PCI bridge */ 430 430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 431 431 dev->rom_base_reg = PCI_ROM_ADDRESS1;
+1 -1
arch/x86/boot/compressed/relocs.c
··· 492 492 continue; 493 493 } 494 494 sh_symtab = sec_symtab->symtab; 495 - sym_strtab = sec->link->strtab; 495 + sym_strtab = sec_symtab->link->strtab; 496 496 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) { 497 497 Elf32_Rel *rel; 498 498 Elf32_Sym *sym;
+16 -6
arch/x86/kernel/amd_iommu.c
··· 101 101 */ 102 102 static int iommu_completion_wait(struct amd_iommu *iommu) 103 103 { 104 - int ret, ready = 0; 104 + int ret = 0, ready = 0; 105 105 unsigned status = 0; 106 106 struct iommu_cmd cmd; 107 - unsigned long i = 0; 107 + unsigned long flags, i = 0; 108 108 109 109 memset(&cmd, 0, sizeof(cmd)); 110 110 cmd.data[0] = CMD_COMPL_WAIT_INT_MASK; ··· 112 112 113 113 iommu->need_sync = 0; 114 114 115 - ret = iommu_queue_command(iommu, &cmd); 115 + spin_lock_irqsave(&iommu->lock, flags); 116 + 117 + ret = __iommu_queue_command(iommu, &cmd); 116 118 117 119 if (ret) 118 - return ret; 120 + goto out; 119 121 120 122 while (!ready && (i < EXIT_LOOP_COUNT)) { 121 123 ++i; ··· 132 130 133 131 if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit())) 134 132 printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n"); 133 + out: 134 + spin_unlock_irqrestore(&iommu->lock, flags); 135 135 136 136 return 0; 137 137 } ··· 144 140 static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid) 145 141 { 146 142 struct iommu_cmd cmd; 143 + int ret; 147 144 148 145 BUG_ON(iommu == NULL); 149 146 ··· 152 147 CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY); 153 148 cmd.data[0] = devid; 154 149 150 + ret = iommu_queue_command(iommu, &cmd); 151 + 155 152 iommu->need_sync = 1; 156 153 157 - return iommu_queue_command(iommu, &cmd); 154 + return ret; 158 155 } 159 156 160 157 /* ··· 166 159 u64 address, u16 domid, int pde, int s) 167 160 { 168 161 struct iommu_cmd cmd; 162 + int ret; 169 163 170 164 memset(&cmd, 0, sizeof(cmd)); 171 165 address &= PAGE_MASK; ··· 179 171 if (pde) /* PDE bit - we wan't flush everything not only the PTEs */ 180 172 cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; 181 173 174 + ret = iommu_queue_command(iommu, &cmd); 175 + 182 176 iommu->need_sync = 1; 183 177 184 - return iommu_queue_command(iommu, &cmd); 178 + return ret; 185 179 } 186 180 187 181 /*
+2 -1
arch/x86/kernel/apm_32.c
··· 234 234 #include <asm/uaccess.h> 235 235 #include <asm/desc.h> 236 236 #include <asm/i8253.h> 237 + #include <asm/olpc.h> 237 238 #include <asm/paravirt.h> 238 239 #include <asm/reboot.h> 239 240 ··· 2218 2217 2219 2218 dmi_check_system(apm_dmi_table); 2220 2219 2221 - if (apm_info.bios.version == 0 || paravirt_enabled()) { 2220 + if (apm_info.bios.version == 0 || paravirt_enabled() || machine_is_olpc()) { 2222 2221 printk(KERN_INFO "apm: BIOS not found.\n"); 2223 2222 return -ENODEV; 2224 2223 }
+1 -1
arch/x86/kernel/cpu/mtrr/main.c
··· 834 834 enable_mtrr_cleanup = 1; 835 835 return 0; 836 836 } 837 - early_param("enble_mtrr_cleanup", enable_mtrr_cleanup_setup); 837 + early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup); 838 838 839 839 struct var_mtrr_state { 840 840 unsigned long range_startk;
+32 -11
arch/x86/kernel/kgdb.c
··· 69 69 */ 70 70 void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 71 71 { 72 + #ifndef CONFIG_X86_32 73 + u32 *gdb_regs32 = (u32 *)gdb_regs; 74 + #endif 72 75 gdb_regs[GDB_AX] = regs->ax; 73 76 gdb_regs[GDB_BX] = regs->bx; 74 77 gdb_regs[GDB_CX] = regs->cx; ··· 79 76 gdb_regs[GDB_SI] = regs->si; 80 77 gdb_regs[GDB_DI] = regs->di; 81 78 gdb_regs[GDB_BP] = regs->bp; 82 - gdb_regs[GDB_PS] = regs->flags; 83 79 gdb_regs[GDB_PC] = regs->ip; 84 80 #ifdef CONFIG_X86_32 81 + gdb_regs[GDB_PS] = regs->flags; 85 82 gdb_regs[GDB_DS] = regs->ds; 86 83 gdb_regs[GDB_ES] = regs->es; 87 84 gdb_regs[GDB_CS] = regs->cs; ··· 97 94 gdb_regs[GDB_R13] = regs->r13; 98 95 gdb_regs[GDB_R14] = regs->r14; 99 96 gdb_regs[GDB_R15] = regs->r15; 97 + gdb_regs32[GDB_PS] = regs->flags; 98 + gdb_regs32[GDB_CS] = regs->cs; 99 + gdb_regs32[GDB_SS] = regs->ss; 100 100 #endif 101 101 gdb_regs[GDB_SP] = regs->sp; 102 102 } ··· 118 112 */ 119 113 void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 120 114 { 115 + #ifndef CONFIG_X86_32 116 + u32 *gdb_regs32 = (u32 *)gdb_regs; 117 + #endif 121 118 gdb_regs[GDB_AX] = 0; 122 119 gdb_regs[GDB_BX] = 0; 123 120 gdb_regs[GDB_CX] = 0; ··· 138 129 gdb_regs[GDB_FS] = 0xFFFF; 139 130 gdb_regs[GDB_GS] = 0xFFFF; 140 131 #else 141 - gdb_regs[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); 142 - gdb_regs[GDB_PC] = 0; 132 + gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); 133 + gdb_regs32[GDB_CS] = __KERNEL_CS; 134 + gdb_regs32[GDB_SS] = __KERNEL_DS; 135 + gdb_regs[GDB_PC] = p->thread.ip; 143 136 gdb_regs[GDB_R8] = 0; 144 137 gdb_regs[GDB_R9] = 0; 145 138 gdb_regs[GDB_R10] = 0; ··· 164 153 */ 165 154 void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) 166 155 { 156 + #ifndef CONFIG_X86_32 157 + u32 *gdb_regs32 = (u32 *)gdb_regs; 158 + #endif 167 159 regs->ax = gdb_regs[GDB_AX]; 168 160 regs->bx = gdb_regs[GDB_BX]; 169 161 regs->cx = gdb_regs[GDB_CX]; ··· 174 160 regs->si = gdb_regs[GDB_SI]; 175 161 regs->di = gdb_regs[GDB_DI]; 176 162 regs->bp = gdb_regs[GDB_BP]; 177 - regs->flags = gdb_regs[GDB_PS]; 178 163 regs->ip = gdb_regs[GDB_PC]; 179 164 #ifdef CONFIG_X86_32 165 + regs->flags = gdb_regs[GDB_PS]; 180 166 regs->ds = gdb_regs[GDB_DS]; 181 167 regs->es = gdb_regs[GDB_ES]; 182 168 regs->cs = gdb_regs[GDB_CS]; ··· 189 175 regs->r13 = gdb_regs[GDB_R13]; 190 176 regs->r14 = gdb_regs[GDB_R14]; 191 177 regs->r15 = gdb_regs[GDB_R15]; 178 + regs->flags = gdb_regs32[GDB_PS]; 179 + regs->cs = gdb_regs32[GDB_CS]; 180 + regs->ss = gdb_regs32[GDB_SS]; 192 181 #endif 193 182 } 194 183 ··· 395 378 if (remcomInBuffer[0] == 's') { 396 379 linux_regs->flags |= X86_EFLAGS_TF; 397 380 kgdb_single_step = 1; 398 - if (kgdb_contthread) { 399 - atomic_set(&kgdb_cpu_doing_single_step, 400 - raw_smp_processor_id()); 401 - } 381 + atomic_set(&kgdb_cpu_doing_single_step, 382 + raw_smp_processor_id()); 402 383 } 403 384 404 385 get_debugreg(dr6, 6); ··· 481 466 482 467 case DIE_DEBUG: 483 468 if (atomic_read(&kgdb_cpu_doing_single_step) == 484 - raw_smp_processor_id() && 485 - user_mode(regs)) 486 - return single_step_cont(regs, args); 469 + raw_smp_processor_id()) { 470 + if (user_mode(regs)) 471 + return single_step_cont(regs, args); 472 + break; 473 + } else if (test_thread_flag(TIF_SINGLESTEP)) 474 + /* This means a user thread is single stepping 475 + * a system call which should be ignored 476 + */ 477 + return NOTIFY_DONE; 487 478 /* fall through */ 488 479 default: 489 480 if (user_mode(regs))
+12 -5
arch/x86/kernel/process.c
··· 246 246 return 1; 247 247 } 248 248 249 + static cpumask_t c1e_mask = CPU_MASK_NONE; 250 + static int c1e_detected; 251 + 252 + void c1e_remove_cpu(int cpu) 253 + { 254 + cpu_clear(cpu, c1e_mask); 255 + } 256 + 249 257 /* 250 258 * C1E aware idle routine. We check for C1E active in the interrupt 251 259 * pending message MSR. If we detect C1E, then we handle it the same ··· 261 253 */ 262 254 static void c1e_idle(void) 263 255 { 264 - static cpumask_t c1e_mask = CPU_MASK_NONE; 265 - static int c1e_detected; 266 - 267 256 if (need_resched()) 268 257 return; 269 258 ··· 270 265 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 271 266 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 272 267 c1e_detected = 1; 273 - mark_tsc_unstable("TSC halt in C1E"); 274 - printk(KERN_INFO "System has C1E enabled\n"); 268 + if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) 269 + mark_tsc_unstable("TSC halt in AMD C1E"); 270 + printk(KERN_INFO "System has AMD C1E enabled\n"); 271 + set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E); 275 272 } 276 273 } 277 274
+2
arch/x86/kernel/process_32.c
··· 55 55 #include <asm/tlbflush.h> 56 56 #include <asm/cpu.h> 57 57 #include <asm/kdebug.h> 58 + #include <asm/idle.h> 58 59 59 60 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 60 61 ··· 89 88 cpu_clear(cpu, cpu_callin_map); 90 89 91 90 numa_remove_cpu(cpu); 91 + c1e_remove_cpu(cpu); 92 92 } 93 93 94 94 /* We don't actually take CPU down, just spin without interrupts. */
+2
arch/x86/kernel/process_64.c
··· 93 93 static inline void play_dead(void) 94 94 { 95 95 idle_task_exit(); 96 + c1e_remove_cpu(raw_smp_processor_id()); 97 + 96 98 mb(); 97 99 /* Ack it */ 98 100 __get_cpu_var(cpu_state) = CPU_DEAD;
+1 -1
arch/x86/kernel/vmi_32.c
··· 235 235 const void *desc) 236 236 { 237 237 u32 *ldt_entry = (u32 *)desc; 238 - vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]); 238 + vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]); 239 239 } 240 240 241 241 static void vmi_load_sp0(struct tss_struct *tss,
+1 -1
arch/x86/kernel/vsmp_64.c
··· 61 61 native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC)); 62 62 } 63 63 64 - static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf, 64 + static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf, 65 65 unsigned long addr, unsigned len) 66 66 { 67 67 switch (type) {
+3 -1
arch/x86/oprofile/nmi_int.c
··· 295 295 296 296 static void nmi_shutdown(void) 297 297 { 298 - struct op_msrs *msrs = &get_cpu_var(cpu_msrs); 298 + struct op_msrs *msrs; 299 + 299 300 nmi_enabled = 0; 300 301 on_each_cpu(nmi_cpu_shutdown, NULL, 1); 301 302 unregister_die_notifier(&profile_exceptions_nb); 303 + msrs = &get_cpu_var(cpu_msrs); 302 304 model->shutdown(msrs); 303 305 free_msrs(); 304 306 put_cpu_var(cpu_msrs);
+4 -9
drivers/accessibility/braille/braille_console.c
··· 376 376 console->flags |= CON_ENABLED; 377 377 console->index = index; 378 378 braille_co = console; 379 + register_keyboard_notifier(&keyboard_notifier_block); 380 + register_vt_notifier(&vt_notifier_block); 379 381 return 0; 380 382 } 381 383 ··· 385 383 { 386 384 if (braille_co != console) 387 385 return -EINVAL; 386 + unregister_keyboard_notifier(&keyboard_notifier_block); 387 + unregister_vt_notifier(&vt_notifier_block); 388 388 braille_co = NULL; 389 389 return 0; 390 390 } 391 - 392 - static int __init braille_init(void) 393 - { 394 - register_keyboard_notifier(&keyboard_notifier_block); 395 - register_vt_notifier(&vt_notifier_block); 396 - return 0; 397 - } 398 - 399 - console_initcall(braille_init);
+4 -1
drivers/acpi/glue.c
··· 165 165 "firmware_node"); 166 166 ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, 167 167 "physical_node"); 168 - if (acpi_dev->wakeup.flags.valid) 168 + if (acpi_dev->wakeup.flags.valid) { 169 169 device_set_wakeup_capable(dev, true); 170 + device_set_wakeup_enable(dev, 171 + acpi_dev->wakeup.state.enabled); 172 + } 170 173 } 171 174 172 175 return 0;
+10
drivers/acpi/sleep/proc.c
··· 377 377 return 0; 378 378 } 379 379 380 + static void physical_device_enable_wakeup(struct acpi_device *adev) 381 + { 382 + struct device *dev = acpi_get_physical_device(adev->handle); 383 + 384 + if (dev && device_can_wakeup(dev)) 385 + device_set_wakeup_enable(dev, adev->wakeup.state.enabled); 386 + } 387 + 380 388 static ssize_t 381 389 acpi_system_write_wakeup_device(struct file *file, 382 390 const char __user * buffer, ··· 419 411 } 420 412 } 421 413 if (found_dev) { 414 + physical_device_enable_wakeup(found_dev); 422 415 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 423 416 struct acpi_device *dev = container_of(node, 424 417 struct ··· 437 428 dev->pnp.bus_id, found_dev->pnp.bus_id); 438 429 dev->wakeup.state.enabled = 439 430 found_dev->wakeup.state.enabled; 431 + physical_device_enable_wakeup(dev); 440 432 } 441 433 } 442 434 }
+40 -6
drivers/ata/sata_nv.c
··· 309 309 static void nv_nf2_thaw(struct ata_port *ap); 310 310 static void nv_ck804_freeze(struct ata_port *ap); 311 311 static void nv_ck804_thaw(struct ata_port *ap); 312 + static int nv_hardreset(struct ata_link *link, unsigned int *class, 313 + unsigned long deadline); 312 314 static int nv_adma_slave_config(struct scsi_device *sdev); 313 315 static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); 314 316 static void nv_adma_qc_prep(struct ata_queued_cmd *qc); ··· 405 403 .slave_configure = nv_swncq_slave_config, 406 404 }; 407 405 408 - static struct ata_port_operations nv_generic_ops = { 406 + /* OSDL bz3352 reports that some nv controllers can't determine device 407 + * signature reliably and nv_hardreset is implemented to work around 408 + * the problem. This was reported on nf3 and it's unclear whether any 409 + * other controllers are affected. However, the workaround has been 410 + * applied to all variants and there isn't much to gain by trying to 411 + * find out exactly which ones are affected at this point especially 412 + * because NV has moved over to ahci for newer controllers. 413 + */ 414 + static struct ata_port_operations nv_common_ops = { 409 415 .inherits = &ata_bmdma_port_ops, 410 - .hardreset = ATA_OP_NULL, 416 + .hardreset = nv_hardreset, 411 417 .scr_read = nv_scr_read, 412 418 .scr_write = nv_scr_write, 413 419 }; 414 420 421 + /* OSDL bz11195 reports that link doesn't come online after hardreset 422 + * on generic nv's and there have been several other similar reports 423 + * on linux-ide. Disable hardreset for generic nv's. 424 + */ 425 + static struct ata_port_operations nv_generic_ops = { 426 + .inherits = &nv_common_ops, 427 + .hardreset = ATA_OP_NULL, 428 + }; 429 + 415 430 static struct ata_port_operations nv_nf2_ops = { 416 - .inherits = &nv_generic_ops, 431 + .inherits = &nv_common_ops, 417 432 .freeze = nv_nf2_freeze, 418 433 .thaw = nv_nf2_thaw, 419 434 }; 420 435 421 436 static struct ata_port_operations nv_ck804_ops = { 422 - .inherits = &nv_generic_ops, 437 + .inherits = &nv_common_ops, 423 438 .freeze = nv_ck804_freeze, 424 439 .thaw = nv_ck804_thaw, 425 440 .host_stop = nv_ck804_host_stop, 426 441 }; 427 442 428 443 static struct ata_port_operations nv_adma_ops = { 429 - .inherits = &nv_generic_ops, 444 + .inherits = &nv_common_ops, 430 445 431 446 .check_atapi_dma = nv_adma_check_atapi_dma, 432 447 .sff_tf_read = nv_adma_tf_read, ··· 467 448 }; 468 449 469 450 static struct ata_port_operations nv_swncq_ops = { 470 - .inherits = &nv_generic_ops, 451 + .inherits = &nv_common_ops, 471 452 472 453 .qc_defer = ata_std_qc_defer, 473 454 .qc_prep = nv_swncq_qc_prep, ··· 1603 1584 mask |= (NV_INT_MASK_MCP55 << shift); 1604 1585 writel(mask, mmio_base + NV_INT_ENABLE_MCP55); 1605 1586 ata_sff_thaw(ap); 1587 + } 1588 + 1589 + static int nv_hardreset(struct ata_link *link, unsigned int *class, 1590 + unsigned long deadline) 1591 + { 1592 + int rc; 1593 + 1594 + /* SATA hardreset fails to retrieve proper device signature on 1595 + * some controllers. Request follow up SRST. For more info, 1596 + * see http://bugzilla.kernel.org/show_bug.cgi?id=3352 1597 + */ 1598 + rc = sata_sff_hardreset(link, class, deadline); 1599 + if (rc) 1600 + return rc; 1601 + return -EAGAIN; 1606 1602 } 1607 1603 1608 1604 static void nv_adma_error_handler(struct ata_port *ap)
+22 -6
drivers/bluetooth/btusb.c
··· 104 104 /* Broadcom BCM2046 */ 105 105 { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET }, 106 106 107 + /* Apple MacBook Pro with Broadcom chip */ 108 + { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET }, 109 + 107 110 /* IBM/Lenovo ThinkPad with Broadcom chip */ 108 111 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 109 112 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, ··· 172 169 struct btusb_data { 173 170 struct hci_dev *hdev; 174 171 struct usb_device *udev; 172 + struct usb_interface *intf; 175 173 struct usb_interface *isoc; 176 174 177 175 spinlock_t lock; ··· 520 516 521 517 err = btusb_submit_intr_urb(hdev); 522 518 if (err < 0) { 523 - clear_bit(BTUSB_INTR_RUNNING, &hdev->flags); 519 + clear_bit(BTUSB_INTR_RUNNING, &data->flags); 524 520 clear_bit(HCI_RUNNING, &hdev->flags); 525 521 } 526 522 ··· 536 532 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 537 533 return 0; 538 534 535 + cancel_work_sync(&data->work); 536 + 539 537 clear_bit(BTUSB_ISOC_RUNNING, &data->flags); 540 - usb_kill_anchored_urbs(&data->intr_anchor); 538 + usb_kill_anchored_urbs(&data->isoc_anchor); 541 539 542 540 clear_bit(BTUSB_BULK_RUNNING, &data->flags); 543 541 usb_kill_anchored_urbs(&data->bulk_anchor); ··· 827 821 } 828 822 829 823 data->udev = interface_to_usbdev(intf); 824 + data->intf = intf; 830 825 831 826 spin_lock_init(&data->lock); 832 827 ··· 896 889 897 890 if (data->isoc) { 898 891 err = usb_driver_claim_interface(&btusb_driver, 899 - data->isoc, NULL); 892 + data->isoc, data); 900 893 if (err < 0) { 901 894 hci_free_dev(hdev); 902 895 kfree(data); ··· 928 921 929 922 hdev = data->hdev; 930 923 931 - if (data->isoc) 932 - usb_driver_release_interface(&btusb_driver, data->isoc); 924 + __hci_dev_hold(hdev); 933 925 934 - usb_set_intfdata(intf, NULL); 926 + usb_set_intfdata(data->intf, NULL); 927 + 928 + if (data->isoc) 929 + usb_set_intfdata(data->isoc, NULL); 935 930 936 931 hci_unregister_dev(hdev); 932 + 933 + if (intf == data->isoc) 934 + usb_driver_release_interface(&btusb_driver, data->intf); 935 + else if (data->isoc) 936 + usb_driver_release_interface(&btusb_driver, data->isoc); 937 + 938 + __hci_dev_put(hdev); 937 939 938 940 hci_free_dev(hdev); 939 941 }
+12 -2
drivers/char/tty_io.c
··· 695 695 { 696 696 struct tty_driver *p, *res = NULL; 697 697 int tty_line = 0; 698 + int len; 698 699 char *str; 700 + 701 + for (str = name; *str; str++) 702 + if ((*str >= '0' && *str <= '9') || *str == ',') 703 + break; 704 + if (!*str) 705 + return NULL; 706 + 707 + len = str - name; 708 + tty_line = simple_strtoul(str, &str, 10); 699 709 700 710 mutex_lock(&tty_mutex); 701 711 /* Search through the tty devices to look for a match */ 702 712 list_for_each_entry(p, &tty_drivers, tty_drivers) { 703 - str = name + strlen(p->name); 704 - tty_line = simple_strtoul(str, &str, 10); 713 + if (strncmp(name, p->name, len) != 0) 714 + continue; 705 715 if (*str == ',') 706 716 str++; 707 717 if (*str == '\0')
+1 -1
drivers/dma/dw_dmac.c
··· 364 364 int i; 365 365 366 366 status_block = dma_readl(dw, RAW.BLOCK); 367 - status_xfer = dma_readl(dw, RAW.BLOCK); 367 + status_xfer = dma_readl(dw, RAW.XFER); 368 368 status_err = dma_readl(dw, RAW.ERROR); 369 369 370 370 dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n",
+2 -2
drivers/i2c/busses/i2c-powermac.c
··· 180 180 }; 181 181 182 182 183 - static int i2c_powermac_remove(struct platform_device *dev) 183 + static int __devexit i2c_powermac_remove(struct platform_device *dev) 184 184 { 185 185 struct i2c_adapter *adapter = platform_get_drvdata(dev); 186 186 struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); ··· 200 200 } 201 201 202 202 203 - static int __devexit i2c_powermac_probe(struct platform_device *dev) 203 + static int __devinit i2c_powermac_probe(struct platform_device *dev) 204 204 { 205 205 struct pmac_i2c_bus *bus = dev->dev.platform_data; 206 206 struct device_node *parent = NULL;
+3 -1
drivers/i2c/i2c-dev.c
··· 583 583 goto out; 584 584 585 585 i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); 586 - if (IS_ERR(i2c_dev_class)) 586 + if (IS_ERR(i2c_dev_class)) { 587 + res = PTR_ERR(i2c_dev_class); 587 588 goto out_unreg_chrdev; 589 + } 588 590 589 591 res = i2c_add_driver(&i2cdev_driver); 590 592 if (res)
+14
drivers/ide/Kconfig
··· 292 292 tristate "generic/default IDE chipset support" 293 293 depends on ALPHA || X86 || IA64 || M32R || MIPS 294 294 help 295 + This is the generic IDE driver. This driver attaches to the 296 + fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and 297 + so on). Please note that if this driver is built into the 298 + kernel or loaded before other ATA (IDE or libata) drivers 299 + and the controller is located at legacy ports, this driver 300 + may grab those ports and thus can prevent the controller 301 + specific driver from attaching. 302 + 303 + Also, currently, IDE generic doesn't allow IRQ sharing 304 + meaning that the IRQs it grabs won't be available to other 305 + controllers sharing those IRQs which usually makes drivers 306 + for those controllers fail. Generally, it's not a good idea 307 + to load IDE generic driver on modern systems. 308 + 295 309 If unsure, say N. 296 310 297 311 config BLK_DEV_PLATFORM
+5 -5
drivers/ide/ide-tape.c
··· 2338 2338 { 2339 2339 idetape_tape_t *tape = drive->driver_data; 2340 2340 struct ide_atapi_pc pc; 2341 - char fw_rev[6], vendor_id[10], product_id[18]; 2341 + char fw_rev[4], vendor_id[8], product_id[16]; 2342 2342 2343 2343 idetape_create_inquiry_cmd(&pc); 2344 2344 if (idetape_queue_pc_tail(drive, &pc)) { ··· 2350 2350 memcpy(product_id, &pc.buf[16], 16); 2351 2351 memcpy(fw_rev, &pc.buf[32], 4); 2352 2352 2353 - ide_fixstring(vendor_id, 10, 0); 2354 - ide_fixstring(product_id, 18, 0); 2355 - ide_fixstring(fw_rev, 6, 0); 2353 + ide_fixstring(vendor_id, 8, 0); 2354 + ide_fixstring(product_id, 16, 0); 2355 + ide_fixstring(fw_rev, 4, 0); 2356 2356 2357 - printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", 2357 + printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n", 2358 2358 drive->name, tape->name, vendor_id, product_id, fw_rev); 2359 2359 } 2360 2360
+1
drivers/ide/mips/swarm.c
··· 107 107 108 108 base = ioremap(offset, size); 109 109 110 + memset(&hw, 0, sizeof(hw)); 110 111 for (i = 0; i <= 7; i++) 111 112 hw.io_ports_array[i] = 112 113 (unsigned long)(base + ((0x1f0 + i) << 5));
+4 -4
drivers/infiniband/ulp/ipoib/ipoib_main.c
··· 404 404 struct net_device *dev = path->dev; 405 405 struct ipoib_dev_priv *priv = netdev_priv(dev); 406 406 struct ipoib_ah *ah = NULL; 407 - struct ipoib_ah *old_ah; 407 + struct ipoib_ah *old_ah = NULL; 408 408 struct ipoib_neigh *neigh, *tn; 409 409 struct sk_buff_head skqueue; 410 410 struct sk_buff *skb; ··· 428 428 429 429 spin_lock_irqsave(&priv->lock, flags); 430 430 431 - old_ah = path->ah; 432 - path->ah = ah; 433 - 434 431 if (ah) { 435 432 path->pathrec = *pathrec; 433 + 434 + old_ah = path->ah; 435 + path->ah = ah; 436 436 437 437 ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n", 438 438 ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
+14 -14
drivers/leds/leds-fsg.c
··· 161 161 { 162 162 int ret; 163 163 164 + /* Map the LED chip select address space */ 165 + latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); 166 + if (!latch_address) { 167 + ret = -ENOMEM; 168 + goto failremap; 169 + } 170 + 171 + latch_value = 0xffff; 172 + *latch_address = latch_value; 173 + 164 174 ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); 165 175 if (ret < 0) 166 176 goto failwlan; ··· 195 185 if (ret < 0) 196 186 goto failring; 197 187 198 - /* Map the LED chip select address space */ 199 - latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); 200 - if (!latch_address) { 201 - ret = -ENOMEM; 202 - goto failremap; 203 - } 204 - 205 - latch_value = 0xffff; 206 - *latch_address = latch_value; 207 - 208 188 return ret; 209 189 210 - failremap: 211 - led_classdev_unregister(&fsg_ring_led); 212 190 failring: 213 191 led_classdev_unregister(&fsg_sync_led); 214 192 failsync: ··· 208 210 failwan: 209 211 led_classdev_unregister(&fsg_wlan_led); 210 212 failwlan: 213 + iounmap(latch_address); 214 + failremap: 211 215 212 216 return ret; 213 217 } 214 218 215 219 static int fsg_led_remove(struct platform_device *pdev) 216 220 { 217 - iounmap(latch_address); 218 - 219 221 led_classdev_unregister(&fsg_wlan_led); 220 222 led_classdev_unregister(&fsg_wan_led); 221 223 led_classdev_unregister(&fsg_sata_led); 222 224 led_classdev_unregister(&fsg_usb_led); 223 225 led_classdev_unregister(&fsg_sync_led); 224 226 led_classdev_unregister(&fsg_ring_led); 227 + 228 + iounmap(latch_address); 225 229 226 230 return 0; 227 231 }
+39 -33
drivers/leds/leds-pca955x.c
··· 248 248 const struct i2c_device_id *id) 249 249 { 250 250 struct pca955x_led *pca955x; 251 - int i; 252 - int err = -ENODEV; 253 251 struct pca955x_chipdef *chip; 254 252 struct i2c_adapter *adapter; 255 253 struct led_platform_data *pdata; 254 + int i, err; 256 255 257 256 chip = &pca955x_chipdefs[id->driver_data]; 258 257 adapter = to_i2c_adapter(client->dev.parent); ··· 281 282 } 282 283 } 283 284 284 - for (i = 0; i < chip->bits; i++) { 285 - pca955x = kzalloc(sizeof(struct pca955x_led), GFP_KERNEL); 286 - if (!pca955x) { 287 - err = -ENOMEM; 288 - goto exit; 289 - } 285 + pca955x = kzalloc(sizeof(*pca955x) * chip->bits, GFP_KERNEL); 286 + if (!pca955x) 287 + return -ENOMEM; 290 288 291 - pca955x->chipdef = chip; 292 - pca955x->client = client; 293 - pca955x->led_num = i; 289 + i2c_set_clientdata(client, pca955x); 290 + 291 + for (i = 0; i < chip->bits; i++) { 292 + pca955x[i].chipdef = chip; 293 + pca955x[i].client = client; 294 + pca955x[i].led_num = i; 295 + 294 296 /* Platform data can specify LED names and default triggers */ 295 297 if (pdata) { 296 298 if (pdata->leds[i].name) 297 - snprintf(pca955x->name, 32, "pca955x:%s", 298 - pdata->leds[i].name); 299 + snprintf(pca955x[i].name, 300 + sizeof(pca955x[i].name), "pca955x:%s", 301 + pdata->leds[i].name); 299 302 if (pdata->leds[i].default_trigger) 300 - pca955x->led_cdev.default_trigger = 303 + pca955x[i].led_cdev.default_trigger = 301 304 pdata->leds[i].default_trigger; 302 305 } else { 303 - snprintf(pca955x->name, 32, "pca955x:%d", i); 306 + snprintf(pca955x[i].name, sizeof(pca955x[i].name), 307 + "pca955x:%d", i); 304 308 } 305 - spin_lock_init(&pca955x->lock); 306 309 307 - pca955x->led_cdev.name = pca955x->name; 308 - pca955x->led_cdev.brightness_set = 309 - pca955x_led_set; 310 + spin_lock_init(&pca955x[i].lock); 310 311 311 - /* 312 - * Client data is a pointer to the _first_ pca955x_led 313 - * struct 314 - */ 315 - if (i == 0) 316 - i2c_set_clientdata(client, pca955x); 312 + pca955x[i].led_cdev.name = pca955x[i].name; 313 + pca955x[i].led_cdev.brightness_set = pca955x_led_set; 317 314 318 - INIT_WORK(&(pca955x->work), pca955x_led_work); 315 + INIT_WORK(&pca955x[i].work, pca955x_led_work); 319 316 320 - led_classdev_register(&client->dev, &(pca955x->led_cdev)); 317 + err = led_classdev_register(&client->dev, &pca955x[i].led_cdev); 318 + if (err < 0) 319 + goto exit; 321 320 } 322 321 323 322 /* Turn off LEDs */ ··· 333 336 pca955x_write_psc(client, 1, 0); 334 337 335 338 return 0; 339 + 336 340 exit: 341 + while (i--) { 342 + led_classdev_unregister(&pca955x[i].led_cdev); 343 + cancel_work_sync(&pca955x[i].work); 344 + } 345 + 346 + kfree(pca955x); 347 + i2c_set_clientdata(client, NULL); 348 + 337 349 return err; 338 350 } 339 351 340 352 static int __devexit pca955x_remove(struct i2c_client *client) 341 353 { 342 354 struct pca955x_led *pca955x = i2c_get_clientdata(client); 343 - int leds = pca955x->chipdef->bits; 344 355 int i; 345 356 346 - for (i = 0; i < leds; i++) { 347 - led_classdev_unregister(&(pca955x->led_cdev)); 348 - cancel_work_sync(&(pca955x->work)); 349 - kfree(pca955x); 350 - pca955x = pca955x + 1; 357 + for (i = 0; i < pca955x->chipdef->bits; i++) { 358 + led_classdev_unregister(&pca955x[i].led_cdev); 359 + cancel_work_sync(&pca955x[i].work); 351 360 } 361 + 362 + kfree(pca955x); 363 + i2c_set_clientdata(client, NULL); 352 364 353 365 return 0; 354 366 }
+15 -1
drivers/md/dm-mpath.c
··· 63 63 64 64 const char *hw_handler_name; 65 65 struct work_struct activate_path; 66 + struct pgpath *pgpath_to_activate; 66 67 unsigned nr_priority_groups; 67 68 struct list_head priority_groups; 68 69 unsigned pg_init_required; /* pg_init needs calling? */ ··· 147 146 148 147 static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) 149 148 { 149 + unsigned long flags; 150 150 struct pgpath *pgpath, *tmp; 151 151 struct multipath *m = ti->private; 152 152 ··· 156 154 if (m->hw_handler_name) 157 155 scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev)); 158 156 dm_put_device(ti, pgpath->path.dev); 157 + spin_lock_irqsave(&m->lock, flags); 158 + if (m->pgpath_to_activate == pgpath) 159 + m->pgpath_to_activate = NULL; 160 + spin_unlock_irqrestore(&m->lock, flags); 159 161 free_pgpath(pgpath); 160 162 } 161 163 } ··· 427 421 __choose_pgpath(m); 428 422 429 423 pgpath = m->current_pgpath; 424 + m->pgpath_to_activate = m->current_pgpath; 430 425 431 426 if ((pgpath && !m->queue_io) || 432 427 (!pgpath && !m->queue_if_no_path)) ··· 1100 1093 int ret; 1101 1094 struct multipath *m = 1102 1095 container_of(work, struct multipath, activate_path); 1103 - struct dm_path *path = &m->current_pgpath->path; 1096 + struct dm_path *path; 1097 + unsigned long flags; 1104 1098 1099 + spin_lock_irqsave(&m->lock, flags); 1100 + path = &m->pgpath_to_activate->path; 1101 + m->pgpath_to_activate = NULL; 1102 + spin_unlock_irqrestore(&m->lock, flags); 1103 + if (!path) 1104 + return; 1105 1105 ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev)); 1106 1106 pg_init_done(path, ret); 1107 1107 }
+8 -4
drivers/md/dm.c
··· 837 837 struct dm_table *map = dm_get_table(md); 838 838 struct dm_target *ti; 839 839 sector_t max_sectors; 840 - int max_size; 840 + int max_size = 0; 841 841 842 842 if (unlikely(!map)) 843 - return 0; 843 + goto out; 844 844 845 845 ti = dm_table_find_target(map, bvm->bi_sector); 846 + if (!dm_target_is_valid(ti)) 847 + goto out_table; 846 848 847 849 /* 848 850 * Find maximum amount of I/O that won't need splitting ··· 863 861 if (max_size && ti->type->merge) 864 862 max_size = ti->type->merge(ti, bvm, biovec, max_size); 865 863 864 + out_table: 865 + dm_table_put(map); 866 + 867 + out: 866 868 /* 867 869 * Always allow an entire first page 868 870 */ 869 871 if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) 870 872 max_size = biovec->bv_len; 871 - 872 - dm_table_put(map); 873 873 874 874 return max_size; 875 875 }
+2 -2
drivers/mfd/Kconfig
··· 21 21 22 22 config MFD_SM501_GPIO 23 23 bool "Export GPIO via GPIO layer" 24 - depends on MFD_SM501 && HAVE_GPIO_LIB 24 + depends on MFD_SM501 && GPIOLIB 25 25 ---help--- 26 26 This option uses the gpio library layer to export the 64 GPIO 27 27 lines on the SM501. The platform data is used to supply the ··· 29 29 30 30 config MFD_ASIC3 31 31 bool "Support for Compaq ASIC3" 32 - depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM 32 + depends on GENERIC_HARDIRQS && GPIOLIB && ARM 33 33 ---help--- 34 34 This driver supports the ASIC3 multifunction chip found on many 35 35 PDAs (mainly iPAQ and HTC based ones)
+1 -1
drivers/mfd/asic3.c
··· 312 312 struct asic3 *asic = platform_get_drvdata(pdev); 313 313 unsigned long clksel = 0; 314 314 unsigned int irq, irq_base; 315 - int map_size; 316 315 int ret; 317 316 318 317 ret = platform_get_irq(pdev, 0); ··· 533 534 struct asic3 *asic; 534 535 struct resource *mem; 535 536 unsigned long clksel; 537 + int map_size; 536 538 int ret = 0; 537 539 538 540 asic = kzalloc(sizeof(struct asic3), GFP_KERNEL);
+4 -1
drivers/net/e1000e/e1000.h
··· 257 257 struct net_device *netdev; 258 258 struct pci_dev *pdev; 259 259 struct net_device_stats net_stats; 260 - spinlock_t stats_lock; /* prevent concurrent stats updates */ 261 260 262 261 /* structs defined in e1000_hw.h */ 263 262 struct e1000_hw hw; ··· 283 284 unsigned long led_status; 284 285 285 286 unsigned int flags; 287 + struct work_struct downshift_task; 288 + struct work_struct update_phy_task; 286 289 }; 287 290 288 291 struct e1000_info { ··· 306 305 #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) 307 306 #define FLAG_HAS_SWSM_ON_LOAD (1 << 6) 308 307 #define FLAG_HAS_JUMBO_FRAMES (1 << 7) 308 + #define FLAG_READ_ONLY_NVM (1 << 8) 309 309 #define FLAG_IS_ICH (1 << 9) 310 310 #define FLAG_HAS_SMART_POWER_DOWN (1 << 11) 311 311 #define FLAG_IS_QUAD_PORT_A (1 << 12) ··· 387 385 extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw); 388 386 extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); 389 387 388 + extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw); 390 389 extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, 391 390 bool state); 392 391 extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
+8 -1
drivers/net/e1000e/ethtool.c
··· 432 432 regs_buff[11] = er32(TIDV); 433 433 434 434 regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ 435 + 436 + /* ethtool doesn't use anything past this point, so all this 437 + * code is likely legacy junk for apps that may or may not 438 + * exist */ 435 439 if (hw->phy.type == e1000_phy_m88) { 436 440 e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); 437 441 regs_buff[13] = (u32)phy_data; /* cable length */ ··· 451 447 regs_buff[22] = adapter->phy_stats.receive_errors; 452 448 regs_buff[23] = regs_buff[13]; /* mdix mode */ 453 449 } 454 - regs_buff[21] = adapter->phy_stats.idle_errors; /* phy idle errors */ 450 + regs_buff[21] = 0; /* was idle_errors */ 455 451 e1e_rphy(hw, PHY_1000T_STATUS, &phy_data); 456 452 regs_buff[24] = (u32)phy_data; /* phy local receiver status */ 457 453 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ ··· 532 528 533 529 if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16))) 534 530 return -EFAULT; 531 + 532 + if (adapter->flags & FLAG_READ_ONLY_NVM) 533 + return -EINVAL; 535 534 536 535 max_len = hw->nvm.word_size * 2; 537 536
+78
drivers/net/e1000e/ich8lan.c
··· 58 58 #define ICH_FLASH_HSFCTL 0x0006 59 59 #define ICH_FLASH_FADDR 0x0008 60 60 #define ICH_FLASH_FDATA0 0x0010 61 + #define ICH_FLASH_PR0 0x0074 61 62 62 63 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500 63 64 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 ··· 149 148 u32 gmwag :8; /* 31:24 GbE Master Write Access Grant */ 150 149 } hsf_flregacc; 151 150 u16 regval; 151 + }; 152 + 153 + /* ICH Flash Protected Region */ 154 + union ich8_flash_protected_range { 155 + struct ich8_pr { 156 + u32 base:13; /* 0:12 Protected Range Base */ 157 + u32 reserved1:2; /* 13:14 Reserved */ 158 + u32 rpe:1; /* 15 Read Protection Enable */ 159 + u32 limit:13; /* 16:28 Protected Range Limit */ 160 + u32 reserved2:2; /* 29:30 Reserved */ 161 + u32 wpe:1; /* 31 Write Protection Enable */ 162 + } range; 163 + u32 regval; 152 164 }; 153 165 154 166 static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); ··· 380 366 return 0; 381 367 } 382 368 369 + static DEFINE_MUTEX(nvm_mutex); 370 + static pid_t nvm_owner = -1; 371 + 383 372 /** 384 373 * e1000_acquire_swflag_ich8lan - Acquire software control flag 385 374 * @hw: pointer to the HW structure ··· 395 378 { 396 379 u32 extcnf_ctrl; 397 380 u32 timeout = PHY_CFG_TIMEOUT; 381 + 382 + might_sleep(); 383 + 384 + if (!mutex_trylock(&nvm_mutex)) { 385 + WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n", 386 + nvm_owner); 387 + mutex_lock(&nvm_mutex); 388 + } 389 + nvm_owner = current->pid; 398 390 399 391 while (timeout) { 400 392 extcnf_ctrl = er32(EXTCNF_CTRL); ··· 419 393 420 394 if (!timeout) { 421 395 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 396 + nvm_owner = -1; 397 + mutex_unlock(&nvm_mutex); 422 398 return -E1000_ERR_CONFIG; 423 399 } 424 400 ··· 442 414 extcnf_ctrl = er32(EXTCNF_CTRL); 443 415 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 444 416 ew32(EXTCNF_CTRL, extcnf_ctrl); 417 + 418 + nvm_owner = -1; 419 + mutex_unlock(&nvm_mutex); 445 420 } 446 421 447 422 /** ··· 1315 1284 * programming failed. 1316 1285 */ 1317 1286 if (ret_val) { 1287 + /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ 1318 1288 hw_dbg(hw, "Flash commit failed.\n"); 1319 1289 e1000_release_swflag_ich8lan(hw); 1320 1290 return ret_val; ··· 1403 1371 } 1404 1372 1405 1373 return e1000e_validate_nvm_checksum_generic(hw); 1374 + } 1375 + 1376 + /** 1377 + * e1000e_write_protect_nvm_ich8lan - Make the NVM read-only 1378 + * @hw: pointer to the HW structure 1379 + * 1380 + * To prevent malicious write/erase of the NVM, set it to be read-only 1381 + * so that the hardware ignores all write/erase cycles of the NVM via 1382 + * the flash control registers. The shadow-ram copy of the NVM will 1383 + * still be updated, however any updates to this copy will not stick 1384 + * across driver reloads. 1385 + **/ 1386 + void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) 1387 + { 1388 + union ich8_flash_protected_range pr0; 1389 + union ich8_hws_flash_status hsfsts; 1390 + u32 gfpreg; 1391 + s32 ret_val; 1392 + 1393 + ret_val = e1000_acquire_swflag_ich8lan(hw); 1394 + if (ret_val) 1395 + return; 1396 + 1397 + gfpreg = er32flash(ICH_FLASH_GFPREG); 1398 + 1399 + /* Write-protect GbE Sector of NVM */ 1400 + pr0.regval = er32flash(ICH_FLASH_PR0); 1401 + pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK; 1402 + pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK); 1403 + pr0.range.wpe = true; 1404 + ew32flash(ICH_FLASH_PR0, pr0.regval); 1405 + 1406 + /* 1407 + * Lock down a subset of GbE Flash Control Registers, e.g. 1408 + * PR0 to prevent the write-protection from being lifted. 1409 + * Once FLOCKDN is set, the registers protected by it cannot 1410 + * be written until FLOCKDN is cleared by a hardware reset. 1411 + */ 1412 + hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); 1413 + hsfsts.hsf_status.flockdn = true; 1414 + ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); 1415 + 1416 + e1000_release_swflag_ich8lan(hw); 1406 1417 } 1407 1418 1408 1419 /** ··· 1794 1719 hw_dbg(hw, "Issuing a global reset to ich8lan"); 1795 1720 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 1796 1721 msleep(20); 1722 + 1723 + /* release the swflag because it is not reset by hardware reset */ 1724 + e1000_release_swflag_ich8lan(hw); 1797 1725 1798 1726 ret_val = e1000e_get_auto_rd_done(hw); 1799 1727 if (ret_val) {
+35 -37
drivers/net/e1000e/netdev.c
··· 47 47 48 48 #include "e1000.h" 49 49 50 - #define DRV_VERSION "0.3.3.3-k2" 50 + #define DRV_VERSION "0.3.3.3-k6" 51 51 char e1000e_driver_name[] = "e1000e"; 52 52 const char e1000e_driver_version[] = DRV_VERSION; 53 53 ··· 1115 1115 writel(0, adapter->hw.hw_addr + rx_ring->tail); 1116 1116 } 1117 1117 1118 + static void e1000e_downshift_workaround(struct work_struct *work) 1119 + { 1120 + struct e1000_adapter *adapter = container_of(work, 1121 + struct e1000_adapter, downshift_task); 1122 + 1123 + e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); 1124 + } 1125 + 1118 1126 /** 1119 1127 * e1000_intr_msi - Interrupt Handler 1120 1128 * @irq: interrupt number ··· 1147 1139 */ 1148 1140 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1149 1141 (!(er32(STATUS) & E1000_STATUS_LU))) 1150 - e1000e_gig_downshift_workaround_ich8lan(hw); 1142 + schedule_work(&adapter->downshift_task); 1151 1143 1152 1144 /* 1153 1145 * 80003ES2LAN workaround-- For packet buffer work-around on ··· 1213 1205 */ 1214 1206 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1215 1207 (!(er32(STATUS) & E1000_STATUS_LU))) 1216 - e1000e_gig_downshift_workaround_ich8lan(hw); 1208 + schedule_work(&adapter->downshift_task); 1217 1209 1218 1210 /* 1219 1211 * 80003ES2LAN workaround-- ··· 2600 2592 /* Explicitly disable IRQ since the NIC can be in any state. */ 2601 2593 e1000_irq_disable(adapter); 2602 2594 2603 - spin_lock_init(&adapter->stats_lock); 2604 - 2605 2595 set_bit(__E1000_DOWN, &adapter->state); 2606 2596 return 0; 2607 2597 ··· 2918 2912 return 0; 2919 2913 } 2920 2914 2915 + /** 2916 + * e1000e_update_phy_task - work thread to update phy 2917 + * @work: pointer to our work struct 2918 + * 2919 + * this worker thread exists because we must acquire a 2920 + * semaphore to read the phy, which we could msleep while 2921 + * waiting for it, and we can't msleep in a timer. 2922 + **/ 2923 + static void e1000e_update_phy_task(struct work_struct *work) 2924 + { 2925 + struct e1000_adapter *adapter = container_of(work, 2926 + struct e1000_adapter, update_phy_task); 2927 + e1000_get_phy_info(&adapter->hw); 2928 + } 2929 + 2921 2930 /* 2922 2931 * Need to wait a few seconds after link up to get diagnostic information from 2923 2932 * the phy ··· 2940 2919 static void e1000_update_phy_info(unsigned long data) 2941 2920 { 2942 2921 struct e1000_adapter *adapter = (struct e1000_adapter *) data; 2943 - e1000_get_phy_info(&adapter->hw); 2922 + schedule_work(&adapter->update_phy_task); 2944 2923 } 2945 2924 2946 2925 /** ··· 2951 2930 { 2952 2931 struct e1000_hw *hw = &adapter->hw; 2953 2932 struct pci_dev *pdev = adapter->pdev; 2954 - unsigned long irq_flags; 2955 - u16 phy_tmp; 2956 - 2957 - #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF 2958 2933 2959 2934 /* 2960 2935 * Prevent stats update while adapter is being reset, or if the pci ··· 2960 2943 return; 2961 2944 if (pci_channel_offline(pdev)) 2962 2945 return; 2963 - 2964 - spin_lock_irqsave(&adapter->stats_lock, irq_flags); 2965 - 2966 - /* 2967 - * these counters are modified from e1000_adjust_tbi_stats, 2968 - * called from the interrupt context, so they must only 2969 - * be written while holding adapter->stats_lock 2970 - */ 2971 2946 2972 2947 adapter->stats.crcerrs += er32(CRCERRS); 2973 2948 adapter->stats.gprc += er32(GPRC); ··· 3031 3022 3032 3023 /* Tx Dropped needs to be maintained elsewhere */ 3033 3024 3034 - /* Phy Stats */ 3035 - if (hw->phy.media_type == e1000_media_type_copper) { 3036 - if ((adapter->link_speed == SPEED_1000) && 3037 - (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) { 3038 - phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; 3039 - adapter->phy_stats.idle_errors += phy_tmp; 3040 - } 3041 - } 3042 - 3043 3025 /* Management Stats */ 3044 3026 adapter->stats.mgptc += er32(MGTPTC); 3045 3027 adapter->stats.mgprc += er32(MGTPRC); 3046 3028 adapter->stats.mgpdc += er32(MGTPDC); 3047 - 3048 - spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); 3049 3029 } 3050 3030 3051 3031 /** ··· 3046 3048 struct e1000_hw *hw = &adapter->hw; 3047 3049 struct e1000_phy_regs *phy = &adapter->phy_regs; 3048 3050 int ret_val; 3049 - unsigned long irq_flags; 3050 - 3051 - 3052 - spin_lock_irqsave(&adapter->stats_lock, irq_flags); 3053 3051 3054 3052 if ((er32(STATUS) & E1000_STATUS_LU) && 3055 3053 (adapter->hw.phy.media_type == e1000_media_type_copper)) { ··· 3076 3082 phy->stat1000 = 0; 3077 3083 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); 3078 3084 } 3079 - 3080 - spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); 3081 3085 } 3082 3086 3083 3087 static void e1000_print_link_info(struct e1000_adapter *adapter) ··· 4459 4467 4460 4468 adapter->bd_number = cards_found++; 4461 4469 4470 + e1000e_check_options(adapter); 4471 + 4462 4472 /* setup adapter struct */ 4463 4473 err = e1000_sw_init(adapter); 4464 4474 if (err) ··· 4475 4481 err = ei->get_variants(adapter); 4476 4482 if (err) 4477 4483 goto err_hw_init; 4484 + 4485 + if ((adapter->flags & FLAG_IS_ICH) && 4486 + (adapter->flags & FLAG_READ_ONLY_NVM)) 4487 + e1000e_write_protect_nvm_ich8lan(&adapter->hw); 4478 4488 4479 4489 hw->mac.ops.get_bus_info(&adapter->hw); 4480 4490 ··· 4570 4572 4571 4573 INIT_WORK(&adapter->reset_task, e1000_reset_task); 4572 4574 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); 4573 - 4574 - e1000e_check_options(adapter); 4575 + INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); 4576 + INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); 4575 4577 4576 4578 /* Initialize link parameters. User can change them with ethtool */ 4577 4579 adapter->hw.mac.autoneg = 1;
+30
drivers/net/e1000e/param.c
··· 133 133 */ 134 134 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); 135 135 136 + /* 137 + * Write Protect NVM 138 + * 139 + * Valid Range: 0, 1 140 + * 141 + * Default Value: 1 (enabled) 142 + */ 143 + E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); 144 + 136 145 struct e1000_option { 137 146 enum { enable_option, range_option, list_option } type; 138 147 const char *name; ··· 395 386 if (hw->mac.type == e1000_ich8lan) 396 387 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 397 388 opt.def); 389 + } 390 + } 391 + { /* Write-protect NVM */ 392 + const struct e1000_option opt = { 393 + .type = enable_option, 394 + .name = "Write-protect NVM", 395 + .err = "defaulting to Enabled", 396 + .def = OPTION_ENABLED 397 + }; 398 + 399 + if (adapter->flags & FLAG_IS_ICH) { 400 + if (num_WriteProtectNVM > bd) { 401 + unsigned int write_protect_nvm = WriteProtectNVM[bd]; 402 + e1000_validate_option(&write_protect_nvm, &opt, 403 + adapter); 404 + if (write_protect_nvm) 405 + adapter->flags |= FLAG_READ_ONLY_NVM; 406 + } else { 407 + if (opt.def) 408 + adapter->flags |= FLAG_READ_ONLY_NVM; 409 + } 398 410 } 399 411 } 400 412 }
+9 -2
drivers/net/wireless/ath9k/core.c
··· 294 294 * hardware is gone (invalid). 295 295 */ 296 296 297 - if (!sc->sc_invalid) 298 - ath9k_hw_set_interrupts(ah, 0); 299 297 ath_draintxq(sc, false); 300 298 if (!sc->sc_invalid) { 301 299 ath_stoprecv(sc); ··· 795 797 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 796 798 sc->sc_imask |= ATH9K_INT_CST; 797 799 800 + /* Note: We disable MIB interrupts for now as we don't yet 801 + * handle processing ANI, otherwise you will get an interrupt 802 + * storm after about 7 hours of usage making the system unusable 803 + * with huge latency. Once we do have ANI processing included 804 + * we can re-enable this interrupt. */ 805 + #if 0 798 806 /* 799 807 * Enable MIB interrupts when there are hardware phy counters. 800 808 * Note we only do this (at the moment) for station mode. ··· 808 804 if (ath9k_hw_phycounters(ah) && 809 805 ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS))) 810 806 sc->sc_imask |= ATH9K_INT_MIB; 807 + #endif 811 808 /* 812 809 * Some hardware processes the TIM IE and fires an 813 810 * interrupt when the TIM bit is set. For hardware ··· 1341 1336 1342 1337 DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__); 1343 1338 1339 + tasklet_kill(&sc->intr_tq); 1340 + tasklet_kill(&sc->bcon_tasklet); 1344 1341 ath_stop(sc); 1345 1342 if (!sc->sc_invalid) 1346 1343 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
-1
drivers/net/wireless/ath9k/core.h
··· 974 974 u32 sc_keymax; /* size of key cache */ 975 975 DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */ 976 976 u8 sc_splitmic; /* split TKIP MIC keys */ 977 - int sc_keytype; 978 977 979 978 /* RX */ 980 979 struct list_head sc_rxbuf;
+8 -4
drivers/net/wireless/ath9k/main.c
··· 206 206 if (!ret) 207 207 return -EIO; 208 208 209 - if (mac) 210 - sc->sc_keytype = hk.kv_type; 211 209 return 0; 212 210 } 213 211 ··· 776 778 case DISABLE_KEY: 777 779 ath_key_delete(sc, key); 778 780 clear_bit(key->keyidx, sc->sc_keymap); 779 - sc->sc_keytype = ATH9K_CIPHER_CLR; 780 781 break; 781 782 default: 782 783 ret = -EINVAL; ··· 1411 1414 { 1412 1415 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 1413 1416 struct ath_softc *sc = hw->priv; 1417 + enum ath9k_int status; 1414 1418 1415 - if (pdev->irq) 1419 + if (pdev->irq) { 1420 + ath9k_hw_set_interrupts(sc->sc_ah, 0); 1421 + /* clear the ISR */ 1422 + ath9k_hw_getisr(sc->sc_ah, &status); 1423 + sc->sc_invalid = 1; 1416 1424 free_irq(pdev->irq, sc); 1425 + } 1417 1426 ath_detach(sc); 1427 + 1418 1428 pci_iounmap(pdev, sc->mem); 1419 1429 pci_release_region(pdev, 0); 1420 1430 pci_disable_device(pdev);
+3 -3
drivers/net/wireless/ath9k/xmit.c
··· 315 315 txctl->keyix = tx_info->control.hw_key->hw_key_idx; 316 316 txctl->frmlen += tx_info->control.icv_len; 317 317 318 - if (sc->sc_keytype == ATH9K_CIPHER_WEP) 318 + if (tx_info->control.hw_key->alg == ALG_WEP) 319 319 txctl->keytype = ATH9K_KEY_TYPE_WEP; 320 - else if (sc->sc_keytype == ATH9K_CIPHER_TKIP) 320 + else if (tx_info->control.hw_key->alg == ALG_TKIP) 321 321 txctl->keytype = ATH9K_KEY_TYPE_TKIP; 322 - else if (sc->sc_keytype == ATH9K_CIPHER_AES_CCM) 322 + else if (tx_info->control.hw_key->alg == ALG_CCMP) 323 323 txctl->keytype = ATH9K_KEY_TYPE_AES; 324 324 } 325 325
+1
drivers/net/wireless/zd1211rw/zd_usb.c
··· 58 58 { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 }, 59 59 { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 }, 60 60 { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, 61 + { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, 61 62 /* ZD1211B */ 62 63 { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, 63 64 { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
+19
drivers/pci/pci-sysfs.c
··· 16 16 17 17 18 18 #include <linux/kernel.h> 19 + #include <linux/sched.h> 19 20 #include <linux/pci.h> 20 21 #include <linux/stat.h> 21 22 #include <linux/topology.h> ··· 485 484 #endif /* HAVE_PCI_LEGACY */ 486 485 487 486 #ifdef HAVE_PCI_MMAP 487 + 488 + static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) 489 + { 490 + unsigned long nr, start, size; 491 + 492 + nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 493 + start = vma->vm_pgoff; 494 + size = pci_resource_len(pdev, resno) >> PAGE_SHIFT; 495 + if (start < size && size - start >= nr) 496 + return 1; 497 + WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", 498 + current->comm, start, start+nr, pci_name(pdev), resno, size); 499 + return 0; 500 + } 501 + 488 502 /** 489 503 * pci_mmap_resource - map a PCI resource into user memory space 490 504 * @kobj: kobject for mapping ··· 525 509 break; 526 510 if (i >= PCI_ROM_RESOURCE) 527 511 return -ENODEV; 512 + 513 + if (!pci_mmap_fits(pdev, i, vma)) 514 + return -EINVAL; 528 515 529 516 /* pci_mmap_page_range() expects the same kind of entry as coming 530 517 * from /proc/bus/pci/ which is a "user visible" value. If this is
+1 -1
drivers/pci/pcie/aspm.c
··· 527 527 */ 528 528 pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP, 529 529 &reg32); 530 - if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) { 530 + if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) { 531 531 printk("Pre-1.1 PCIe device detected, " 532 532 "disable ASPM for %s. It can be enabled forcedly" 533 533 " with 'pcie_aspm=force'\n", pci_name(pdev));
+3 -3
drivers/pci/search.c
··· 162 162 * time. 163 163 */ 164 164 struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, 165 - const struct pci_dev *from) 165 + struct pci_dev *from) 166 166 { 167 167 struct pci_dev *pdev; 168 168 ··· 263 263 * this file. 264 264 */ 265 265 static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, 266 - const struct pci_dev *from) 266 + struct pci_dev *from) 267 267 { 268 268 struct device *dev; 269 269 struct device *dev_start = NULL; ··· 303 303 */ 304 304 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 305 305 unsigned int ss_vendor, unsigned int ss_device, 306 - const struct pci_dev *from) 306 + struct pci_dev *from) 307 307 { 308 308 struct pci_dev *pdev; 309 309 struct pci_device_id *id;
+9 -6
drivers/rtc/rtc-dev.c
··· 422 422 return err; 423 423 } 424 424 425 + static int rtc_dev_fasync(int fd, struct file *file, int on) 426 + { 427 + struct rtc_device *rtc = file->private_data; 428 + return fasync_helper(fd, file, on, &rtc->async_queue); 429 + } 430 + 425 431 static int rtc_dev_release(struct inode *inode, struct file *file) 426 432 { 427 433 struct rtc_device *rtc = file->private_data; ··· 440 434 if (rtc->ops->release) 441 435 rtc->ops->release(rtc->dev.parent); 442 436 437 + if (file->f_flags & FASYNC) 438 + rtc_dev_fasync(-1, file, 0); 439 + 443 440 clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); 444 441 return 0; 445 - } 446 - 447 - static int rtc_dev_fasync(int fd, struct file *file, int on) 448 - { 449 - struct rtc_device *rtc = file->private_data; 450 - return fasync_helper(fd, file, on, &rtc->async_queue); 451 442 } 452 443 453 444 static const struct file_operations rtc_dev_fops = {
+20 -35
drivers/s390/cio/qdio_setup.c
··· 447 447 { 448 448 char s[80]; 449 449 450 - sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no); 451 - 450 + sprintf(s, "qdio: %s ", dev_name(&cdev->dev)); 452 451 switch (irq_ptr->qib.qfmt) { 453 452 case QDIO_QETH_QFMT: 454 - sprintf(s + strlen(s), "OSADE "); 453 + sprintf(s + strlen(s), "OSA "); 455 454 break; 456 455 case QDIO_ZFCP_QFMT: 457 456 sprintf(s + strlen(s), "ZFCP "); 458 457 break; 459 458 case QDIO_IQDIO_QFMT: 460 - sprintf(s + strlen(s), "HiperSockets "); 459 + sprintf(s + strlen(s), "HS "); 461 460 break; 462 461 } 463 - sprintf(s + strlen(s), "using: "); 464 - 465 - if (!is_thinint_irq(irq_ptr)) 466 - sprintf(s + strlen(s), "no"); 467 - sprintf(s + strlen(s), "AdapterInterrupts "); 468 - if (!(irq_ptr->sch_token != 0)) 469 - sprintf(s + strlen(s), "no"); 470 - sprintf(s + strlen(s), "QEBSM "); 471 - if (!(irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED)) 472 - sprintf(s + strlen(s), "no"); 473 - sprintf(s + strlen(s), "OutboundPCI "); 474 - if (!css_general_characteristics.aif_tdd) 475 - sprintf(s + strlen(s), "no"); 476 - sprintf(s + strlen(s), "TDD\n"); 477 - printk(KERN_INFO "qdio: %s", s); 478 - 479 - memset(s, 0, sizeof(s)); 480 - sprintf(s, "%s SIGA required: ", cdev->dev.bus_id); 481 - if (irq_ptr->siga_flag.input) 482 - sprintf(s + strlen(s), "Read "); 483 - if (irq_ptr->siga_flag.output) 484 - sprintf(s + strlen(s), "Write "); 485 - if (irq_ptr->siga_flag.sync) 486 - sprintf(s + strlen(s), "Sync "); 487 - if (!irq_ptr->siga_flag.no_sync_ti) 488 - sprintf(s + strlen(s), "SyncAI "); 489 - if (!irq_ptr->siga_flag.no_sync_out_ti) 490 - sprintf(s + strlen(s), "SyncOutAI "); 491 - if (!irq_ptr->siga_flag.no_sync_out_pci) 492 - sprintf(s + strlen(s), "SyncOutPCI"); 462 + sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no); 463 + sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr)); 464 + sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0); 465 + sprintf(s + strlen(s), "PCI:%d ", 466 + (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0); 467 + sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd); 468 + sprintf(s + strlen(s), "SIGA:"); 469 + sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " "); 470 + sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " "); 471 + sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " "); 472 + sprintf(s + strlen(s), "%s", 473 + (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " "); 474 + sprintf(s + strlen(s), "%s", 475 + (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " "); 476 + sprintf(s + strlen(s), "%s", 477 + (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " "); 493 478 sprintf(s + strlen(s), "\n"); 494 - printk(KERN_INFO "qdio: %s", s); 479 + printk(KERN_INFO "%s", s); 495 480 } 496 481 497 482 int __init qdio_setup_init(void)
-1
drivers/scsi/qla2xxx/qla_isr.c
··· 1834 1834 WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT); 1835 1835 } 1836 1836 spin_unlock_irq(&ha->hardware_lock); 1837 - ha->isp_ops->enable_intrs(ha); 1838 1837 1839 1838 fail: 1840 1839 return ret;
+2
drivers/scsi/qla2xxx/qla_os.c
··· 1740 1740 if (ret) 1741 1741 goto probe_failed; 1742 1742 1743 + ha->isp_ops->enable_intrs(ha); 1744 + 1743 1745 scsi_scan_host(host); 1744 1746 1745 1747 qla2x00_alloc_sysfs_attr(ha);
+1
drivers/scsi/qlogicpti.c
··· 914 914 ds[i].d_count = sg_dma_len(s); 915 915 } 916 916 sg_count -= n; 917 + sg = s; 917 918 } 918 919 } else { 919 920 cmd->dataseg[0].d_base = 0;
+2 -1
drivers/scsi/scsi_lib.c
··· 852 852 void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) 853 853 { 854 854 int result = cmd->result; 855 - int this_count = scsi_bufflen(cmd); 855 + int this_count; 856 856 struct request_queue *q = cmd->device->request_queue; 857 857 struct request *req = cmd->request; 858 858 int error = 0; ··· 908 908 */ 909 909 if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) 910 910 return; 911 + this_count = blk_rq_bytes(req); 911 912 912 913 /* good_bytes = 0, or (inclusive) there were leftovers and 913 914 * result = 0, so scsi_end_request couldn't retry.
+19 -13
drivers/serial/atmel_serial.c
··· 131 131 struct atmel_uart_port { 132 132 struct uart_port uart; /* uart */ 133 133 struct clk *clk; /* uart clock */ 134 - unsigned short suspended; /* is port suspended? */ 134 + int may_wakeup; /* cached value of device_may_wakeup for times we need to disable it */ 135 + u32 backup_imr; /* IMR saved during suspend */ 135 136 int break_active; /* break being received */ 136 137 137 138 short use_dma_rx; /* enable PDC receiver */ ··· 985 984 * This is called on uart_open() or a resume event. 986 985 */ 987 986 clk_enable(atmel_port->clk); 987 + 988 + /* re-enable interrupts if we disabled some on suspend */ 989 + UART_PUT_IER(port, atmel_port->backup_imr); 988 990 break; 989 991 case 3: 992 + /* Back up the interrupt mask and disable all interrupts */ 993 + atmel_port->backup_imr = UART_GET_IMR(port); 994 + UART_PUT_IDR(port, -1); 995 + 990 996 /* 991 997 * Disable the peripheral clock for this serial port. 992 998 * This is called on uart_close() or a suspend event. ··· 1483 1475 cpu_relax(); 1484 1476 } 1485 1477 1486 - if (device_may_wakeup(&pdev->dev) 1487 - && !atmel_serial_clk_will_stop()) 1488 - enable_irq_wake(port->irq); 1489 - else { 1490 - uart_suspend_port(&atmel_uart, port); 1491 - atmel_port->suspended = 1; 1492 - } 1478 + /* we can not wake up if we're running on slow clock */ 1479 + atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); 1480 + if (atmel_serial_clk_will_stop()) 1481 + device_set_wakeup_enable(&pdev->dev, 0); 1482 + 1483 + uart_suspend_port(&atmel_uart, port); 1493 1484 1494 1485 return 0; 1495 1486 } ··· 1498 1491 struct uart_port *port = platform_get_drvdata(pdev); 1499 1492 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 1500 1493 1501 - if (atmel_port->suspended) { 1502 - uart_resume_port(&atmel_uart, port); 1503 - atmel_port->suspended = 0; 1504 - } else 1505 - disable_irq_wake(port->irq); 1494 + uart_resume_port(&atmel_uart, port); 1495 + device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); 1506 1496 1507 1497 return 0; 1508 1498 } ··· 1517 1513 BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); 1518 1514 1519 1515 port = &atmel_ports[pdev->id]; 1516 + port->backup_imr = 0; 1517 + 1520 1518 atmel_init_port(port, pdev); 1521 1519 1522 1520 if (!atmel_use_dma_rx(&port->uart)) {
+1 -1
drivers/spi/orion_spi.c
··· 427 427 goto msg_rejected; 428 428 } 429 429 430 - if (t->speed_hz < orion_spi->min_speed) { 430 + if (t->speed_hz && t->speed_hz < orion_spi->min_speed) { 431 431 dev_err(&spi->dev, 432 432 "message rejected : " 433 433 "device min speed (%d Hz) exceeds "
+2 -2
drivers/spi/pxa2xx_spi.c
··· 49 49 50 50 #define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) 51 51 #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) 52 - #define IS_DMA_ALIGNED(x) (((x) & 0x07) == 0) 52 + #define IS_DMA_ALIGNED(x) ((((u32)(x)) & 0x07) == 0) 53 53 #define MAX_DMA_LEN 8191 54 54 55 55 /* ··· 896 896 || transfer->rx_dma || transfer->tx_dma) { 897 897 dev_err(&drv_data->pdev->dev, 898 898 "pump_transfers: mapped transfer length " 899 - "of %lu is greater than %d\n", 899 + "of %u is greater than %d\n", 900 900 transfer->len, MAX_DMA_LEN); 901 901 message->status = -EINVAL; 902 902 giveback(drv_data);
+1
drivers/ssb/main.c
··· 471 471 #endif 472 472 break; 473 473 case SSB_BUSTYPE_SSB: 474 + dev->dma_mask = &dev->coherent_dma_mask; 474 475 break; 475 476 } 476 477
+2 -1
drivers/usb/core/hcd.c
··· 1876 1876 * with IRQF_SHARED. As usb_hcd_irq() will always disable 1877 1877 * interrupts we can remove it here. 1878 1878 */ 1879 - irqflags &= ~IRQF_DISABLED; 1879 + if (irqflags & IRQF_SHARED) 1880 + irqflags &= ~IRQF_DISABLED; 1880 1881 1881 1882 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", 1882 1883 hcd->driver->description, hcd->self.busnum);
+17 -22
drivers/usb/core/hub.c
··· 2683 2683 USB_PORT_STAT_C_ENABLE); 2684 2684 #endif 2685 2685 2686 - /* Try to use the debounce delay for protection against 2687 - * port-enable changes caused, for example, by EMI. 2688 - */ 2689 - if (portchange & (USB_PORT_STAT_C_CONNECTION | 2690 - USB_PORT_STAT_C_ENABLE)) { 2691 - status = hub_port_debounce(hub, port1); 2692 - if (status < 0) { 2693 - if (printk_ratelimit()) 2694 - dev_err (hub_dev, "connect-debounce failed, " 2695 - "port %d disabled\n", port1); 2696 - portstatus &= ~USB_PORT_STAT_CONNECTION; 2697 - } else { 2698 - portstatus = status; 2699 - } 2700 - } 2701 - 2702 2686 /* Try to resuscitate an existing device */ 2703 2687 udev = hdev->children[port1-1]; 2704 2688 if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && 2705 2689 udev->state != USB_STATE_NOTATTACHED) { 2706 - 2707 2690 usb_lock_device(udev); 2708 2691 if (portstatus & USB_PORT_STAT_ENABLE) { 2709 2692 status = 0; /* Nothing to do */ 2710 - } else if (!udev->persist_enabled) { 2711 - status = -ENODEV; /* Mustn't resuscitate */ 2712 2693 2713 2694 #ifdef CONFIG_USB_SUSPEND 2714 - } else if (udev->state == USB_STATE_SUSPENDED) { 2695 + } else if (udev->state == USB_STATE_SUSPENDED && 2696 + udev->persist_enabled) { 2715 2697 /* For a suspended device, treat this as a 2716 2698 * remote wakeup event. 2717 2699 */ ··· 2708 2726 #endif 2709 2727 2710 2728 } else { 2711 - status = usb_reset_device(udev); 2729 + status = -ENODEV; /* Don't resuscitate */ 2712 2730 } 2713 2731 usb_unlock_device(udev); 2714 2732 ··· 2723 2741 usb_disconnect(&hdev->children[port1-1]); 2724 2742 clear_bit(port1, hub->change_bits); 2725 2743 2744 + if (portchange & (USB_PORT_STAT_C_CONNECTION | 2745 + USB_PORT_STAT_C_ENABLE)) { 2746 + status = hub_port_debounce(hub, port1); 2747 + if (status < 0) { 2748 + if (printk_ratelimit()) 2749 + dev_err(hub_dev, "connect-debounce failed, " 2750 + "port %d disabled\n", port1); 2751 + portstatus &= ~USB_PORT_STAT_CONNECTION; 2752 + } else { 2753 + portstatus = status; 2754 + } 2755 + } 2756 + 2726 2757 /* Return now if debouncing failed or nothing is connected */ 2727 2758 if (!(portstatus & USB_PORT_STAT_CONNECTION)) { 2728 2759 ··· 2743 2748 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 2744 2749 && !(portstatus & (1 << USB_PORT_FEAT_POWER))) 2745 2750 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); 2746 - 2751 + 2747 2752 if (portstatus & USB_PORT_STAT_ENABLE) 2748 2753 goto done; 2749 2754 return;
+1 -1
drivers/usb/gadget/fsl_usb2_udc.c
··· 223 223 fsl_writel(tmp, &dr_regs->endpointlistaddr); 224 224 225 225 VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x", 226 - (int)udc->ep_qh, (int)tmp, 226 + udc->ep_qh, (int)tmp, 227 227 fsl_readl(&dr_regs->endpointlistaddr)); 228 228 229 229 /* Config PHY interface */
+2 -2
drivers/usb/gadget/omap_udc.c
··· 787 787 omap_set_dma_dest_params(ep->lch, 788 788 OMAP_DMA_PORT_TIPB, 789 789 OMAP_DMA_AMODE_CONSTANT, 790 - (unsigned long) io_v2p(UDC_DATA_DMA), 790 + UDC_DATA_DMA, 791 791 0, 0); 792 792 } 793 793 } else { ··· 804 804 omap_set_dma_src_params(ep->lch, 805 805 OMAP_DMA_PORT_TIPB, 806 806 OMAP_DMA_AMODE_CONSTANT, 807 - (unsigned long) io_v2p(UDC_DATA_DMA), 807 + UDC_DATA_DMA, 808 808 0, 0); 809 809 /* EMIFF or SDRC */ 810 810 omap_set_dma_dest_burst_mode(ep->lch,
+16 -10
drivers/usb/host/ehci-hcd.c
··· 145 145 return -ETIMEDOUT; 146 146 } 147 147 148 - static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, 149 - u32 mask, u32 done, int usec) 150 - { 151 - int error = handshake(ehci, ptr, mask, done, usec); 152 - if (error) 153 - ehci_to_hcd(ehci)->state = HC_STATE_HALT; 154 - 155 - return error; 156 - } 157 - 158 148 /* force HC to halt state from unknown (EHCI spec section 2.3) */ 159 149 static int ehci_halt (struct ehci_hcd *ehci) 160 150 { ··· 161 171 ehci_writel(ehci, temp, &ehci->regs->command); 162 172 return handshake (ehci, &ehci->regs->status, 163 173 STS_HALT, STS_HALT, 16 * 125); 174 + } 175 + 176 + static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, 177 + u32 mask, u32 done, int usec) 178 + { 179 + int error; 180 + 181 + error = handshake(ehci, ptr, mask, done, usec); 182 + if (error) { 183 + ehci_halt(ehci); 184 + ehci_to_hcd(ehci)->state = HC_STATE_HALT; 185 + ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n", 186 + ptr, mask, done, error); 187 + } 188 + 189 + return error; 164 190 } 165 191 166 192 /* put TDI/ARC silicon into EHCI mode */
+14 -18
drivers/usb/host/ehci-sched.c
··· 437 437 u32 cmd; 438 438 int status; 439 439 440 + if (ehci->periodic_sched++) 441 + return 0; 442 + 440 443 /* did clearing PSE did take effect yet? 441 444 * takes effect only at frame boundaries... 442 445 */ ··· 463 460 { 464 461 u32 cmd; 465 462 int status; 463 + 464 + if (--ehci->periodic_sched) 465 + return 0; 466 466 467 467 /* did setting PSE not take effect yet? 468 468 * takes effect only at frame boundaries... ··· 550 544 : (qh->usecs * 8); 551 545 552 546 /* maybe enable periodic schedule processing */ 553 - if (!ehci->periodic_sched++) 554 - return enable_periodic (ehci); 555 - 556 - return 0; 547 + return enable_periodic(ehci); 557 548 } 558 549 559 - static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) 550 + static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh) 560 551 { 561 552 unsigned i; 562 553 unsigned period; ··· 589 586 qh_put (qh); 590 587 591 588 /* maybe turn off periodic schedule */ 592 - ehci->periodic_sched--; 593 - if (!ehci->periodic_sched) 594 - (void) disable_periodic (ehci); 589 + return disable_periodic(ehci); 595 590 } 596 591 597 592 static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) ··· 1563 1562 urb->hcpriv = NULL; 1564 1563 1565 1564 timer_action (ehci, TIMER_IO_WATCHDOG); 1566 - if (unlikely (!ehci->periodic_sched++)) 1567 - return enable_periodic (ehci); 1568 - return 0; 1565 + return enable_periodic(ehci); 1569 1566 } 1570 1567 1571 1568 #define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR) ··· 1641 1642 ehci_urb_done(ehci, urb, 0); 1642 1643 retval = true; 1643 1644 urb = NULL; 1644 - ehci->periodic_sched--; 1645 + (void) disable_periodic(ehci); 1645 1646 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 1646 1647 1647 1648 if (unlikely (list_empty (&stream->td_list))) { ··· 1950 1951 urb->hcpriv = NULL; 1951 1952 1952 1953 timer_action (ehci, TIMER_IO_WATCHDOG); 1953 - if (!ehci->periodic_sched++) 1954 - return enable_periodic (ehci); 1955 - return 0; 1954 + return enable_periodic(ehci); 1956 1955 } 1957 1956 1958 1957 /*-------------------------------------------------------------------------*/ ··· 2016 2019 ehci_urb_done(ehci, urb, 0); 2017 2020 retval = true; 2018 2021 urb = NULL; 2019 - ehci->periodic_sched--; 2022 + (void) disable_periodic(ehci); 2020 2023 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 2021 2024 2022 2025 if (list_empty (&stream->td_list)) { ··· 2240 2243 if (unlikely (modified)) { 2241 2244 if (likely(ehci->periodic_sched > 0)) 2242 2245 goto restart; 2243 - /* maybe we can short-circuit this scan! */ 2244 - disable_periodic(ehci); 2246 + /* short-circuit this scan */ 2245 2247 now_uframe = clock; 2246 2248 break; 2247 2249 }
+1
drivers/usb/musb/Kconfig
··· 9 9 # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 10 10 config USB_MUSB_HDRC 11 11 depends on (USB || USB_GADGET) && HAVE_CLK 12 + depends on !SUPERH 12 13 select TWL4030_USB if MACH_OMAP_3430SDP 13 14 tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' 14 15 help
+2 -2
drivers/usb/musb/musb_core.c
··· 100 100 #include <linux/io.h> 101 101 102 102 #ifdef CONFIG_ARM 103 - #include <asm/arch/hardware.h> 104 - #include <asm/arch/memory.h> 103 + #include <mach/hardware.h> 104 + #include <mach/memory.h> 105 105 #include <asm/mach-types.h> 106 106 #endif 107 107
+2 -2
drivers/usb/musb/omap2430.c
··· 35 35 #include <linux/io.h> 36 36 37 37 #include <asm/mach-types.h> 38 - #include <asm/arch/hardware.h> 39 - #include <asm/arch/mux.h> 38 + #include <mach/hardware.h> 39 + #include <mach/mux.h> 40 40 41 41 #include "musb_core.h" 42 42 #include "omap2430.h"
+2 -2
drivers/usb/musb/omap2430.h
··· 11 11 #define __MUSB_OMAP243X_H__ 12 12 13 13 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) 14 - #include <asm/arch/hardware.h> 15 - #include <asm/arch/usb.h> 14 + #include <mach/hardware.h> 15 + #include <mach/usb.h> 16 16 17 17 /* 18 18 * OMAP2430-specific definitions
+3
drivers/usb/serial/cp2101.c
··· 72 72 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ 73 73 { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ 74 74 { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ 75 + { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ 75 76 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 76 77 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 77 78 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ ··· 84 83 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ 85 84 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 86 85 { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */ 86 + { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ 87 87 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 88 88 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 89 89 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ ··· 95 93 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ 96 94 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ 97 95 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 96 + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 98 97 { } /* Terminating Entry */ 99 98 }; 100 99
+3
drivers/usb/serial/ftdi_sio.c
··· 654 654 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 655 655 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 656 656 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 657 + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, 658 + { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, 659 + { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, 657 660 { }, /* Optional parameter entry */ 658 661 { } /* Terminating entry */ 659 662 };
+5
drivers/usb/serial/ftdi_sio.h
··· 750 750 751 751 #define PAPOUCH_VID 0x5050 /* Vendor ID */ 752 752 #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ 753 + #define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */ 753 754 754 755 /* 755 756 * ACG Identification Technologies GmbH products (http://www.acg.de/). ··· 838 837 839 838 /* Rig Expert Ukraine devices */ 840 839 #define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */ 840 + 841 + /* Domintell products http://www.domintell.com */ 842 + #define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */ 843 + #define FTDI_DOMINTELL_DUSB_PID 0xEF51 /* DUSB01 module */ 841 844 842 845 /* Commands */ 843 846 #define FTDI_SIO_RESET 0 /* Reset the port */
+2
drivers/usb/serial/option.c
··· 218 218 /* ZTE PRODUCTS */ 219 219 #define ZTE_VENDOR_ID 0x19d2 220 220 #define ZTE_PRODUCT_MF628 0x0015 221 + #define ZTE_PRODUCT_CDMA_TECH 0xfffe 221 222 222 223 static struct usb_device_id option_ids[] = { 223 224 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, ··· 348 347 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ 349 348 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, 350 349 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, 350 + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, 351 351 { } /* Terminating entry */ 352 352 }; 353 353 MODULE_DEVICE_TABLE(usb, option_ids);
+7 -5
drivers/usb/serial/sierra.c
··· 14 14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> 15 15 */ 16 16 17 - #define DRIVER_VERSION "v.1.2.13a" 17 + #define DRIVER_VERSION "v.1.3.2" 18 18 #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" 19 19 #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 20 20 ··· 30 30 31 31 #define SWIMS_USB_REQUEST_SetPower 0x00 32 32 #define SWIMS_USB_REQUEST_SetNmea 0x07 33 - #define SWIMS_USB_REQUEST_SetMode 0x0B 34 - #define SWIMS_USB_REQUEST_GetSwocInfo 0x0A 35 - #define SWIMS_SET_MODE_Modem 0x0001 36 33 37 34 /* per port private data */ 38 35 #define N_IN_URB 4 ··· 160 163 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ 161 164 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ 162 165 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 163 - { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ 166 + { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */ 164 167 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 165 168 { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ 166 169 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ ··· 172 175 /* Sierra Wireless Device */ 173 176 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, 174 177 { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ 178 + { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */ 179 + { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */ 175 180 176 181 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 177 182 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ ··· 186 187 { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ 187 188 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ 188 189 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ 190 + { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ 189 191 { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ 190 192 { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */ 191 193 { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */ ··· 203 203 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, 204 204 /* Sierra Wireless Device */ 205 205 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, 206 + /* Sierra Wireless Device */ 207 + { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, 206 208 /* Sierra Wireless Device */ 207 209 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, 208 210
+1 -1
drivers/usb/serial/ti_usb_3410_5052.c
··· 1744 1744 if (buffer) { 1745 1745 memcpy(buffer, fw_p->data, fw_p->size); 1746 1746 memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); 1747 - ti_do_download(dev, pipe, buffer, fw_p->size); 1747 + status = ti_do_download(dev, pipe, buffer, fw_p->size); 1748 1748 kfree(buffer); 1749 1749 } 1750 1750 release_firmware(fw_p);
+3 -1
drivers/usb/serial/usb-serial.c
··· 733 733 ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) && 734 734 (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) || 735 735 ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) && 736 - (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID))) { 736 + (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) || 737 + ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && 738 + (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) { 737 739 if (interface != dev->actconfig->interface[0]) { 738 740 /* check out the endpoints of the other interface*/ 739 741 iface_desc = dev->actconfig->interface[0]->cur_altsetting;
-12
drivers/usb/storage/Kconfig
··· 146 146 on the resulting scsi device node returns the Karma to normal 147 147 operation. 148 148 149 - config USB_STORAGE_SIERRA 150 - bool "Sierra Wireless TRU-Install Feature Support" 151 - depends on USB_STORAGE 152 - help 153 - Say Y here to include additional code to support Sierra Wireless 154 - products with the TRU-Install feature (e.g., AC597E, AC881U). 155 - 156 - This code switches the Sierra Wireless device from being in 157 - Mass Storage mode to Modem mode. It also has the ability to 158 - support host software upgrades should full Linux support be added 159 - to TRU-Install. 160 - 161 149 config USB_STORAGE_CYPRESS_ATACB 162 150 bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" 163 151 depends on USB_STORAGE
+1 -2
drivers/usb/storage/Makefile
··· 21 21 usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o 22 22 usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o 23 23 usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o 24 - usb-storage-obj-$(CONFIG_USB_STORAGE_SIERRA) += sierra_ms.o 25 24 usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o 26 25 27 26 usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ 28 - initializers.o $(usb-storage-obj-y) 27 + initializers.o sierra_ms.o $(usb-storage-obj-y) 29 28 30 29 ifneq ($(CONFIG_USB_LIBUSUAL),) 31 30 obj-$(CONFIG_USB) += libusual.o
+28 -2
drivers/usb/storage/unusual_devs.h
··· 160 160 US_SC_DEVICE, US_PR_DEVICE, NULL, 161 161 US_FL_MAX_SECTORS_64 ), 162 162 163 + /* Reported by Filip Joelsson <filip@blueturtle.nu> */ 164 + UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600, 165 + "Nokia", 166 + "Nokia 3110c", 167 + US_SC_DEVICE, US_PR_DEVICE, NULL, 168 + US_FL_FIX_CAPACITY ), 169 + 163 170 /* Reported by Mario Rettig <mariorettig@web.de> */ 164 171 UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, 165 172 "Nokia", ··· 238 231 "5300", 239 232 US_SC_DEVICE, US_PR_DEVICE, NULL, 240 233 US_FL_FIX_CAPACITY ), 234 + 235 + /* Reported by Richard Nauber <RichardNauber@web.de> */ 236 + UNUSUAL_DEV( 0x0421, 0x04fa, 0x0601, 0x0601, 237 + "Nokia", 238 + "6300", 239 + US_SC_DEVICE, US_PR_DEVICE, NULL, 240 + US_FL_FIX_CAPACITY ), 241 + 242 + /* Patch for Nokia 5310 capacity */ 243 + UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591, 244 + "Nokia", 245 + "5310", 246 + US_SC_DEVICE, US_PR_DEVICE, NULL, 247 + US_FL_FIX_CAPACITY ), 241 248 242 249 /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 243 250 UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, ··· 1008 987 US_SC_DEVICE, US_PR_DEVICE, NULL, 1009 988 US_FL_FIX_CAPACITY ), 1010 989 990 + /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ 991 + UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, 992 + "RockChip", 993 + "MP3", 994 + US_SC_DEVICE, US_PR_DEVICE, NULL, 995 + US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64), 996 + 1011 997 /* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com> 1012 998 * This USB MP3/AVI player device fails and disconnects if more than 128 1013 999 * sectors (64kB) are read/written in a single command, and may be present ··· 1604 1576 US_SC_DEVICE, US_PR_DEVICE, NULL, 1605 1577 0), 1606 1578 1607 - #ifdef CONFIG_USB_STORAGE_SIERRA 1608 1579 /* Reported by Kevin Lloyd <linux@sierrawireless.com> 1609 1580 * Entry is needed for the initializer function override, 1610 1581 * which instructs the device to load as a modem ··· 1614 1587 "USB MMC Storage", 1615 1588 US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init, 1616 1589 0), 1617 - #endif 1618 1590 1619 1591 /* Reported by Jaco Kroon <jaco@kroon.co.za> 1620 1592 * The usb-storage module found on the Digitech GNX4 (and supposedly other
-2
drivers/usb/storage/usb.c
··· 102 102 #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB 103 103 #include "cypress_atacb.h" 104 104 #endif 105 - #ifdef CONFIG_USB_STORAGE_SIERRA 106 105 #include "sierra_ms.h" 107 - #endif 108 106 109 107 /* Some informational data */ 110 108 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
+5 -1
drivers/video/console/fbcon.c
··· 2400 2400 2401 2401 if (!fbcon_is_inactive(vc, info)) { 2402 2402 if (ops->blank_state != blank) { 2403 + int ret = 1; 2404 + 2403 2405 ops->blank_state = blank; 2404 2406 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); 2405 2407 ops->cursor_flash = (!blank); 2406 2408 2407 - if (fb_blank(info, blank)) 2409 + if (info->fbops->fb_blank) 2410 + ret = info->fbops->fb_blank(blank, info); 2411 + if (ret) 2408 2412 fbcon_generic_blank(vc, info, blank); 2409 2413 } 2410 2414
+1 -1
drivers/video/console/fbcon.h
··· 110 110 __u32 max_len; 111 111 max_len = max(info->var.green.length, info->var.red.length); 112 112 max_len = max(info->var.blue.length, max_len); 113 - return ~(0xfff << (max_len & 0xff)); 113 + return (~(0xfff << max_len)) & 0xff; 114 114 } 115 115 116 116 static inline int attr_col_ec(int shift, struct vc_data *vc,
+3 -3
drivers/watchdog/geodewdt.c
··· 130 130 return len; 131 131 } 132 132 133 - static int geodewdt_ioctl(struct inode *inode, struct file *file, 134 - unsigned int cmd, unsigned long arg) 133 + static long geodewdt_ioctl(struct file *file, unsigned int cmd, 134 + unsigned long arg) 135 135 { 136 136 void __user *argp = (void __user *)arg; 137 137 int __user *p = argp; ··· 198 198 .owner = THIS_MODULE, 199 199 .llseek = no_llseek, 200 200 .write = geodewdt_write, 201 - .ioctl = geodewdt_ioctl, 201 + .unlocked_ioctl = geodewdt_ioctl, 202 202 .open = geodewdt_open, 203 203 .release = geodewdt_release, 204 204 };
-1
drivers/watchdog/ibmasr.c
··· 85 85 86 86 outb(reg & ~asr_toggle_mask, asr_write_addr); 87 87 reg = inb(asr_read_addr); 88 - spin_unlock(&asr_lock); 89 88 } 90 89 91 90 static void asr_toggle(void)
+2 -2
drivers/watchdog/pnx4008_wdt.c
··· 173 173 .identity = "PNX4008 Watchdog", 174 174 }; 175 175 176 - static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file, 177 - unsigned int cmd, unsigned long arg) 176 + static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd, 177 + unsigned long arg) 178 178 { 179 179 int ret = -ENOTTY; 180 180 int time;
+3 -3
drivers/watchdog/rc32434_wdt.c
··· 182 182 return 0; 183 183 } 184 184 185 - static int rc32434_wdt_ioctl(struct inode *inode, struct file *file, 186 - unsigned int cmd, unsigned long arg) 185 + static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, 186 + unsigned long arg) 187 187 { 188 188 void __user *argp = (void __user *)arg; 189 189 int new_timeout; ··· 242 242 .owner = THIS_MODULE, 243 243 .llseek = no_llseek, 244 244 .write = rc32434_wdt_write, 245 - .ioctl = rc32434_wdt_ioctl, 245 + .unlocked_ioctl = rc32434_wdt_ioctl, 246 246 .open = rc32434_wdt_open, 247 247 .release = rc32434_wdt_release, 248 248 };
+3 -3
drivers/watchdog/rdc321x_wdt.c
··· 144 144 return 0; 145 145 } 146 146 147 - static int rdc321x_wdt_ioctl(struct inode *inode, struct file *file, 148 - unsigned int cmd, unsigned long arg) 147 + static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd, 148 + unsigned long arg) 149 149 { 150 150 void __user *argp = (void __user *)arg; 151 151 unsigned int value; ··· 204 204 static const struct file_operations rdc321x_wdt_fops = { 205 205 .owner = THIS_MODULE, 206 206 .llseek = no_llseek, 207 - .ioctl = rdc321x_wdt_ioctl, 207 + .unlocked_ioctl = rdc321x_wdt_ioctl, 208 208 .open = rdc321x_wdt_open, 209 209 .write = rdc321x_wdt_write, 210 210 .release = rdc321x_wdt_release,
+8 -7
drivers/watchdog/wdt285.c
··· 115 115 return 0; 116 116 } 117 117 118 - static ssize_t watchdog_write(struct file *file, const char *data, 119 - size_t len, loff_t *ppos) 118 + static ssize_t watchdog_write(struct file *file, const char __user *data, 119 + size_t len, loff_t *ppos) 120 120 { 121 121 /* 122 122 * Refresh the timer. ··· 133 133 }; 134 134 135 135 static long watchdog_ioctl(struct file *file, unsigned int cmd, 136 - unsigned long arg) 136 + unsigned long arg) 137 137 { 138 138 unsigned int new_margin; 139 + int __user *int_arg = (int __user *)arg; 139 140 int ret = -ENOTTY; 140 141 141 142 switch (cmd) { 142 143 case WDIOC_GETSUPPORT: 143 144 ret = 0; 144 - if (copy_to_user((void *)arg, &ident, sizeof(ident))) 145 + if (copy_to_user((void __user *)arg, &ident, sizeof(ident))) 145 146 ret = -EFAULT; 146 147 break; 147 148 148 149 case WDIOC_GETSTATUS: 149 150 case WDIOC_GETBOOTSTATUS: 150 - ret = put_user(0, (int *)arg); 151 + ret = put_user(0, int_arg); 151 152 break; 152 153 153 154 case WDIOC_KEEPALIVE: ··· 157 156 break; 158 157 159 158 case WDIOC_SETTIMEOUT: 160 - ret = get_user(new_margin, (int *)arg); 159 + ret = get_user(new_margin, int_arg); 161 160 if (ret) 162 161 break; 163 162 ··· 172 171 watchdog_ping(); 173 172 /* Fall */ 174 173 case WDIOC_GETTIMEOUT: 175 - ret = put_user(soft_margin, (int *)arg); 174 + ret = put_user(soft_margin, int_arg); 176 175 break; 177 176 } 178 177 return ret;
+1 -2
fs/9p/vfs_inode.c
··· 626 626 return NULL; 627 627 628 628 error: 629 - if (fid) 630 - p9_client_clunk(fid); 629 + p9_client_clunk(fid); 631 630 632 631 return ERR_PTR(result); 633 632 }
+6 -4
fs/dcache.c
··· 1395 1395 if (dentry->d_parent != parent) 1396 1396 goto next; 1397 1397 1398 + /* non-existing due to RCU? */ 1399 + if (d_unhashed(dentry)) 1400 + goto next; 1401 + 1398 1402 /* 1399 1403 * It is safe to compare names since d_move() cannot 1400 1404 * change the qstr (protected by d_lock). ··· 1414 1410 goto next; 1415 1411 } 1416 1412 1417 - if (!d_unhashed(dentry)) { 1418 - atomic_inc(&dentry->d_count); 1419 - found = dentry; 1420 - } 1413 + atomic_inc(&dentry->d_count); 1414 + found = dentry; 1421 1415 spin_unlock(&dentry->d_lock); 1422 1416 break; 1423 1417 next:
+1 -1
fs/exec.c
··· 752 752 tsk->active_mm = mm; 753 753 activate_mm(active_mm, mm); 754 754 task_unlock(tsk); 755 - mm_update_next_owner(old_mm); 756 755 arch_pick_mmap_layout(mm); 757 756 if (old_mm) { 758 757 up_read(&old_mm->mmap_sem); 759 758 BUG_ON(active_mm != old_mm); 759 + mm_update_next_owner(old_mm); 760 760 mmput(old_mm); 761 761 return 0; 762 762 }
+20 -7
fs/inotify_user.c
··· 323 323 } 324 324 325 325 /* 326 - * remove_kevent - cleans up and ultimately frees the given kevent 326 + * remove_kevent - cleans up the given kevent 327 327 * 328 328 * Caller must hold dev->ev_mutex. 329 329 */ ··· 334 334 335 335 dev->event_count--; 336 336 dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len; 337 + } 337 338 339 + /* 340 + * free_kevent - frees the given kevent. 341 + */ 342 + static void free_kevent(struct inotify_kernel_event *kevent) 343 + { 338 344 kfree(kevent->name); 339 345 kmem_cache_free(event_cachep, kevent); 340 346 } ··· 356 350 struct inotify_kernel_event *kevent; 357 351 kevent = inotify_dev_get_event(dev); 358 352 remove_kevent(dev, kevent); 353 + free_kevent(kevent); 359 354 } 360 355 } 361 356 ··· 440 433 dev = file->private_data; 441 434 442 435 while (1) { 443 - int events; 444 436 445 437 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE); 446 438 447 439 mutex_lock(&dev->ev_mutex); 448 - events = !list_empty(&dev->events); 449 - mutex_unlock(&dev->ev_mutex); 450 - if (events) { 440 + if (!list_empty(&dev->events)) { 451 441 ret = 0; 452 442 break; 453 443 } 444 + mutex_unlock(&dev->ev_mutex); 454 445 455 446 if (file->f_flags & O_NONBLOCK) { 456 447 ret = -EAGAIN; ··· 467 462 if (ret) 468 463 return ret; 469 464 470 - mutex_lock(&dev->ev_mutex); 471 465 while (1) { 472 466 struct inotify_kernel_event *kevent; 473 467 ··· 485 481 } 486 482 break; 487 483 } 484 + remove_kevent(dev, kevent); 485 + 486 + /* 487 + * Must perform the copy_to_user outside the mutex in order 488 + * to avoid a lock order reversal with mmap_sem. 489 + */ 490 + mutex_unlock(&dev->ev_mutex); 488 491 489 492 if (copy_to_user(buf, &kevent->event, event_size)) { 490 493 ret = -EFAULT; ··· 509 498 count -= kevent->event.len; 510 499 } 511 500 512 - remove_kevent(dev, kevent); 501 + free_kevent(kevent); 502 + 503 + mutex_lock(&dev->ev_mutex); 513 504 } 514 505 mutex_unlock(&dev->ev_mutex); 515 506
+1 -1
fs/ramfs/file-nommu.c
··· 58 58 * size 0 on the assumption that it's going to be used for an mmap of shared 59 59 * memory 60 60 */ 61 - static int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) 61 + int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) 62 62 { 63 63 struct pagevec lru_pvec; 64 64 unsigned long npages, xpages, loop, limit;
+1 -1
fs/ubifs/debug.c
··· 538 538 printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n); 539 539 for (i = 0; i < n; i++) 540 540 printk(KERN_DEBUG "\t ino %llu\n", 541 - le64_to_cpu(orph->inos[i])); 541 + (unsigned long long)le64_to_cpu(orph->inos[i])); 542 542 break; 543 543 } 544 544 default:
+1 -1
fs/ubifs/dir.c
··· 426 426 427 427 while (1) { 428 428 dbg_gen("feed '%s', ino %llu, new f_pos %#x", 429 - dent->name, le64_to_cpu(dent->inum), 429 + dent->name, (unsigned long long)le64_to_cpu(dent->inum), 430 430 key_hash_flash(c, &dent->key)); 431 431 ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum); 432 432
-1
fs/ubifs/find.c
··· 507 507 rsvd_idx_lebs = 0; 508 508 lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - 509 509 c->lst.taken_empty_lebs; 510 - ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs); 511 510 if (rsvd_idx_lebs < lebs) 512 511 /* 513 512 * OK to allocate an empty LEB, but we still don't want to go
+11 -3
fs/ubifs/gc.c
··· 334 334 335 335 err = move_nodes(c, sleb); 336 336 if (err) 337 - goto out; 337 + goto out_inc_seq; 338 338 339 339 err = gc_sync_wbufs(c); 340 340 if (err) 341 - goto out; 341 + goto out_inc_seq; 342 342 343 343 err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); 344 344 if (err) 345 - goto out; 345 + goto out_inc_seq; 346 346 347 347 /* Allow for races with TNC */ 348 348 c->gced_lnum = lnum; ··· 369 369 out: 370 370 ubifs_scan_destroy(sleb); 371 371 return err; 372 + 373 + out_inc_seq: 374 + /* We may have moved at least some nodes so allow for races with TNC */ 375 + c->gced_lnum = lnum; 376 + smp_wmb(); 377 + c->gc_seq += 1; 378 + smp_wmb(); 379 + goto out; 372 380 } 373 381 374 382 /**
+1 -2
fs/ubifs/super.c
··· 1024 1024 goto out_dereg; 1025 1025 } 1026 1026 1027 + sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); 1027 1028 if (!mounted_read_only) { 1028 1029 err = alloc_wbufs(c); 1029 1030 if (err) 1030 1031 goto out_cbuf; 1031 1032 1032 1033 /* Create background thread */ 1033 - sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, 1034 - c->vi.vol_id); 1035 1034 c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name); 1036 1035 if (!c->bgt) 1037 1036 c->bgt = ERR_PTR(-EINVAL);
+1 -1
fs/ubifs/tnc.c
··· 1476 1476 } 1477 1477 1478 1478 err = fallible_read_node(c, key, &zbr, node); 1479 - if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { 1479 + if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { 1480 1480 /* 1481 1481 * The node may have been GC'ed out from under us so try again 1482 1482 * while keeping the TNC mutex locked.
+3 -91
fs/xfs/xfs_inode.c
··· 4118 4118 ASSERT(nextents <= XFS_LINEAR_EXTS); 4119 4119 size = nextents * sizeof(xfs_bmbt_rec_t); 4120 4120 4121 - xfs_iext_irec_compact_full(ifp); 4121 + xfs_iext_irec_compact_pages(ifp); 4122 4122 ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ); 4123 4123 4124 4124 ep = ifp->if_u1.if_ext_irec->er_extbuf; ··· 4449 4449 * compaction policy is as follows: 4450 4450 * 4451 4451 * Full Compaction: Extents fit into a single page (or inline buffer) 4452 - * Full Compaction: Extents occupy less than 10% of allocated space 4453 - * Partial Compaction: Extents occupy > 10% and < 50% of allocated space 4452 + * Partial Compaction: Extents occupy less than 50% of allocated space 4454 4453 * No Compaction: Extents occupy at least 50% of allocated space 4455 4454 */ 4456 4455 void ··· 4470 4471 xfs_iext_direct_to_inline(ifp, nextents); 4471 4472 } else if (nextents <= XFS_LINEAR_EXTS) { 4472 4473 xfs_iext_indirect_to_direct(ifp); 4473 - } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) { 4474 - xfs_iext_irec_compact_full(ifp); 4475 4474 } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) { 4476 4475 xfs_iext_irec_compact_pages(ifp); 4477 4476 } ··· 4493 4496 erp_next = erp + 1; 4494 4497 if (erp_next->er_extcount <= 4495 4498 (XFS_LINEAR_EXTS - erp->er_extcount)) { 4496 - memmove(&erp->er_extbuf[erp->er_extcount], 4499 + memcpy(&erp->er_extbuf[erp->er_extcount], 4497 4500 erp_next->er_extbuf, erp_next->er_extcount * 4498 4501 sizeof(xfs_bmbt_rec_t)); 4499 4502 erp->er_extcount += erp_next->er_extcount; ··· 4509 4512 } else { 4510 4513 erp_idx++; 4511 4514 } 4512 - } 4513 - } 4514 - 4515 - /* 4516 - * Fully compact the extent records managed by the indirection array. 4517 - */ 4518 - void 4519 - xfs_iext_irec_compact_full( 4520 - xfs_ifork_t *ifp) /* inode fork pointer */ 4521 - { 4522 - xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */ 4523 - xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */ 4524 - int erp_idx = 0; /* extent irec index */ 4525 - int ext_avail; /* empty entries in ex list */ 4526 - int ext_diff; /* number of exts to add */ 4527 - int nlists; /* number of irec's (ex lists) */ 4528 - 4529 - ASSERT(ifp->if_flags & XFS_IFEXTIREC); 4530 - 4531 - nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; 4532 - erp = ifp->if_u1.if_ext_irec; 4533 - ep = &erp->er_extbuf[erp->er_extcount]; 4534 - erp_next = erp + 1; 4535 - ep_next = erp_next->er_extbuf; 4536 - 4537 - while (erp_idx < nlists - 1) { 4538 - /* 4539 - * Check how many extent records are available in this irec. 4540 - * If there is none skip the whole exercise. 4541 - */ 4542 - ext_avail = XFS_LINEAR_EXTS - erp->er_extcount; 4543 - if (ext_avail) { 4544 - 4545 - /* 4546 - * Copy over as many as possible extent records into 4547 - * the previous page. 4548 - */ 4549 - ext_diff = MIN(ext_avail, erp_next->er_extcount); 4550 - memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t)); 4551 - erp->er_extcount += ext_diff; 4552 - erp_next->er_extcount -= ext_diff; 4553 - 4554 - /* 4555 - * If the next irec is empty now we can simply 4556 - * remove it. 4557 - */ 4558 - if (erp_next->er_extcount == 0) { 4559 - /* 4560 - * Free page before removing extent record 4561 - * so er_extoffs don't get modified in 4562 - * xfs_iext_irec_remove. 4563 - */ 4564 - kmem_free(erp_next->er_extbuf); 4565 - erp_next->er_extbuf = NULL; 4566 - xfs_iext_irec_remove(ifp, erp_idx + 1); 4567 - erp = &ifp->if_u1.if_ext_irec[erp_idx]; 4568 - nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; 4569 - 4570 - /* 4571 - * If the next irec is not empty move up the content 4572 - * that has not been copied to the previous page to 4573 - * the beggining of this one. 4574 - */ 4575 - } else { 4576 - memmove(erp_next->er_extbuf, &ep_next[ext_diff], 4577 - erp_next->er_extcount * 4578 - sizeof(xfs_bmbt_rec_t)); 4579 - ep_next = erp_next->er_extbuf; 4580 - memset(&ep_next[erp_next->er_extcount], 0, 4581 - (XFS_LINEAR_EXTS - 4582 - erp_next->er_extcount) * 4583 - sizeof(xfs_bmbt_rec_t)); 4584 - } 4585 - } 4586 - 4587 - if (erp->er_extcount == XFS_LINEAR_EXTS) { 4588 - erp_idx++; 4589 - if (erp_idx < nlists) 4590 - erp = &ifp->if_u1.if_ext_irec[erp_idx]; 4591 - else 4592 - break; 4593 - } 4594 - ep = &erp->er_extbuf[erp->er_extcount]; 4595 - erp_next = erp + 1; 4596 - ep_next = erp_next->er_extbuf; 4597 4515 } 4598 4516 } 4599 4517
+46
include/asm-mips/cevt-r4k.h
··· 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file "COPYING" in the main directory of this archive 4 + * for more details. 5 + * 6 + * Copyright (C) 2008 Kevin D. Kissell 7 + */ 8 + 9 + /* 10 + * Definitions used for common event timer implementation 11 + * for MIPS 4K-type processors and their MIPS MT variants. 12 + * Avoids unsightly extern declarations in C files. 13 + */ 14 + #ifndef __ASM_CEVT_R4K_H 15 + #define __ASM_CEVT_R4K_H 16 + 17 + DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device); 18 + 19 + void mips_event_handler(struct clock_event_device *dev); 20 + int c0_compare_int_usable(void); 21 + void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *); 22 + irqreturn_t c0_compare_interrupt(int, void *); 23 + 24 + extern struct irqaction c0_compare_irqaction; 25 + extern int cp0_timer_irq_installed; 26 + 27 + /* 28 + * Possibly handle a performance counter interrupt. 29 + * Return true if the timer interrupt should not be checked 30 + */ 31 + 32 + static inline int handle_perf_irq(int r2) 33 + { 34 + /* 35 + * The performance counter overflow interrupt may be shared with the 36 + * timer interrupt (cp0_perfcount_irq < 0). If it is and a 37 + * performance counter has overflowed (perf_irq() == IRQ_HANDLED) 38 + * and we can't reliably determine if a counter interrupt has also 39 + * happened (!r2) then don't check for a timer interrupt. 40 + */ 41 + return (cp0_perfcount_irq < 0) && 42 + perf_irq() == IRQ_HANDLED && 43 + !r2; 44 + } 45 + 46 + #endif /* __ASM_CEVT_R4K_H */
+23 -3
include/asm-mips/irqflags.h
··· 38 38 " .set pop \n" 39 39 " .endm"); 40 40 41 + extern void smtc_ipi_replay(void); 42 + 41 43 static inline void raw_local_irq_enable(void) 42 44 { 45 + #ifdef CONFIG_MIPS_MT_SMTC 46 + /* 47 + * SMTC kernel needs to do a software replay of queued 48 + * IPIs, at the cost of call overhead on each local_irq_enable() 49 + */ 50 + smtc_ipi_replay(); 51 + #endif 43 52 __asm__ __volatile__( 44 53 "raw_local_irq_enable" 45 54 : /* no outputs */ 46 55 : /* no inputs */ 47 56 : "memory"); 48 57 } 58 + 49 59 50 60 /* 51 61 * For cli() we have to insert nops to make sure that the new value ··· 195 185 " .set pop \n" 196 186 " .endm \n"); 197 187 198 - extern void smtc_ipi_replay(void); 199 188 200 189 static inline void raw_local_irq_restore(unsigned long flags) 201 190 { 202 191 unsigned long __tmp1; 203 192 204 - #ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY 193 + #ifdef CONFIG_MIPS_MT_SMTC 205 194 /* 206 - * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred 195 + * SMTC kernel needs to do a software replay of queued 207 196 * IPIs, at the cost of branch and call overhead on each 208 197 * local_irq_restore() 209 198 */ 210 199 if (unlikely(!(flags & 0x0400))) 211 200 smtc_ipi_replay(); 212 201 #endif 202 + 203 + __asm__ __volatile__( 204 + "raw_local_irq_restore\t%0" 205 + : "=r" (__tmp1) 206 + : "0" (flags) 207 + : "memory"); 208 + } 209 + 210 + static inline void __raw_local_irq_restore(unsigned long flags) 211 + { 212 + unsigned long __tmp1; 213 213 214 214 __asm__ __volatile__( 215 215 "raw_local_irq_restore\t%0"
+3 -3
include/asm-mips/mipsregs.h
··· 1462 1462 { \ 1463 1463 unsigned int res; \ 1464 1464 unsigned int omt; \ 1465 - unsigned int flags; \ 1465 + unsigned long flags; \ 1466 1466 \ 1467 1467 local_irq_save(flags); \ 1468 1468 omt = __dmt(); \ ··· 1480 1480 { \ 1481 1481 unsigned int res; \ 1482 1482 unsigned int omt; \ 1483 - unsigned int flags; \ 1483 + unsigned long flags; \ 1484 1484 \ 1485 1485 local_irq_save(flags); \ 1486 1486 omt = __dmt(); \ ··· 1498 1498 { \ 1499 1499 unsigned int res; \ 1500 1500 unsigned int omt; \ 1501 - unsigned int flags; \ 1501 + unsigned long flags; \ 1502 1502 \ 1503 1503 local_irq_save(flags); \ 1504 1504 \
+1 -1
include/asm-mips/pgtable-32.h
··· 57 57 #define PMD_ORDER 1 58 58 #define PTE_ORDER 0 59 59 60 - #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) 60 + #define PTRS_PER_PGD (USER_PTRS_PER_PGD * 2) 61 61 #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 62 62 63 63 #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
+5 -3
include/asm-mips/smtc.h
··· 6 6 */ 7 7 8 8 #include <asm/mips_mt.h> 9 + #include <asm/smtc_ipi.h> 9 10 10 11 /* 11 12 * System-wide SMTC status information ··· 39 38 struct task_struct; 40 39 41 40 void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu); 42 - 41 + void self_ipi(struct smtc_ipi *); 43 42 void smtc_flush_tlb_asid(unsigned long asid); 44 - extern int mipsmt_build_cpu_map(int startslot); 45 - extern void mipsmt_prepare_cpus(void); 43 + extern int smtc_build_cpu_map(int startslot); 44 + extern void smtc_prepare_cpus(int cpus); 46 45 extern void smtc_smp_finish(void); 47 46 extern void smtc_boot_secondary(int cpu, struct task_struct *t); 48 47 extern void smtc_cpus_done(void); 48 + 49 49 50 50 /* 51 51 * Sharing the TLB between multiple VPEs means that the
+61 -11
include/asm-mips/stackframe.h
··· 297 297 #ifdef CONFIG_MIPS_MT_SMTC 298 298 .set mips32r2 299 299 /* 300 - * This may not really be necessary if ints are already 301 - * inhibited here. 300 + * We need to make sure the read-modify-write 301 + * of Status below isn't perturbed by an interrupt 302 + * or cross-TC access, so we need to do at least a DMT, 303 + * protected by an interrupt-inhibit. But setting IXMT 304 + * also creates a few-cycle window where an IPI could 305 + * be queued and not be detected before potentially 306 + * returning to a WAIT or user-mode loop. It must be 307 + * replayed. 308 + * 309 + * We're in the middle of a context switch, and 310 + * we can't dispatch it directly without trashing 311 + * some registers, so we'll try to detect this unlikely 312 + * case and program a software interrupt in the VPE, 313 + * as would be done for a cross-VPE IPI. To accomodate 314 + * the handling of that case, we're doing a DVPE instead 315 + * of just a DMT here to protect against other threads. 316 + * This is a lot of cruft to cover a tiny window. 317 + * If you can find a better design, implement it! 318 + * 302 319 */ 303 320 mfc0 v0, CP0_TCSTATUS 304 321 ori v0, TCSTATUS_IXMT 305 322 mtc0 v0, CP0_TCSTATUS 306 323 _ehb 307 - DMT 5 # dmt a1 324 + DVPE 5 # dvpe a1 308 325 jal mips_ihb 309 326 #endif /* CONFIG_MIPS_MT_SMTC */ 310 327 mfc0 a0, CP0_STATUS ··· 342 325 */ 343 326 LONG_L v1, PT_TCSTATUS(sp) 344 327 _ehb 345 - mfc0 v0, CP0_TCSTATUS 328 + mfc0 a0, CP0_TCSTATUS 346 329 andi v1, TCSTATUS_IXMT 347 - /* We know that TCStatua.IXMT should be set from above */ 348 - xori v0, v0, TCSTATUS_IXMT 349 - or v0, v0, v1 350 - mtc0 v0, CP0_TCSTATUS 351 - _ehb 352 - andi a1, a1, VPECONTROL_TE 330 + bnez v1, 0f 331 + 332 + /* 333 + * We'd like to detect any IPIs queued in the tiny window 334 + * above and request an software interrupt to service them 335 + * when we ERET. 336 + * 337 + * Computing the offset into the IPIQ array of the executing 338 + * TC's IPI queue in-line would be tedious. We use part of 339 + * the TCContext register to hold 16 bits of offset that we 340 + * can add in-line to find the queue head. 341 + */ 342 + mfc0 v0, CP0_TCCONTEXT 343 + la a2, IPIQ 344 + srl v0, v0, 16 345 + addu a2, a2, v0 346 + LONG_L v0, 0(a2) 347 + beqz v0, 0f 348 + /* 349 + * If we have a queue, provoke dispatch within the VPE by setting C_SW1 350 + */ 351 + mfc0 v0, CP0_CAUSE 352 + ori v0, v0, C_SW1 353 + mtc0 v0, CP0_CAUSE 354 + 0: 355 + /* 356 + * This test should really never branch but 357 + * let's be prudent here. Having atomized 358 + * the shared register modifications, we can 359 + * now EVPE, and must do so before interrupts 360 + * are potentially re-enabled. 361 + */ 362 + andi a1, a1, MVPCONTROL_EVP 353 363 beqz a1, 1f 354 - emt 364 + evpe 355 365 1: 366 + /* We know that TCStatua.IXMT should be set from above */ 367 + xori a0, a0, TCSTATUS_IXMT 368 + or a0, a0, v1 369 + mtc0 a0, CP0_TCSTATUS 370 + _ehb 371 + 356 372 .set mips0 357 373 #endif /* CONFIG_MIPS_MT_SMTC */ 358 374 LONG_L v1, PT_EPC(sp)
+2
include/asm-x86/acpi.h
··· 140 140 boot_cpu_data.x86_model <= 0x05 && 141 141 boot_cpu_data.x86_mask < 0x0A) 142 142 return 1; 143 + else if (boot_cpu_has(X86_FEATURE_AMDC1E)) 144 + return 1; 143 145 else 144 146 return max_cstate; 145 147 }
+1
include/asm-x86/cpufeature.h
··· 81 81 #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */ 82 82 #define X86_FEATURE_11AP (3*32+19) /* Bad local APIC aka 11AP */ 83 83 #define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 84 + #define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */ 84 85 85 86 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 86 87 #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
+2
include/asm-x86/idle.h
··· 10 10 void enter_idle(void); 11 11 void exit_idle(void); 12 12 13 + void c1e_remove_cpu(int cpu); 14 + 13 15 #endif
+11 -13
include/asm-x86/kgdb.h
··· 39 39 GDB_FS, /* 14 */ 40 40 GDB_GS, /* 15 */ 41 41 }; 42 + #define NUMREGBYTES ((GDB_GS+1)*4) 42 43 #else /* ! CONFIG_X86_32 */ 43 - enum regnames { 44 + enum regnames64 { 44 45 GDB_AX, /* 0 */ 45 - GDB_DX, /* 1 */ 46 + GDB_BX, /* 1 */ 46 47 GDB_CX, /* 2 */ 47 - GDB_BX, /* 3 */ 48 + GDB_DX, /* 3 */ 48 49 GDB_SI, /* 4 */ 49 50 GDB_DI, /* 5 */ 50 51 GDB_BP, /* 6 */ ··· 59 58 GDB_R14, /* 14 */ 60 59 GDB_R15, /* 15 */ 61 60 GDB_PC, /* 16 */ 62 - GDB_PS, /* 17 */ 63 61 }; 64 - #endif /* CONFIG_X86_32 */ 65 62 66 - /* 67 - * Number of bytes of registers: 68 - */ 69 - #ifdef CONFIG_X86_32 70 - # define NUMREGBYTES 64 71 - #else 72 - # define NUMREGBYTES ((GDB_PS+1)*8) 73 - #endif 63 + enum regnames32 { 64 + GDB_PS = 34, 65 + GDB_CS, 66 + GDB_SS, 67 + }; 68 + #define NUMREGBYTES ((GDB_SS+1)*4) 69 + #endif /* CONFIG_X86_32 */ 74 70 75 71 static inline void arch_kgdb_breakpoint(void) 76 72 {
+1
include/asm-x86/uaccess_64.h
··· 7 7 #include <linux/compiler.h> 8 8 #include <linux/errno.h> 9 9 #include <linux/prefetch.h> 10 + #include <linux/lockdep.h> 10 11 #include <asm/page.h> 11 12 12 13 /*
+14 -4
include/linux/hrtimer.h
··· 47 47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context 48 48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and 49 49 * does not restart the timer 50 - * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context 51 - * Special mode for tick emultation 50 + * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context 51 + * Special mode for tick emulation and 52 + * scheduler timer. Such timers are per 53 + * cpu and not allowed to be migrated on 54 + * cpu unplug. 55 + * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context 56 + * with timer->base lock unlocked 57 + * used for timers which call wakeup to 58 + * avoid lock order problems with rq->lock 52 59 */ 53 60 enum hrtimer_cb_mode { 54 61 HRTIMER_CB_SOFTIRQ, 55 62 HRTIMER_CB_IRQSAFE, 56 63 HRTIMER_CB_IRQSAFE_NO_RESTART, 57 - HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, 64 + HRTIMER_CB_IRQSAFE_PERCPU, 65 + HRTIMER_CB_IRQSAFE_UNLOCKED, 58 66 }; 59 67 60 68 /* ··· 75 67 * 0x02 callback function running 76 68 * 0x04 callback pending (high resolution mode) 77 69 * 78 - * Special case: 70 + * Special cases: 79 71 * 0x03 callback function running and enqueued 80 72 * (was requeued on another CPU) 73 + * 0x09 timer was migrated on CPU hotunplug 81 74 * The "callback function running and enqueued" status is only possible on 82 75 * SMP. It happens for example when a posix timer expired and the callback 83 76 * queued a signal. Between dropping the lock which protects the posix timer ··· 96 87 #define HRTIMER_STATE_ENQUEUED 0x01 97 88 #define HRTIMER_STATE_CALLBACK 0x02 98 89 #define HRTIMER_STATE_PENDING 0x04 90 + #define HRTIMER_STATE_MIGRATE 0x08 99 91 100 92 /** 101 93 * struct hrtimer - the basic hrtimer structure
+4 -4
include/linux/pci.h
··· 534 534 #ifdef CONFIG_PCI_LEGACY 535 535 struct pci_dev __deprecated *pci_find_device(unsigned int vendor, 536 536 unsigned int device, 537 - const struct pci_dev *from); 537 + struct pci_dev *from); 538 538 struct pci_dev __deprecated *pci_find_slot(unsigned int bus, 539 539 unsigned int devfn); 540 540 #endif /* CONFIG_PCI_LEGACY */ ··· 550 550 struct pci_dev *from); 551 551 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 552 552 unsigned int ss_vendor, unsigned int ss_device, 553 - const struct pci_dev *from); 553 + struct pci_dev *from); 554 554 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 555 555 struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 556 556 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); ··· 816 816 817 817 static inline struct pci_dev *pci_find_device(unsigned int vendor, 818 818 unsigned int device, 819 - const struct pci_dev *from) 819 + struct pci_dev *from) 820 820 { 821 821 return NULL; 822 822 } ··· 838 838 unsigned int device, 839 839 unsigned int ss_vendor, 840 840 unsigned int ss_device, 841 - const struct pci_dev *from) 841 + struct pci_dev *from) 842 842 { 843 843 return NULL; 844 844 }
+1
include/linux/ramfs.h
··· 6 6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 7 8 8 #ifndef CONFIG_MMU 9 + extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); 9 10 extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 10 11 unsigned long addr, 11 12 unsigned long len,
+2
include/linux/smb.h
··· 11 11 12 12 #include <linux/types.h> 13 13 #include <linux/magic.h> 14 + #ifdef __KERNEL__ 14 15 #include <linux/time.h> 16 + #endif 15 17 16 18 enum smb_protocol { 17 19 SMB_PROTOCOL_NONE,
+2
include/linux/stacktrace.h
··· 1 1 #ifndef __LINUX_STACKTRACE_H 2 2 #define __LINUX_STACKTRACE_H 3 3 4 + struct task_struct; 5 + 4 6 #ifdef CONFIG_STACKTRACE 5 7 struct stack_trace { 6 8 unsigned int nr_entries, max_entries;
+1
include/net/9p/9p.h
··· 596 596 int p9_error_init(void); 597 597 int p9_errstr2errno(char *, int); 598 598 int p9_trans_fd_init(void); 599 + void p9_trans_fd_exit(void); 599 600 #endif /* NET_9P_H */
+7 -2
include/net/9p/transport.h
··· 26 26 #ifndef NET_9P_TRANSPORT_H 27 27 #define NET_9P_TRANSPORT_H 28 28 29 + #include <linux/module.h> 30 + 29 31 /** 30 32 * enum p9_trans_status - different states of underlying transports 31 33 * @Connected: transport is connected and healthy ··· 93 91 int maxsize; /* max message size of transport */ 94 92 int def; /* this transport should be default */ 95 93 struct p9_trans * (*create)(const char *, char *, int, unsigned char); 94 + struct module *owner; 96 95 }; 97 96 98 97 void v9fs_register_trans(struct p9_trans_module *m); 99 - struct p9_trans_module *v9fs_match_trans(const substring_t *name); 100 - struct p9_trans_module *v9fs_default_trans(void); 98 + void v9fs_unregister_trans(struct p9_trans_module *m); 99 + struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name); 100 + struct p9_trans_module *v9fs_get_default_trans(void); 101 + void v9fs_put_trans(struct p9_trans_module *m); 101 102 #endif /* NET_9P_TRANSPORT_H */
+3
include/net/sctp/sm.h
··· 227 227 const struct sctp_chunk *, 228 228 const __u8 *, 229 229 const size_t ); 230 + struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *, 231 + const struct sctp_chunk *, 232 + struct sctp_paramhdr *); 230 233 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, 231 234 const struct sctp_transport *, 232 235 const void *payload,
+4 -5
init/main.c
··· 708 708 int result; 709 709 710 710 if (initcall_debug) { 711 - print_fn_descriptor_symbol("calling %s\n", fn); 711 + printk("calling %pF\n", fn); 712 712 t0 = ktime_get(); 713 713 } 714 714 ··· 718 718 t1 = ktime_get(); 719 719 delta = ktime_sub(t1, t0); 720 720 721 - print_fn_descriptor_symbol("initcall %s", fn); 722 - printk(" returned %d after %Ld msecs\n", result, 721 + printk("initcall %pF returned %d after %Ld msecs\n", 722 + fn, result, 723 723 (unsigned long long) delta.tv64 >> 20); 724 724 } 725 725 ··· 737 737 local_irq_enable(); 738 738 } 739 739 if (msgbuf[0]) { 740 - print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); 741 - printk(" returned with %s\n", msgbuf); 740 + printk("initcall %pF returned with %s\n", fn, msgbuf); 742 741 } 743 742 744 743 return result;
+3 -2
kernel/cgroup.c
··· 2738 2738 */ 2739 2739 void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) 2740 2740 { 2741 - struct cgroup *oldcgrp, *newcgrp; 2741 + struct cgroup *oldcgrp, *newcgrp = NULL; 2742 2742 2743 2743 if (need_mm_owner_callback) { 2744 2744 int i; 2745 2745 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 2746 2746 struct cgroup_subsys *ss = subsys[i]; 2747 2747 oldcgrp = task_cgroup(old, ss->subsys_id); 2748 - newcgrp = task_cgroup(new, ss->subsys_id); 2748 + if (new) 2749 + newcgrp = task_cgroup(new, ss->subsys_id); 2749 2750 if (oldcgrp == newcgrp) 2750 2751 continue; 2751 2752 if (ss->mm_owner_changed)
+10 -2
kernel/exit.c
··· 583 583 * If there are other users of the mm and the owner (us) is exiting 584 584 * we need to find a new owner to take on the responsibility. 585 585 */ 586 - if (!mm) 587 - return 0; 588 586 if (atomic_read(&mm->mm_users) <= 1) 589 587 return 0; 590 588 if (mm->owner != p) ··· 625 627 } while_each_thread(g, c); 626 628 627 629 read_unlock(&tasklist_lock); 630 + /* 631 + * We found no owner yet mm_users > 1: this implies that we are 632 + * most likely racing with swapoff (try_to_unuse()) or /proc or 633 + * ptrace or page migration (get_task_mm()). Mark owner as NULL, 634 + * so that subsystems can understand the callback and take action. 635 + */ 636 + down_write(&mm->mmap_sem); 637 + cgroup_mm_owner_callbacks(mm->owner, NULL); 638 + mm->owner = NULL; 639 + up_write(&mm->mmap_sem); 628 640 return; 629 641 630 642 assign_new_owner:
+85 -10
kernel/hrtimer.c
··· 672 672 */ 673 673 BUG_ON(timer->function(timer) != HRTIMER_NORESTART); 674 674 return 1; 675 - case HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: 675 + case HRTIMER_CB_IRQSAFE_PERCPU: 676 + case HRTIMER_CB_IRQSAFE_UNLOCKED: 676 677 /* 677 678 * This is solely for the sched tick emulation with 678 679 * dynamic tick support to ensure that we do not 679 680 * restart the tick right on the edge and end up with 680 681 * the tick timer in the softirq ! The calling site 681 - * takes care of this. 682 + * takes care of this. Also used for hrtimer sleeper ! 682 683 */ 683 684 debug_hrtimer_deactivate(timer); 684 685 return 1; ··· 1246 1245 timer_stats_account_hrtimer(timer); 1247 1246 1248 1247 fn = timer->function; 1249 - if (timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ) { 1248 + if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU || 1249 + timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED) { 1250 1250 /* 1251 1251 * Used for scheduler timers, avoid lock inversion with 1252 1252 * rq->lock and tasklist_lock. ··· 1454 1452 sl->timer.function = hrtimer_wakeup; 1455 1453 sl->task = task; 1456 1454 #ifdef CONFIG_HIGH_RES_TIMERS 1457 - sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 1455 + sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED; 1458 1456 #endif 1459 1457 } 1460 1458 ··· 1593 1591 1594 1592 #ifdef CONFIG_HOTPLUG_CPU 1595 1593 1596 - static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, 1597 - struct hrtimer_clock_base *new_base) 1594 + static int migrate_hrtimer_list(struct hrtimer_clock_base *old_base, 1595 + struct hrtimer_clock_base *new_base, int dcpu) 1598 1596 { 1599 1597 struct hrtimer *timer; 1600 1598 struct rb_node *node; 1599 + int raise = 0; 1601 1600 1602 1601 while ((node = rb_first(&old_base->active))) { 1603 1602 timer = rb_entry(node, struct hrtimer, node); 1604 1603 BUG_ON(hrtimer_callback_running(timer)); 1605 1604 debug_hrtimer_deactivate(timer); 1606 - __remove_hrtimer(timer, old_base, HRTIMER_STATE_INACTIVE, 0); 1605 + 1606 + /* 1607 + * Should not happen. Per CPU timers should be 1608 + * canceled _before_ the migration code is called 1609 + */ 1610 + if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU) { 1611 + __remove_hrtimer(timer, old_base, 1612 + HRTIMER_STATE_INACTIVE, 0); 1613 + WARN(1, "hrtimer (%p %p)active but cpu %d dead\n", 1614 + timer, timer->function, dcpu); 1615 + continue; 1616 + } 1617 + 1618 + /* 1619 + * Mark it as STATE_MIGRATE not INACTIVE otherwise the 1620 + * timer could be seen as !active and just vanish away 1621 + * under us on another CPU 1622 + */ 1623 + __remove_hrtimer(timer, old_base, HRTIMER_STATE_MIGRATE, 0); 1607 1624 timer->base = new_base; 1608 1625 /* 1609 1626 * Enqueue the timer. Allow reprogramming of the event device 1610 1627 */ 1611 1628 enqueue_hrtimer(timer, new_base, 1); 1629 + 1630 + #ifdef CONFIG_HIGH_RES_TIMERS 1631 + /* 1632 + * Happens with high res enabled when the timer was 1633 + * already expired and the callback mode is 1634 + * HRTIMER_CB_IRQSAFE_UNLOCKED (hrtimer_sleeper). The 1635 + * enqueue code does not move them to the soft irq 1636 + * pending list for performance/latency reasons, but 1637 + * in the migration state, we need to do that 1638 + * otherwise we end up with a stale timer. 1639 + */ 1640 + if (timer->state == HRTIMER_STATE_MIGRATE) { 1641 + timer->state = HRTIMER_STATE_PENDING; 1642 + list_add_tail(&timer->cb_entry, 1643 + &new_base->cpu_base->cb_pending); 1644 + raise = 1; 1645 + } 1646 + #endif 1647 + /* Clear the migration state bit */ 1648 + timer->state &= ~HRTIMER_STATE_MIGRATE; 1612 1649 } 1650 + return raise; 1613 1651 } 1652 + 1653 + #ifdef CONFIG_HIGH_RES_TIMERS 1654 + static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base, 1655 + struct hrtimer_cpu_base *new_base) 1656 + { 1657 + struct hrtimer *timer; 1658 + int raise = 0; 1659 + 1660 + while (!list_empty(&old_base->cb_pending)) { 1661 + timer = list_entry(old_base->cb_pending.next, 1662 + struct hrtimer, cb_entry); 1663 + 1664 + __remove_hrtimer(timer, timer->base, HRTIMER_STATE_PENDING, 0); 1665 + timer->base = &new_base->clock_base[timer->base->index]; 1666 + list_add_tail(&timer->cb_entry, &new_base->cb_pending); 1667 + raise = 1; 1668 + } 1669 + return raise; 1670 + } 1671 + #else 1672 + static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base, 1673 + struct hrtimer_cpu_base *new_base) 1674 + { 1675 + return 0; 1676 + } 1677 + #endif 1614 1678 1615 1679 static void migrate_hrtimers(int cpu) 1616 1680 { 1617 1681 struct hrtimer_cpu_base *old_base, *new_base; 1618 - int i; 1682 + int i, raise = 0; 1619 1683 1620 1684 BUG_ON(cpu_online(cpu)); 1621 1685 old_base = &per_cpu(hrtimer_bases, cpu); ··· 1694 1626 spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); 1695 1627 1696 1628 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { 1697 - migrate_hrtimer_list(&old_base->clock_base[i], 1698 - &new_base->clock_base[i]); 1629 + if (migrate_hrtimer_list(&old_base->clock_base[i], 1630 + &new_base->clock_base[i], cpu)) 1631 + raise = 1; 1699 1632 } 1633 + 1634 + if (migrate_hrtimer_pending(old_base, new_base)) 1635 + raise = 1; 1700 1636 1701 1637 spin_unlock(&old_base->lock); 1702 1638 spin_unlock(&new_base->lock); 1703 1639 local_irq_enable(); 1704 1640 put_cpu_var(hrtimer_bases); 1641 + 1642 + if (raise) 1643 + hrtimer_raise_softirq(); 1705 1644 } 1706 1645 #endif /* CONFIG_HOTPLUG_CPU */ 1707 1646
+7 -1
kernel/kexec.c
··· 753 753 *old = addr | (*old & ~PAGE_MASK); 754 754 755 755 /* The old page I have found cannot be a 756 - * destination page, so return it. 756 + * destination page, so return it if it's 757 + * gfp_flags honor the ones passed in. 757 758 */ 759 + if (!(gfp_mask & __GFP_HIGHMEM) && 760 + PageHighMem(old_page)) { 761 + kimage_free_pages(old_page); 762 + continue; 763 + } 758 764 addr = old_addr; 759 765 page = old_page; 760 766 break;
+5 -5
kernel/kgdb.c
··· 488 488 if (err) 489 489 return err; 490 490 if (CACHE_FLUSH_IS_SAFE) 491 - flush_icache_range(addr, addr + length + 1); 491 + flush_icache_range(addr, addr + length); 492 492 return 0; 493 493 } 494 494 ··· 1462 1462 * Get the passive CPU lock which will hold all the non-primary 1463 1463 * CPU in a spin state while the debugger is active 1464 1464 */ 1465 - if (!kgdb_single_step || !kgdb_contthread) { 1465 + if (!kgdb_single_step) { 1466 1466 for (i = 0; i < NR_CPUS; i++) 1467 1467 atomic_set(&passive_cpu_wait[i], 1); 1468 1468 } ··· 1475 1475 1476 1476 #ifdef CONFIG_SMP 1477 1477 /* Signal the other CPUs to enter kgdb_wait() */ 1478 - if ((!kgdb_single_step || !kgdb_contthread) && kgdb_do_roundup) 1478 + if ((!kgdb_single_step) && kgdb_do_roundup) 1479 1479 kgdb_roundup_cpus(flags); 1480 1480 #endif 1481 1481 ··· 1494 1494 kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code); 1495 1495 kgdb_deactivate_sw_breakpoints(); 1496 1496 kgdb_single_step = 0; 1497 - kgdb_contthread = NULL; 1497 + kgdb_contthread = current; 1498 1498 exception_level = 0; 1499 1499 1500 1500 /* Talk to debugger with gdbserial protocol */ ··· 1508 1508 kgdb_info[ks->cpu].task = NULL; 1509 1509 atomic_set(&cpu_in_kgdb[ks->cpu], 0); 1510 1510 1511 - if (!kgdb_single_step || !kgdb_contthread) { 1511 + if (!kgdb_single_step) { 1512 1512 for (i = NR_CPUS-1; i >= 0; i--) 1513 1513 atomic_set(&passive_cpu_wait[i], 0); 1514 1514 /*
+1 -1
kernel/posix-timers.c
··· 441 441 return tmr; 442 442 if (unlikely(!(tmr->sigq = sigqueue_alloc()))) { 443 443 kmem_cache_free(posix_timers_cache, tmr); 444 - tmr = NULL; 444 + return NULL; 445 445 } 446 446 memset(&tmr->sigq->info, 0, sizeof(siginfo_t)); 447 447 return tmr;
+2 -2
kernel/sched.c
··· 201 201 hrtimer_init(&rt_b->rt_period_timer, 202 202 CLOCK_MONOTONIC, HRTIMER_MODE_REL); 203 203 rt_b->rt_period_timer.function = sched_rt_period_timer; 204 - rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 204 + rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED; 205 205 } 206 206 207 207 static inline int rt_bandwidth_enabled(void) ··· 1124 1124 1125 1125 hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1126 1126 rq->hrtick_timer.function = hrtick; 1127 - rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 1127 + rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU; 1128 1128 } 1129 1129 #else /* CONFIG_SCHED_HRTICK */ 1130 1130 static inline void hrtick_clear(struct rq *rq)
+12 -2
kernel/time/tick-broadcast.c
··· 235 235 case CLOCK_EVT_NOTIFY_BROADCAST_FORCE: 236 236 if (!cpu_isset(cpu, tick_broadcast_mask)) { 237 237 cpu_set(cpu, tick_broadcast_mask); 238 - if (td->mode == TICKDEV_MODE_PERIODIC) 238 + if (tick_broadcast_device.mode == 239 + TICKDEV_MODE_PERIODIC) 239 240 clockevents_shutdown(dev); 240 241 } 241 242 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE) ··· 246 245 if (!tick_broadcast_force && 247 246 cpu_isset(cpu, tick_broadcast_mask)) { 248 247 cpu_clear(cpu, tick_broadcast_mask); 249 - if (td->mode == TICKDEV_MODE_PERIODIC) 248 + if (tick_broadcast_device.mode == 249 + TICKDEV_MODE_PERIODIC) 250 250 tick_setup_periodic(dev, 0); 251 251 } 252 252 break; ··· 575 573 cpu_clear(cpu, tick_broadcast_oneshot_mask); 576 574 577 575 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 576 + } 577 + 578 + /* 579 + * Check, whether the broadcast device is in one shot mode 580 + */ 581 + int tick_broadcast_oneshot_active(void) 582 + { 583 + return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; 578 584 } 579 585 580 586 #endif
+6 -4
kernel/time/tick-common.c
··· 33 33 */ 34 34 ktime_t tick_next_period; 35 35 ktime_t tick_period; 36 - int tick_do_timer_cpu __read_mostly = -1; 36 + int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; 37 37 DEFINE_SPINLOCK(tick_device_lock); 38 38 39 39 /* ··· 109 109 if (!tick_device_is_functional(dev)) 110 110 return; 111 111 112 - if (dev->features & CLOCK_EVT_FEAT_PERIODIC) { 112 + if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) && 113 + !tick_broadcast_oneshot_active()) { 113 114 clockevents_set_mode(dev, CLOCK_EVT_MODE_PERIODIC); 114 115 } else { 115 116 unsigned long seq; ··· 149 148 * If no cpu took the do_timer update, assign it to 150 149 * this cpu: 151 150 */ 152 - if (tick_do_timer_cpu == -1) { 151 + if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) { 153 152 tick_do_timer_cpu = cpu; 154 153 tick_next_period = ktime_get(); 155 154 tick_period = ktime_set(0, NSEC_PER_SEC / HZ); ··· 301 300 if (*cpup == tick_do_timer_cpu) { 302 301 int cpu = first_cpu(cpu_online_map); 303 302 304 - tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : -1; 303 + tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : 304 + TICK_DO_TIMER_NONE; 305 305 } 306 306 spin_unlock_irqrestore(&tick_device_lock, flags); 307 307 }
+7
kernel/time/tick-internal.h
··· 1 1 /* 2 2 * tick internal variable and functions used by low/high res code 3 3 */ 4 + 5 + #define TICK_DO_TIMER_NONE -1 6 + #define TICK_DO_TIMER_BOOT -2 7 + 4 8 DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 5 9 extern spinlock_t tick_device_lock; 6 10 extern ktime_t tick_next_period; ··· 35 31 extern void tick_broadcast_switch_to_oneshot(void); 36 32 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); 37 33 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); 34 + extern int tick_broadcast_oneshot_active(void); 38 35 # else /* BROADCAST */ 39 36 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 40 37 { ··· 44 39 static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 45 40 static inline void tick_broadcast_switch_to_oneshot(void) { } 46 41 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 42 + static inline int tick_broadcast_oneshot_active(void) { return 0; } 47 43 # endif /* !BROADCAST */ 48 44 49 45 #else /* !ONESHOT */ ··· 74 68 { 75 69 return 0; 76 70 } 71 + static inline int tick_broadcast_oneshot_active(void) { return 0; } 77 72 #endif /* !TICK_ONESHOT */ 78 73 79 74 /*
+8 -5
kernel/time/tick-sched.c
··· 75 75 incr * ticks); 76 76 } 77 77 do_timer(++ticks); 78 + 79 + /* Keep the tick_next_period variable up to date */ 80 + tick_next_period = ktime_add(last_jiffies_update, tick_period); 78 81 } 79 82 write_sequnlock(&xtime_lock); 80 83 } ··· 224 221 */ 225 222 if (unlikely(!cpu_online(cpu))) { 226 223 if (cpu == tick_do_timer_cpu) 227 - tick_do_timer_cpu = -1; 224 + tick_do_timer_cpu = TICK_DO_TIMER_NONE; 228 225 } 229 226 230 227 if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) ··· 306 303 * invoked. 307 304 */ 308 305 if (cpu == tick_do_timer_cpu) 309 - tick_do_timer_cpu = -1; 306 + tick_do_timer_cpu = TICK_DO_TIMER_NONE; 310 307 311 308 ts->idle_sleeps++; 312 309 ··· 471 468 * this duty, then the jiffies update is still serialized by 472 469 * xtime_lock. 473 470 */ 474 - if (unlikely(tick_do_timer_cpu == -1)) 471 + if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) 475 472 tick_do_timer_cpu = cpu; 476 473 477 474 /* Check, if the jiffies need an update */ ··· 573 570 * this duty, then the jiffies update is still serialized by 574 571 * xtime_lock. 575 572 */ 576 - if (unlikely(tick_do_timer_cpu == -1)) 573 + if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) 577 574 tick_do_timer_cpu = cpu; 578 575 #endif 579 576 ··· 625 622 */ 626 623 hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 627 624 ts->sched_timer.function = tick_sched_timer; 628 - ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 625 + ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU; 629 626 630 627 /* Get the next period (per cpu) */ 631 628 ts->sched_timer.expires = tick_init_jiffy_update();
+1 -1
kernel/trace/trace_sysprof.c
··· 202 202 203 203 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 204 204 hrtimer->function = stack_trace_timer_fn; 205 - hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 205 + hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_PERCPU; 206 206 207 207 hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL); 208 208 }
+18
mm/memcontrol.c
··· 250 250 251 251 struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p) 252 252 { 253 + /* 254 + * mm_update_next_owner() may clear mm->owner to NULL 255 + * if it races with swapoff, page migration, etc. 256 + * So this can be called with p == NULL. 257 + */ 258 + if (unlikely(!p)) 259 + return NULL; 260 + 253 261 return container_of(task_subsys_state(p, mem_cgroup_subsys_id), 254 262 struct mem_cgroup, css); 255 263 } ··· 557 549 if (likely(!memcg)) { 558 550 rcu_read_lock(); 559 551 mem = mem_cgroup_from_task(rcu_dereference(mm->owner)); 552 + if (unlikely(!mem)) { 553 + rcu_read_unlock(); 554 + kmem_cache_free(page_cgroup_cache, pc); 555 + return 0; 556 + } 560 557 /* 561 558 * For every charge from the cgroup, increment reference count 562 559 */ ··· 814 801 815 802 rcu_read_lock(); 816 803 mem = mem_cgroup_from_task(rcu_dereference(mm->owner)); 804 + if (unlikely(!mem)) { 805 + rcu_read_unlock(); 806 + return 0; 807 + } 817 808 css_get(&mem->css); 818 809 rcu_read_unlock(); 819 810 820 811 do { 821 812 progress = try_to_free_mem_cgroup_pages(mem, gfp_mask); 813 + progress += res_counter_check_under_limit(&mem->res); 822 814 } while (!progress && --retry); 823 815 824 816 css_put(&mem->css);
+8 -5
mm/page_alloc.c
··· 268 268 { 269 269 int i; 270 270 int nr_pages = 1 << order; 271 + struct page *p = page + 1; 271 272 272 273 set_compound_page_dtor(page, free_compound_page); 273 274 set_compound_order(page, order); 274 275 __SetPageHead(page); 275 - for (i = 1; i < nr_pages; i++) { 276 - struct page *p = page + i; 277 - 276 + for (i = 1; i < nr_pages; i++, p++) { 277 + if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0)) 278 + p = pfn_to_page(page_to_pfn(page) + i); 278 279 __SetPageTail(p); 279 280 p->first_page = page; 280 281 } ··· 285 284 { 286 285 int i; 287 286 int nr_pages = 1 << order; 287 + struct page *p = page + 1; 288 288 289 289 if (unlikely(compound_order(page) != order)) 290 290 bad_page(page); ··· 293 291 if (unlikely(!PageHead(page))) 294 292 bad_page(page); 295 293 __ClearPageHead(page); 296 - for (i = 1; i < nr_pages; i++) { 297 - struct page *p = page + i; 294 + for (i = 1; i < nr_pages; i++, p++) { 295 + if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0)) 296 + p = pfn_to_page(page_to_pfn(page) + i); 298 297 299 298 if (unlikely(!PageTail(p) | 300 299 (p->first_page != page)))
+8 -4
mm/page_isolation.c
··· 114 114 115 115 int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) 116 116 { 117 - unsigned long pfn; 117 + unsigned long pfn, flags; 118 118 struct page *page; 119 + struct zone *zone; 120 + int ret; 119 121 120 122 pfn = start_pfn; 121 123 /* ··· 133 131 if (pfn < end_pfn) 134 132 return -EBUSY; 135 133 /* Check all pages are free or Marked as ISOLATED */ 136 - if (__test_page_isolated_in_pageblock(start_pfn, end_pfn)) 137 - return 0; 138 - return -EBUSY; 134 + zone = page_zone(pfn_to_page(pfn)); 135 + spin_lock_irqsave(&zone->lock, flags); 136 + ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn); 137 + spin_unlock_irqrestore(&zone->lock, flags); 138 + return ret ? 0 : -EBUSY; 139 139 }
+15 -15
mm/tiny-shmem.c
··· 65 65 if (!dentry) 66 66 goto put_memory; 67 67 68 - error = -ENOSPC; 69 - inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); 70 - if (!inode) 71 - goto put_dentry; 72 - 73 - d_instantiate(dentry, inode); 74 68 error = -ENFILE; 75 - file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ, 76 - &ramfs_file_operations); 69 + file = get_empty_filp(); 77 70 if (!file) 78 71 goto put_dentry; 79 72 80 - inode->i_nlink = 0; /* It is unlinked */ 81 - 82 - /* notify everyone as to the change of file size */ 83 - error = do_truncate(dentry, size, 0, file); 84 - if (error < 0) 73 + error = -ENOSPC; 74 + inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); 75 + if (!inode) 85 76 goto close_file; 86 77 78 + d_instantiate(dentry, inode); 79 + inode->i_size = size; 80 + inode->i_nlink = 0; /* It is unlinked */ 81 + init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ, 82 + &ramfs_file_operations); 83 + 84 + #ifndef CONFIG_MMU 85 + error = ramfs_nommu_expand_for_mapping(inode, size); 86 + if (error) 87 + goto close_file; 88 + #endif 87 89 return file; 88 90 89 91 close_file: 90 92 put_filp(file); 91 - return ERR_PTR(error); 92 - 93 93 put_dentry: 94 94 dput(dentry); 95 95 put_memory:
+8 -2
net/9p/client.c
··· 75 75 int option; 76 76 int ret = 0; 77 77 78 - clnt->trans_mod = v9fs_default_trans(); 79 78 clnt->dotu = 1; 80 79 clnt->msize = 8192; 81 80 ··· 107 108 clnt->msize = option; 108 109 break; 109 110 case Opt_trans: 110 - clnt->trans_mod = v9fs_match_trans(&args[0]); 111 + clnt->trans_mod = v9fs_get_trans_by_name(&args[0]); 111 112 break; 112 113 case Opt_legacy: 113 114 clnt->dotu = 0; ··· 116 117 continue; 117 118 } 118 119 } 120 + 121 + if (!clnt->trans_mod) 122 + clnt->trans_mod = v9fs_get_default_trans(); 123 + 119 124 kfree(options); 120 125 return ret; 121 126 } ··· 153 150 if (!clnt) 154 151 return ERR_PTR(-ENOMEM); 155 152 153 + clnt->trans_mod = NULL; 156 154 clnt->trans = NULL; 157 155 spin_lock_init(&clnt->lock); 158 156 INIT_LIST_HEAD(&clnt->fidlist); ··· 238 234 kfree(clnt->trans); 239 235 clnt->trans = NULL; 240 236 } 237 + 238 + v9fs_put_trans(clnt->trans_mod); 241 239 242 240 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) 243 241 p9_fid_destroy(fid);
+5 -1
net/9p/conv.c
··· 451 451 unsigned char **pdata) 452 452 { 453 453 *pdata = buf_alloc(bufp, count); 454 + if (*pdata == NULL) 455 + return -ENOMEM; 454 456 memmove(*pdata, data, count); 455 - return count; 457 + return 0; 456 458 } 457 459 458 460 static int ··· 462 460 unsigned char **pdata) 463 461 { 464 462 *pdata = buf_alloc(bufp, count); 463 + if (*pdata == NULL) 464 + return -ENOMEM; 465 465 return copy_from_user(*pdata, data, count); 466 466 } 467 467
+67 -25
net/9p/mod.c
··· 31 31 #include <linux/parser.h> 32 32 #include <net/9p/transport.h> 33 33 #include <linux/list.h> 34 + #include <linux/spinlock.h> 34 35 35 36 #ifdef CONFIG_NET_9P_DEBUG 36 37 unsigned int p9_debug_level = 0; /* feature-rific global debug level */ ··· 45 44 * 46 45 */ 47 46 47 + static DEFINE_SPINLOCK(v9fs_trans_lock); 48 48 static LIST_HEAD(v9fs_trans_list); 49 - static struct p9_trans_module *v9fs_default_transport; 50 49 51 50 /** 52 51 * v9fs_register_trans - register a new transport with 9p ··· 55 54 */ 56 55 void v9fs_register_trans(struct p9_trans_module *m) 57 56 { 57 + spin_lock(&v9fs_trans_lock); 58 58 list_add_tail(&m->list, &v9fs_trans_list); 59 - if (m->def) 60 - v9fs_default_transport = m; 59 + spin_unlock(&v9fs_trans_lock); 61 60 } 62 61 EXPORT_SYMBOL(v9fs_register_trans); 63 62 64 63 /** 65 - * v9fs_match_trans - match transport versus registered transports 64 + * v9fs_unregister_trans - unregister a 9p transport 65 + * @m: the transport to remove 66 + * 67 + */ 68 + void v9fs_unregister_trans(struct p9_trans_module *m) 69 + { 70 + spin_lock(&v9fs_trans_lock); 71 + list_del_init(&m->list); 72 + spin_unlock(&v9fs_trans_lock); 73 + } 74 + EXPORT_SYMBOL(v9fs_unregister_trans); 75 + 76 + /** 77 + * v9fs_get_trans_by_name - get transport with the matching name 66 78 * @name: string identifying transport 67 79 * 68 80 */ 69 - struct p9_trans_module *v9fs_match_trans(const substring_t *name) 81 + struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name) 70 82 { 71 - struct list_head *p; 72 - struct p9_trans_module *t = NULL; 83 + struct p9_trans_module *t, *found = NULL; 73 84 74 - list_for_each(p, &v9fs_trans_list) { 75 - t = list_entry(p, struct p9_trans_module, list); 76 - if (strncmp(t->name, name->from, name->to-name->from) == 0) 77 - return t; 78 - } 79 - return NULL; 85 + spin_lock(&v9fs_trans_lock); 86 + 87 + list_for_each_entry(t, &v9fs_trans_list, list) 88 + if (strncmp(t->name, name->from, name->to-name->from) == 0 && 89 + try_module_get(t->owner)) { 90 + found = t; 91 + break; 92 + } 93 + 94 + spin_unlock(&v9fs_trans_lock); 95 + return found; 80 96 } 81 - EXPORT_SYMBOL(v9fs_match_trans); 97 + EXPORT_SYMBOL(v9fs_get_trans_by_name); 82 98 83 99 /** 84 - * v9fs_default_trans - returns pointer to default transport 100 + * v9fs_get_default_trans - get the default transport 85 101 * 86 102 */ 87 103 88 - struct p9_trans_module *v9fs_default_trans(void) 104 + struct p9_trans_module *v9fs_get_default_trans(void) 89 105 { 90 - if (v9fs_default_transport) 91 - return v9fs_default_transport; 92 - else if (!list_empty(&v9fs_trans_list)) 93 - return list_first_entry(&v9fs_trans_list, 94 - struct p9_trans_module, list); 95 - else 96 - return NULL; 97 - } 98 - EXPORT_SYMBOL(v9fs_default_trans); 106 + struct p9_trans_module *t, *found = NULL; 99 107 108 + spin_lock(&v9fs_trans_lock); 109 + 110 + list_for_each_entry(t, &v9fs_trans_list, list) 111 + if (t->def && try_module_get(t->owner)) { 112 + found = t; 113 + break; 114 + } 115 + 116 + if (!found) 117 + list_for_each_entry(t, &v9fs_trans_list, list) 118 + if (try_module_get(t->owner)) { 119 + found = t; 120 + break; 121 + } 122 + 123 + spin_unlock(&v9fs_trans_lock); 124 + return found; 125 + } 126 + EXPORT_SYMBOL(v9fs_get_default_trans); 127 + 128 + /** 129 + * v9fs_put_trans - put trans 130 + * @m: transport to put 131 + * 132 + */ 133 + void v9fs_put_trans(struct p9_trans_module *m) 134 + { 135 + if (m) 136 + module_put(m->owner); 137 + } 100 138 101 139 /** 102 140 * v9fs_init - Initialize module ··· 160 120 static void __exit exit_p9(void) 161 121 { 162 122 printk(KERN_INFO "Unloading 9P2000 support\n"); 123 + 124 + p9_trans_fd_exit(); 163 125 } 164 126 165 127 module_init(init_p9)
+36 -68
net/9p/trans_fd.c
··· 151 151 * @trans: reference to transport instance for this connection 152 152 * @tagpool: id accounting for transactions 153 153 * @err: error state 154 - * @equeue: event wait_q (?) 155 154 * @req_list: accounting for requests which have been sent 156 155 * @unsent_req_list: accounting for requests that haven't been sent 157 156 * @rcall: current response &p9_fcall structure ··· 177 178 struct p9_trans *trans; 178 179 struct p9_idpool *tagpool; 179 180 int err; 180 - wait_queue_head_t equeue; 181 181 struct list_head req_list; 182 182 struct list_head unsent_req_list; 183 183 struct p9_fcall *rcall; ··· 237 239 #endif /* P9_NONBLOCK */ 238 240 239 241 static void p9_conn_cancel(struct p9_conn *m, int err); 240 - 241 - static int p9_mux_global_init(void) 242 - { 243 - int i; 244 - 245 - for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++) 246 - p9_mux_poll_tasks[i].task = NULL; 247 - 248 - p9_mux_wq = create_workqueue("v9fs"); 249 - if (!p9_mux_wq) { 250 - printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n"); 251 - return -ENOMEM; 252 - } 253 - 254 - return 0; 255 - } 256 242 257 243 static u16 p9_mux_get_tag(struct p9_conn *m) 258 244 { ··· 391 409 static struct p9_conn *p9_conn_create(struct p9_trans *trans) 392 410 { 393 411 int i, n; 394 - struct p9_conn *m, *mtmp; 412 + struct p9_conn *m; 395 413 396 414 P9_DPRINTK(P9_DEBUG_MUX, "transport %p msize %d\n", trans, 397 415 trans->msize); 398 - m = kmalloc(sizeof(struct p9_conn), GFP_KERNEL); 416 + m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL); 399 417 if (!m) 400 418 return ERR_PTR(-ENOMEM); 401 419 ··· 406 424 m->trans = trans; 407 425 m->tagpool = p9_idpool_create(); 408 426 if (IS_ERR(m->tagpool)) { 409 - mtmp = ERR_PTR(-ENOMEM); 410 427 kfree(m); 411 - return mtmp; 428 + return ERR_PTR(-ENOMEM); 412 429 } 413 430 414 - m->err = 0; 415 - init_waitqueue_head(&m->equeue); 416 431 INIT_LIST_HEAD(&m->req_list); 417 432 INIT_LIST_HEAD(&m->unsent_req_list); 418 - m->rcall = NULL; 419 - m->rpos = 0; 420 - m->rbuf = NULL; 421 - m->wpos = m->wsize = 0; 422 - m->wbuf = NULL; 423 433 INIT_WORK(&m->rq, p9_read_work); 424 434 INIT_WORK(&m->wq, p9_write_work); 425 - m->wsched = 0; 426 - memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); 427 - m->poll_task = NULL; 428 435 n = p9_mux_poll_start(m); 429 436 if (n) { 430 437 kfree(m); ··· 434 463 for (i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) { 435 464 if (IS_ERR(m->poll_waddr[i])) { 436 465 p9_mux_poll_stop(m); 437 - mtmp = (void *)m->poll_waddr; /* the error code */ 438 466 kfree(m); 439 - m = mtmp; 440 - break; 467 + return (void *)m->poll_waddr; /* the error code */ 441 468 } 442 469 } 443 470 ··· 452 483 { 453 484 P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m, 454 485 m->mux_list.prev, m->mux_list.next); 455 - p9_conn_cancel(m, -ECONNRESET); 456 - 457 - if (!list_empty(&m->req_list)) { 458 - /* wait until all processes waiting on this session exit */ 459 - P9_DPRINTK(P9_DEBUG_MUX, 460 - "mux %p waiting for empty request queue\n", m); 461 - wait_event_timeout(m->equeue, (list_empty(&m->req_list)), 5000); 462 - P9_DPRINTK(P9_DEBUG_MUX, "mux %p request queue empty: %d\n", m, 463 - list_empty(&m->req_list)); 464 - } 465 486 466 487 p9_mux_poll_stop(m); 488 + cancel_work_sync(&m->rq); 489 + cancel_work_sync(&m->wq); 490 + 491 + p9_conn_cancel(m, -ECONNRESET); 492 + 467 493 m->trans = NULL; 468 494 p9_idpool_destroy(m->tagpool); 469 495 kfree(m); ··· 804 840 (*req->cb) (req, req->cba); 805 841 else 806 842 kfree(req->rcall); 807 - 808 - wake_up(&m->equeue); 809 843 } 810 844 } else { 811 845 if (err >= 0 && rcall->id != P9_RFLUSH) ··· 870 908 else 871 909 n = p9_mux_get_tag(m); 872 910 873 - if (n < 0) 911 + if (n < 0) { 912 + kfree(req); 874 913 return ERR_PTR(-ENOMEM); 914 + } 875 915 876 916 p9_set_tag(tc, n); 877 917 ··· 948 984 (*req->cb) (req, req->cba); 949 985 else 950 986 kfree(req->rcall); 951 - 952 - wake_up(&m->equeue); 953 987 } 954 988 955 989 kfree(freq->tcall); ··· 1153 1191 else 1154 1192 kfree(req->rcall); 1155 1193 } 1156 - 1157 - wake_up(&m->equeue); 1158 1194 } 1159 1195 1160 1196 /** ··· 1330 1370 { 1331 1371 int ret, n; 1332 1372 struct p9_trans_fd *ts = NULL; 1333 - mm_segment_t oldfs; 1334 1373 1335 1374 if (trans && trans->status == Connected) 1336 1375 ts = trans->priv; ··· 1343 1384 if (!ts->wr->f_op || !ts->wr->f_op->poll) 1344 1385 return -EIO; 1345 1386 1346 - oldfs = get_fs(); 1347 - set_fs(get_ds()); 1348 - 1349 1387 ret = ts->rd->f_op->poll(ts->rd, pt); 1350 1388 if (ret < 0) 1351 - goto end; 1389 + return ret; 1352 1390 1353 1391 if (ts->rd != ts->wr) { 1354 1392 n = ts->wr->f_op->poll(ts->wr, pt); 1355 - if (n < 0) { 1356 - ret = n; 1357 - goto end; 1358 - } 1393 + if (n < 0) 1394 + return n; 1359 1395 ret = (ret & ~POLLOUT) | (n & ~POLLIN); 1360 1396 } 1361 1397 1362 - end: 1363 - set_fs(oldfs); 1364 1398 return ret; 1365 1399 } 1366 1400 ··· 1581 1629 .maxsize = MAX_SOCK_BUF, 1582 1630 .def = 1, 1583 1631 .create = p9_trans_create_tcp, 1632 + .owner = THIS_MODULE, 1584 1633 }; 1585 1634 1586 1635 static struct p9_trans_module p9_unix_trans = { ··· 1589 1636 .maxsize = MAX_SOCK_BUF, 1590 1637 .def = 0, 1591 1638 .create = p9_trans_create_unix, 1639 + .owner = THIS_MODULE, 1592 1640 }; 1593 1641 1594 1642 static struct p9_trans_module p9_fd_trans = { ··· 1597 1643 .maxsize = MAX_SOCK_BUF, 1598 1644 .def = 0, 1599 1645 .create = p9_trans_create_fd, 1646 + .owner = THIS_MODULE, 1600 1647 }; 1601 1648 1602 1649 int p9_trans_fd_init(void) 1603 1650 { 1604 - int ret = p9_mux_global_init(); 1605 - if (ret) { 1606 - printk(KERN_WARNING "9p: starting mux failed\n"); 1607 - return ret; 1651 + int i; 1652 + 1653 + for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++) 1654 + p9_mux_poll_tasks[i].task = NULL; 1655 + 1656 + p9_mux_wq = create_workqueue("v9fs"); 1657 + if (!p9_mux_wq) { 1658 + printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n"); 1659 + return -ENOMEM; 1608 1660 } 1609 1661 1610 1662 v9fs_register_trans(&p9_tcp_trans); ··· 1619 1659 1620 1660 return 0; 1621 1661 } 1622 - EXPORT_SYMBOL(p9_trans_fd_init); 1662 + 1663 + void p9_trans_fd_exit(void) 1664 + { 1665 + v9fs_unregister_trans(&p9_tcp_trans); 1666 + v9fs_unregister_trans(&p9_unix_trans); 1667 + v9fs_unregister_trans(&p9_fd_trans); 1668 + 1669 + destroy_workqueue(p9_mux_wq); 1670 + }
+2
net/9p/trans_virtio.c
··· 528 528 .create = p9_virtio_create, 529 529 .maxsize = PAGE_SIZE*16, 530 530 .def = 0, 531 + .owner = THIS_MODULE, 531 532 }; 532 533 533 534 /* The standard init function */ ··· 546 545 static void __exit p9_virtio_cleanup(void) 547 546 { 548 547 unregister_virtio_driver(&p9_virtio_drv); 548 + v9fs_unregister_trans(&p9_virtio_trans); 549 549 } 550 550 551 551 module_init(p9_virtio_init);
+1 -1
net/ipv4/tcp_ipv4.c
··· 618 618 ]; 619 619 } rep; 620 620 struct ip_reply_arg arg; 621 - struct net *net = dev_net(skb->dev); 621 + struct net *net = dev_net(skb->dst->dev); 622 622 623 623 memset(&rep.th, 0, sizeof(struct tcphdr)); 624 624 memset(&arg, 0, sizeof(arg));
+6 -2
net/ipv6/netfilter/ip6t_hbh.c
··· 97 97 hdrlen -= 2; 98 98 if (!(optinfo->flags & IP6T_OPTS_OPTS)) { 99 99 return ret; 100 - } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { 101 - pr_debug("Not strict - not implemented"); 102 100 } else { 103 101 pr_debug("Strict "); 104 102 pr_debug("#%d ", optinfo->optsnr); ··· 175 177 pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags); 176 178 return false; 177 179 } 180 + 181 + if (optsinfo->flags & IP6T_OPTS_NSTRICT) { 182 + pr_debug("ip6t_opts: Not strict - not implemented"); 183 + return false; 184 + } 185 + 178 186 return true; 179 187 } 180 188
+2
net/ipv6/route.c
··· 2688 2688 if (ret) 2689 2689 goto out_kmem_cache; 2690 2690 2691 + ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep; 2692 + 2691 2693 /* Registering of the loopback is done before this portion of code, 2692 2694 * the loopback reference in rt6_info will not be taken, do it 2693 2695 * manually for init_net */
+1 -1
net/ipv6/tcp_ipv6.c
··· 1050 1050 struct tcphdr *th = tcp_hdr(skb), *t1; 1051 1051 struct sk_buff *buff; 1052 1052 struct flowi fl; 1053 - struct net *net = dev_net(skb->dev); 1053 + struct net *net = dev_net(skb->dst->dev); 1054 1054 struct sock *ctl_sk = net->ipv6.tcp_sk; 1055 1055 unsigned int tot_len = sizeof(struct tcphdr); 1056 1056 __be32 *topt;
+2 -1
net/iucv/iucv.c
··· 524 524 get_online_cpus(); 525 525 for_each_online_cpu(cpu) 526 526 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1); 527 - preempt_enable(); 528 527 if (cpus_empty(iucv_buffer_cpumask)) 529 528 /* No cpu could declare an iucv buffer. */ 530 529 goto out_path; ··· 546 547 */ 547 548 static void iucv_disable(void) 548 549 { 550 + get_online_cpus(); 549 551 on_each_cpu(iucv_retrieve_cpu, NULL, 1); 552 + put_online_cpus(); 550 553 kfree(iucv_path_table); 551 554 } 552 555
+19 -11
net/key/af_key.c
··· 73 73 return 0; 74 74 } 75 75 76 - static int pfkey_do_dump(struct pfkey_sock *pfk) 76 + static void pfkey_terminate_dump(struct pfkey_sock *pfk) 77 77 { 78 - int rc; 79 - 80 - rc = pfk->dump.dump(pfk); 81 - if (rc == -ENOBUFS) 82 - return 0; 83 - 84 - pfk->dump.done(pfk); 85 - pfk->dump.dump = NULL; 86 - pfk->dump.done = NULL; 87 - return rc; 78 + if (pfk->dump.dump) { 79 + pfk->dump.done(pfk); 80 + pfk->dump.dump = NULL; 81 + pfk->dump.done = NULL; 82 + } 88 83 } 89 84 90 85 static void pfkey_sock_destruct(struct sock *sk) 91 86 { 87 + pfkey_terminate_dump(pfkey_sk(sk)); 92 88 skb_queue_purge(&sk->sk_receive_queue); 93 89 94 90 if (!sock_flag(sk, SOCK_DEAD)) { ··· 304 308 kfree_skb(skb2); 305 309 kfree_skb(skb); 306 310 return err; 311 + } 312 + 313 + static int pfkey_do_dump(struct pfkey_sock *pfk) 314 + { 315 + int rc; 316 + 317 + rc = pfk->dump.dump(pfk); 318 + if (rc == -ENOBUFS) 319 + return 0; 320 + 321 + pfkey_terminate_dump(pfk); 322 + return rc; 307 323 } 308 324 309 325 static inline void pfkey_hdr_dup(struct sadb_msg *new, struct sadb_msg *orig)
+24 -13
net/sctp/sm_make_chunk.c
··· 1012 1012 return retval; 1013 1013 } 1014 1014 1015 + struct sctp_chunk *sctp_make_violation_paramlen( 1016 + const struct sctp_association *asoc, 1017 + const struct sctp_chunk *chunk, 1018 + struct sctp_paramhdr *param) 1019 + { 1020 + struct sctp_chunk *retval; 1021 + static const char error[] = "The following parameter had invalid length:"; 1022 + size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t) + 1023 + sizeof(sctp_paramhdr_t); 1024 + 1025 + retval = sctp_make_abort(asoc, chunk, payload_len); 1026 + if (!retval) 1027 + goto nodata; 1028 + 1029 + sctp_init_cause(retval, SCTP_ERROR_PROTO_VIOLATION, 1030 + sizeof(error) + sizeof(sctp_paramhdr_t)); 1031 + sctp_addto_chunk(retval, sizeof(error), error); 1032 + sctp_addto_param(retval, sizeof(sctp_paramhdr_t), param); 1033 + 1034 + nodata: 1035 + return retval; 1036 + } 1037 + 1015 1038 /* Make a HEARTBEAT chunk. */ 1016 1039 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc, 1017 1040 const struct sctp_transport *transport, ··· 1805 1782 const struct sctp_chunk *chunk, 1806 1783 struct sctp_chunk **errp) 1807 1784 { 1808 - static const char error[] = "The following parameter had invalid length:"; 1809 - size_t payload_len = WORD_ROUND(sizeof(error)) + 1810 - sizeof(sctp_paramhdr_t); 1811 - 1812 - 1813 1785 /* This is a fatal error. Any accumulated non-fatal errors are 1814 1786 * not reported. 1815 1787 */ ··· 1812 1794 sctp_chunk_free(*errp); 1813 1795 1814 1796 /* Create an error chunk and fill it in with our payload. */ 1815 - *errp = sctp_make_op_error_space(asoc, chunk, payload_len); 1816 - 1817 - if (*errp) { 1818 - sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION, 1819 - sizeof(error) + sizeof(sctp_paramhdr_t)); 1820 - sctp_addto_chunk(*errp, sizeof(error), error); 1821 - sctp_addto_param(*errp, sizeof(sctp_paramhdr_t), param); 1822 - } 1797 + *errp = sctp_make_violation_paramlen(asoc, chunk, param); 1823 1798 1824 1799 return 0; 1825 1800 }
+37 -11
net/sctp/sm_statefuns.c
··· 119 119 const struct sctp_endpoint *ep, 120 120 const struct sctp_association *asoc, 121 121 const sctp_subtype_t type, 122 - void *arg, 122 + void *arg, void *ext, 123 123 sctp_cmd_seq_t *commands); 124 124 125 125 static sctp_disposition_t sctp_sf_violation_ctsn( ··· 3425 3425 addr_param = (union sctp_addr_param *)hdr->params; 3426 3426 length = ntohs(addr_param->p.length); 3427 3427 if (length < sizeof(sctp_paramhdr_t)) 3428 - return sctp_sf_violation_paramlen(ep, asoc, type, 3428 + return sctp_sf_violation_paramlen(ep, asoc, type, arg, 3429 3429 (void *)addr_param, commands); 3430 3430 3431 3431 /* Verify the ASCONF chunk before processing it. */ ··· 3433 3433 (sctp_paramhdr_t *)((void *)addr_param + length), 3434 3434 (void *)chunk->chunk_end, 3435 3435 &err_param)) 3436 - return sctp_sf_violation_paramlen(ep, asoc, type, 3437 - (void *)&err_param, commands); 3436 + return sctp_sf_violation_paramlen(ep, asoc, type, arg, 3437 + (void *)err_param, commands); 3438 3438 3439 3439 /* ADDIP 5.2 E1) Compare the value of the serial number to the value 3440 3440 * the endpoint stored in a new association variable ··· 3542 3542 (sctp_paramhdr_t *)addip_hdr->params, 3543 3543 (void *)asconf_ack->chunk_end, 3544 3544 &err_param)) 3545 - return sctp_sf_violation_paramlen(ep, asoc, type, 3546 - (void *)&err_param, commands); 3545 + return sctp_sf_violation_paramlen(ep, asoc, type, arg, 3546 + (void *)err_param, commands); 3547 3547 3548 3548 if (last_asconf) { 3549 3549 addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr; ··· 4240 4240 const struct sctp_endpoint *ep, 4241 4241 const struct sctp_association *asoc, 4242 4242 const sctp_subtype_t type, 4243 - void *arg, 4244 - sctp_cmd_seq_t *commands) { 4245 - static const char err_str[] = "The following parameter had invalid length:"; 4243 + void *arg, void *ext, 4244 + sctp_cmd_seq_t *commands) 4245 + { 4246 + struct sctp_chunk *chunk = arg; 4247 + struct sctp_paramhdr *param = ext; 4248 + struct sctp_chunk *abort = NULL; 4246 4249 4247 - return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, 4248 - sizeof(err_str)); 4250 + if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) 4251 + goto discard; 4252 + 4253 + /* Make the abort chunk. */ 4254 + abort = sctp_make_violation_paramlen(asoc, chunk, param); 4255 + if (!abort) 4256 + goto nomem; 4257 + 4258 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4259 + SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); 4260 + 4261 + sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, 4262 + SCTP_ERROR(ECONNABORTED)); 4263 + sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, 4264 + SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION)); 4265 + SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); 4266 + 4267 + discard: 4268 + sctp_sf_pdiscard(ep, asoc, SCTP_ST_CHUNK(0), arg, commands); 4269 + 4270 + SCTP_INC_STATS(SCTP_MIB_ABORTEDS); 4271 + 4272 + return SCTP_DISPOSITION_ABORT; 4273 + nomem: 4274 + return SCTP_DISPOSITION_NOMEM; 4249 4275 } 4250 4276 4251 4277 /* Handle a protocol violation when the peer trying to advance the
+2
net/socket.c
··· 1511 1511 goto out_put; 1512 1512 } 1513 1513 1514 + #if 0 1514 1515 #ifdef HAVE_SET_RESTORE_SIGMASK 1515 1516 asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, 1516 1517 int __user *upeer_addrlen, ··· 1564 1563 1565 1564 return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); 1566 1565 } 1566 + #endif 1567 1567 #endif 1568 1568 1569 1569 asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
+7 -3
net/xfrm/xfrm_output.c
··· 27 27 - skb_headroom(skb); 28 28 int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); 29 29 30 - if (nhead > 0 || ntail > 0) 31 - return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); 30 + if (nhead <= 0) { 31 + if (ntail <= 0) 32 + return 0; 33 + nhead = 0; 34 + } else if (ntail < 0) 35 + ntail = 0; 32 36 33 - return 0; 37 + return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); 34 38 } 35 39 36 40 static int xfrm_output_one(struct sk_buff *skb, int err)
+57 -66
scripts/kconfig/conf.c
··· 32 32 33 33 static int indent = 1; 34 34 static int valid_stdin = 1; 35 + static int sync_kconfig; 35 36 static int conf_cnt; 36 37 static char line[128]; 37 38 static struct menu *rootEntry; ··· 66 65 67 66 static void check_stdin(void) 68 67 { 69 - if (!valid_stdin && input_mode == ask_silent) { 68 + if (!valid_stdin) { 70 69 printf(_("aborted!\n\n")); 71 70 printf(_("Console input/output is redirected. ")); 72 71 printf(_("Run 'make oldconfig' to update configuration.\n\n")); ··· 428 427 check_conf(child); 429 428 } 430 429 431 - static void conf_do_update(void) 432 - { 433 - /* Update until a loop caused no more changes */ 434 - do { 435 - conf_cnt = 0; 436 - check_conf(&rootmenu); 437 - } while (conf_cnt); 438 - } 439 - 440 - static int conf_silent_update(void) 441 - { 442 - const char *name; 443 - 444 - if (conf_get_changed()) { 445 - name = getenv("KCONFIG_NOSILENTUPDATE"); 446 - if (name && *name) { 447 - fprintf(stderr, 448 - _("\n*** Kernel configuration requires explicit update.\n\n")); 449 - return 1; 450 - } 451 - conf_do_update(); 452 - } 453 - return 0; 454 - } 455 - 456 - static int conf_update(void) 457 - { 458 - rootEntry = &rootmenu; 459 - conf(&rootmenu); 460 - if (input_mode == ask_all) { 461 - input_mode = ask_silent; 462 - valid_stdin = 1; 463 - } 464 - conf_do_update(); 465 - return 0; 466 - } 467 - 468 430 int main(int ac, char **av) 469 431 { 470 432 int opt; ··· 441 477 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { 442 478 switch (opt) { 443 479 case 'o': 444 - input_mode = ask_new; 480 + input_mode = ask_silent; 445 481 break; 446 482 case 's': 447 483 input_mode = ask_silent; 448 - valid_stdin = isatty(0) && isatty(1) && isatty(2); 484 + sync_kconfig = 1; 449 485 break; 450 486 case 'd': 451 487 input_mode = set_default; ··· 483 519 name = av[optind]; 484 520 conf_parse(name); 485 521 //zconfdump(stdout); 522 + if (sync_kconfig) { 523 + if (stat(".config", &tmpstat)) { 524 + fprintf(stderr, _("***\n" 525 + "*** You have not yet configured your kernel!\n" 526 + "*** (missing kernel .config file)\n" 527 + "***\n" 528 + "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 529 + "*** \"make menuconfig\" or \"make xconfig\").\n" 530 + "***\n")); 531 + exit(1); 532 + } 533 + } 534 + 486 535 switch (input_mode) { 487 536 case set_default: 488 537 if (!defconfig_file) ··· 508 531 } 509 532 break; 510 533 case ask_silent: 511 - if (stat(".config", &tmpstat)) { 512 - printf(_("***\n" 513 - "*** You have not yet configured your kernel!\n" 514 - "*** (missing kernel .config file)\n" 515 - "***\n" 516 - "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 517 - "*** \"make menuconfig\" or \"make xconfig\").\n" 518 - "***\n")); 519 - exit(1); 520 - } 521 534 case ask_all: 522 535 case ask_new: 523 536 conf_read(NULL); ··· 536 569 default: 537 570 break; 538 571 } 572 + 573 + if (sync_kconfig) { 574 + if (conf_get_changed()) { 575 + name = getenv("KCONFIG_NOSILENTUPDATE"); 576 + if (name && *name) { 577 + fprintf(stderr, 578 + _("\n*** Kernel configuration requires explicit update.\n\n")); 579 + return 1; 580 + } 581 + } 582 + valid_stdin = isatty(0) && isatty(1) && isatty(2); 583 + } 584 + 539 585 switch (input_mode) { 540 586 case set_no: 541 587 conf_set_all_new_symbols(def_no); ··· 565 585 case set_default: 566 586 conf_set_all_new_symbols(def_default); 567 587 break; 568 - case ask_silent: 569 588 case ask_new: 570 - if (conf_silent_update()) 571 - exit(1); 572 - break; 573 589 case ask_all: 574 - if (conf_update()) 575 - exit(1); 590 + rootEntry = &rootmenu; 591 + conf(&rootmenu); 592 + input_mode = ask_silent; 593 + /* fall through */ 594 + case ask_silent: 595 + /* Update until a loop caused no more changes */ 596 + do { 597 + conf_cnt = 0; 598 + check_conf(&rootmenu); 599 + } while (conf_cnt); 576 600 break; 577 601 } 578 602 579 - if (conf_write(NULL)) { 580 - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 581 - exit(1); 582 - } 583 - /* ask_silent is used during the build so we shall update autoconf. 584 - * All other commands are only used to generate a config. 585 - */ 586 - if (input_mode == ask_silent && conf_write_autoconf()) { 587 - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 588 - return 1; 603 + if (sync_kconfig) { 604 + /* silentoldconfig is used during the build so we shall update autoconf. 605 + * All other commands are only used to generate a config. 606 + */ 607 + if (conf_get_changed() && conf_write(NULL)) { 608 + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 609 + exit(1); 610 + } 611 + if (conf_write_autoconf()) { 612 + fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 613 + return 1; 614 + } 615 + } else { 616 + if (conf_write(NULL)) { 617 + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 618 + exit(1); 619 + } 589 620 } 590 621 return 0; 591 622 }
+6 -2
scripts/kconfig/confdata.c
··· 222 222 continue; 223 223 if (def == S_DEF_USER) { 224 224 sym = sym_find(line + 9); 225 - if (!sym) 225 + if (!sym) { 226 + sym_add_change_count(1); 226 227 break; 228 + } 227 229 } else { 228 230 sym = sym_lookup(line + 9, 0); 229 231 if (sym->type == S_UNKNOWN) ··· 261 259 } 262 260 if (def == S_DEF_USER) { 263 261 sym = sym_find(line + 7); 264 - if (!sym) 262 + if (!sym) { 263 + sym_add_change_count(1); 265 264 break; 265 + } 266 266 } else { 267 267 sym = sym_lookup(line + 7, 0); 268 268 if (sym->type == S_UNKNOWN)
+4
scripts/kernel-doc
··· 781 781 print " <refsect1>\n"; 782 782 print " <title>Members</title>\n"; 783 783 784 + if ($#{$args{'parameterlist'}} >= 0) { 784 785 print " <variablelist>\n"; 785 786 foreach $parameter (@{$args{'parameterlist'}}) { 786 787 ($parameter =~ /^#/) && next; ··· 799 798 print " </varlistentry>\n"; 800 799 } 801 800 print " </variablelist>\n"; 801 + } else { 802 + print " <para>\n None\n </para>\n"; 803 + } 802 804 print " </refsect1>\n"; 803 805 804 806 output_section_xml(@_);
+4 -7
security/selinux/ss/services.c
··· 2737 2737 if (ctx == NULL) 2738 2738 goto netlbl_secattr_to_sid_return; 2739 2739 2740 + context_init(&ctx_new); 2740 2741 ctx_new.user = ctx->user; 2741 2742 ctx_new.role = ctx->role; 2742 2743 ctx_new.type = ctx->type; ··· 2746 2745 if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat, 2747 2746 secattr->attr.mls.cat) != 0) 2748 2747 goto netlbl_secattr_to_sid_return; 2749 - ctx_new.range.level[1].cat.highbit = 2750 - ctx_new.range.level[0].cat.highbit; 2751 - ctx_new.range.level[1].cat.node = 2752 - ctx_new.range.level[0].cat.node; 2753 - } else { 2754 - ebitmap_init(&ctx_new.range.level[0].cat); 2755 - ebitmap_init(&ctx_new.range.level[1].cat); 2748 + memcpy(&ctx_new.range.level[1].cat, 2749 + &ctx_new.range.level[0].cat, 2750 + sizeof(ctx_new.range.level[0].cat)); 2756 2751 } 2757 2752 if (mls_context_isvalid(&policydb, &ctx_new) != 1) 2758 2753 goto netlbl_secattr_to_sid_return_cleanup;
+2 -2
sound/core/pcm.c
··· 781 781 return -ENODEV; 782 782 783 783 card = pcm->card; 784 - down_read(&card->controls_rwsem); 784 + read_lock(&card->ctl_files_rwlock); 785 785 list_for_each_entry(kctl, &card->ctl_files, list) { 786 786 if (kctl->pid == current->pid) { 787 787 prefer_subdevice = kctl->prefer_pcm_subdevice; ··· 789 789 break; 790 790 } 791 791 } 792 - up_read(&card->controls_rwsem); 792 + read_unlock(&card->ctl_files_rwlock); 793 793 794 794 switch (stream) { 795 795 case SNDRV_PCM_STREAM_PLAYBACK:
+3 -10
sound/core/pcm_native.c
··· 1546 1546 card = substream->pcm->card; 1547 1547 1548 1548 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || 1549 - runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) 1549 + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || 1550 + runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) 1550 1551 return -EBADFD; 1551 - 1552 - snd_power_lock(card); 1553 - if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { 1554 - result = snd_power_wait(card, SNDRV_CTL_POWER_D0); 1555 - if (result < 0) 1556 - goto _unlock; 1557 - } 1558 1552 1559 1553 snd_pcm_stream_lock_irq(substream); 1560 1554 /* resume pause */ ··· 1558 1564 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); 1559 1565 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ 1560 1566 snd_pcm_stream_unlock_irq(substream); 1561 - _unlock: 1562 - snd_power_unlock(card); 1567 + 1563 1568 return result; 1564 1569 } 1565 1570
+2 -2
sound/core/rawmidi.c
··· 418 418 mutex_lock(&rmidi->open_mutex); 419 419 while (1) { 420 420 subdevice = -1; 421 - down_read(&card->controls_rwsem); 421 + read_lock(&card->ctl_files_rwlock); 422 422 list_for_each_entry(kctl, &card->ctl_files, list) { 423 423 if (kctl->pid == current->pid) { 424 424 subdevice = kctl->prefer_rawmidi_subdevice; ··· 426 426 break; 427 427 } 428 428 } 429 - up_read(&card->controls_rwsem); 429 + read_unlock(&card->ctl_files_rwlock); 430 430 err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, 431 431 subdevice, fflags, rawmidi_file); 432 432 if (err >= 0)
+1 -1
sound/pci/hda/patch_sigmatel.c
··· 1683 1683 /* Dell 3 stack systems with verb table in BIOS */ 1684 1684 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), 1685 1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), 1686 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS), 1687 1686 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), 1687 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST), 1688 1688 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), 1689 1689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), 1690 1690 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
+38 -12
sound/ppc/awacs.c
··· 621 621 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 622 622 }; 623 623 624 + static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __initdata = { 625 + AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 626 + AWACS_VOLUME("Master Playback Volume", 5, 6, 1), 627 + AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 628 + AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 629 + }; 630 + 624 631 static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = { 625 632 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 626 633 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), ··· 695 688 static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = 696 689 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 697 690 698 - static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata = 691 + static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata = 692 + AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); 693 + 694 + static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata = 699 695 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 700 696 701 697 ··· 775 765 776 766 #define IS_PM7500 (machine_is_compatible("AAPL,7500")) 777 767 #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) 778 - #define IS_IMAC (machine_is_compatible("PowerMac2,1") \ 779 - || machine_is_compatible("PowerMac2,2") \ 768 + #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) 769 + #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ 780 770 || machine_is_compatible("PowerMac4,1")) 771 + #define IS_G4AGP (machine_is_compatible("PowerMac3,1")) 781 772 782 - static int imac; 773 + static int imac1, imac2; 783 774 784 775 #ifdef PMAC_SUPPORT_AUTOMUTE 785 776 /* ··· 826 815 { 827 816 int reg = chip->awacs_reg[1] 828 817 | (MASK_HDMUTE | MASK_SPKMUTE); 829 - if (imac) { 818 + if (imac1) { 819 + reg &= ~MASK_SPKMUTE; 820 + reg |= MASK_PAROUT1; 821 + } else if (imac2) { 830 822 reg &= ~MASK_SPKMUTE; 831 823 reg &= ~MASK_PAROUT1; 832 824 } 833 825 if (snd_pmac_awacs_detect_headphone(chip)) 834 826 reg &= ~MASK_HDMUTE; 835 - else if (imac) 827 + else if (imac1) 828 + reg &= ~MASK_PAROUT1; 829 + else if (imac2) 836 830 reg |= MASK_PAROUT1; 837 831 else 838 832 reg &= ~MASK_SPKMUTE; ··· 866 850 { 867 851 int pm7500 = IS_PM7500; 868 852 int beige = IS_BEIGE; 853 + int g4agp = IS_G4AGP; 854 + int imac; 869 855 int err, vol; 870 856 871 - imac = IS_IMAC; 857 + imac1 = IS_IMAC1; 858 + imac2 = IS_IMAC2; 859 + imac = imac1 || imac2; 872 860 /* looks like MASK_GAINLINE triggers something, so we set here 873 861 * as start-up 874 862 */ ··· 959 939 snd_pmac_awacs_mixers); 960 940 if (err < 0) 961 941 return err; 962 - if (beige) 942 + if (beige || g4agp) 963 943 ; 964 944 else if (chip->model == PMAC_SCREAMER) 965 945 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), ··· 981 961 err = build_mixers(chip, 982 962 ARRAY_SIZE(snd_pmac_screamer_mixers_imac), 983 963 snd_pmac_screamer_mixers_imac); 964 + else if (g4agp) 965 + err = build_mixers(chip, 966 + ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp), 967 + snd_pmac_screamer_mixers_g4agp); 984 968 else 985 969 err = build_mixers(chip, 986 970 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac), 987 971 snd_pmac_awacs_mixers_pmac); 988 972 if (err < 0) 989 973 return err; 990 - chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac) 974 + chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp) 991 975 ? &snd_pmac_awacs_master_sw_imac 992 976 : &snd_pmac_awacs_master_sw, chip); 993 977 err = snd_ctl_add(chip->card, chip->master_sw_ctl); ··· 1028 1004 snd_pmac_awacs_speaker_vol); 1029 1005 if (err < 0) 1030 1006 return err; 1031 - chip->speaker_sw_ctl = snd_ctl_new1(imac 1032 - ? &snd_pmac_awacs_speaker_sw_imac 1007 + chip->speaker_sw_ctl = snd_ctl_new1(imac1 1008 + ? &snd_pmac_awacs_speaker_sw_imac1 1009 + : imac2 1010 + ? &snd_pmac_awacs_speaker_sw_imac2 1033 1011 : &snd_pmac_awacs_speaker_sw, chip); 1034 1012 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); 1035 1013 if (err < 0) 1036 1014 return err; 1037 1015 } 1038 1016 1039 - if (beige) 1017 + if (beige || g4agp) 1040 1018 err = build_mixers(chip, 1041 1019 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), 1042 1020 snd_pmac_screamer_mic_boost_beige);
+3 -2
sound/soc/at32/at32-pcm.c
··· 434 434 params = prtd->params; 435 435 436 436 /* Disable the PDC and save the PDC registers */ 437 - ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable); 437 + ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, 438 + params->mask->pdc_disable); 438 439 439 440 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr); 440 441 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr); ··· 465 464 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save); 466 465 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save); 467 466 468 - ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable); 467 + ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable); 469 468 return 0; 470 469 } 471 470 #else /* CONFIG_PM */
+34 -69
sound/soc/codecs/cs4270.c
··· 490 490 491 491 #endif 492 492 493 - static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind); 494 - 495 - /* 496 - * Notify the driver that a new I2C bus has been found. 497 - * 498 - * This function is called for each I2C bus in the system. The function 499 - * then asks the I2C subsystem to probe that bus at the addresses on which 500 - * our device (the CS4270) could exist. If a device is found at one of 501 - * those addresses, then our probe function (cs4270_i2c_probe) is called. 502 - */ 503 - static int cs4270_i2c_attach(struct i2c_adapter *adapter) 504 - { 505 - return i2c_probe(adapter, &addr_data, cs4270_i2c_probe); 506 - } 507 - 508 - static int cs4270_i2c_detach(struct i2c_client *client) 509 - { 510 - struct snd_soc_codec *codec = i2c_get_clientdata(client); 511 - 512 - i2c_detach_client(client); 513 - codec->control_data = NULL; 514 - 515 - kfree(codec->reg_cache); 516 - codec->reg_cache = NULL; 517 - 518 - kfree(client); 519 - return 0; 520 - } 493 + static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *); 521 494 522 495 /* A list of non-DAPM controls that the CS4270 supports */ 523 496 static const struct snd_kcontrol_new cs4270_snd_controls[] = { ··· 498 525 CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) 499 526 }; 500 527 528 + static const struct i2c_device_id cs4270_id[] = { 529 + {"cs4270", 0}, 530 + {} 531 + }; 532 + MODULE_DEVICE_TABLE(i2c, cs4270_id); 533 + 501 534 static struct i2c_driver cs4270_i2c_driver = { 502 535 .driver = { 503 536 .name = "CS4270 I2C", 504 537 .owner = THIS_MODULE, 505 538 }, 506 - .id = I2C_DRIVERID_CS4270, 507 - .attach_adapter = cs4270_i2c_attach, 508 - .detach_client = cs4270_i2c_detach, 539 + .id_table = cs4270_id, 540 + .probe = cs4270_i2c_probe, 509 541 }; 510 542 511 543 /* ··· 539 561 * Note: snd_soc_new_pcms() must be called before this function can be called, 540 562 * because of snd_ctl_add(). 541 563 */ 542 - static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) 564 + static int cs4270_i2c_probe(struct i2c_client *i2c_client, 565 + const struct i2c_device_id *id) 543 566 { 544 567 struct snd_soc_device *socdev = cs4270_socdev; 545 568 struct snd_soc_codec *codec = socdev->codec; 546 - struct i2c_client *i2c_client = NULL; 547 569 int i; 548 570 int ret = 0; 549 571 ··· 556 578 557 579 /* Note: codec_dai->codec is NULL here */ 558 580 559 - i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 560 - if (!i2c_client) { 561 - printk(KERN_ERR "cs4270: could not allocate I2C client\n"); 562 - return -ENOMEM; 563 - } 564 - 565 581 codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); 566 582 if (!codec->reg_cache) { 567 583 printk(KERN_ERR "cs4270: could not allocate register cache\n"); 568 584 ret = -ENOMEM; 569 585 goto error; 570 586 } 571 - 572 - i2c_set_clientdata(i2c_client, codec); 573 - strcpy(i2c_client->name, "CS4270"); 574 - 575 - i2c_client->driver = &cs4270_i2c_driver; 576 - i2c_client->adapter = adapter; 577 - i2c_client->addr = addr; 578 587 579 588 /* Verify that we have a CS4270 */ 580 589 ··· 577 612 goto error; 578 613 } 579 614 580 - printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr); 615 + printk(KERN_INFO "cs4270: found device at I2C address %X\n", 616 + i2c_client->addr); 581 617 printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); 582 - 583 - /* Tell the I2C layer a new client has arrived */ 584 - 585 - ret = i2c_attach_client(i2c_client); 586 - if (ret) { 587 - printk(KERN_ERR "cs4270: could not attach codec, " 588 - "I2C address %x, error code %i\n", addr, ret); 589 - goto error; 590 - } 591 618 592 619 codec->control_data = i2c_client; 593 620 codec->read = cs4270_read_reg_cache; ··· 605 648 goto error; 606 649 } 607 650 651 + i2c_set_clientdata(i2c_client, codec); 652 + 608 653 return 0; 609 654 610 655 error: 611 - if (codec->control_data) { 612 - i2c_detach_client(i2c_client); 613 - codec->control_data = NULL; 614 - } 656 + codec->control_data = NULL; 615 657 616 658 kfree(codec->reg_cache); 617 659 codec->reg_cache = NULL; 618 660 codec->reg_cache_size = 0; 619 - 620 - kfree(i2c_client); 621 661 622 662 return ret; 623 663 } ··· 681 727 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 682 728 if (ret < 0) { 683 729 printk(KERN_ERR "cs4270: failed to create PCMs\n"); 684 - return ret; 730 + goto error_free_codec; 685 731 } 686 732 687 733 #ifdef USE_I2C ··· 690 736 ret = i2c_add_driver(&cs4270_i2c_driver); 691 737 if (ret) { 692 738 printk(KERN_ERR "cs4270: failed to attach driver"); 693 - snd_soc_free_pcms(socdev); 694 - return ret; 739 + goto error_free_pcms; 695 740 } 696 741 697 742 /* Did we find a CS4270 on the I2C bus? */ ··· 712 759 ret = snd_soc_register_card(socdev); 713 760 if (ret < 0) { 714 761 printk(KERN_ERR "cs4270: failed to register card\n"); 715 - snd_soc_free_pcms(socdev); 716 - return ret; 762 + goto error_del_driver; 717 763 } 764 + 765 + return 0; 766 + 767 + error_del_driver: 768 + #ifdef USE_I2C 769 + i2c_del_driver(&cs4270_i2c_driver); 770 + 771 + error_free_pcms: 772 + #endif 773 + snd_soc_free_pcms(socdev); 774 + 775 + error_free_codec: 776 + kfree(socdev->codec); 777 + socdev->codec = NULL; 718 778 719 779 return ret; 720 780 } ··· 739 773 snd_soc_free_pcms(socdev); 740 774 741 775 #ifdef USE_I2C 742 - if (socdev->codec->control_data) 743 - i2c_del_driver(&cs4270_i2c_driver); 776 + i2c_del_driver(&cs4270_i2c_driver); 744 777 #endif 745 778 746 779 kfree(socdev->codec);
+2 -2
sound/soc/codecs/wm8753.c
··· 583 583 584 584 /* out 4 */ 585 585 {"Out4 Mux", "VREF", "VREF"}, 586 - {"Out4 Mux", "Capture ST", "Capture ST Mixer"}, 586 + {"Out4 Mux", "Capture ST", "Playback Mixer"}, 587 587 {"Out4 Mux", "LOUT2", "LOUT2"}, 588 588 {"Out 4", NULL, "Out4 Mux"}, 589 589 {"OUT4", NULL, "Out 4"}, ··· 607 607 /* Capture Right Mux */ 608 608 {"Capture Right Mux", "PGA", "Right Capture Volume"}, 609 609 {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"}, 610 - {"Capture Right Mux", "Sidetone", "Capture ST Mixer"}, 610 + {"Capture Right Mux", "Sidetone", "Playback Mixer"}, 611 611 612 612 /* Mono Capture mixer-mux */ 613 613 {"Capture Right Mixer", "Stereo", "Capture Right Mux"},