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

Merge branch 'linus' into tracing/blktrace

Conflicts:
block/blktrace.c

Semantic merge:
kernel/trace/blktrace.c

Signed-off-by: Ingo Molnar <mingo@elte.hu>

+1999 -821
-1
CREDITS
··· 2166 2166 2167 2167 N: Pavel Machek 2168 2168 E: pavel@ucw.cz 2169 - E: pavel@suse.cz 2170 2169 D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd 2171 2170 D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, 2172 2171 D: work on suspend-to-ram/disk, killing duplicates from ioctl32
+1 -1
Documentation/ABI/testing/sysfs-firmware-memmap
··· 1 1 What: /sys/firmware/memmap/ 2 2 Date: June 2008 3 - Contact: Bernhard Walle <bwalle@suse.de> 3 + Contact: Bernhard Walle <bernhard.walle@gmx.de> 4 4 Description: 5 5 On all platforms, the firmware provides a memory map which the 6 6 kernel reads. The resources from that memory map are registered
+1 -1
Documentation/PCI/PCIEBUS-HOWTO.txt
··· 93 93 94 94 int pcie_port_service_register(struct pcie_port_service_driver *new) 95 95 96 - This API replaces the Linux Driver Model's pci_module_init API. A 96 + This API replaces the Linux Driver Model's pci_register_driver API. A 97 97 service driver should always calls pcie_port_service_register at 98 98 module init. Note that after service driver being loaded, calls 99 99 such as pci_enable_device(dev) and pci_set_master(dev) are no longer
+2 -4
Documentation/cgroups/cgroups.txt
··· 252 252 When a task is moved from one cgroup to another, it gets a new 253 253 css_set pointer - if there's an already existing css_set with the 254 254 desired collection of cgroups then that group is reused, else a new 255 - css_set is allocated. Note that the current implementation uses a 256 - linear search to locate an appropriate existing css_set, so isn't 257 - very efficient. A future version will use a hash table for better 258 - performance. 255 + css_set is allocated. The appropriate existing css_set is located by 256 + looking into a hash table. 259 257 260 258 To allow access from a cgroup to the css_sets (and hence tasks) 261 259 that comprise it, a set of cg_cgroup_link objects form a lattice;
+101
Documentation/hwmon/hpfall.c
··· 1 + /* Disk protection for HP machines. 2 + * 3 + * Copyright 2008 Eric Piel 4 + * Copyright 2009 Pavel Machek <pavel@suse.cz> 5 + * 6 + * GPLv2. 7 + */ 8 + 9 + #include <stdio.h> 10 + #include <stdlib.h> 11 + #include <unistd.h> 12 + #include <fcntl.h> 13 + #include <sys/stat.h> 14 + #include <sys/types.h> 15 + #include <string.h> 16 + #include <stdint.h> 17 + #include <errno.h> 18 + #include <signal.h> 19 + 20 + void write_int(char *path, int i) 21 + { 22 + char buf[1024]; 23 + int fd = open(path, O_RDWR); 24 + if (fd < 0) { 25 + perror("open"); 26 + exit(1); 27 + } 28 + sprintf(buf, "%d", i); 29 + if (write(fd, buf, strlen(buf)) != strlen(buf)) { 30 + perror("write"); 31 + exit(1); 32 + } 33 + close(fd); 34 + } 35 + 36 + void set_led(int on) 37 + { 38 + write_int("/sys/class/leds/hp::hddprotect/brightness", on); 39 + } 40 + 41 + void protect(int seconds) 42 + { 43 + write_int("/sys/block/sda/device/unload_heads", seconds*1000); 44 + } 45 + 46 + int on_ac(void) 47 + { 48 + // /sys/class/power_supply/AC0/online 49 + } 50 + 51 + int lid_open(void) 52 + { 53 + // /proc/acpi/button/lid/LID/state 54 + } 55 + 56 + void ignore_me(void) 57 + { 58 + protect(0); 59 + set_led(0); 60 + 61 + } 62 + 63 + int main(int argc, char* argv[]) 64 + { 65 + int fd, ret; 66 + 67 + fd = open("/dev/freefall", O_RDONLY); 68 + if (fd < 0) { 69 + perror("open"); 70 + return EXIT_FAILURE; 71 + } 72 + 73 + signal(SIGALRM, ignore_me); 74 + 75 + for (;;) { 76 + unsigned char count; 77 + 78 + ret = read(fd, &count, sizeof(count)); 79 + alarm(0); 80 + if ((ret == -1) && (errno == EINTR)) { 81 + /* Alarm expired, time to unpark the heads */ 82 + continue; 83 + } 84 + 85 + if (ret != sizeof(count)) { 86 + perror("read"); 87 + break; 88 + } 89 + 90 + protect(21); 91 + set_led(1); 92 + if (1 || on_ac() || lid_open()) { 93 + alarm(2); 94 + } else { 95 + alarm(20); 96 + } 97 + } 98 + 99 + close(fd); 100 + return EXIT_SUCCESS; 101 + }
+8
Documentation/hwmon/lis3lv02d
··· 33 33 This driver also provides an absolute input class device, allowing 34 34 the laptop to act as a pinball machine-esque joystick. 35 35 36 + Another feature of the driver is misc device called "freefall" that 37 + acts similar to /dev/rtc and reacts on free-fall interrupts received 38 + from the device. It supports blocking operations, poll/select and 39 + fasync operation modes. You must read 1 bytes from the device. The 40 + result is number of free-fall interrupts since the last successful 41 + read (or 255 if number of interrupts would not fit). 42 + 43 + 36 44 Axes orientation 37 45 ---------------- 38 46
+9 -9
MAINTAINERS
··· 1905 1905 S: Maintained 1906 1906 1907 1907 HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER 1908 - P: Robert Love 1909 - M: rlove@rlove.org 1910 - M: linux-kernel@vger.kernel.org 1911 - W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/ 1908 + P: Frank Seidel 1909 + M: frank@f-seidel.de 1910 + L: lm-sensors@lm-sensors.org 1911 + W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/ 1912 1912 S: Maintained 1913 1913 1914 1914 GSPCA FINEPIX SUBDRIVER ··· 2001 2001 2002 2002 HIBERNATION (aka Software Suspend, aka swsusp) 2003 2003 P: Pavel Machek 2004 - M: pavel@suse.cz 2004 + M: pavel@ucw.cz 2005 2005 P: Rafael J. Wysocki 2006 2006 M: rjw@sisk.pl 2007 2007 L: linux-pm@lists.linux-foundation.org ··· 4178 4178 P: Len Brown 4179 4179 M: len.brown@intel.com 4180 4180 P: Pavel Machek 4181 - M: pavel@suse.cz 4181 + M: pavel@ucw.cz 4182 4182 P: Rafael J. Wysocki 4183 4183 M: rjw@sisk.pl 4184 4184 L: linux-pm@lists.linux-foundation.org ··· 4930 4930 S: Maintained 4931 4931 4932 4932 ZR36067 VIDEO FOR LINUX DRIVER 4933 - P: Ronald Bultje 4934 - M: rbultje@ronald.bitfreak.net 4935 4933 L: mjpeg-users@lists.sourceforge.net 4934 + L: linux-media@vger.kernel.org 4936 4935 W: http://mjpeg.sourceforge.net/driver-zoran/ 4937 - S: Maintained 4936 + T: Mercurial http://linuxtv.org/hg/v4l-dvb 4937 + S: Odd Fixes 4938 4938 4939 4939 ZS DECSTATION Z85C30 SERIAL DRIVER 4940 4940 P: Maciej W. Rozycki
+1 -1
Makefile
··· 389 389 # output directory. 390 390 outputmakefile: 391 391 ifneq ($(KBUILD_SRC),) 392 + $(Q)ln -fsn $(srctree) source 392 393 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 393 394 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) 394 395 endif ··· 947 946 mkdir -p include2; \ 948 947 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ 949 948 fi 950 - ln -fsn $(srctree) source 951 949 endif 952 950 953 951 # prepare2 creates a makefile if using a separate output directory
+4 -4
arch/alpha/kernel/process.c
··· 93 93 if (cpuid != boot_cpuid) { 94 94 flags |= 0x00040000UL; /* "remain halted" */ 95 95 *pflags = flags; 96 - cpu_clear(cpuid, cpu_present_map); 97 - cpu_clear(cpuid, cpu_possible_map); 96 + set_cpu_present(cpuid, false); 97 + set_cpu_possible(cpuid, false); 98 98 halt(); 99 99 } 100 100 #endif ··· 120 120 121 121 #ifdef CONFIG_SMP 122 122 /* Wait for the secondaries to halt. */ 123 - cpu_clear(boot_cpuid, cpu_present_map); 124 - cpu_clear(boot_cpuid, cpu_possible_map); 123 + set_cpu_present(boot_cpuid, false); 124 + set_cpu_possible(boot_cpuid, false); 125 125 while (cpus_weight(cpu_present_map)) 126 126 barrier(); 127 127 #endif
+6 -6
arch/alpha/kernel/smp.c
··· 120 120 smp_callin(void) 121 121 { 122 122 int cpuid = hard_smp_processor_id(); 123 - cpumask_t mask = cpu_online_map; 124 123 125 - if (cpu_test_and_set(cpuid, mask)) { 124 + if (cpu_online(cpuid)) { 126 125 printk("??, cpu 0x%x already present??\n", cpuid); 127 126 BUG(); 128 127 } 128 + set_cpu_online(cpuid, true); 129 129 130 130 /* Turn on machine checks. */ 131 131 wrmces(7); ··· 436 436 ((char *)cpubase + i*hwrpb->processor_size); 437 437 if ((cpu->flags & 0x1cc) == 0x1cc) { 438 438 smp_num_probed++; 439 - cpu_set(i, cpu_possible_map); 440 - cpu_set(i, cpu_present_map); 439 + set_cpu_possible(i, true); 440 + set_cpu_present(i, true); 441 441 cpu->pal_revision = boot_cpu_palrev; 442 442 } 443 443 ··· 470 470 471 471 /* Nothing to do on a UP box, or when told not to. */ 472 472 if (smp_num_probed == 1 || max_cpus == 0) { 473 - cpu_possible_map = cpumask_of_cpu(boot_cpuid); 474 - cpu_present_map = cpumask_of_cpu(boot_cpuid); 473 + init_cpu_possible(cpumask_of(boot_cpuid)); 474 + init_cpu_present(cpumask_of(boot_cpuid)); 475 475 printk(KERN_INFO "SMP mode deactivated.\n"); 476 476 return; 477 477 }
+4
arch/ia64/include/asm/kvm.h
··· 25 25 26 26 #include <linux/ioctl.h> 27 27 28 + /* Select x86 specific features in <linux/kvm.h> */ 29 + #define __KVM_HAVE_IOAPIC 30 + #define __KVM_HAVE_DEVICE_ASSIGNMENT 31 + 28 32 /* Architectural interrupt line count. */ 29 33 #define KVM_NR_INTERRUPTS 256 30 34
-4
arch/ia64/include/asm/mmzone.h
··· 31 31 #endif 32 32 } 33 33 34 - #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 35 - extern int early_pfn_to_nid(unsigned long pfn); 36 - #endif 37 - 38 34 #ifdef CONFIG_IA64_DIG /* DIG systems are small */ 39 35 # define MAX_PHYSNODE_ID 8 40 36 # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
+4
arch/ia64/kvm/kvm-ia64.c
··· 1337 1337 } 1338 1338 } 1339 1339 1340 + void kvm_arch_sync_events(struct kvm *kvm) 1341 + { 1342 + } 1343 + 1340 1344 void kvm_arch_destroy_vm(struct kvm *kvm) 1341 1345 { 1342 1346 kvm_iommu_unmap_guest(kvm);
+9 -8
arch/ia64/kvm/process.c
··· 455 455 if (!vmm_fpswa_interface) 456 456 return (fpswa_ret_t) {-1, 0, 0, 0}; 457 457 458 - /* 459 - * Just let fpswa driver to use hardware fp registers. 460 - * No fp register is valid in memory. 461 - */ 462 458 memset(&fp_state, 0, sizeof(fp_state_t)); 463 459 464 460 /* 461 + * compute fp_state. only FP registers f6 - f11 are used by the 462 + * vmm, so set those bits in the mask and set the low volatile 463 + * pointer to point to these registers. 464 + */ 465 + fp_state.bitmask_low64 = 0xfc0; /* bit6..bit11 */ 466 + 467 + fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) &regs->f6; 468 + 469 + /* 465 470 * unsigned long (*EFI_FPSWA) ( 466 471 * unsigned long trap_type, 467 472 * void *Bundle, ··· 550 545 status = vmm_handle_fpu_swa(0, regs, isr); 551 546 if (!status) 552 547 return ; 553 - else if (-EAGAIN == status) { 554 - vcpu_decrement_iip(vcpu); 555 - return ; 556 - } 557 548 break; 558 549 } 559 550
+2 -2
arch/ia64/mm/numa.c
··· 58 58 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where 59 59 * the section resides. 60 60 */ 61 - int early_pfn_to_nid(unsigned long pfn) 61 + int __meminit __early_pfn_to_nid(unsigned long pfn) 62 62 { 63 63 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; 64 64 ··· 70 70 return node_memblk[i].nid; 71 71 } 72 72 73 - return 0; 73 + return -1; 74 74 } 75 75 76 76 #ifdef CONFIG_MEMORY_HOTPLUG
+1 -1
arch/powerpc/include/asm/pgtable-4k.h
··· 60 60 /* It should be preserving the high 48 bits and then specifically */ 61 61 /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ 62 62 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ 63 - _PAGE_HPTEFLAGS) 63 + _PAGE_HPTEFLAGS | _PAGE_SPECIAL) 64 64 65 65 /* Bits to mask out from a PMD to get to the PTE page */ 66 66 #define PMD_MASKED_BITS 0
+1 -1
arch/powerpc/include/asm/pgtable-64k.h
··· 114 114 * pgprot changes 115 115 */ 116 116 #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ 117 - _PAGE_ACCESSED) 117 + _PAGE_ACCESSED | _PAGE_SPECIAL) 118 118 119 119 /* Bits to mask out from a PMD to get to the PTE page */ 120 120 #define PMD_MASKED_BITS 0x1ff
+2 -1
arch/powerpc/include/asm/pgtable-ppc32.h
··· 429 429 #define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() 430 430 #endif 431 431 432 - #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 432 + #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ 433 + _PAGE_SPECIAL) 433 434 434 435 435 436 #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
+6 -1
arch/powerpc/kernel/align.c
··· 646 646 unsigned int areg, struct pt_regs *regs, 647 647 unsigned int flags, unsigned int length) 648 648 { 649 - char *ptr = (char *) &current->thread.TS_FPR(reg); 649 + char *ptr; 650 650 int ret = 0; 651 651 652 652 flush_vsx_to_thread(current); 653 + 654 + if (reg < 32) 655 + ptr = (char *) &current->thread.TS_FPR(reg); 656 + else 657 + ptr = (char *) &current->thread.vr[reg - 32]; 653 658 654 659 if (flags & ST) 655 660 ret = __copy_to_user(addr, ptr, length);
+4
arch/powerpc/kvm/powerpc.c
··· 125 125 } 126 126 } 127 127 128 + void kvm_arch_sync_events(struct kvm *kvm) 129 + { 130 + } 131 + 128 132 void kvm_arch_destroy_vm(struct kvm *kvm) 129 133 { 130 134 kvmppc_free_vcpus(kvm);
+3 -2
arch/powerpc/mm/numa.c
··· 19 19 #include <linux/notifier.h> 20 20 #include <linux/lmb.h> 21 21 #include <linux/of.h> 22 + #include <linux/pfn.h> 22 23 #include <asm/sparsemem.h> 23 24 #include <asm/prom.h> 24 25 #include <asm/system.h> ··· 883 882 unsigned long physbase = lmb.reserved.region[i].base; 884 883 unsigned long size = lmb.reserved.region[i].size; 885 884 unsigned long start_pfn = physbase >> PAGE_SHIFT; 886 - unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); 885 + unsigned long end_pfn = PFN_UP(physbase + size); 887 886 struct node_active_region node_ar; 888 887 unsigned long node_end_pfn = node->node_start_pfn + 889 888 node->node_spanned_pages; ··· 909 908 */ 910 909 if (end_pfn > node_ar.end_pfn) 911 910 reserve_size = (node_ar.end_pfn << PAGE_SHIFT) 912 - - (start_pfn << PAGE_SHIFT); 911 + - physbase; 913 912 /* 914 913 * Only worry about *this* node, others may not 915 914 * yet have valid NODE_DATA().
+1 -1
arch/powerpc/platforms/ps3/mm.c
··· 328 328 return result; 329 329 } 330 330 331 - core_initcall(ps3_mm_add_memory); 331 + device_initcall(ps3_mm_add_memory); 332 332 333 333 /*============================================================================*/ 334 334 /* dma routines */
+4
arch/s390/kvm/kvm-s390.c
··· 212 212 } 213 213 } 214 214 215 + void kvm_arch_sync_events(struct kvm *kvm) 216 + { 217 + } 218 + 215 219 void kvm_arch_destroy_vm(struct kvm *kvm) 216 220 { 217 221 kvm_free_vcpus(kvm);
+7
arch/x86/include/asm/kvm.h
··· 9 9 #include <linux/types.h> 10 10 #include <linux/ioctl.h> 11 11 12 + /* Select x86 specific features in <linux/kvm.h> */ 13 + #define __KVM_HAVE_PIT 14 + #define __KVM_HAVE_IOAPIC 15 + #define __KVM_HAVE_DEVICE_ASSIGNMENT 16 + #define __KVM_HAVE_MSI 17 + #define __KVM_HAVE_USER_NMI 18 + 12 19 /* Architectural interrupt line count. */ 13 20 #define KVM_NR_INTERRUPTS 256 14 21
-2
arch/x86/include/asm/mmzone_32.h
··· 32 32 get_memcfg_numa_flat(); 33 33 } 34 34 35 - extern int early_pfn_to_nid(unsigned long pfn); 36 - 37 35 extern void resume_map_numa_kva(pgd_t *pgd); 38 36 39 37 #else /* !CONFIG_NUMA */
-2
arch/x86/include/asm/mmzone_64.h
··· 40 40 #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ 41 41 NODE_DATA(nid)->node_spanned_pages) 42 42 43 - extern int early_pfn_to_nid(unsigned long pfn); 44 - 45 43 #ifdef CONFIG_NUMA_EMU 46 44 #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) 47 45 #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
-1
arch/x86/include/asm/page.h
··· 57 57 typedef struct { pgprotval_t pgprot; } pgprot_t; 58 58 59 59 extern int page_is_ram(unsigned long pagenr); 60 - extern int pagerange_is_ram(unsigned long start, unsigned long end); 61 60 extern int devmem_is_allowed(unsigned long pagenr); 62 61 extern void map_devmem(unsigned long pfn, unsigned long size, 63 62 pgprot_t vma_prot);
+2 -15
arch/x86/include/asm/paravirt.h
··· 1352 1352 PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave); 1353 1353 } 1354 1354 1355 - static inline void arch_flush_lazy_cpu_mode(void) 1356 - { 1357 - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) { 1358 - arch_leave_lazy_cpu_mode(); 1359 - arch_enter_lazy_cpu_mode(); 1360 - } 1361 - } 1362 - 1355 + void arch_flush_lazy_cpu_mode(void); 1363 1356 1364 1357 #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 1365 1358 static inline void arch_enter_lazy_mmu_mode(void) ··· 1365 1372 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); 1366 1373 } 1367 1374 1368 - static inline void arch_flush_lazy_mmu_mode(void) 1369 - { 1370 - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) { 1371 - arch_leave_lazy_mmu_mode(); 1372 - arch_enter_lazy_mmu_mode(); 1373 - } 1374 - } 1375 + void arch_flush_lazy_mmu_mode(void); 1375 1376 1376 1377 static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, 1377 1378 unsigned long phys, pgprot_t flags)
+7 -5
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
··· 1157 1157 data->cpu = pol->cpu; 1158 1158 data->currpstate = HW_PSTATE_INVALID; 1159 1159 1160 - rc = powernow_k8_cpu_init_acpi(data); 1161 - if (rc) { 1160 + if (powernow_k8_cpu_init_acpi(data)) { 1162 1161 /* 1163 1162 * Use the PSB BIOS structure. This is only availabe on 1164 1163 * an UP version, and is deprecated by AMD. ··· 1175 1176 "ACPI maintainers and complain to your BIOS " 1176 1177 "vendor.\n"); 1177 1178 #endif 1178 - goto err_out; 1179 + kfree(data); 1180 + return -ENODEV; 1179 1181 } 1180 1182 if (pol->cpu != 0) { 1181 1183 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " 1182 1184 "CPU other than CPU0. Complain to your BIOS " 1183 1185 "vendor.\n"); 1184 - goto err_out; 1186 + kfree(data); 1187 + return -ENODEV; 1185 1188 } 1186 1189 rc = find_psb_table(data); 1187 1190 if (rc) { 1188 - goto err_out; 1191 + kfree(data); 1192 + return -ENODEV; 1189 1193 } 1190 1194 /* Take a crude guess here. 1191 1195 * That guess was in microseconds, so multiply with 1000 */
+2
arch/x86/kernel/hpet.c
··· 269 269 now = hpet_readl(HPET_COUNTER); 270 270 cmp = now + (unsigned long) delta; 271 271 cfg = hpet_readl(HPET_Tn_CFG(timer)); 272 + /* Make sure we use edge triggered interrupts */ 273 + cfg &= ~HPET_TN_LEVEL; 272 274 cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC | 273 275 HPET_TN_SETVAL | HPET_TN_32BIT; 274 276 hpet_writel(cfg, HPET_Tn_CFG(timer));
+1 -1
arch/x86/kernel/olpc.c
··· 203 203 static void __init platform_detect(void) 204 204 { 205 205 /* stopgap until OFW support is added to the kernel */ 206 - olpc_platform_info.boardrev = 0xc2; 206 + olpc_platform_info.boardrev = olpc_board(0xc2); 207 207 } 208 208 #endif 209 209
+26
arch/x86/kernel/paravirt.c
··· 268 268 return __get_cpu_var(paravirt_lazy_mode); 269 269 } 270 270 271 + void arch_flush_lazy_mmu_mode(void) 272 + { 273 + preempt_disable(); 274 + 275 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { 276 + WARN_ON(preempt_count() == 1); 277 + arch_leave_lazy_mmu_mode(); 278 + arch_enter_lazy_mmu_mode(); 279 + } 280 + 281 + preempt_enable(); 282 + } 283 + 284 + void arch_flush_lazy_cpu_mode(void) 285 + { 286 + preempt_disable(); 287 + 288 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) { 289 + WARN_ON(preempt_count() == 1); 290 + arch_leave_lazy_cpu_mode(); 291 + arch_enter_lazy_cpu_mode(); 292 + } 293 + 294 + preempt_enable(); 295 + } 296 + 271 297 struct pv_info pv_info = { 272 298 .name = "bare hardware", 273 299 .paravirt_enabled = 0,
+10 -6
arch/x86/kernel/ptrace.c
··· 810 810 811 811 static void ptrace_bts_detach(struct task_struct *child) 812 812 { 813 - if (unlikely(child->bts)) { 814 - ds_release_bts(child->bts); 815 - child->bts = NULL; 816 - 817 - ptrace_bts_free_buffer(child); 818 - } 813 + /* 814 + * Ptrace_detach() races with ptrace_untrace() in case 815 + * the child dies and is reaped by another thread. 816 + * 817 + * We only do the memory accounting at this point and 818 + * leave the buffer deallocation and the bts tracer 819 + * release to ptrace_bts_untrace() which will be called 820 + * later on with tasklist_lock held. 821 + */ 822 + release_locked_buffer(child->bts_buffer, child->bts_size); 819 823 } 820 824 #else 821 825 static inline void ptrace_bts_fork(struct task_struct *tsk) {}
+9 -1
arch/x86/kernel/traps.c
··· 99 99 local_irq_enable(); 100 100 } 101 101 102 + static inline void conditional_cli(struct pt_regs *regs) 103 + { 104 + if (regs->flags & X86_EFLAGS_IF) 105 + local_irq_disable(); 106 + } 107 + 102 108 static inline void preempt_conditional_cli(struct pt_regs *regs) 103 109 { 104 110 if (regs->flags & X86_EFLAGS_IF) ··· 632 626 633 627 #ifdef CONFIG_X86_32 634 628 debug_vm86: 629 + /* reenable preemption: handle_vm86_trap() might sleep */ 630 + dec_preempt_count(); 635 631 handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); 636 - preempt_conditional_cli(regs); 632 + conditional_cli(regs); 637 633 return; 638 634 #endif 639 635
+1 -1
arch/x86/kvm/i8254.c
··· 207 207 hrtimer_add_expires_ns(&pt->timer, pt->period); 208 208 pt->scheduled = hrtimer_get_expires_ns(&pt->timer); 209 209 if (pt->period) 210 - ps->channels[0].count_load_time = hrtimer_get_expires(&pt->timer); 210 + ps->channels[0].count_load_time = ktime_get(); 211 211 212 212 return (pt->period == 0 ? 0 : 1); 213 213 }
-7
arch/x86/kvm/irq.c
··· 87 87 } 88 88 EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); 89 89 90 - void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec) 91 - { 92 - kvm_apic_timer_intr_post(vcpu, vec); 93 - /* TODO: PIT, RTC etc. */ 94 - } 95 - EXPORT_SYMBOL_GPL(kvm_timer_intr_post); 96 - 97 90 void __kvm_migrate_timers(struct kvm_vcpu *vcpu) 98 91 { 99 92 __kvm_migrate_apic_timer(vcpu);
-1
arch/x86/kvm/irq.h
··· 89 89 90 90 void kvm_pic_reset(struct kvm_kpic_state *s); 91 91 92 - void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec); 93 92 void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 94 93 void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); 95 94 void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu);
+14 -50
arch/x86/kvm/lapic.c
··· 35 35 #include "kvm_cache_regs.h" 36 36 #include "irq.h" 37 37 38 + #ifndef CONFIG_X86_64 39 + #define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) 40 + #else 41 + #define mod_64(x, y) ((x) % (y)) 42 + #endif 43 + 38 44 #define PRId64 "d" 39 45 #define PRIx64 "llx" 40 46 #define PRIu64 "u" ··· 517 511 518 512 static u32 apic_get_tmcct(struct kvm_lapic *apic) 519 513 { 520 - u64 counter_passed; 521 - ktime_t passed, now; 514 + ktime_t remaining; 515 + s64 ns; 522 516 u32 tmcct; 523 517 524 518 ASSERT(apic != NULL); 525 519 526 - now = apic->timer.dev.base->get_time(); 527 - tmcct = apic_get_reg(apic, APIC_TMICT); 528 - 529 520 /* if initial count is 0, current count should also be 0 */ 530 - if (tmcct == 0) 521 + if (apic_get_reg(apic, APIC_TMICT) == 0) 531 522 return 0; 532 523 533 - if (unlikely(ktime_to_ns(now) <= 534 - ktime_to_ns(apic->timer.last_update))) { 535 - /* Wrap around */ 536 - passed = ktime_add(( { 537 - (ktime_t) { 538 - .tv64 = KTIME_MAX - 539 - (apic->timer.last_update).tv64}; } 540 - ), now); 541 - apic_debug("time elapsed\n"); 542 - } else 543 - passed = ktime_sub(now, apic->timer.last_update); 524 + remaining = hrtimer_expires_remaining(&apic->timer.dev); 525 + if (ktime_to_ns(remaining) < 0) 526 + remaining = ktime_set(0, 0); 544 527 545 - counter_passed = div64_u64(ktime_to_ns(passed), 546 - (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); 547 - 548 - if (counter_passed > tmcct) { 549 - if (unlikely(!apic_lvtt_period(apic))) { 550 - /* one-shot timers stick at 0 until reset */ 551 - tmcct = 0; 552 - } else { 553 - /* 554 - * periodic timers reset to APIC_TMICT when they 555 - * hit 0. The while loop simulates this happening N 556 - * times. (counter_passed %= tmcct) would also work, 557 - * but might be slower or not work on 32-bit?? 558 - */ 559 - while (counter_passed > tmcct) 560 - counter_passed -= tmcct; 561 - tmcct -= counter_passed; 562 - } 563 - } else { 564 - tmcct -= counter_passed; 565 - } 528 + ns = mod_64(ktime_to_ns(remaining), apic->timer.period); 529 + tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); 566 530 567 531 return tmcct; 568 532 } ··· 628 652 static void start_apic_timer(struct kvm_lapic *apic) 629 653 { 630 654 ktime_t now = apic->timer.dev.base->get_time(); 631 - 632 - apic->timer.last_update = now; 633 655 634 656 apic->timer.period = apic_get_reg(apic, APIC_TMICT) * 635 657 APIC_BUS_CYCLE_NS * apic->timer.divide_count; ··· 1082 1108 if (kvm_apic_local_deliver(apic, APIC_LVTT)) 1083 1109 atomic_dec(&apic->timer.pending); 1084 1110 } 1085 - } 1086 - 1087 - void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec) 1088 - { 1089 - struct kvm_lapic *apic = vcpu->arch.apic; 1090 - 1091 - if (apic && apic_lvt_vector(apic, APIC_LVTT) == vec) 1092 - apic->timer.last_update = ktime_add_ns( 1093 - apic->timer.last_update, 1094 - apic->timer.period); 1095 1111 } 1096 1112 1097 1113 int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
-2
arch/x86/kvm/lapic.h
··· 12 12 atomic_t pending; 13 13 s64 period; /* unit: ns */ 14 14 u32 divide_count; 15 - ktime_t last_update; 16 15 struct hrtimer dev; 17 16 } timer; 18 17 struct kvm_vcpu *vcpu; ··· 41 42 void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); 42 43 int kvm_lapic_enabled(struct kvm_vcpu *vcpu); 43 44 int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); 44 - void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec); 45 45 46 46 void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); 47 47 void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu);
+7 -2
arch/x86/kvm/mmu.c
··· 1698 1698 if (largepage) 1699 1699 spte |= PT_PAGE_SIZE_MASK; 1700 1700 if (mt_mask) { 1701 - mt_mask = get_memory_type(vcpu, gfn) << 1702 - kvm_x86_ops->get_mt_mask_shift(); 1701 + if (!kvm_is_mmio_pfn(pfn)) { 1702 + mt_mask = get_memory_type(vcpu, gfn) << 1703 + kvm_x86_ops->get_mt_mask_shift(); 1704 + mt_mask |= VMX_EPT_IGMT_BIT; 1705 + } else 1706 + mt_mask = MTRR_TYPE_UNCACHABLE << 1707 + kvm_x86_ops->get_mt_mask_shift(); 1703 1708 spte |= mt_mask; 1704 1709 } 1705 1710
-1
arch/x86/kvm/svm.c
··· 1600 1600 /* Okay, we can deliver the interrupt: grab it and update PIC state. */ 1601 1601 intr_vector = kvm_cpu_get_interrupt(vcpu); 1602 1602 svm_inject_irq(svm, intr_vector); 1603 - kvm_timer_intr_post(vcpu, intr_vector); 1604 1603 out: 1605 1604 update_cr8_intercept(vcpu); 1606 1605 }
+2 -3
arch/x86/kvm/vmx.c
··· 903 903 data = vmcs_readl(GUEST_SYSENTER_ESP); 904 904 break; 905 905 default: 906 + vmx_load_host_state(to_vmx(vcpu)); 906 907 msr = find_msr_entry(to_vmx(vcpu), msr_index); 907 908 if (msr) { 908 909 data = msr->data; ··· 3286 3285 } 3287 3286 if (vcpu->arch.interrupt.pending) { 3288 3287 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); 3289 - kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr); 3290 3288 if (kvm_cpu_has_interrupt(vcpu)) 3291 3289 enable_irq_window(vcpu); 3292 3290 } ··· 3687 3687 if (vm_need_ept()) { 3688 3688 bypass_guest_pf = 0; 3689 3689 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | 3690 - VMX_EPT_WRITABLE_MASK | 3691 - VMX_EPT_IGMT_BIT); 3690 + VMX_EPT_WRITABLE_MASK); 3692 3691 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, 3693 3692 VMX_EPT_EXECUTABLE_MASK, 3694 3693 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
+8 -2
arch/x86/kvm/x86.c
··· 967 967 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: 968 968 case KVM_CAP_SET_TSS_ADDR: 969 969 case KVM_CAP_EXT_CPUID: 970 - case KVM_CAP_CLOCKSOURCE: 971 970 case KVM_CAP_PIT: 972 971 case KVM_CAP_NOP_IO_DELAY: 973 972 case KVM_CAP_MP_STATE: ··· 990 991 break; 991 992 case KVM_CAP_IOMMU: 992 993 r = iommu_found(); 994 + break; 995 + case KVM_CAP_CLOCKSOURCE: 996 + r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC); 993 997 break; 994 998 default: 995 999 r = 0; ··· 4129 4127 4130 4128 } 4131 4129 4132 - void kvm_arch_destroy_vm(struct kvm *kvm) 4130 + void kvm_arch_sync_events(struct kvm *kvm) 4133 4131 { 4134 4132 kvm_free_all_assigned_devices(kvm); 4133 + } 4134 + 4135 + void kvm_arch_destroy_vm(struct kvm *kvm) 4136 + { 4135 4137 kvm_iommu_unmap_guest(kvm); 4136 4138 kvm_free_pit(kvm); 4137 4139 kfree(kvm->arch.vpic);
-19
arch/x86/mm/ioremap.c
··· 134 134 return 0; 135 135 } 136 136 137 - int pagerange_is_ram(unsigned long start, unsigned long end) 138 - { 139 - int ram_page = 0, not_rampage = 0; 140 - unsigned long page_nr; 141 - 142 - for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT); 143 - ++page_nr) { 144 - if (page_is_ram(page_nr)) 145 - ram_page = 1; 146 - else 147 - not_rampage = 1; 148 - 149 - if (ram_page == not_rampage) 150 - return -1; 151 - } 152 - 153 - return ram_page; 154 - } 155 - 156 137 /* 157 138 * Fix up the linear direct mapping of the kernel to avoid cache attribute 158 139 * conflicts.
+1 -1
arch/x86/mm/numa_64.c
··· 145 145 return shift; 146 146 } 147 147 148 - int early_pfn_to_nid(unsigned long pfn) 148 + int __meminit __early_pfn_to_nid(unsigned long pfn) 149 149 { 150 150 return phys_to_nid(pfn << PAGE_SHIFT); 151 151 }
+14 -1
arch/x86/mm/pageattr.c
··· 575 575 address = cpa->vaddr[cpa->curpage]; 576 576 else 577 577 address = *cpa->vaddr; 578 - 579 578 repeat: 580 579 kpte = lookup_address(address, &level); 581 580 if (!kpte) ··· 811 812 812 813 vm_unmap_aliases(); 813 814 815 + /* 816 + * If we're called with lazy mmu updates enabled, the 817 + * in-memory pte state may be stale. Flush pending updates to 818 + * bring them up to date. 819 + */ 820 + arch_flush_lazy_mmu_mode(); 821 + 814 822 cpa.vaddr = addr; 815 823 cpa.numpages = numpages; 816 824 cpa.mask_set = mask_set; ··· 859 853 cpa_flush_range(*addr, numpages, cache); 860 854 } else 861 855 cpa_flush_all(cache); 856 + 857 + /* 858 + * If we've been called with lazy mmu updates enabled, then 859 + * make sure that everything gets flushed out before we 860 + * return. 861 + */ 862 + arch_flush_lazy_mmu_mode(); 862 863 863 864 out: 864 865 return ret;
+45 -38
arch/x86/mm/pat.c
··· 211 211 static struct memtype *cached_entry; 212 212 static u64 cached_start; 213 213 214 + static int pat_pagerange_is_ram(unsigned long start, unsigned long end) 215 + { 216 + int ram_page = 0, not_rampage = 0; 217 + unsigned long page_nr; 218 + 219 + for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT); 220 + ++page_nr) { 221 + /* 222 + * For legacy reasons, physical address range in the legacy ISA 223 + * region is tracked as non-RAM. This will allow users of 224 + * /dev/mem to map portions of legacy ISA region, even when 225 + * some of those portions are listed(or not even listed) with 226 + * different e820 types(RAM/reserved/..) 227 + */ 228 + if (page_nr >= (ISA_END_ADDRESS >> PAGE_SHIFT) && 229 + page_is_ram(page_nr)) 230 + ram_page = 1; 231 + else 232 + not_rampage = 1; 233 + 234 + if (ram_page == not_rampage) 235 + return -1; 236 + } 237 + 238 + return ram_page; 239 + } 240 + 214 241 /* 215 242 * For RAM pages, mark the pages as non WB memory type using 216 243 * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or ··· 363 336 if (new_type) 364 337 *new_type = actual_type; 365 338 366 - /* 367 - * For legacy reasons, some parts of the physical address range in the 368 - * legacy 1MB region is treated as non-RAM (even when listed as RAM in 369 - * the e820 tables). So we will track the memory attributes of this 370 - * legacy 1MB region using the linear memtype_list always. 371 - */ 372 - if (end >= ISA_END_ADDRESS) { 373 - is_range_ram = pagerange_is_ram(start, end); 374 - if (is_range_ram == 1) 375 - return reserve_ram_pages_type(start, end, req_type, 376 - new_type); 377 - else if (is_range_ram < 0) 378 - return -EINVAL; 379 - } 339 + is_range_ram = pat_pagerange_is_ram(start, end); 340 + if (is_range_ram == 1) 341 + return reserve_ram_pages_type(start, end, req_type, 342 + new_type); 343 + else if (is_range_ram < 0) 344 + return -EINVAL; 380 345 381 346 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 382 347 if (!new) ··· 465 446 if (is_ISA_range(start, end - 1)) 466 447 return 0; 467 448 468 - /* 469 - * For legacy reasons, some parts of the physical address range in the 470 - * legacy 1MB region is treated as non-RAM (even when listed as RAM in 471 - * the e820 tables). So we will track the memory attributes of this 472 - * legacy 1MB region using the linear memtype_list always. 473 - */ 474 - if (end >= ISA_END_ADDRESS) { 475 - is_range_ram = pagerange_is_ram(start, end); 476 - if (is_range_ram == 1) 477 - return free_ram_pages_type(start, end); 478 - else if (is_range_ram < 0) 479 - return -EINVAL; 480 - } 449 + is_range_ram = pat_pagerange_is_ram(start, end); 450 + if (is_range_ram == 1) 451 + return free_ram_pages_type(start, end); 452 + else if (is_range_ram < 0) 453 + return -EINVAL; 481 454 482 455 spin_lock(&memtype_lock); 483 456 list_for_each_entry(entry, &memtype_list, nd) { ··· 637 626 unsigned long flags; 638 627 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); 639 628 640 - is_ram = pagerange_is_ram(paddr, paddr + size); 629 + is_ram = pat_pagerange_is_ram(paddr, paddr + size); 641 630 642 - if (is_ram != 0) { 643 - /* 644 - * For mapping RAM pages, drivers need to call 645 - * set_memory_[uc|wc|wb] directly, for reserve and free, before 646 - * setting up the PTE. 647 - */ 648 - WARN_ON_ONCE(1); 649 - return 0; 650 - } 631 + /* 632 + * reserve_pfn_range() doesn't support RAM pages. 633 + */ 634 + if (is_ram != 0) 635 + return -EINVAL; 651 636 652 637 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags); 653 638 if (ret) ··· 700 693 { 701 694 int is_ram; 702 695 703 - is_ram = pagerange_is_ram(paddr, paddr + size); 696 + is_ram = pat_pagerange_is_ram(paddr, paddr + size); 704 697 if (is_ram == 0) 705 698 free_memtype(paddr, paddr + size); 706 699 }
+8 -1
block/blk-timeout.c
··· 209 209 { 210 210 unsigned long flags; 211 211 struct request *rq, *tmp; 212 + LIST_HEAD(list); 212 213 213 214 spin_lock_irqsave(q->queue_lock, flags); 214 215 215 216 elv_abort_queue(q); 216 217 217 - list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) 218 + /* 219 + * Splice entries to local list, to avoid deadlocking if entries 220 + * get readded to the timeout list by error handling 221 + */ 222 + list_splice_init(&q->timeout_list, &list); 223 + 224 + list_for_each_entry_safe(rq, tmp, &list, timeout_list) 218 225 blk_abort_request(rq); 219 226 220 227 spin_unlock_irqrestore(q->queue_lock, flags);
+10 -7
block/bsg.c
··· 244 244 * map sg_io_v4 to a request. 245 245 */ 246 246 static struct request * 247 - bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) 247 + bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, 248 + u8 *sense) 248 249 { 249 250 struct request_queue *q = bd->queue; 250 251 struct request *rq, *next_rq = NULL; ··· 307 306 if (ret) 308 307 goto out; 309 308 } 309 + 310 + rq->sense = sense; 311 + rq->sense_len = 0; 312 + 310 313 return rq; 311 314 out: 312 315 if (rq->cmd != rq->__cmd) ··· 353 348 static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, 354 349 struct bsg_command *bc, struct request *rq) 355 350 { 356 - rq->sense = bc->sense; 357 - rq->sense_len = 0; 358 - 359 351 /* 360 352 * add bc command to busy queue and submit rq for io 361 353 */ ··· 421 419 { 422 420 int ret = 0; 423 421 424 - dprintk("rq %p bio %p %u\n", rq, bio, rq->errors); 422 + dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors); 425 423 /* 426 424 * fill in all the output members 427 425 */ ··· 637 635 /* 638 636 * get a request, fill in the blanks, and add to request queue 639 637 */ 640 - rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm); 638 + rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense); 641 639 if (IS_ERR(rq)) { 642 640 ret = PTR_ERR(rq); 643 641 rq = NULL; ··· 924 922 struct request *rq; 925 923 struct bio *bio, *bidi_bio = NULL; 926 924 struct sg_io_v4 hdr; 925 + u8 sense[SCSI_SENSE_BUFFERSIZE]; 927 926 928 927 if (copy_from_user(&hdr, uarg, sizeof(hdr))) 929 928 return -EFAULT; 930 929 931 - rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE); 930 + rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense); 932 931 if (IS_ERR(rq)) 933 932 return PTR_ERR(rq); 934 933
+8
block/genhd.c
··· 1087 1087 if (strcmp(dev_name(dev), name)) 1088 1088 continue; 1089 1089 1090 + if (partno < disk->minors) { 1091 + /* We need to return the right devno, even 1092 + * if the partition doesn't exist yet. 1093 + */ 1094 + devt = MKDEV(MAJOR(dev->devt), 1095 + MINOR(dev->devt) + partno); 1096 + break; 1097 + } 1090 1098 part = disk_get_part(disk, partno); 1091 1099 if (part) { 1092 1100 devt = part_devt(part);
+7 -1
crypto/lrw.c
··· 45 45 46 46 static inline void setbit128_bbe(void *b, int bit) 47 47 { 48 - __set_bit(bit ^ 0x78, b); 48 + __set_bit(bit ^ (0x80 - 49 + #ifdef __BIG_ENDIAN 50 + BITS_PER_LONG 51 + #else 52 + BITS_PER_BYTE 53 + #endif 54 + ), b); 49 55 } 50 56 51 57 static int setkey(struct crypto_tfm *parent, const u8 *key,
+21 -7
drivers/ata/libata-sff.c
··· 773 773 else 774 774 iowrite32_rep(data_addr, buf, words); 775 775 776 + /* Transfer trailing bytes, if any */ 776 777 if (unlikely(slop)) { 777 - __le32 pad; 778 + unsigned char pad[4]; 779 + 780 + /* Point buf to the tail of buffer */ 781 + buf += buflen - slop; 782 + 783 + /* 784 + * Use io*_rep() accessors here as well to avoid pointlessly 785 + * swapping bytes to and fro on the big endian machines... 786 + */ 778 787 if (rw == READ) { 779 - pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); 780 - memcpy(buf + buflen - slop, &pad, slop); 788 + if (slop < 3) 789 + ioread16_rep(data_addr, pad, 1); 790 + else 791 + ioread32_rep(data_addr, pad, 1); 792 + memcpy(buf, pad, slop); 781 793 } else { 782 - memcpy(&pad, buf + buflen - slop, slop); 783 - iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); 794 + memcpy(pad, buf, slop); 795 + if (slop < 3) 796 + iowrite16_rep(data_addr, pad, 1); 797 + else 798 + iowrite32_rep(data_addr, pad, 1); 784 799 } 785 - words++; 786 800 } 787 - return words << 2; 801 + return (buflen + 1) & ~1; 788 802 } 789 803 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); 790 804
+3 -1
drivers/ata/pata_via.c
··· 110 110 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 111 111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 112 112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 113 - { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES}, 113 + { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 114 + { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 114 115 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 115 116 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 116 117 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, ··· 594 593 #endif 595 594 596 595 static const struct pci_device_id via[] = { 596 + { PCI_VDEVICE(VIA, 0x0415), }, 597 597 { PCI_VDEVICE(VIA, 0x0571), }, 598 598 { PCI_VDEVICE(VIA, 0x0581), }, 599 599 { PCI_VDEVICE(VIA, 0x1571), },
+8 -6
drivers/ata/sata_nv.c
··· 421 421 .hardreset = ATA_OP_NULL, 422 422 }; 423 423 424 - /* OSDL bz3352 reports that nf2/3 controllers can't determine device 425 - * signature reliably. Also, the following thread reports detection 426 - * failure on cold boot with the standard debouncing timing. 424 + /* nf2 is ripe with hardreset related problems. 425 + * 426 + * kernel bz#3352 reports nf2/3 controllers can't determine device 427 + * signature reliably. The following thread reports detection failure 428 + * on cold boot with the standard debouncing timing. 427 429 * 428 430 * http://thread.gmane.org/gmane.linux.ide/34098 429 431 * 430 - * Debounce with hotplug timing and request follow-up SRST. 432 + * And bz#12176 reports that hardreset simply doesn't work on nf2. 433 + * Give up on it and just don't do hardreset. 431 434 */ 432 435 static struct ata_port_operations nv_nf2_ops = { 433 - .inherits = &nv_common_ops, 436 + .inherits = &nv_generic_ops, 434 437 .freeze = nv_nf2_freeze, 435 438 .thaw = nv_nf2_thaw, 436 - .hardreset = nv_noclassify_hardreset, 437 439 }; 438 440 439 441 /* For initial probing after boot and hot plugging, hardreset mostly
+1
drivers/block/aoe/aoe.h
··· 18 18 enum { 19 19 AOECMD_ATA, 20 20 AOECMD_CFG, 21 + AOECMD_VEND_MIN = 0xf0, 21 22 22 23 AOEFL_RSP = (1<<3), 23 24 AOEFL_ERR = (1<<2),
+2
drivers/block/aoe/aoenet.c
··· 142 142 aoecmd_cfg_rsp(skb); 143 143 break; 144 144 default: 145 + if (h->cmd >= AOECMD_VEND_MIN) 146 + break; /* don't complain about vendor commands */ 145 147 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); 146 148 } 147 149 exit:
+215
drivers/block/cciss.c
··· 3390 3390 kfree(p); 3391 3391 } 3392 3392 3393 + /* Send a message CDB to the firmware. */ 3394 + static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type) 3395 + { 3396 + typedef struct { 3397 + CommandListHeader_struct CommandHeader; 3398 + RequestBlock_struct Request; 3399 + ErrDescriptor_struct ErrorDescriptor; 3400 + } Command; 3401 + static const size_t cmd_sz = sizeof(Command) + sizeof(ErrorInfo_struct); 3402 + Command *cmd; 3403 + dma_addr_t paddr64; 3404 + uint32_t paddr32, tag; 3405 + void __iomem *vaddr; 3406 + int i, err; 3407 + 3408 + vaddr = ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); 3409 + if (vaddr == NULL) 3410 + return -ENOMEM; 3411 + 3412 + /* The Inbound Post Queue only accepts 32-bit physical addresses for the 3413 + CCISS commands, so they must be allocated from the lower 4GiB of 3414 + memory. */ 3415 + err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 3416 + if (err) { 3417 + iounmap(vaddr); 3418 + return -ENOMEM; 3419 + } 3420 + 3421 + cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64); 3422 + if (cmd == NULL) { 3423 + iounmap(vaddr); 3424 + return -ENOMEM; 3425 + } 3426 + 3427 + /* This must fit, because of the 32-bit consistent DMA mask. Also, 3428 + although there's no guarantee, we assume that the address is at 3429 + least 4-byte aligned (most likely, it's page-aligned). */ 3430 + paddr32 = paddr64; 3431 + 3432 + cmd->CommandHeader.ReplyQueue = 0; 3433 + cmd->CommandHeader.SGList = 0; 3434 + cmd->CommandHeader.SGTotal = 0; 3435 + cmd->CommandHeader.Tag.lower = paddr32; 3436 + cmd->CommandHeader.Tag.upper = 0; 3437 + memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8); 3438 + 3439 + cmd->Request.CDBLen = 16; 3440 + cmd->Request.Type.Type = TYPE_MSG; 3441 + cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE; 3442 + cmd->Request.Type.Direction = XFER_NONE; 3443 + cmd->Request.Timeout = 0; /* Don't time out */ 3444 + cmd->Request.CDB[0] = opcode; 3445 + cmd->Request.CDB[1] = type; 3446 + memset(&cmd->Request.CDB[2], 0, 14); /* the rest of the CDB is reserved */ 3447 + 3448 + cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(Command); 3449 + cmd->ErrorDescriptor.Addr.upper = 0; 3450 + cmd->ErrorDescriptor.Len = sizeof(ErrorInfo_struct); 3451 + 3452 + writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET); 3453 + 3454 + for (i = 0; i < 10; i++) { 3455 + tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); 3456 + if ((tag & ~3) == paddr32) 3457 + break; 3458 + schedule_timeout_uninterruptible(HZ); 3459 + } 3460 + 3461 + iounmap(vaddr); 3462 + 3463 + /* we leak the DMA buffer here ... no choice since the controller could 3464 + still complete the command. */ 3465 + if (i == 10) { 3466 + printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n", 3467 + opcode, type); 3468 + return -ETIMEDOUT; 3469 + } 3470 + 3471 + pci_free_consistent(pdev, cmd_sz, cmd, paddr64); 3472 + 3473 + if (tag & 2) { 3474 + printk(KERN_ERR "cciss: controller message %02x:%02x failed\n", 3475 + opcode, type); 3476 + return -EIO; 3477 + } 3478 + 3479 + printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n", 3480 + opcode, type); 3481 + return 0; 3482 + } 3483 + 3484 + #define cciss_soft_reset_controller(p) cciss_message(p, 1, 0) 3485 + #define cciss_noop(p) cciss_message(p, 3, 0) 3486 + 3487 + static __devinit int cciss_reset_msi(struct pci_dev *pdev) 3488 + { 3489 + /* the #defines are stolen from drivers/pci/msi.h. */ 3490 + #define msi_control_reg(base) (base + PCI_MSI_FLAGS) 3491 + #define PCI_MSIX_FLAGS_ENABLE (1 << 15) 3492 + 3493 + int pos; 3494 + u16 control = 0; 3495 + 3496 + pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); 3497 + if (pos) { 3498 + pci_read_config_word(pdev, msi_control_reg(pos), &control); 3499 + if (control & PCI_MSI_FLAGS_ENABLE) { 3500 + printk(KERN_INFO "cciss: resetting MSI\n"); 3501 + pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE); 3502 + } 3503 + } 3504 + 3505 + pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); 3506 + if (pos) { 3507 + pci_read_config_word(pdev, msi_control_reg(pos), &control); 3508 + if (control & PCI_MSIX_FLAGS_ENABLE) { 3509 + printk(KERN_INFO "cciss: resetting MSI-X\n"); 3510 + pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE); 3511 + } 3512 + } 3513 + 3514 + return 0; 3515 + } 3516 + 3517 + /* This does a hard reset of the controller using PCI power management 3518 + * states. */ 3519 + static __devinit int cciss_hard_reset_controller(struct pci_dev *pdev) 3520 + { 3521 + u16 pmcsr, saved_config_space[32]; 3522 + int i, pos; 3523 + 3524 + printk(KERN_INFO "cciss: using PCI PM to reset controller\n"); 3525 + 3526 + /* This is very nearly the same thing as 3527 + 3528 + pci_save_state(pci_dev); 3529 + pci_set_power_state(pci_dev, PCI_D3hot); 3530 + pci_set_power_state(pci_dev, PCI_D0); 3531 + pci_restore_state(pci_dev); 3532 + 3533 + but we can't use these nice canned kernel routines on 3534 + kexec, because they also check the MSI/MSI-X state in PCI 3535 + configuration space and do the wrong thing when it is 3536 + set/cleared. Also, the pci_save/restore_state functions 3537 + violate the ordering requirements for restoring the 3538 + configuration space from the CCISS document (see the 3539 + comment below). So we roll our own .... */ 3540 + 3541 + for (i = 0; i < 32; i++) 3542 + pci_read_config_word(pdev, 2*i, &saved_config_space[i]); 3543 + 3544 + pos = pci_find_capability(pdev, PCI_CAP_ID_PM); 3545 + if (pos == 0) { 3546 + printk(KERN_ERR "cciss_reset_controller: PCI PM not supported\n"); 3547 + return -ENODEV; 3548 + } 3549 + 3550 + /* Quoting from the Open CISS Specification: "The Power 3551 + * Management Control/Status Register (CSR) controls the power 3552 + * state of the device. The normal operating state is D0, 3553 + * CSR=00h. The software off state is D3, CSR=03h. To reset 3554 + * the controller, place the interface device in D3 then to 3555 + * D0, this causes a secondary PCI reset which will reset the 3556 + * controller." */ 3557 + 3558 + /* enter the D3hot power management state */ 3559 + pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr); 3560 + pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 3561 + pmcsr |= PCI_D3hot; 3562 + pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); 3563 + 3564 + schedule_timeout_uninterruptible(HZ >> 1); 3565 + 3566 + /* enter the D0 power management state */ 3567 + pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 3568 + pmcsr |= PCI_D0; 3569 + pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); 3570 + 3571 + schedule_timeout_uninterruptible(HZ >> 1); 3572 + 3573 + /* Restore the PCI configuration space. The Open CISS 3574 + * Specification says, "Restore the PCI Configuration 3575 + * Registers, offsets 00h through 60h. It is important to 3576 + * restore the command register, 16-bits at offset 04h, 3577 + * last. Do not restore the configuration status register, 3578 + * 16-bits at offset 06h." Note that the offset is 2*i. */ 3579 + for (i = 0; i < 32; i++) { 3580 + if (i == 2 || i == 3) 3581 + continue; 3582 + pci_write_config_word(pdev, 2*i, saved_config_space[i]); 3583 + } 3584 + wmb(); 3585 + pci_write_config_word(pdev, 4, saved_config_space[2]); 3586 + 3587 + return 0; 3588 + } 3589 + 3393 3590 /* 3394 3591 * This is it. Find all the controllers and register them. I really hate 3395 3592 * stealing all these major device numbers. ··· 3600 3403 int rc; 3601 3404 int dac, return_code; 3602 3405 InquiryData_struct *inq_buff = NULL; 3406 + 3407 + if (reset_devices) { 3408 + /* Reset the controller with a PCI power-cycle */ 3409 + if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev)) 3410 + return -ENODEV; 3411 + 3412 + /* Some devices (notably the HP Smart Array 5i Controller) 3413 + need a little pause here */ 3414 + schedule_timeout_uninterruptible(30*HZ); 3415 + 3416 + /* Now try to get the controller to respond to a no-op */ 3417 + for (i=0; i<12; i++) { 3418 + if (cciss_noop(pdev) == 0) 3419 + break; 3420 + else 3421 + printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : "")); 3422 + } 3423 + } 3603 3424 3604 3425 i = alloc_cciss_hba(); 3605 3426 if (i < 0)
+52 -27
drivers/block/floppy.c
··· 558 558 static void recalibrate_floppy(void); 559 559 static void floppy_shutdown(unsigned long); 560 560 561 + static int floppy_request_regions(int); 562 + static void floppy_release_regions(int); 561 563 static int floppy_grab_irq_and_dma(void); 562 564 static void floppy_release_irq_and_dma(void); 563 565 ··· 4276 4274 FDCS->rawcmd = 2; 4277 4275 if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { 4278 4276 /* free ioports reserved by floppy_grab_irq_and_dma() */ 4279 - release_region(FDCS->address + 2, 4); 4280 - release_region(FDCS->address + 7, 1); 4277 + floppy_release_regions(fdc); 4281 4278 FDCS->address = -1; 4282 4279 FDCS->version = FDC_NONE; 4283 4280 continue; ··· 4285 4284 FDCS->version = get_fdc_version(); 4286 4285 if (FDCS->version == FDC_NONE) { 4287 4286 /* free ioports reserved by floppy_grab_irq_and_dma() */ 4288 - release_region(FDCS->address + 2, 4); 4289 - release_region(FDCS->address + 7, 1); 4287 + floppy_release_regions(fdc); 4290 4288 FDCS->address = -1; 4291 4289 continue; 4292 4290 } ··· 4358 4358 4359 4359 static DEFINE_SPINLOCK(floppy_usage_lock); 4360 4360 4361 + static const struct io_region { 4362 + int offset; 4363 + int size; 4364 + } io_regions[] = { 4365 + { 2, 1 }, 4366 + /* address + 3 is sometimes reserved by pnp bios for motherboard */ 4367 + { 4, 2 }, 4368 + /* address + 6 is reserved, and may be taken by IDE. 4369 + * Unfortunately, Adaptec doesn't know this :-(, */ 4370 + { 7, 1 }, 4371 + }; 4372 + 4373 + static void floppy_release_allocated_regions(int fdc, const struct io_region *p) 4374 + { 4375 + while (p != io_regions) { 4376 + p--; 4377 + release_region(FDCS->address + p->offset, p->size); 4378 + } 4379 + } 4380 + 4381 + #define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)])) 4382 + 4383 + static int floppy_request_regions(int fdc) 4384 + { 4385 + const struct io_region *p; 4386 + 4387 + for (p = io_regions; p < ARRAY_END(io_regions); p++) { 4388 + if (!request_region(FDCS->address + p->offset, p->size, "floppy")) { 4389 + DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + p->offset); 4390 + floppy_release_allocated_regions(fdc, p); 4391 + return -EBUSY; 4392 + } 4393 + } 4394 + return 0; 4395 + } 4396 + 4397 + static void floppy_release_regions(int fdc) 4398 + { 4399 + floppy_release_allocated_regions(fdc, ARRAY_END(io_regions)); 4400 + } 4401 + 4361 4402 static int floppy_grab_irq_and_dma(void) 4362 4403 { 4363 4404 unsigned long flags; ··· 4440 4399 4441 4400 for (fdc = 0; fdc < N_FDC; fdc++) { 4442 4401 if (FDCS->address != -1) { 4443 - if (!request_region(FDCS->address + 2, 4, "floppy")) { 4444 - DPRINT("Floppy io-port 0x%04lx in use\n", 4445 - FDCS->address + 2); 4446 - goto cleanup1; 4447 - } 4448 - if (!request_region(FDCS->address + 7, 1, "floppy DIR")) { 4449 - DPRINT("Floppy io-port 0x%04lx in use\n", 4450 - FDCS->address + 7); 4451 - goto cleanup2; 4452 - } 4453 - /* address + 6 is reserved, and may be taken by IDE. 4454 - * Unfortunately, Adaptec doesn't know this :-(, */ 4402 + if (floppy_request_regions(fdc)) 4403 + goto cleanup; 4455 4404 } 4456 4405 } 4457 4406 for (fdc = 0; fdc < N_FDC; fdc++) { ··· 4463 4432 fdc = 0; 4464 4433 irqdma_allocated = 1; 4465 4434 return 0; 4466 - cleanup2: 4467 - release_region(FDCS->address + 2, 4); 4468 - cleanup1: 4435 + cleanup: 4469 4436 fd_free_irq(); 4470 4437 fd_free_dma(); 4471 - while (--fdc >= 0) { 4472 - release_region(FDCS->address + 2, 4); 4473 - release_region(FDCS->address + 7, 1); 4474 - } 4438 + while (--fdc >= 0) 4439 + floppy_release_regions(fdc); 4475 4440 spin_lock_irqsave(&floppy_usage_lock, flags); 4476 4441 usage_count--; 4477 4442 spin_unlock_irqrestore(&floppy_usage_lock, flags); ··· 4528 4501 #endif 4529 4502 old_fdc = fdc; 4530 4503 for (fdc = 0; fdc < N_FDC; fdc++) 4531 - if (FDCS->address != -1) { 4532 - release_region(FDCS->address + 2, 4); 4533 - release_region(FDCS->address + 7, 1); 4534 - } 4504 + if (FDCS->address != -1) 4505 + floppy_release_regions(fdc); 4535 4506 fdc = old_fdc; 4536 4507 } 4537 4508
+1 -1
drivers/block/paride/pg.c
··· 422 422 423 423 for (k = 0; k < len; k++) { 424 424 char c = *buf++; 425 - if (c != ' ' || c != l) 425 + if (c != ' ' && c != l) 426 426 l = *targ++ = c; 427 427 } 428 428 if (l == ' ')
+2
drivers/dma/dmaengine.c
··· 518 518 dma_chan_name(chan), err); 519 519 else 520 520 break; 521 + chan->private = NULL; 521 522 chan = NULL; 522 523 } 523 524 } ··· 537 536 WARN_ONCE(chan->client_count != 1, 538 537 "chan reference count %d != 1\n", chan->client_count); 539 538 dma_chan_put(chan); 539 + chan->private = NULL; 540 540 mutex_unlock(&dma_list_mutex); 541 541 } 542 542 EXPORT_SYMBOL_GPL(dma_release_channel);
+2 -3
drivers/dma/dw_dmac.c
··· 560 560 unsigned long flags) 561 561 { 562 562 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 563 - struct dw_dma_slave *dws = dwc->dws; 563 + struct dw_dma_slave *dws = chan->private; 564 564 struct dw_desc *prev; 565 565 struct dw_desc *first; 566 566 u32 ctllo; ··· 790 790 cfghi = DWC_CFGH_FIFO_MODE; 791 791 cfglo = 0; 792 792 793 - dws = dwc->dws; 793 + dws = chan->private; 794 794 if (dws) { 795 795 /* 796 796 * We need controller-specific data to set up slave ··· 866 866 spin_lock_bh(&dwc->lock); 867 867 list_splice_init(&dwc->free_list, &list); 868 868 dwc->descs_allocated = 0; 869 - dwc->dws = NULL; 870 869 871 870 /* Disable interrupts */ 872 871 channel_clear_bit(dw, MASK.XFER, dwc->mask);
-2
drivers/dma/dw_dmac_regs.h
··· 139 139 struct list_head queue; 140 140 struct list_head free_list; 141 141 142 - struct dw_dma_slave *dws; 143 - 144 142 unsigned int descs_allocated; 145 143 }; 146 144
+1 -1
drivers/firmware/memmap.c
··· 1 1 /* 2 2 * linux/drivers/firmware/memmap.c 3 3 * Copyright (C) 2008 SUSE LINUX Products GmbH 4 - * by Bernhard Walle <bwalle@suse.de> 4 + * by Bernhard Walle <bernhard.walle@gmx.de> 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License v2.0 as published by
+6 -7
drivers/gpu/drm/Kconfig
··· 80 80 XFree86 4.4 and above. If unsure, build this and i830 as modules and 81 81 the X server will load the correct one. 82 82 83 - endchoice 84 - 85 83 config DRM_I915_KMS 86 84 bool "Enable modesetting on intel by default" 87 85 depends on DRM_I915 88 86 help 89 - Choose this option if you want kernel modesetting enabled by default, 90 - and you have a new enough userspace to support this. Running old 91 - userspaces with this enabled will cause pain. Note that this causes 92 - the driver to bind to PCI devices, which precludes loading things 93 - like intelfb. 87 + Choose this option if you want kernel modesetting enabled by default, 88 + and you have a new enough userspace to support this. Running old 89 + userspaces with this enabled will cause pain. Note that this causes 90 + the driver to bind to PCI devices, which precludes loading things 91 + like intelfb. 94 92 93 + endchoice 95 94 96 95 config DRM_MGA 97 96 tristate "Matrox g200/g400"
+7 -6
drivers/hid/hid-core.c
··· 1300 1300 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1301 1301 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1302 1302 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1303 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 1304 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 1305 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, 1306 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1303 1307 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1308 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1309 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1304 1310 1305 1311 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1306 1312 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, ··· 1611 1605 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, 1612 1606 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, 1613 1607 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, 1608 + { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, 1614 1609 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, 1615 1610 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, 1616 1611 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, ··· 1619 1612 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, 1620 1613 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, 1621 1614 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, 1622 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 1623 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 1624 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, 1625 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1626 1615 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, 1627 1616 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 1628 1617 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, ··· 1629 1626 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, 1630 1627 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, 1631 1628 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 1632 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1633 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1634 1629 { } 1635 1630 }; 1636 1631
+3
drivers/hid/hid-ids.h
··· 348 348 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 349 349 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 350 350 351 + #define USB_VENDOR_ID_POWERCOM 0x0d9f 352 + #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 353 + 351 354 #define USB_VENDOR_ID_SAITEK 0x06a3 352 355 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 353 356
+9 -5
drivers/hid/hidraw.c
··· 267 267 default: 268 268 { 269 269 struct hid_device *hid = dev->hid; 270 - if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) 271 - return -EINVAL; 270 + if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) { 271 + ret = -EINVAL; 272 + break; 273 + } 272 274 273 275 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { 274 276 int len; ··· 279 277 len = strlen(hid->name) + 1; 280 278 if (len > _IOC_SIZE(cmd)) 281 279 len = _IOC_SIZE(cmd); 282 - return copy_to_user(user_arg, hid->name, len) ? 280 + ret = copy_to_user(user_arg, hid->name, len) ? 283 281 -EFAULT : len; 282 + break; 284 283 } 285 284 286 285 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { ··· 291 288 len = strlen(hid->phys) + 1; 292 289 if (len > _IOC_SIZE(cmd)) 293 290 len = _IOC_SIZE(cmd); 294 - return copy_to_user(user_arg, hid->phys, len) ? 291 + ret = copy_to_user(user_arg, hid->phys, len) ? 295 292 -EFAULT : len; 293 + break; 296 294 } 297 295 } 298 296 299 - ret = -ENOTTY; 297 + ret = -ENOTTY; 300 298 } 301 299 unlock_kernel(); 302 300 return ret;
+2 -2
drivers/hwmon/f71882fg.c
··· 1872 1872 1873 1873 devid = superio_inw(sioaddr, SIO_REG_MANID); 1874 1874 if (devid != SIO_FINTEK_ID) { 1875 - printk(KERN_INFO DRVNAME ": Not a Fintek device\n"); 1875 + pr_debug(DRVNAME ": Not a Fintek device\n"); 1876 1876 goto exit; 1877 1877 } 1878 1878 ··· 1932 1932 res.name = f71882fg_pdev->name; 1933 1933 err = acpi_check_resource_conflict(&res); 1934 1934 if (err) 1935 - return err; 1935 + goto exit_device_put; 1936 1936 1937 1937 err = platform_device_add_resources(f71882fg_pdev, &res, 1); 1938 1938 if (err) {
+81 -4
drivers/hwmon/hp_accel.c
··· 166 166 }, \ 167 167 .driver_data = &lis3lv02d_axis_##_axis \ 168 168 } 169 + 170 + #define AXIS_DMI_MATCH2(_ident, _class1, _name1, \ 171 + _class2, _name2, \ 172 + _axis) { \ 173 + .ident = _ident, \ 174 + .callback = lis3lv02d_dmi_matched, \ 175 + .matches = { \ 176 + DMI_MATCH(DMI_##_class1, _name1), \ 177 + DMI_MATCH(DMI_##_class2, _name2), \ 178 + }, \ 179 + .driver_data = &lis3lv02d_axis_##_axis \ 180 + } 169 181 static struct dmi_system_id lis3lv02d_dmi_ids[] = { 170 182 /* product names are truncated to match all kinds of a same model */ 171 183 AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), ··· 191 179 AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), 192 180 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), 193 181 AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), 182 + /* Intel-based HP Pavilion dv5 */ 183 + AXIS_DMI_MATCH2("HPDV5_I", 184 + PRODUCT_NAME, "HP Pavilion dv5", 185 + BOARD_NAME, "3603", 186 + x_inverted), 187 + /* AMD-based HP Pavilion dv5 */ 188 + AXIS_DMI_MATCH2("HPDV5_A", 189 + PRODUCT_NAME, "HP Pavilion dv5", 190 + BOARD_NAME, "3600", 191 + y_inverted), 194 192 { NULL, } 195 193 /* Laptop models without axis info (yet): 196 194 * "NC6910" "HP Compaq 6910" ··· 235 213 .set_brightness = hpled_set, 236 214 }; 237 215 216 + static acpi_status 217 + lis3lv02d_get_resource(struct acpi_resource *resource, void *context) 218 + { 219 + if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { 220 + struct acpi_resource_extended_irq *irq; 221 + u32 *device_irq = context; 222 + 223 + irq = &resource->data.extended_irq; 224 + *device_irq = irq->interrupts[0]; 225 + } 226 + 227 + return AE_OK; 228 + } 229 + 230 + static void lis3lv02d_enum_resources(struct acpi_device *device) 231 + { 232 + acpi_status status; 233 + 234 + status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, 235 + lis3lv02d_get_resource, &adev.irq); 236 + if (ACPI_FAILURE(status)) 237 + printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); 238 + } 239 + 240 + static s16 lis3lv02d_read_16(acpi_handle handle, int reg) 241 + { 242 + u8 lo, hi; 243 + 244 + adev.read(handle, reg - 1, &lo); 245 + adev.read(handle, reg, &hi); 246 + /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ 247 + return (s16)((hi << 8) | lo); 248 + } 249 + 250 + static s16 lis3lv02d_read_8(acpi_handle handle, int reg) 251 + { 252 + s8 lo; 253 + adev.read(handle, reg, &lo); 254 + return lo; 255 + } 256 + 238 257 static int lis3lv02d_add(struct acpi_device *device) 239 258 { 240 - u8 val; 241 259 int ret; 242 260 243 261 if (!device) ··· 291 229 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); 292 230 device->driver_data = &adev; 293 231 294 - lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val); 295 - if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) { 232 + lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami); 233 + switch (adev.whoami) { 234 + case LIS_DOUBLE_ID: 235 + printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n"); 236 + adev.read_data = lis3lv02d_read_16; 237 + adev.mdps_max_val = 2048; 238 + break; 239 + case LIS_SINGLE_ID: 240 + printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n"); 241 + adev.read_data = lis3lv02d_read_8; 242 + adev.mdps_max_val = 128; 243 + break; 244 + default: 296 245 printk(KERN_ERR DRIVER_NAME 297 - ": Accelerometer chip not LIS3LV02D{L,Q}\n"); 246 + ": unknown sensor type 0x%X\n", adev.whoami); 247 + return -EINVAL; 298 248 } 299 249 300 250 /* If possible use a "standard" axes order */ ··· 320 246 ret = led_classdev_register(NULL, &hpled_led.led_classdev); 321 247 if (ret) 322 248 return ret; 249 + 250 + /* obtain IRQ number of our device from ACPI */ 251 + lis3lv02d_enum_resources(adev.device); 323 252 324 253 ret = lis3lv02d_init_device(&adev); 325 254 if (ret) {
+160 -35
drivers/hwmon/lis3lv02d.c
··· 3 3 * 4 4 * Copyright (C) 2007-2008 Yan Burman 5 5 * Copyright (C) 2008 Eric Piel 6 - * Copyright (C) 2008 Pavel Machek 6 + * Copyright (C) 2008-2009 Pavel Machek 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by ··· 35 35 #include <linux/poll.h> 36 36 #include <linux/freezer.h> 37 37 #include <linux/uaccess.h> 38 + #include <linux/miscdevice.h> 38 39 #include <acpi/acpi_drivers.h> 39 40 #include <asm/atomic.h> 40 41 #include "lis3lv02d.h" ··· 53 52 * joystick. 54 53 */ 55 54 56 - /* Maximum value our axis may get for the input device (signed 12 bits) */ 57 - #define MDPS_MAX_VAL 2048 55 + struct acpi_lis3lv02d adev = { 56 + .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait), 57 + }; 58 58 59 - struct acpi_lis3lv02d adev; 60 59 EXPORT_SYMBOL_GPL(adev); 61 60 62 61 static int lis3lv02d_add_fs(struct acpi_device *device); 63 - 64 - static s16 lis3lv02d_read_16(acpi_handle handle, int reg) 65 - { 66 - u8 lo, hi; 67 - 68 - adev.read(handle, reg, &lo); 69 - adev.read(handle, reg + 1, &hi); 70 - /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ 71 - return (s16)((hi << 8) | lo); 72 - } 73 62 74 63 /** 75 64 * lis3lv02d_get_axis - For the given axis, give the value converted ··· 89 98 { 90 99 int position[3]; 91 100 92 - position[0] = lis3lv02d_read_16(handle, OUTX_L); 93 - position[1] = lis3lv02d_read_16(handle, OUTY_L); 94 - position[2] = lis3lv02d_read_16(handle, OUTZ_L); 101 + position[0] = adev.read_data(handle, OUTX); 102 + position[1] = adev.read_data(handle, OUTY); 103 + position[2] = adev.read_data(handle, OUTZ); 95 104 96 105 *x = lis3lv02d_get_axis(adev.ac.x, position); 97 106 *y = lis3lv02d_get_axis(adev.ac.y, position); ··· 101 110 void lis3lv02d_poweroff(acpi_handle handle) 102 111 { 103 112 adev.is_on = 0; 104 - /* disable X,Y,Z axis and power down */ 105 - adev.write(handle, CTRL_REG1, 0x00); 106 113 } 107 114 EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); 108 115 109 116 void lis3lv02d_poweron(acpi_handle handle) 110 117 { 111 - u8 val; 112 - 113 118 adev.is_on = 1; 114 119 adev.init(handle); 115 - adev.write(handle, FF_WU_CFG, 0); 116 - /* 117 - * BDU: LSB and MSB values are not updated until both have been read. 118 - * So the value read will always be correct. 119 - * IEN: Interrupt for free-fall and DD, not for data-ready. 120 - */ 121 - adev.read(handle, CTRL_REG2, &val); 122 - val |= CTRL2_BDU | CTRL2_IEN; 123 - adev.write(handle, CTRL_REG2, val); 124 120 } 125 121 EXPORT_SYMBOL_GPL(lis3lv02d_poweron); 126 122 ··· 139 161 lis3lv02d_poweroff(dev->device->handle); 140 162 mutex_unlock(&dev->lock); 141 163 } 164 + 165 + static irqreturn_t lis302dl_interrupt(int irq, void *dummy) 166 + { 167 + /* 168 + * Be careful: on some HP laptops the bios force DD when on battery and 169 + * the lid is closed. This leads to interrupts as soon as a little move 170 + * is done. 171 + */ 172 + atomic_inc(&adev.count); 173 + 174 + wake_up_interruptible(&adev.misc_wait); 175 + kill_fasync(&adev.async_queue, SIGIO, POLL_IN); 176 + return IRQ_HANDLED; 177 + } 178 + 179 + static int lis3lv02d_misc_open(struct inode *inode, struct file *file) 180 + { 181 + int ret; 182 + 183 + if (test_and_set_bit(0, &adev.misc_opened)) 184 + return -EBUSY; /* already open */ 185 + 186 + atomic_set(&adev.count, 0); 187 + 188 + /* 189 + * The sensor can generate interrupts for free-fall and direction 190 + * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep 191 + * the things simple and _fast_ we activate it only for free-fall, so 192 + * no need to read register (very slow with ACPI). For the same reason, 193 + * we forbid shared interrupts. 194 + * 195 + * IRQF_TRIGGER_RISING seems pointless on HP laptops because the 196 + * io-apic is not configurable (and generates a warning) but I keep it 197 + * in case of support for other hardware. 198 + */ 199 + ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING, 200 + DRIVER_NAME, &adev); 201 + 202 + if (ret) { 203 + clear_bit(0, &adev.misc_opened); 204 + printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq); 205 + return -EBUSY; 206 + } 207 + lis3lv02d_increase_use(&adev); 208 + printk("lis3: registered interrupt %d\n", adev.irq); 209 + return 0; 210 + } 211 + 212 + static int lis3lv02d_misc_release(struct inode *inode, struct file *file) 213 + { 214 + fasync_helper(-1, file, 0, &adev.async_queue); 215 + lis3lv02d_decrease_use(&adev); 216 + free_irq(adev.irq, &adev); 217 + clear_bit(0, &adev.misc_opened); /* release the device */ 218 + return 0; 219 + } 220 + 221 + static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, 222 + size_t count, loff_t *pos) 223 + { 224 + DECLARE_WAITQUEUE(wait, current); 225 + u32 data; 226 + unsigned char byte_data; 227 + ssize_t retval = 1; 228 + 229 + if (count < 1) 230 + return -EINVAL; 231 + 232 + add_wait_queue(&adev.misc_wait, &wait); 233 + while (true) { 234 + set_current_state(TASK_INTERRUPTIBLE); 235 + data = atomic_xchg(&adev.count, 0); 236 + if (data) 237 + break; 238 + 239 + if (file->f_flags & O_NONBLOCK) { 240 + retval = -EAGAIN; 241 + goto out; 242 + } 243 + 244 + if (signal_pending(current)) { 245 + retval = -ERESTARTSYS; 246 + goto out; 247 + } 248 + 249 + schedule(); 250 + } 251 + 252 + if (data < 255) 253 + byte_data = data; 254 + else 255 + byte_data = 255; 256 + 257 + /* make sure we are not going into copy_to_user() with 258 + * TASK_INTERRUPTIBLE state */ 259 + set_current_state(TASK_RUNNING); 260 + if (copy_to_user(buf, &byte_data, sizeof(byte_data))) 261 + retval = -EFAULT; 262 + 263 + out: 264 + __set_current_state(TASK_RUNNING); 265 + remove_wait_queue(&adev.misc_wait, &wait); 266 + 267 + return retval; 268 + } 269 + 270 + static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait) 271 + { 272 + poll_wait(file, &adev.misc_wait, wait); 273 + if (atomic_read(&adev.count)) 274 + return POLLIN | POLLRDNORM; 275 + return 0; 276 + } 277 + 278 + static int lis3lv02d_misc_fasync(int fd, struct file *file, int on) 279 + { 280 + return fasync_helper(fd, file, on, &adev.async_queue); 281 + } 282 + 283 + static const struct file_operations lis3lv02d_misc_fops = { 284 + .owner = THIS_MODULE, 285 + .llseek = no_llseek, 286 + .read = lis3lv02d_misc_read, 287 + .open = lis3lv02d_misc_open, 288 + .release = lis3lv02d_misc_release, 289 + .poll = lis3lv02d_misc_poll, 290 + .fasync = lis3lv02d_misc_fasync, 291 + }; 292 + 293 + static struct miscdevice lis3lv02d_misc_device = { 294 + .minor = MISC_DYNAMIC_MINOR, 295 + .name = "freefall", 296 + .fops = &lis3lv02d_misc_fops, 297 + }; 142 298 143 299 /** 144 300 * lis3lv02d_joystick_kthread - Kthread polling function ··· 315 203 lis3lv02d_decrease_use(&adev); 316 204 } 317 205 318 - 319 206 static inline void lis3lv02d_calibrate_joystick(void) 320 207 { 321 208 lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); ··· 342 231 adev.idev->close = lis3lv02d_joystick_close; 343 232 344 233 set_bit(EV_ABS, adev.idev->evbit); 345 - input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 346 - input_set_abs_params(adev.idev, ABS_Y, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 347 - input_set_abs_params(adev.idev, ABS_Z, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 234 + input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); 235 + input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); 236 + input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); 348 237 349 238 err = input_register_device(adev.idev); 350 239 if (err) { ··· 361 250 if (!adev.idev) 362 251 return; 363 252 253 + misc_deregister(&lis3lv02d_misc_device); 364 254 input_unregister_device(adev.idev); 365 255 adev.idev = NULL; 366 256 } ··· 380 268 if (lis3lv02d_joystick_enable()) 381 269 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); 382 270 271 + printk("lis3_init_device: irq %d\n", dev->irq); 272 + 273 + /* if we did not get an IRQ from ACPI - we have nothing more to do */ 274 + if (!dev->irq) { 275 + printk(KERN_ERR DRIVER_NAME 276 + ": No IRQ in ACPI. Disabling /dev/freefall\n"); 277 + goto out; 278 + } 279 + 280 + printk("lis3: registering device\n"); 281 + if (misc_register(&lis3lv02d_misc_device)) 282 + printk(KERN_ERR DRIVER_NAME ": misc_register failed\n"); 283 + out: 383 284 lis3lv02d_decrease_use(dev); 384 285 return 0; 385 286 } ··· 476 351 EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); 477 352 478 353 MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); 479 - MODULE_AUTHOR("Yan Burman and Eric Piel"); 354 + MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); 480 355 MODULE_LICENSE("GPL"); 481 356
+18 -3
drivers/hwmon/lis3lv02d.h
··· 22 22 /* 23 23 * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to 24 24 * be connected via SPI. There exists also several similar chips (such as LIS302DL or 25 - * LIS3L02DQ) but not in the HP laptops and they have slightly different registers. 25 + * LIS3L02DQ) and they have slightly different registers, but we can provide a 26 + * common interface for all of them. 26 27 * They can also be connected via I²C. 27 28 */ 28 29 29 - #define LIS3LV02DL_ID 0x3A /* Also the LIS3LV02DQ */ 30 - #define LIS302DL_ID 0x3B /* Also the LIS202DL! */ 30 + /* 2-byte registers */ 31 + #define LIS_DOUBLE_ID 0x3A /* LIS3LV02D[LQ] */ 32 + /* 1-byte registers */ 33 + #define LIS_SINGLE_ID 0x3B /* LIS[32]02DL and others */ 31 34 32 35 enum lis3lv02d_reg { 33 36 WHO_AM_I = 0x0F, ··· 47 44 STATUS_REG = 0x27, 48 45 OUTX_L = 0x28, 49 46 OUTX_H = 0x29, 47 + OUTX = 0x29, 50 48 OUTY_L = 0x2A, 51 49 OUTY_H = 0x2B, 50 + OUTY = 0x2B, 52 51 OUTZ_L = 0x2C, 53 52 OUTZ_H = 0x2D, 53 + OUTZ = 0x2D, 54 54 FF_WU_CFG = 0x30, 55 55 FF_WU_SRC = 0x31, 56 56 FF_WU_ACK = 0x32, ··· 165 159 acpi_status (*write) (acpi_handle handle, int reg, u8 val); 166 160 acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); 167 161 162 + u8 whoami; /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */ 163 + s16 (*read_data) (acpi_handle handle, int reg); 164 + int mdps_max_val; 165 + 168 166 struct input_dev *idev; /* input device */ 169 167 struct task_struct *kthread; /* kthread for input */ 170 168 struct mutex lock; ··· 180 170 unsigned char is_on; /* whether the device is on or off */ 181 171 unsigned char usage; /* usage counter */ 182 172 struct axis_conversion ac; /* hw -> logical axis */ 173 + 174 + u32 irq; /* IRQ number */ 175 + struct fasync_struct *async_queue; /* queue for the misc device */ 176 + wait_queue_head_t misc_wait; /* Wait queue for the misc device */ 177 + unsigned long misc_opened; /* bit0: whether the device is open */ 183 178 }; 184 179 185 180 int lis3lv02d_init_device(struct acpi_lis3lv02d *dev);
+1 -1
drivers/hwmon/vt1211.c
··· 1262 1262 res.name = pdev->name; 1263 1263 err = acpi_check_resource_conflict(&res); 1264 1264 if (err) 1265 - goto EXIT; 1265 + goto EXIT_DEV_PUT; 1266 1266 1267 1267 err = platform_device_add_resources(pdev, &res, 1); 1268 1268 if (err) {
+1 -1
drivers/hwmon/w83627ehf.c
··· 1548 1548 1549 1549 err = acpi_check_resource_conflict(&res); 1550 1550 if (err) 1551 - goto exit; 1551 + goto exit_device_put; 1552 1552 1553 1553 err = platform_device_add_resources(pdev, &res, 1); 1554 1554 if (err) {
+1 -1
drivers/md/dm-io.c
··· 328 328 struct dpages old_pages = *dp; 329 329 330 330 if (sync) 331 - rw |= (1 << BIO_RW_SYNC); 331 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 332 332 333 333 /* 334 334 * For multiple regions we need to be careful to rewind
+1 -1
drivers/md/dm-kcopyd.c
··· 344 344 { 345 345 int r; 346 346 struct dm_io_request io_req = { 347 - .bi_rw = job->rw | (1 << BIO_RW_SYNC), 347 + .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG), 348 348 .mem.type = DM_IO_PAGE_LIST, 349 349 .mem.ptr.pl = job->pages, 350 350 .mem.offset = job->offset,
+2 -2
drivers/md/md.c
··· 474 474 * causes ENOTSUPP, we allocate a spare bio... 475 475 */ 476 476 struct bio *bio = bio_alloc(GFP_NOIO, 1); 477 - int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); 477 + int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG); 478 478 479 479 bio->bi_bdev = rdev->bdev; 480 480 bio->bi_sector = sector; ··· 531 531 struct completion event; 532 532 int ret; 533 533 534 - rw |= (1 << BIO_RW_SYNC); 534 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 535 535 536 536 bio->bi_bdev = bdev; 537 537 bio->bi_sector = sector;
+4 -6
drivers/media/common/tuners/tuner-simple.c
··· 318 318 u8 *config, u8 *cb) 319 319 { 320 320 struct tuner_simple_priv *priv = fe->tuner_priv; 321 - u8 tuneraddr; 322 321 int rc; 323 322 324 323 /* tv norm specific stuff for multi-norm tuners */ ··· 386 387 387 388 case TUNER_PHILIPS_TUV1236D: 388 389 { 390 + struct tuner_i2c_props i2c = priv->i2c_props; 389 391 /* 0x40 -> ATSC antenna input 1 */ 390 392 /* 0x48 -> ATSC antenna input 2 */ 391 393 /* 0x00 -> NTSC antenna input 1 */ ··· 398 398 buffer[1] = 0x04; 399 399 } 400 400 /* set to the correct mode (analog or digital) */ 401 - tuneraddr = priv->i2c_props.addr; 402 - priv->i2c_props.addr = 0x0a; 403 - rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[0], 2); 401 + i2c.addr = 0x0a; 402 + rc = tuner_i2c_xfer_send(&i2c, &buffer[0], 2); 404 403 if (2 != rc) 405 404 tuner_warn("i2c i/o error: rc == %d " 406 405 "(should be 2)\n", rc); 407 - rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[2], 2); 406 + rc = tuner_i2c_xfer_send(&i2c, &buffer[2], 2); 408 407 if (2 != rc) 409 408 tuner_warn("i2c i/o error: rc == %d " 410 409 "(should be 2)\n", rc); 411 - priv->i2c_props.addr = tuneraddr; 412 410 break; 413 411 } 414 412 }
+7 -9
drivers/media/dvb/dvb-core/dmxdev.c
··· 364 364 enum dmx_success success) 365 365 { 366 366 struct dmxdev_filter *dmxdevfilter = filter->priv; 367 - unsigned long flags; 368 367 int ret; 369 368 370 369 if (dmxdevfilter->buffer.error) { 371 370 wake_up(&dmxdevfilter->buffer.queue); 372 371 return 0; 373 372 } 374 - spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); 373 + spin_lock(&dmxdevfilter->dev->lock); 375 374 if (dmxdevfilter->state != DMXDEV_STATE_GO) { 376 - spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 375 + spin_unlock(&dmxdevfilter->dev->lock); 377 376 return 0; 378 377 } 379 378 del_timer(&dmxdevfilter->timer); ··· 391 392 } 392 393 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) 393 394 dmxdevfilter->state = DMXDEV_STATE_DONE; 394 - spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 395 + spin_unlock(&dmxdevfilter->dev->lock); 395 396 wake_up(&dmxdevfilter->buffer.queue); 396 397 return 0; 397 398 } ··· 403 404 { 404 405 struct dmxdev_filter *dmxdevfilter = feed->priv; 405 406 struct dvb_ringbuffer *buffer; 406 - unsigned long flags; 407 407 int ret; 408 408 409 - spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); 409 + spin_lock(&dmxdevfilter->dev->lock); 410 410 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { 411 - spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 411 + spin_unlock(&dmxdevfilter->dev->lock); 412 412 return 0; 413 413 } 414 414 ··· 417 419 else 418 420 buffer = &dmxdevfilter->dev->dvr_buffer; 419 421 if (buffer->error) { 420 - spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 422 + spin_unlock(&dmxdevfilter->dev->lock); 421 423 wake_up(&buffer->queue); 422 424 return 0; 423 425 } ··· 428 430 dvb_ringbuffer_flush(buffer); 429 431 buffer->error = ret; 430 432 } 431 - spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 433 + spin_unlock(&dmxdevfilter->dev->lock); 432 434 wake_up(&buffer->queue); 433 435 return 0; 434 436 }
+6 -10
drivers/media/dvb/dvb-core/dvb_demux.c
··· 399 399 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, 400 400 size_t count) 401 401 { 402 - unsigned long flags; 403 - 404 - spin_lock_irqsave(&demux->lock, flags); 402 + spin_lock(&demux->lock); 405 403 406 404 while (count--) { 407 405 if (buf[0] == 0x47) ··· 407 409 buf += 188; 408 410 } 409 411 410 - spin_unlock_irqrestore(&demux->lock, flags); 412 + spin_unlock(&demux->lock); 411 413 } 412 414 413 415 EXPORT_SYMBOL(dvb_dmx_swfilter_packets); 414 416 415 417 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) 416 418 { 417 - unsigned long flags; 418 419 int p = 0, i, j; 419 420 420 - spin_lock_irqsave(&demux->lock, flags); 421 + spin_lock(&demux->lock); 421 422 422 423 if (demux->tsbufp) { 423 424 i = demux->tsbufp; ··· 449 452 } 450 453 451 454 bailout: 452 - spin_unlock_irqrestore(&demux->lock, flags); 455 + spin_unlock(&demux->lock); 453 456 } 454 457 455 458 EXPORT_SYMBOL(dvb_dmx_swfilter); 456 459 457 460 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) 458 461 { 459 - unsigned long flags; 460 462 int p = 0, i, j; 461 463 u8 tmppack[188]; 462 464 463 - spin_lock_irqsave(&demux->lock, flags); 465 + spin_lock(&demux->lock); 464 466 465 467 if (demux->tsbufp) { 466 468 i = demux->tsbufp; ··· 500 504 } 501 505 502 506 bailout: 503 - spin_unlock_irqrestore(&demux->lock, flags); 507 + spin_unlock(&demux->lock); 504 508 } 505 509 506 510 EXPORT_SYMBOL(dvb_dmx_swfilter_204);
+46 -9
drivers/media/radio/radio-si470x.c
··· 98 98 * - blacklisted KWorld radio in hid-core.c and hid-ids.h 99 99 * 2008-12-03 Mark Lord <mlord@pobox.com> 100 100 * - add support for DealExtreme USB Radio 101 + * 2009-01-31 Bob Ross <pigiron@gmx.com> 102 + * - correction of stereo detection/setting 103 + * - correction of signal strength indicator scaling 104 + * 2009-01-31 Rick Bronson <rick@efn.org> 105 + * Tobias Lorenz <tobias.lorenz@gmx.net> 106 + * - add LED status output 101 107 * 102 108 * ToDo: 103 109 * - add firmware download/update support 104 110 * - RDS support: interrupt mode, instead of polling 105 - * - add LED status output (check if that's not already done in firmware) 106 111 */ 107 112 108 113 ··· 887 882 888 883 889 884 /************************************************************************** 885 + * General Driver Functions - LED_REPORT 886 + **************************************************************************/ 887 + 888 + /* 889 + * si470x_set_led_state - sets the led state 890 + */ 891 + static int si470x_set_led_state(struct si470x_device *radio, 892 + unsigned char led_state) 893 + { 894 + unsigned char buf[LED_REPORT_SIZE]; 895 + int retval; 896 + 897 + buf[0] = LED_REPORT; 898 + buf[1] = LED_COMMAND; 899 + buf[2] = led_state; 900 + 901 + retval = si470x_set_report(radio, (void *) &buf, sizeof(buf)); 902 + 903 + return (retval < 0) ? -EINVAL : 0; 904 + } 905 + 906 + 907 + 908 + /************************************************************************** 890 909 * RDS Driver Functions 891 910 **************************************************************************/ 892 911 ··· 1414 1385 }; 1415 1386 1416 1387 /* stereo indicator == stereo (instead of mono) */ 1417 - if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) 1418 - tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; 1419 - else 1388 + if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 0) 1420 1389 tuner->rxsubchans = V4L2_TUNER_SUB_MONO; 1390 + else 1391 + tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; 1421 1392 1422 1393 /* mono/stereo selector */ 1423 - if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1) 1424 - tuner->audmode = V4L2_TUNER_MODE_MONO; 1425 - else 1394 + if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) 1426 1395 tuner->audmode = V4L2_TUNER_MODE_STEREO; 1396 + else 1397 + tuner->audmode = V4L2_TUNER_MODE_MONO; 1427 1398 1428 1399 /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ 1429 - tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) 1430 - * 0x0101; 1400 + /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */ 1401 + tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI); 1402 + /* the ideal factor is 0xffff/75 = 873,8 */ 1403 + tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10); 1431 1404 1432 1405 /* automatic frequency control: -1: freq to low, 1 freq to high */ 1433 1406 /* AFCRL does only indicate that freq. differs, not if too low/high */ ··· 1663 1632 /* set initial frequency */ 1664 1633 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ 1665 1634 1635 + /* set led to connect state */ 1636 + si470x_set_led_state(radio, BLINK_GREEN_LED); 1637 + 1666 1638 /* rds buffer allocation */ 1667 1639 radio->buf_size = rds_buf * 3; 1668 1640 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); ··· 1749 1715 cancel_delayed_work_sync(&radio->work); 1750 1716 usb_set_intfdata(intf, NULL); 1751 1717 if (radio->users == 0) { 1718 + /* set led to disconnect state */ 1719 + si470x_set_led_state(radio, BLINK_ORANGE_LED); 1720 + 1752 1721 video_unregister_device(radio->videodev); 1753 1722 kfree(radio->buffer); 1754 1723 kfree(radio);
+5
drivers/media/video/gspca/gspca.c
··· 422 422 if (urb == NULL) 423 423 break; 424 424 425 + BUG_ON(!gspca_dev->dev); 425 426 gspca_dev->urb[i] = NULL; 426 427 if (!gspca_dev->present) 427 428 usb_kill_urb(urb); ··· 1951 1950 { 1952 1951 struct gspca_dev *gspca_dev = usb_get_intfdata(intf); 1953 1952 1953 + mutex_lock(&gspca_dev->usb_lock); 1954 1954 gspca_dev->present = 0; 1955 + mutex_unlock(&gspca_dev->usb_lock); 1955 1956 1957 + destroy_urbs(gspca_dev); 1958 + gspca_dev->dev = NULL; 1956 1959 usb_set_intfdata(intf, NULL); 1957 1960 1958 1961 /* release the device */
+13 -13
drivers/media/video/ivtv/ivtv-ioctl.c
··· 393 393 return 0; 394 394 } 395 395 396 - v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt); 396 + v4l2_subdev_call(itv->sd_video, video, g_fmt, fmt); 397 397 vbifmt->service_set = ivtv_get_service_set(vbifmt); 398 398 return 0; 399 399 } ··· 1748 1748 break; 1749 1749 } 1750 1750 1751 + case IVTV_IOC_DMA_FRAME: 1752 + case VIDEO_GET_PTS: 1753 + case VIDEO_GET_FRAME_COUNT: 1754 + case VIDEO_GET_EVENT: 1755 + case VIDEO_PLAY: 1756 + case VIDEO_STOP: 1757 + case VIDEO_FREEZE: 1758 + case VIDEO_CONTINUE: 1759 + case VIDEO_COMMAND: 1760 + case VIDEO_TRY_COMMAND: 1761 + return ivtv_decoder_ioctls(file, cmd, (void *)arg); 1762 + 1751 1763 default: 1752 1764 return -EINVAL; 1753 1765 } ··· 1801 1789 itv->audio_bilingual_mode = arg; 1802 1790 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); 1803 1791 return 0; 1804 - 1805 - case IVTV_IOC_DMA_FRAME: 1806 - case VIDEO_GET_PTS: 1807 - case VIDEO_GET_FRAME_COUNT: 1808 - case VIDEO_GET_EVENT: 1809 - case VIDEO_PLAY: 1810 - case VIDEO_STOP: 1811 - case VIDEO_FREEZE: 1812 - case VIDEO_CONTINUE: 1813 - case VIDEO_COMMAND: 1814 - case VIDEO_TRY_COMMAND: 1815 - return ivtv_decoder_ioctls(filp, cmd, (void *)arg); 1816 1792 1817 1793 default: 1818 1794 break;
+2 -2
drivers/mfd/htc-egpio.c
··· 286 286 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 287 287 if (!res) 288 288 goto fail; 289 - ei->base_addr = ioremap_nocache(res->start, res->end - res->start); 289 + ei->base_addr = ioremap_nocache(res->start, resource_size(res)); 290 290 if (!ei->base_addr) 291 291 goto fail; 292 292 pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); ··· 307 307 308 308 ei->nchips = pdata->num_chips; 309 309 ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); 310 - if (!ei) { 310 + if (!ei->chip) { 311 311 ret = -ENOMEM; 312 312 goto fail; 313 313 }
+1
drivers/mfd/pcf50633-core.c
··· 678 678 679 679 static struct i2c_device_id pcf50633_id_table[] = { 680 680 {"pcf50633", 0x73}, 681 + {/* end of list */} 681 682 }; 682 683 683 684 static struct i2c_driver pcf50633_driver = {
+13 -13
drivers/mfd/sm501.c
··· 1050 1050 return gpiochip_add(gchip); 1051 1051 } 1052 1052 1053 - static int sm501_register_gpio(struct sm501_devdata *sm) 1053 + static int __devinit sm501_register_gpio(struct sm501_devdata *sm) 1054 1054 { 1055 1055 struct sm501_gpio *gpio = &sm->gpio; 1056 1056 resource_size_t iobase = sm->io_res->start + SM501_GPIO; ··· 1321 1321 * Common init code for an SM501 1322 1322 */ 1323 1323 1324 - static int sm501_init_dev(struct sm501_devdata *sm) 1324 + static int __devinit sm501_init_dev(struct sm501_devdata *sm) 1325 1325 { 1326 1326 struct sm501_initdata *idata; 1327 1327 struct sm501_platdata *pdata; ··· 1397 1397 return 0; 1398 1398 } 1399 1399 1400 - static int sm501_plat_probe(struct platform_device *dev) 1400 + static int __devinit sm501_plat_probe(struct platform_device *dev) 1401 1401 { 1402 1402 struct sm501_devdata *sm; 1403 1403 int ret; ··· 1586 1586 .gpio_base = -1, 1587 1587 }; 1588 1588 1589 - static int sm501_pci_probe(struct pci_dev *dev, 1590 - const struct pci_device_id *id) 1589 + static int __devinit sm501_pci_probe(struct pci_dev *dev, 1590 + const struct pci_device_id *id) 1591 1591 { 1592 1592 struct sm501_devdata *sm; 1593 1593 int err; ··· 1693 1693 sm501_gpio_remove(sm); 1694 1694 } 1695 1695 1696 - static void sm501_pci_remove(struct pci_dev *dev) 1696 + static void __devexit sm501_pci_remove(struct pci_dev *dev) 1697 1697 { 1698 1698 struct sm501_devdata *sm = pci_get_drvdata(dev); 1699 1699 ··· 1727 1727 1728 1728 MODULE_DEVICE_TABLE(pci, sm501_pci_tbl); 1729 1729 1730 - static struct pci_driver sm501_pci_drv = { 1730 + static struct pci_driver sm501_pci_driver = { 1731 1731 .name = "sm501", 1732 1732 .id_table = sm501_pci_tbl, 1733 1733 .probe = sm501_pci_probe, 1734 - .remove = sm501_pci_remove, 1734 + .remove = __devexit_p(sm501_pci_remove), 1735 1735 }; 1736 1736 1737 1737 MODULE_ALIAS("platform:sm501"); 1738 1738 1739 - static struct platform_driver sm501_plat_drv = { 1739 + static struct platform_driver sm501_plat_driver = { 1740 1740 .driver = { 1741 1741 .name = "sm501", 1742 1742 .owner = THIS_MODULE, ··· 1749 1749 1750 1750 static int __init sm501_base_init(void) 1751 1751 { 1752 - platform_driver_register(&sm501_plat_drv); 1753 - return pci_register_driver(&sm501_pci_drv); 1752 + platform_driver_register(&sm501_plat_driver); 1753 + return pci_register_driver(&sm501_pci_driver); 1754 1754 } 1755 1755 1756 1756 static void __exit sm501_base_exit(void) 1757 1757 { 1758 - platform_driver_unregister(&sm501_plat_drv); 1759 - pci_unregister_driver(&sm501_pci_drv); 1758 + platform_driver_unregister(&sm501_plat_driver); 1759 + pci_unregister_driver(&sm501_pci_driver); 1760 1760 } 1761 1761 1762 1762 module_init(sm501_base_init);
+1 -1
drivers/mfd/twl4030-core.c
··· 38 38 #include <linux/i2c.h> 39 39 #include <linux/i2c/twl4030.h> 40 40 41 - #ifdef CONFIG_ARM 41 + #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 42 42 #include <mach/cpu.h> 43 43 #endif 44 44
+35 -13
drivers/mfd/wm8350-core.c
··· 1111 1111 do { 1112 1112 schedule_timeout_interruptible(1); 1113 1113 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); 1114 - } while (tries-- && (reg & WM8350_AUXADC_POLL)); 1114 + } while (--tries && (reg & WM8350_AUXADC_POLL)); 1115 1115 1116 1116 if (!tries) 1117 1117 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); ··· 1297 1297 int wm8350_device_init(struct wm8350 *wm8350, int irq, 1298 1298 struct wm8350_platform_data *pdata) 1299 1299 { 1300 - int ret = -EINVAL; 1300 + int ret; 1301 1301 u16 id1, id2, mask_rev; 1302 1302 u16 cust_id, mode, chip_rev; 1303 1303 1304 1304 /* get WM8350 revision and config mode */ 1305 - wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); 1306 - wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); 1307 - wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); 1305 + ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); 1306 + if (ret != 0) { 1307 + dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); 1308 + goto err; 1309 + } 1310 + 1311 + ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); 1312 + if (ret != 0) { 1313 + dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); 1314 + goto err; 1315 + } 1316 + 1317 + ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), 1318 + &mask_rev); 1319 + if (ret != 0) { 1320 + dev_err(wm8350->dev, "Failed to read revision: %d\n", ret); 1321 + goto err; 1322 + } 1308 1323 1309 1324 id1 = be16_to_cpu(id1); 1310 1325 id2 = be16_to_cpu(id2); ··· 1419 1404 return ret; 1420 1405 } 1421 1406 1422 - if (pdata && pdata->init) { 1423 - ret = pdata->init(wm8350); 1424 - if (ret != 0) { 1425 - dev_err(wm8350->dev, "Platform init() failed: %d\n", 1426 - ret); 1427 - goto err; 1428 - } 1429 - } 1407 + wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF); 1408 + wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF); 1409 + wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF); 1410 + wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF); 1411 + wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF); 1412 + wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF); 1430 1413 1431 1414 mutex_init(&wm8350->auxadc_mutex); 1432 1415 mutex_init(&wm8350->irq_mutex); ··· 1442 1429 goto err; 1443 1430 } 1444 1431 wm8350->chip_irq = irq; 1432 + 1433 + if (pdata && pdata->init) { 1434 + ret = pdata->init(wm8350); 1435 + if (ret != 0) { 1436 + dev_err(wm8350->dev, "Platform init() failed: %d\n", 1437 + ret); 1438 + goto err; 1439 + } 1440 + } 1445 1441 1446 1442 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); 1447 1443
+1 -1
drivers/mfd/wm8350-regmap.c
··· 3188 3188 { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ 3189 3189 { 0x0000, 0x0000, 0x0000 }, /* R2 */ 3190 3190 { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */ 3191 - { 0xFCF7, 0xFCF7, 0xF800 }, /* R4 - System Control 2 */ 3191 + { 0xFEF7, 0xFEF7, 0xF800 }, /* R4 - System Control 2 */ 3192 3192 { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ 3193 3193 { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ 3194 3194 { 0x0000, 0x0000, 0x0000 }, /* R7 */
+1 -1
drivers/mmc/card/block.c
··· 584 584 if (err) 585 585 goto out; 586 586 587 - string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2, 587 + string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, 588 588 cap_str, sizeof(cap_str)); 589 589 printk(KERN_INFO "%s: %s %s %s %s\n", 590 590 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
+1 -1
drivers/mmc/card/mmc_test.c
··· 494 494 495 495 sg_init_one(&sg, test->buffer, 512); 496 496 497 - ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); 497 + ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0); 498 498 if (ret) 499 499 return ret; 500 500
+3 -2
drivers/mmc/host/atmel-mci.c
··· 1548 1548 { 1549 1549 struct dw_dma_slave *dws = slave; 1550 1550 1551 - if (dws->dma_dev == chan->device->dev) 1551 + if (dws->dma_dev == chan->device->dev) { 1552 + chan->private = dws; 1552 1553 return true; 1553 - else 1554 + } else 1554 1555 return false; 1555 1556 } 1556 1557 #endif
+68 -30
drivers/mmc/host/omap_hsmmc.c
··· 55 55 #define VS30 (1 << 25) 56 56 #define SDVS18 (0x5 << 9) 57 57 #define SDVS30 (0x6 << 9) 58 + #define SDVS33 (0x7 << 9) 58 59 #define SDVSCLR 0xFFFFF1FF 59 60 #define SDVSDET 0x00000400 60 61 #define AUTOIDLE 0x1 ··· 376 375 } 377 376 #endif /* CONFIG_MMC_DEBUG */ 378 377 378 + /* 379 + * MMC controller internal state machines reset 380 + * 381 + * Used to reset command or data internal state machines, using respectively 382 + * SRC or SRD bit of SYSCTL register 383 + * Can be called from interrupt context 384 + */ 385 + static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host, 386 + unsigned long bit) 387 + { 388 + unsigned long i = 0; 389 + unsigned long limit = (loops_per_jiffy * 390 + msecs_to_jiffies(MMC_TIMEOUT_MS)); 391 + 392 + OMAP_HSMMC_WRITE(host->base, SYSCTL, 393 + OMAP_HSMMC_READ(host->base, SYSCTL) | bit); 394 + 395 + while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) && 396 + (i++ < limit)) 397 + cpu_relax(); 398 + 399 + if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit) 400 + dev_err(mmc_dev(host->mmc), 401 + "Timeout waiting on controller reset in %s\n", 402 + __func__); 403 + } 379 404 380 405 /* 381 406 * MMC controller IRQ handler ··· 430 403 (status & CMD_CRC)) { 431 404 if (host->cmd) { 432 405 if (status & CMD_TIMEOUT) { 433 - OMAP_HSMMC_WRITE(host->base, SYSCTL, 434 - OMAP_HSMMC_READ(host->base, 435 - SYSCTL) | SRC); 436 - while (OMAP_HSMMC_READ(host->base, 437 - SYSCTL) & SRC) 438 - ; 439 - 406 + mmc_omap_reset_controller_fsm(host, SRC); 440 407 host->cmd->error = -ETIMEDOUT; 441 408 } else { 442 409 host->cmd->error = -EILSEQ; 443 410 } 444 411 end_cmd = 1; 445 412 } 446 - if (host->data) 413 + if (host->data) { 447 414 mmc_dma_cleanup(host); 415 + mmc_omap_reset_controller_fsm(host, SRD); 416 + } 448 417 } 449 418 if ((status & DATA_TIMEOUT) || 450 419 (status & DATA_CRC)) { ··· 449 426 mmc_dma_cleanup(host); 450 427 else 451 428 host->data->error = -EILSEQ; 452 - OMAP_HSMMC_WRITE(host->base, SYSCTL, 453 - OMAP_HSMMC_READ(host->base, 454 - SYSCTL) | SRD); 455 - while (OMAP_HSMMC_READ(host->base, 456 - SYSCTL) & SRD) 457 - ; 429 + mmc_omap_reset_controller_fsm(host, SRD); 458 430 end_trans = 1; 459 431 } 460 432 } ··· 474 456 } 475 457 476 458 /* 477 - * Switch MMC operating voltage 459 + * Switch MMC interface voltage ... only relevant for MMC1. 460 + * 461 + * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver. 462 + * The MMC2 transceiver controls are used instead of DAT4..DAT7. 463 + * Some chips, like eMMC ones, use internal transceivers. 478 464 */ 479 465 static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) 480 466 { 481 467 u32 reg_val = 0; 482 468 int ret; 469 + 470 + if (host->id != OMAP_MMC1_DEVID) 471 + return 0; 483 472 484 473 /* Disable the clocks */ 485 474 clk_disable(host->fclk); ··· 510 485 OMAP_HSMMC_WRITE(host->base, HCTL, 511 486 OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); 512 487 reg_val = OMAP_HSMMC_READ(host->base, HCTL); 488 + 513 489 /* 514 490 * If a MMC dual voltage card is detected, the set_ios fn calls 515 491 * this fn with VDD bit set for 1.8V. Upon card removal from the 516 492 * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. 517 493 * 518 - * Only MMC1 supports 3.0V. MMC2 will not function if SDVS30 is 519 - * set in HCTL. 494 + * Cope with a bit of slop in the range ... per data sheets: 495 + * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max, 496 + * but recommended values are 1.71V to 1.89V 497 + * - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max, 498 + * but recommended values are 2.7V to 3.3V 499 + * 500 + * Board setup code shouldn't permit anything very out-of-range. 501 + * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the 502 + * middle range) but VSIM can't power DAT4..DAT7 at more than 3V. 520 503 */ 521 - if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) || 522 - ((1 << vdd) == MMC_VDD_33_34))) 523 - reg_val |= SDVS30; 524 - if ((1 << vdd) == MMC_VDD_165_195) 504 + if ((1 << vdd) <= MMC_VDD_23_24) 525 505 reg_val |= SDVS18; 506 + else 507 + reg_val |= SDVS30; 526 508 527 509 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); 528 510 ··· 549 517 { 550 518 struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, 551 519 mmc_carddetect_work); 520 + struct omap_mmc_slot_data *slot = &mmc_slot(host); 521 + 522 + host->carddetect = slot->card_detect(slot->card_detect_irq); 552 523 553 524 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); 554 525 if (host->carddetect) { 555 526 mmc_detect_change(host->mmc, (HZ * 200) / 1000); 556 527 } else { 557 - OMAP_HSMMC_WRITE(host->base, SYSCTL, 558 - OMAP_HSMMC_READ(host->base, SYSCTL) | SRD); 559 - while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD) 560 - ; 561 - 528 + mmc_omap_reset_controller_fsm(host, SRD); 562 529 mmc_detect_change(host->mmc, (HZ * 50) / 1000); 563 530 } 564 531 } ··· 569 538 { 570 539 struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; 571 540 572 - host->carddetect = mmc_slot(host).card_detect(irq); 573 541 schedule_work(&host->mmc_carddetect_work); 574 542 575 543 return IRQ_HANDLED; ··· 787 757 case MMC_POWER_OFF: 788 758 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 789 759 /* 790 - * Reset bus voltage to 3V if it got set to 1.8V earlier. 760 + * Reset interface voltage to 3V if it's 1.8V now; 761 + * only relevant on MMC-1, the others always use 1.8V. 762 + * 791 763 * REVISIT: If we are able to detect cards after unplugging 792 764 * a 1.8V card, this code should not be needed. 793 765 */ 766 + if (host->id != OMAP_MMC1_DEVID) 767 + break; 794 768 if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { 795 769 int vdd = fls(host->mmc->ocr_avail) - 1; 796 770 if (omap_mmc_switch_opcond(host, vdd) != 0) ··· 818 784 } 819 785 820 786 if (host->id == OMAP_MMC1_DEVID) { 821 - /* Only MMC1 can operate at 3V/1.8V */ 787 + /* Only MMC1 can interface at 3V without some flavor 788 + * of external transceiver; but they all handle 1.8V. 789 + */ 822 790 if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && 823 791 (ios->vdd == DUAL_VOLT_OCR_BIT)) { 824 792 /* ··· 1173 1137 " level suspend\n"); 1174 1138 } 1175 1139 1176 - if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { 1140 + if (host->id == OMAP_MMC1_DEVID 1141 + && !(OMAP_HSMMC_READ(host->base, HCTL) 1142 + & SDVSDET)) { 1177 1143 OMAP_HSMMC_WRITE(host->base, HCTL, 1178 1144 OMAP_HSMMC_READ(host->base, HCTL) 1179 1145 & SDVSCLR);
+1 -1
drivers/mmc/host/s3cmci.c
··· 329 329 330 330 to_ptr = host->base + host->sdidata; 331 331 332 - while ((fifo = fifo_free(host))) { 332 + while ((fifo = fifo_free(host)) > 3) { 333 333 if (!host->pio_bytes) { 334 334 res = get_data_buffer(host, &host->pio_bytes, 335 335 &host->pio_ptr);
+1 -2
drivers/mmc/host/sdhci-pci.c
··· 144 144 SDHCI_QUIRK_32BIT_DMA_SIZE | 145 145 SDHCI_QUIRK_32BIT_ADMA_SIZE | 146 146 SDHCI_QUIRK_RESET_AFTER_REQUEST | 147 - SDHCI_QUIRK_BROKEN_SMALL_PIO | 148 - SDHCI_QUIRK_FORCE_HIGHSPEED; 147 + SDHCI_QUIRK_BROKEN_SMALL_PIO; 149 148 } 150 149 151 150 /*
+4 -3
drivers/mmc/host/sdhci.c
··· 1636 1636 mmc->f_max = host->max_clk; 1637 1637 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; 1638 1638 1639 - if ((caps & SDHCI_CAN_DO_HISPD) || 1640 - (host->quirks & SDHCI_QUIRK_FORCE_HIGHSPEED)) 1639 + if (caps & SDHCI_CAN_DO_HISPD) 1641 1640 mmc->caps |= MMC_CAP_SD_HIGHSPEED; 1642 1641 1643 1642 mmc->ocr_avail = 0; ··· 1722 1723 #endif 1723 1724 1724 1725 #ifdef SDHCI_USE_LEDS_CLASS 1725 - host->led.name = mmc_hostname(mmc); 1726 + snprintf(host->led_name, sizeof(host->led_name), 1727 + "%s::", mmc_hostname(mmc)); 1728 + host->led.name = host->led_name; 1726 1729 host->led.brightness = LED_OFF; 1727 1730 host->led.default_trigger = mmc_hostname(mmc); 1728 1731 host->led.brightness_set = sdhci_led_control;
+1 -2
drivers/mmc/host/sdhci.h
··· 208 208 #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) 209 209 /* Controller has an issue with buffer bits for small transfers */ 210 210 #define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) 211 - /* Controller supports high speed but doesn't have the caps bit set */ 212 - #define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14) 213 211 214 212 int irq; /* Device IRQ */ 215 213 void __iomem * ioaddr; /* Mapped address */ ··· 220 222 221 223 #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 222 224 struct led_classdev led; /* LED control */ 225 + char led_name[32]; 223 226 #endif 224 227 225 228 spinlock_t lock; /* Mutex */
+15 -1
drivers/pci/intel-iommu.c
··· 61 61 /* global iommu list, set NULL for ignored DMAR units */ 62 62 static struct intel_iommu **g_iommus; 63 63 64 + static int rwbf_quirk; 65 + 64 66 /* 65 67 * 0: Present 66 68 * 1-11: Reserved ··· 787 785 u32 val; 788 786 unsigned long flag; 789 787 790 - if (!cap_rwbf(iommu->cap)) 788 + if (!rwbf_quirk && !cap_rwbf(iommu->cap)) 791 789 return; 792 790 val = iommu->gcmd | DMA_GCMD_WBF; 793 791 ··· 3139 3137 .unmap = intel_iommu_unmap_range, 3140 3138 .iova_to_phys = intel_iommu_iova_to_phys, 3141 3139 }; 3140 + 3141 + static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) 3142 + { 3143 + /* 3144 + * Mobile 4 Series Chipset neglects to set RWBF capability, 3145 + * but needs it: 3146 + */ 3147 + printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); 3148 + rwbf_quirk = 1; 3149 + } 3150 + 3151 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
+4 -6
drivers/pci/msi.c
··· 103 103 } 104 104 } 105 105 106 - /* 107 - * Essentially, this is ((1 << (1 << x)) - 1), but without the 108 - * undefinedness of a << 32. 109 - */ 110 106 static inline __attribute_const__ u32 msi_mask(unsigned x) 111 107 { 112 - static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff }; 113 - return mask[x]; 108 + /* Don't shift by >= width of type */ 109 + if (x >= 5) 110 + return 0xffffffff; 111 + return (1 << (1 << x)) - 1; 114 112 } 115 113 116 114 static void msix_flush_writes(struct irq_desc *desc)
+9 -4
drivers/pci/pci.c
··· 1540 1540 } 1541 1541 1542 1542 /** 1543 - * pci_request_region - Reserved PCI I/O and memory resource 1543 + * __pci_request_region - Reserved PCI I/O and memory resource 1544 1544 * @pdev: PCI device whose resources are to be reserved 1545 1545 * @bar: BAR to be reserved 1546 1546 * @res_name: Name to be associated with resource. 1547 + * @exclusive: whether the region access is exclusive or not 1547 1548 * 1548 1549 * Mark the PCI region associated with PCI device @pdev BR @bar as 1549 1550 * being reserved by owner @res_name. Do not access any 1550 1551 * address inside the PCI regions unless this call returns 1551 1552 * successfully. 1553 + * 1554 + * If @exclusive is set, then the region is marked so that userspace 1555 + * is explicitly not allowed to map the resource via /dev/mem or 1556 + * sysfs MMIO access. 1552 1557 * 1553 1558 * Returns 0 on success, or %EBUSY on error. A warning 1554 1559 * message is also printed on failure. ··· 1593 1588 } 1594 1589 1595 1590 /** 1596 - * pci_request_region - Reserved PCI I/O and memory resource 1591 + * pci_request_region - Reserve PCI I/O and memory resource 1597 1592 * @pdev: PCI device whose resources are to be reserved 1598 1593 * @bar: BAR to be reserved 1599 - * @res_name: Name to be associated with resource. 1594 + * @res_name: Name to be associated with resource 1600 1595 * 1601 - * Mark the PCI region associated with PCI device @pdev BR @bar as 1596 + * Mark the PCI region associated with PCI device @pdev BAR @bar as 1602 1597 * being reserved by owner @res_name. Do not access any 1603 1598 * address inside the PCI regions unless this call returns 1604 1599 * successfully.
+10 -10
drivers/pci/pci.h
··· 16 16 #endif 17 17 18 18 /** 19 - * Firmware PM callbacks 19 + * struct pci_platform_pm_ops - Firmware PM callbacks 20 20 * 21 - * @is_manageable - returns 'true' if given device is power manageable by the 22 - * platform firmware 21 + * @is_manageable: returns 'true' if given device is power manageable by the 22 + * platform firmware 23 23 * 24 - * @set_state - invokes the platform firmware to set the device's power state 24 + * @set_state: invokes the platform firmware to set the device's power state 25 25 * 26 - * @choose_state - returns PCI power state of given device preferred by the 27 - * platform; to be used during system-wide transitions from a 28 - * sleeping state to the working state and vice versa 26 + * @choose_state: returns PCI power state of given device preferred by the 27 + * platform; to be used during system-wide transitions from a 28 + * sleeping state to the working state and vice versa 29 29 * 30 - * @can_wakeup - returns 'true' if given device is capable of waking up the 31 - * system from a sleeping state 30 + * @can_wakeup: returns 'true' if given device is capable of waking up the 31 + * system from a sleeping state 32 32 * 33 - * @sleep_wake - enables/disables the system wake up capability of given device 33 + * @sleep_wake: enables/disables the system wake up capability of given device 34 34 * 35 35 * If given platform is generally capable of power managing PCI devices, all of 36 36 * these callbacks are mandatory.
+1
drivers/pci/rom.c
··· 55 55 56 56 /** 57 57 * pci_get_rom_size - obtain the actual size of the ROM image 58 + * @pdev: target PCI device 58 59 * @rom: kernel virtual pointer to image of ROM 59 60 * @size: size of PCI window 60 61 * return: size of actual ROM image
+2
drivers/platform/x86/Kconfig
··· 62 62 depends on EXPERIMENTAL 63 63 depends on BACKLIGHT_CLASS_DEVICE 64 64 depends on RFKILL 65 + depends on POWER_SUPPLY 65 66 default n 66 67 ---help--- 67 68 This driver adds support for rfkill and backlight control to Dell ··· 302 301 config EEEPC_LAPTOP 303 302 tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" 304 303 depends on ACPI 304 + depends on INPUT 305 305 depends on EXPERIMENTAL 306 306 select BACKLIGHT_CLASS_DEVICE 307 307 select HWMON
+4
drivers/serial/atmel_serial.c
··· 877 877 } 878 878 } 879 879 880 + /* Save current CSR for comparison in atmel_tasklet_func() */ 881 + atmel_port->irq_status_prev = UART_GET_CSR(port); 882 + atmel_port->irq_status = atmel_port->irq_status_prev; 883 + 880 884 /* 881 885 * Finally, enable the serial port 882 886 */
+3
drivers/serial/jsm/jsm_driver.c
··· 84 84 brd->pci_dev = pdev; 85 85 if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) 86 86 brd->maxports = 4; 87 + else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8) 88 + brd->maxports = 8; 87 89 else 88 90 brd->maxports = 2; 89 91 ··· 214 212 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, 215 213 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, 216 214 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, 215 + { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 }, 217 216 { 0, } 218 217 }; 219 218 MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
+1 -1
drivers/spi/spi_gpio.c
··· 114 114 115 115 static inline int getmiso(const struct spi_device *spi) 116 116 { 117 - return gpio_get_value(SPI_MISO_GPIO); 117 + return !!gpio_get_value(SPI_MISO_GPIO); 118 118 } 119 119 120 120 #undef pdata
+2 -13
drivers/usb/core/hcd-pci.c
··· 298 298 EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); 299 299 300 300 /** 301 - * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled 302 - * @dev: USB Host Controller being resumed 303 - * 304 - * Store this function in the HCD's struct pci_driver as .resume_early. 305 - */ 306 - int usb_hcd_pci_resume_early(struct pci_dev *dev) 307 - { 308 - pci_restore_state(dev); 309 - return 0; 310 - } 311 - EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early); 312 - 313 - /** 314 301 * usb_hcd_pci_resume - power management resume of a PCI-based HCD 315 302 * @dev: USB Host Controller being resumed 316 303 * ··· 319 332 of_node, 0, 1); 320 333 } 321 334 #endif 335 + 336 + pci_restore_state(dev); 322 337 323 338 hcd = pci_get_drvdata(dev); 324 339 if (hcd->state != HC_STATE_SUSPENDED) {
-1
drivers/usb/core/hcd.h
··· 257 257 258 258 #ifdef CONFIG_PM 259 259 extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg); 260 - extern int usb_hcd_pci_resume_early(struct pci_dev *dev); 261 260 extern int usb_hcd_pci_resume(struct pci_dev *dev); 262 261 #endif /* CONFIG_PM */ 263 262
-1
drivers/usb/host/ehci-pci.c
··· 432 432 433 433 #ifdef CONFIG_PM 434 434 .suspend = usb_hcd_pci_suspend, 435 - .resume_early = usb_hcd_pci_resume_early, 436 435 .resume = usb_hcd_pci_resume, 437 436 #endif 438 437 .shutdown = usb_hcd_pci_shutdown,
-1
drivers/usb/host/ohci-pci.c
··· 487 487 488 488 #ifdef CONFIG_PM 489 489 .suspend = usb_hcd_pci_suspend, 490 - .resume_early = usb_hcd_pci_resume_early, 491 490 .resume = usb_hcd_pci_resume, 492 491 #endif 493 492
-1
drivers/usb/host/uhci-hcd.c
··· 942 942 943 943 #ifdef CONFIG_PM 944 944 .suspend = usb_hcd_pci_suspend, 945 - .resume_early = usb_hcd_pci_resume_early, 946 945 .resume = usb_hcd_pci_resume, 947 946 #endif /* PM */ 948 947 };
+2 -2
drivers/usb/host/whci/asl.c
··· 227 227 * Now that the ASL is updated, complete the removal of any 228 228 * removed qsets. 229 229 */ 230 - spin_lock(&whc->lock); 230 + spin_lock_irq(&whc->lock); 231 231 232 232 list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { 233 233 qset_remove_complete(whc, qset); 234 234 } 235 235 236 - spin_unlock(&whc->lock); 236 + spin_unlock_irq(&whc->lock); 237 237 } 238 238 239 239 /**
+2 -2
drivers/usb/host/whci/pzl.c
··· 255 255 * Now that the PZL is updated, complete the removal of any 256 256 * removed qsets. 257 257 */ 258 - spin_lock(&whc->lock); 258 + spin_lock_irq(&whc->lock); 259 259 260 260 list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { 261 261 qset_remove_complete(whc, qset); 262 262 } 263 263 264 - spin_unlock(&whc->lock); 264 + spin_unlock_irq(&whc->lock); 265 265 } 266 266 267 267 /**
+2 -8
drivers/video/Kconfig
··· 1054 1054 1055 1055 config FB_I810 1056 1056 tristate "Intel 810/815 support (EXPERIMENTAL)" 1057 - depends on EXPERIMENTAL && PCI && X86_32 1058 - select AGP 1059 - select AGP_INTEL 1060 - select FB 1057 + depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL 1061 1058 select FB_MODE_HELPERS 1062 1059 select FB_CFB_FILLRECT 1063 1060 select FB_CFB_COPYAREA ··· 1117 1120 1118 1121 config FB_INTEL 1119 1122 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" 1120 - depends on EXPERIMENTAL && PCI && X86 1121 - select FB 1122 - select AGP 1123 - select AGP_INTEL 1123 + depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL 1124 1124 select FB_MODE_HELPERS 1125 1125 select FB_CFB_FILLRECT 1126 1126 select FB_CFB_COPYAREA
+1 -1
drivers/watchdog/Kconfig
··· 406 406 ---help--- 407 407 Hardware driver for the intel TCO timer based watchdog devices. 408 408 These drivers are included in the Intel 82801 I/O Controller 409 - Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB 409 + Hub family (from ICH0 up to ICH10) and in the Intel 63xxESB 410 410 controller hub. 411 411 412 412 The TCO (Total Cost of Ownership) timer is a watchdog timer
+28 -4
drivers/watchdog/iTCO_vendor_support.c
··· 1 1 /* 2 2 * intel TCO vendor specific watchdog driver support 3 3 * 4 - * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. 4 + * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>. 5 5 * 6 6 * This program is free software; you can redistribute it and/or 7 7 * modify it under the terms of the GNU General Public License ··· 19 19 20 20 /* Module and version information */ 21 21 #define DRV_NAME "iTCO_vendor_support" 22 - #define DRV_VERSION "1.02" 22 + #define DRV_VERSION "1.03" 23 23 #define PFX DRV_NAME ": " 24 24 25 25 /* Includes */ ··· 76 76 * time is about 40 seconds, and the minimum hang time is about 77 77 * 20.6 seconds. 78 78 */ 79 + 80 + static void supermicro_old_pre_start(unsigned long acpibase) 81 + { 82 + unsigned long val32; 83 + 84 + /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ 85 + val32 = inl(SMI_EN); 86 + val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ 87 + outl(val32, SMI_EN); /* Needed to activate watchdog */ 88 + } 89 + 90 + static void supermicro_old_pre_stop(unsigned long acpibase) 91 + { 92 + unsigned long val32; 93 + 94 + /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ 95 + val32 = inl(SMI_EN); 96 + val32 |= 0x00002000; /* Turn on SMI clearing watchdog */ 97 + outl(val32, SMI_EN); /* Needed to deactivate watchdog */ 98 + } 79 99 80 100 static void supermicro_old_pre_keepalive(unsigned long acpibase) 81 101 { ··· 248 228 void iTCO_vendor_pre_start(unsigned long acpibase, 249 229 unsigned int heartbeat) 250 230 { 251 - if (vendorsupport == SUPERMICRO_NEW_BOARD) 231 + if (vendorsupport == SUPERMICRO_OLD_BOARD) 232 + supermicro_old_pre_start(acpibase); 233 + else if (vendorsupport == SUPERMICRO_NEW_BOARD) 252 234 supermicro_new_pre_start(heartbeat); 253 235 } 254 236 EXPORT_SYMBOL(iTCO_vendor_pre_start); 255 237 256 238 void iTCO_vendor_pre_stop(unsigned long acpibase) 257 239 { 258 - if (vendorsupport == SUPERMICRO_NEW_BOARD) 240 + if (vendorsupport == SUPERMICRO_OLD_BOARD) 241 + supermicro_old_pre_stop(acpibase); 242 + else if (vendorsupport == SUPERMICRO_NEW_BOARD) 259 243 supermicro_new_pre_stop(); 260 244 } 261 245 EXPORT_SYMBOL(iTCO_vendor_pre_stop);
+14 -21
drivers/watchdog/iTCO_wdt.c
··· 1 1 /* 2 - * intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets) 2 + * intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets) 3 3 * 4 - * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. 4 + * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>. 5 5 * 6 6 * This program is free software; you can redistribute it and/or 7 7 * modify it under the terms of the GNU General Public License ··· 63 63 64 64 /* Module and version information */ 65 65 #define DRV_NAME "iTCO_wdt" 66 - #define DRV_VERSION "1.04" 66 + #define DRV_VERSION "1.05" 67 67 #define PFX DRV_NAME ": " 68 68 69 69 /* Includes */ ··· 236 236 237 237 /* Address definitions for the TCO */ 238 238 /* TCO base address */ 239 - #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 239 + #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 240 240 /* SMI Control and Enable Register */ 241 - #define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 241 + #define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 242 242 243 243 #define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ 244 244 #define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ 245 - #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ 246 - #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ 247 - #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ 248 - #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ 245 + #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ 246 + #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ 247 + #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ 248 + #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ 249 249 #define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ 250 250 #define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ 251 251 #define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ ··· 338 338 static int iTCO_wdt_start(void) 339 339 { 340 340 unsigned int val; 341 - unsigned long val32; 342 341 343 342 spin_lock(&iTCO_wdt_private.io_lock); 344 343 ··· 349 350 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); 350 351 return -EIO; 351 352 } 352 - 353 - /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ 354 - val32 = inl(SMI_EN); 355 - val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ 356 - outl(val32, SMI_EN); 357 353 358 354 /* Force the timer to its reload value by writing to the TCO_RLD 359 355 register */ ··· 372 378 static int iTCO_wdt_stop(void) 373 379 { 374 380 unsigned int val; 375 - unsigned long val32; 376 381 377 382 spin_lock(&iTCO_wdt_private.io_lock); 378 383 ··· 382 389 val |= 0x0800; 383 390 outw(val, TCO1_CNT); 384 391 val = inw(TCO1_CNT); 385 - 386 - /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ 387 - val32 = inl(SMI_EN); 388 - val32 |= 0x00002000; 389 - outl(val32, SMI_EN); 390 392 391 393 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ 392 394 iTCO_wdt_set_NO_REBOOT_bit(); ··· 637 649 int ret; 638 650 u32 base_address; 639 651 unsigned long RCBA; 652 + unsigned long val32; 640 653 641 654 /* 642 655 * Find the ACPI/PM base I/O address which is the base ··· 684 695 ret = -EIO; 685 696 goto out; 686 697 } 698 + /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ 699 + val32 = inl(SMI_EN); 700 + val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ 701 + outl(val32, SMI_EN); 687 702 688 703 /* The TCO I/O registers reside in a 32-byte range pointed to 689 704 by the TCOBASE value */
+3 -2
fs/bio.c
··· 302 302 struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) 303 303 { 304 304 struct bio *bio = NULL; 305 + void *p; 305 306 306 307 if (bs) { 307 - void *p = mempool_alloc(bs->bio_pool, gfp_mask); 308 + p = mempool_alloc(bs->bio_pool, gfp_mask); 308 309 309 310 if (p) 310 311 bio = p + bs->front_pad; ··· 330 329 } 331 330 if (unlikely(!bvl)) { 332 331 if (bs) 333 - mempool_free(bio, bs->bio_pool); 332 + mempool_free(p, bs->bio_pool); 334 333 else 335 334 kfree(bio); 336 335 bio = NULL;
+37 -21
fs/btrfs/ctree.c
··· 38 38 static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, 39 39 struct btrfs_path *path, int level, int slot); 40 40 41 - inline void btrfs_init_path(struct btrfs_path *p) 42 - { 43 - memset(p, 0, sizeof(*p)); 44 - } 45 - 46 41 struct btrfs_path *btrfs_alloc_path(void) 47 42 { 48 43 struct btrfs_path *path; 49 - path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS); 50 - if (path) { 51 - btrfs_init_path(path); 44 + path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); 45 + if (path) 52 46 path->reada = 1; 53 - } 54 47 return path; 55 48 } 56 49 ··· 62 69 63 70 /* 64 71 * reset all the locked nodes in the patch to spinning locks. 72 + * 73 + * held is used to keep lockdep happy, when lockdep is enabled 74 + * we set held to a blocking lock before we go around and 75 + * retake all the spinlocks in the path. You can safely use NULL 76 + * for held 65 77 */ 66 - noinline void btrfs_clear_path_blocking(struct btrfs_path *p) 78 + noinline void btrfs_clear_path_blocking(struct btrfs_path *p, 79 + struct extent_buffer *held) 67 80 { 68 81 int i; 69 - for (i = 0; i < BTRFS_MAX_LEVEL; i++) { 82 + 83 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 84 + /* lockdep really cares that we take all of these spinlocks 85 + * in the right order. If any of the locks in the path are not 86 + * currently blocking, it is going to complain. So, make really 87 + * really sure by forcing the path to blocking before we clear 88 + * the path blocking. 89 + */ 90 + if (held) 91 + btrfs_set_lock_blocking(held); 92 + btrfs_set_path_blocking(p); 93 + #endif 94 + 95 + for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { 70 96 if (p->nodes[i] && p->locks[i]) 71 97 btrfs_clear_lock_blocking(p->nodes[i]); 72 98 } 99 + 100 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 101 + if (held) 102 + btrfs_clear_lock_blocking(held); 103 + #endif 73 104 } 74 105 75 106 /* this also releases the path */ ··· 303 286 trans->transid, level, &ins); 304 287 BUG_ON(ret); 305 288 cow = btrfs_init_new_buffer(trans, root, prealloc_dest, 306 - buf->len); 289 + buf->len, level); 307 290 } else { 308 291 cow = btrfs_alloc_free_block(trans, root, buf->len, 309 292 parent_start, ··· 934 917 935 918 /* promote the child to a root */ 936 919 child = read_node_slot(root, mid, 0); 920 + BUG_ON(!child); 937 921 btrfs_tree_lock(child); 938 922 btrfs_set_lock_blocking(child); 939 - BUG_ON(!child); 940 923 ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); 941 924 BUG_ON(ret); 942 925 ··· 1583 1566 if (!p->skip_locking) 1584 1567 p->locks[level] = 1; 1585 1568 1586 - btrfs_clear_path_blocking(p); 1569 + btrfs_clear_path_blocking(p, NULL); 1587 1570 1588 1571 /* 1589 1572 * we have a lock on b and as long as we aren't changing ··· 1622 1605 1623 1606 btrfs_set_path_blocking(p); 1624 1607 sret = split_node(trans, root, p, level); 1625 - btrfs_clear_path_blocking(p); 1608 + btrfs_clear_path_blocking(p, NULL); 1626 1609 1627 1610 BUG_ON(sret > 0); 1628 1611 if (sret) { ··· 1642 1625 1643 1626 btrfs_set_path_blocking(p); 1644 1627 sret = balance_level(trans, root, p, level); 1645 - btrfs_clear_path_blocking(p); 1628 + btrfs_clear_path_blocking(p, NULL); 1646 1629 1647 1630 if (sret) { 1648 1631 ret = sret; ··· 1705 1688 if (!p->skip_locking) { 1706 1689 int lret; 1707 1690 1708 - btrfs_clear_path_blocking(p); 1691 + btrfs_clear_path_blocking(p, NULL); 1709 1692 lret = btrfs_try_spin_lock(b); 1710 1693 1711 1694 if (!lret) { 1712 1695 btrfs_set_path_blocking(p); 1713 1696 btrfs_tree_lock(b); 1714 - btrfs_clear_path_blocking(p); 1697 + btrfs_clear_path_blocking(p, b); 1715 1698 } 1716 1699 } 1717 1700 } else { ··· 1723 1706 btrfs_set_path_blocking(p); 1724 1707 sret = split_leaf(trans, root, key, 1725 1708 p, ins_len, ret == 0); 1726 - btrfs_clear_path_blocking(p); 1709 + btrfs_clear_path_blocking(p, NULL); 1727 1710 1728 1711 BUG_ON(sret > 0); 1729 1712 if (sret) { ··· 3943 3926 btrfs_release_path(root, path); 3944 3927 goto again; 3945 3928 } else { 3946 - btrfs_clear_path_blocking(path); 3947 3929 goto out; 3948 3930 } 3949 3931 } ··· 3962 3946 path->locks[level - 1] = 1; 3963 3947 path->nodes[level - 1] = cur; 3964 3948 unlock_up(path, level, 1); 3965 - btrfs_clear_path_blocking(path); 3949 + btrfs_clear_path_blocking(path, NULL); 3966 3950 } 3967 3951 out: 3968 3952 if (ret == 0)
+3 -8
fs/btrfs/ctree.h
··· 43 43 44 44 #define BTRFS_ACL_NOT_CACHED ((void *)-1) 45 45 46 - #ifdef CONFIG_LOCKDEP 47 - # define BTRFS_MAX_LEVEL 7 48 - #else 49 - # define BTRFS_MAX_LEVEL 8 50 - #endif 46 + #define BTRFS_MAX_LEVEL 8 51 47 52 48 /* holds pointers to all of the tree roots */ 53 49 #define BTRFS_ROOT_TREE_OBJECTID 1ULL ··· 1711 1715 u64 empty_size); 1712 1716 struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 1713 1717 struct btrfs_root *root, 1714 - u64 bytenr, u32 blocksize); 1718 + u64 bytenr, u32 blocksize, 1719 + int level); 1715 1720 int btrfs_alloc_extent(struct btrfs_trans_handle *trans, 1716 1721 struct btrfs_root *root, 1717 1722 u64 num_bytes, u64 parent, u64 min_bytes, ··· 1831 1834 void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); 1832 1835 struct btrfs_path *btrfs_alloc_path(void); 1833 1836 void btrfs_free_path(struct btrfs_path *p); 1834 - void btrfs_init_path(struct btrfs_path *p); 1835 1837 void btrfs_set_path_blocking(struct btrfs_path *p); 1836 - void btrfs_clear_path_blocking(struct btrfs_path *p); 1837 1838 void btrfs_unlock_up_safe(struct btrfs_path *p, int level); 1838 1839 1839 1840 int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+45 -1
fs/btrfs/disk-io.c
··· 75 75 struct btrfs_work work; 76 76 }; 77 77 78 + /* These are used to set the lockdep class on the extent buffer locks. 79 + * The class is set by the readpage_end_io_hook after the buffer has 80 + * passed csum validation but before the pages are unlocked. 81 + * 82 + * The lockdep class is also set by btrfs_init_new_buffer on freshly 83 + * allocated blocks. 84 + * 85 + * The class is based on the level in the tree block, which allows lockdep 86 + * to know that lower nodes nest inside the locks of higher nodes. 87 + * 88 + * We also add a check to make sure the highest level of the tree is 89 + * the same as our lockdep setup here. If BTRFS_MAX_LEVEL changes, this 90 + * code needs update as well. 91 + */ 92 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 93 + # if BTRFS_MAX_LEVEL != 8 94 + # error 95 + # endif 96 + static struct lock_class_key btrfs_eb_class[BTRFS_MAX_LEVEL + 1]; 97 + static const char *btrfs_eb_name[BTRFS_MAX_LEVEL + 1] = { 98 + /* leaf */ 99 + "btrfs-extent-00", 100 + "btrfs-extent-01", 101 + "btrfs-extent-02", 102 + "btrfs-extent-03", 103 + "btrfs-extent-04", 104 + "btrfs-extent-05", 105 + "btrfs-extent-06", 106 + "btrfs-extent-07", 107 + /* highest possible level */ 108 + "btrfs-extent-08", 109 + }; 110 + #endif 111 + 78 112 /* 79 113 * extents on the btree inode are pretty simple, there's one extent 80 114 * that covers the entire device ··· 381 347 return ret; 382 348 } 383 349 350 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 351 + void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level) 352 + { 353 + lockdep_set_class_and_name(&eb->lock, 354 + &btrfs_eb_class[level], 355 + btrfs_eb_name[level]); 356 + } 357 + #endif 358 + 384 359 static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, 385 360 struct extent_state *state) 386 361 { ··· 434 391 goto err; 435 392 } 436 393 found_level = btrfs_header_level(eb); 394 + 395 + btrfs_set_buffer_lockdep_class(eb, found_level); 437 396 438 397 ret = csum_tree_block(root, eb, 1); 439 398 if (ret) ··· 1822 1777 ret = find_and_setup_root(tree_root, fs_info, 1823 1778 BTRFS_DEV_TREE_OBJECTID, dev_root); 1824 1779 dev_root->track_dirty = 1; 1825 - 1826 1780 if (ret) 1827 1781 goto fail_extent_root; 1828 1782
+10
fs/btrfs/disk-io.h
··· 101 101 int btrfs_add_log_tree(struct btrfs_trans_handle *trans, 102 102 struct btrfs_root *root); 103 103 int btree_lock_page_hook(struct page *page); 104 + 105 + 106 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 107 + void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level); 108 + #else 109 + static inline void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, 110 + int level) 111 + { 112 + } 113 + #endif 104 114 #endif
+51 -32
fs/btrfs/extent-tree.c
··· 1323 1323 int btrfs_extent_post_op(struct btrfs_trans_handle *trans, 1324 1324 struct btrfs_root *root) 1325 1325 { 1326 - finish_current_insert(trans, root->fs_info->extent_root, 1); 1327 - del_pending_extents(trans, root->fs_info->extent_root, 1); 1326 + u64 start; 1327 + u64 end; 1328 + int ret; 1329 + 1330 + while(1) { 1331 + finish_current_insert(trans, root->fs_info->extent_root, 1); 1332 + del_pending_extents(trans, root->fs_info->extent_root, 1); 1333 + 1334 + /* is there more work to do? */ 1335 + ret = find_first_extent_bit(&root->fs_info->pending_del, 1336 + 0, &start, &end, EXTENT_WRITEBACK); 1337 + if (!ret) 1338 + continue; 1339 + ret = find_first_extent_bit(&root->fs_info->extent_ins, 1340 + 0, &start, &end, EXTENT_WRITEBACK); 1341 + if (!ret) 1342 + continue; 1343 + break; 1344 + } 1328 1345 return 0; 1329 1346 } 1330 1347 ··· 2228 2211 u64 end; 2229 2212 u64 priv; 2230 2213 u64 search = 0; 2231 - u64 skipped = 0; 2232 2214 struct btrfs_fs_info *info = extent_root->fs_info; 2233 2215 struct btrfs_path *path; 2234 2216 struct pending_extent_op *extent_op, *tmp; 2235 2217 struct list_head insert_list, update_list; 2236 2218 int ret; 2237 - int num_inserts = 0, max_inserts; 2219 + int num_inserts = 0, max_inserts, restart = 0; 2238 2220 2239 2221 path = btrfs_alloc_path(); 2240 2222 INIT_LIST_HEAD(&insert_list); ··· 2249 2233 ret = find_first_extent_bit(&info->extent_ins, search, &start, 2250 2234 &end, EXTENT_WRITEBACK); 2251 2235 if (ret) { 2252 - if (skipped && all && !num_inserts && 2236 + if (restart && !num_inserts && 2253 2237 list_empty(&update_list)) { 2254 - skipped = 0; 2238 + restart = 0; 2255 2239 search = 0; 2256 2240 continue; 2257 2241 } 2258 - mutex_unlock(&info->extent_ins_mutex); 2259 2242 break; 2260 2243 } 2261 2244 2262 2245 ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); 2263 2246 if (!ret) { 2264 - skipped = 1; 2247 + if (all) 2248 + restart = 1; 2265 2249 search = end + 1; 2266 2250 if (need_resched()) { 2267 2251 mutex_unlock(&info->extent_ins_mutex); ··· 2280 2264 list_add_tail(&extent_op->list, &insert_list); 2281 2265 search = end + 1; 2282 2266 if (num_inserts == max_inserts) { 2283 - mutex_unlock(&info->extent_ins_mutex); 2267 + restart = 1; 2284 2268 break; 2285 2269 } 2286 2270 } else if (extent_op->type == PENDING_BACKREF_UPDATE) { ··· 2296 2280 * somebody marked this thing for deletion then just unlock it and be 2297 2281 * done, the free_extents will handle it 2298 2282 */ 2299 - mutex_lock(&info->extent_ins_mutex); 2300 2283 list_for_each_entry_safe(extent_op, tmp, &update_list, list) { 2301 2284 clear_extent_bits(&info->extent_ins, extent_op->bytenr, 2302 2285 extent_op->bytenr + extent_op->num_bytes - 1, ··· 2317 2302 if (!list_empty(&update_list)) { 2318 2303 ret = update_backrefs(trans, extent_root, path, &update_list); 2319 2304 BUG_ON(ret); 2305 + 2306 + /* we may have COW'ed new blocks, so lets start over */ 2307 + if (all) 2308 + restart = 1; 2320 2309 } 2321 2310 2322 2311 /* ··· 2328 2309 * need to make sure everything is cleaned then reset everything and 2329 2310 * go back to the beginning 2330 2311 */ 2331 - if (!num_inserts && all && skipped) { 2312 + if (!num_inserts && restart) { 2332 2313 search = 0; 2333 - skipped = 0; 2314 + restart = 0; 2334 2315 INIT_LIST_HEAD(&update_list); 2335 2316 INIT_LIST_HEAD(&insert_list); 2336 2317 goto again; ··· 2387 2368 BUG_ON(ret); 2388 2369 2389 2370 /* 2390 - * if we broke out of the loop in order to insert stuff because we hit 2391 - * the maximum number of inserts at a time we can handle, then loop 2392 - * back and pick up where we left off 2371 + * if restart is set for whatever reason we need to go back and start 2372 + * searching through the pending list again. 2373 + * 2374 + * We just inserted some extents, which could have resulted in new 2375 + * blocks being allocated, which would result in new blocks needing 2376 + * updates, so if all is set we _must_ restart to get the updated 2377 + * blocks. 2393 2378 */ 2394 - if (num_inserts == max_inserts) { 2395 - INIT_LIST_HEAD(&insert_list); 2396 - INIT_LIST_HEAD(&update_list); 2397 - num_inserts = 0; 2398 - goto again; 2399 - } 2400 - 2401 - /* 2402 - * again, if we need to make absolutely sure there are no more pending 2403 - * extent operations left and we know that we skipped some, go back to 2404 - * the beginning and do it all again 2405 - */ 2406 - if (all && skipped) { 2379 + if (restart || all) { 2407 2380 INIT_LIST_HEAD(&insert_list); 2408 2381 INIT_LIST_HEAD(&update_list); 2409 2382 search = 0; 2410 - skipped = 0; 2383 + restart = 0; 2411 2384 num_inserts = 0; 2412 2385 goto again; 2413 2386 } ··· 2720 2709 goto again; 2721 2710 } 2722 2711 2712 + if (!err) 2713 + finish_current_insert(trans, extent_root, 0); 2723 2714 return err; 2724 2715 } 2725 2716 ··· 2872 2859 2873 2860 if (data & BTRFS_BLOCK_GROUP_METADATA) { 2874 2861 last_ptr = &root->fs_info->last_alloc; 2875 - empty_cluster = 64 * 1024; 2862 + if (!btrfs_test_opt(root, SSD)) 2863 + empty_cluster = 64 * 1024; 2876 2864 } 2877 2865 2878 2866 if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) ··· 3416 3402 3417 3403 struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 3418 3404 struct btrfs_root *root, 3419 - u64 bytenr, u32 blocksize) 3405 + u64 bytenr, u32 blocksize, 3406 + int level) 3420 3407 { 3421 3408 struct extent_buffer *buf; 3422 3409 ··· 3425 3410 if (!buf) 3426 3411 return ERR_PTR(-ENOMEM); 3427 3412 btrfs_set_header_generation(buf, trans->transid); 3413 + btrfs_set_buffer_lockdep_class(buf, level); 3428 3414 btrfs_tree_lock(buf); 3429 3415 clean_tree_block(trans, root, buf); 3430 3416 ··· 3469 3453 return ERR_PTR(ret); 3470 3454 } 3471 3455 3472 - buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize); 3456 + buf = btrfs_init_new_buffer(trans, root, ins.objectid, 3457 + blocksize, level); 3473 3458 return buf; 3474 3459 } 3475 3460 ··· 5658 5641 prev_block = block_start; 5659 5642 } 5660 5643 5644 + mutex_lock(&extent_root->fs_info->trans_mutex); 5661 5645 btrfs_record_root_in_trans(found_root); 5646 + mutex_unlock(&extent_root->fs_info->trans_mutex); 5662 5647 if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { 5663 5648 /* 5664 5649 * try to update data extent references while
-2
fs/btrfs/extent_io.c
··· 415 415 416 416 node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); 417 417 if (node) { 418 - struct extent_state *found; 419 - found = rb_entry(node, struct extent_state, rb_node); 420 418 free_extent_state(prealloc); 421 419 return -EEXIST; 422 420 }
-1
fs/btrfs/inode-map.c
··· 84 84 search_key.type = 0; 85 85 search_key.offset = 0; 86 86 87 - btrfs_init_path(path); 88 87 start_found = 0; 89 88 ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); 90 89 if (ret < 0)
+1 -3
fs/btrfs/inode.c
··· 2531 2531 key.offset = (u64)-1; 2532 2532 key.type = (u8)-1; 2533 2533 2534 - btrfs_init_path(path); 2535 - 2536 2534 search_again: 2537 2535 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 2538 2536 if (ret < 0) ··· 4261 4263 { 4262 4264 if (PageWriteback(page) || PageDirty(page)) 4263 4265 return 0; 4264 - return __btrfs_releasepage(page, gfp_flags); 4266 + return __btrfs_releasepage(page, gfp_flags & GFP_NOFS); 4265 4267 } 4266 4268 4267 4269 static void btrfs_invalidatepage(struct page *page, unsigned long offset)
-11
fs/btrfs/locking.c
··· 25 25 #include "extent_io.h" 26 26 #include "locking.h" 27 27 28 - /* 29 - * btrfs_header_level() isn't free, so don't call it when lockdep isn't 30 - * on 31 - */ 32 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 33 - static inline void spin_nested(struct extent_buffer *eb) 34 - { 35 - spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb)); 36 - } 37 - #else 38 28 static inline void spin_nested(struct extent_buffer *eb) 39 29 { 40 30 spin_lock(&eb->lock); 41 31 } 42 - #endif 43 32 44 33 /* 45 34 * Setting a lock to blocking will drop the spinlock and set the
+4 -1
fs/btrfs/super.c
··· 379 379 btrfs_start_delalloc_inodes(root); 380 380 btrfs_wait_ordered_extents(root, 0); 381 381 382 - btrfs_clean_old_snapshots(root); 383 382 trans = btrfs_start_transaction(root, 1); 384 383 ret = btrfs_commit_transaction(trans, root); 385 384 sb->s_dirt = 0; ··· 509 510 { 510 511 struct btrfs_root *root = btrfs_sb(sb); 511 512 int ret; 513 + 514 + ret = btrfs_parse_options(root, data); 515 + if (ret) 516 + return -EINVAL; 512 517 513 518 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 514 519 return 0;
+2
fs/btrfs/transaction.c
··· 688 688 num_bytes -= btrfs_root_used(&dirty->root->root_item); 689 689 bytes_used = btrfs_root_used(&root->root_item); 690 690 if (num_bytes) { 691 + mutex_lock(&root->fs_info->trans_mutex); 691 692 btrfs_record_root_in_trans(root); 693 + mutex_unlock(&root->fs_info->trans_mutex); 692 694 btrfs_set_root_used(&root->root_item, 693 695 bytes_used - num_bytes); 694 696 }
+2
fs/btrfs/tree-log.c
··· 2832 2832 BUG_ON(!wc.replay_dest); 2833 2833 2834 2834 wc.replay_dest->log_root = log; 2835 + mutex_lock(&fs_info->trans_mutex); 2835 2836 btrfs_record_root_in_trans(wc.replay_dest); 2837 + mutex_unlock(&fs_info->trans_mutex); 2836 2838 ret = walk_log_tree(trans, log, &wc); 2837 2839 BUG_ON(ret); 2838 2840
+2 -4
fs/btrfs/volumes.c
··· 2894 2894 free_extent_map(em); 2895 2895 } 2896 2896 2897 - map = kzalloc(sizeof(*map), GFP_NOFS); 2898 - if (!map) 2899 - return -ENOMEM; 2900 - 2901 2897 em = alloc_extent_map(GFP_NOFS); 2902 2898 if (!em) 2903 2899 return -ENOMEM; ··· 3102 3106 if (!sb) 3103 3107 return -ENOMEM; 3104 3108 btrfs_set_buffer_uptodate(sb); 3109 + btrfs_set_buffer_lockdep_class(sb, 0); 3110 + 3105 3111 write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); 3106 3112 array_size = btrfs_super_sys_array_size(super_copy); 3107 3113
+2 -1
fs/buffer.c
··· 777 777 __inc_zone_page_state(page, NR_FILE_DIRTY); 778 778 __inc_bdi_stat(mapping->backing_dev_info, 779 779 BDI_RECLAIMABLE); 780 + task_dirty_inc(current); 780 781 task_io_account_write(PAGE_CACHE_SIZE); 781 782 } 782 783 radix_tree_tag_set(&mapping->page_tree, ··· 3109 3108 if (test_clear_buffer_dirty(bh)) { 3110 3109 get_bh(bh); 3111 3110 bh->b_end_io = end_buffer_write_sync; 3112 - ret = submit_bh(WRITE_SYNC, bh); 3111 + ret = submit_bh(WRITE, bh); 3113 3112 wait_on_buffer(bh); 3114 3113 if (buffer_eopnotsupp(bh)) { 3115 3114 clear_buffer_eopnotsupp(bh);
+2
fs/compat_ioctl.c
··· 1938 1938 /* Big K */ 1939 1939 COMPATIBLE_IOCTL(PIO_FONT) 1940 1940 COMPATIBLE_IOCTL(GIO_FONT) 1941 + COMPATIBLE_IOCTL(PIO_CMAP) 1942 + COMPATIBLE_IOCTL(GIO_CMAP) 1941 1943 ULONG_IOCTL(KDSIGACCEPT) 1942 1944 COMPATIBLE_IOCTL(KDGETKEYCODE) 1943 1945 COMPATIBLE_IOCTL(KDSETKEYCODE)
+1 -1
fs/ext4/ext4.h
··· 868 868 { 869 869 unsigned len = le16_to_cpu(dlen); 870 870 871 - if (len == EXT4_MAX_REC_LEN) 871 + if (len == EXT4_MAX_REC_LEN || len == 0) 872 872 return 1 << 16; 873 873 return len; 874 874 }
+23 -4
fs/ext4/inode.c
··· 47 47 static inline int ext4_begin_ordered_truncate(struct inode *inode, 48 48 loff_t new_size) 49 49 { 50 - return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode, 51 - new_size); 50 + return jbd2_journal_begin_ordered_truncate( 51 + EXT4_SB(inode->i_sb)->s_journal, 52 + &EXT4_I(inode)->jinode, 53 + new_size); 52 54 } 53 55 54 56 static void ext4_invalidatepage(struct page *page, unsigned long offset); ··· 2439 2437 int no_nrwrite_index_update; 2440 2438 int pages_written = 0; 2441 2439 long pages_skipped; 2440 + int range_cyclic, cycled = 1, io_done = 0; 2442 2441 int needed_blocks, ret = 0, nr_to_writebump = 0; 2443 2442 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); 2444 2443 ··· 2491 2488 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) 2492 2489 range_whole = 1; 2493 2490 2494 - if (wbc->range_cyclic) 2491 + range_cyclic = wbc->range_cyclic; 2492 + if (wbc->range_cyclic) { 2495 2493 index = mapping->writeback_index; 2496 - else 2494 + if (index) 2495 + cycled = 0; 2496 + wbc->range_start = index << PAGE_CACHE_SHIFT; 2497 + wbc->range_end = LLONG_MAX; 2498 + wbc->range_cyclic = 0; 2499 + } else 2497 2500 index = wbc->range_start >> PAGE_CACHE_SHIFT; 2498 2501 2499 2502 mpd.wbc = wbc; ··· 2513 2504 wbc->no_nrwrite_index_update = 1; 2514 2505 pages_skipped = wbc->pages_skipped; 2515 2506 2507 + retry: 2516 2508 while (!ret && wbc->nr_to_write > 0) { 2517 2509 2518 2510 /* ··· 2556 2546 pages_written += mpd.pages_written; 2557 2547 wbc->pages_skipped = pages_skipped; 2558 2548 ret = 0; 2549 + io_done = 1; 2559 2550 } else if (wbc->nr_to_write) 2560 2551 /* 2561 2552 * There is no more writeout needed ··· 2565 2554 */ 2566 2555 break; 2567 2556 } 2557 + if (!io_done && !cycled) { 2558 + cycled = 1; 2559 + index = 0; 2560 + wbc->range_start = index << PAGE_CACHE_SHIFT; 2561 + wbc->range_end = mapping->writeback_index - 1; 2562 + goto retry; 2563 + } 2568 2564 if (pages_skipped != wbc->pages_skipped) 2569 2565 printk(KERN_EMERG "This should not happen leaving %s " 2570 2566 "with nr_to_write = %ld ret = %d\n", ··· 2579 2561 2580 2562 /* Update index */ 2581 2563 index += pages_written; 2564 + wbc->range_cyclic = range_cyclic; 2582 2565 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) 2583 2566 /* 2584 2567 * set the writeback_index so that range_cyclic
+19 -13
fs/ext4/mballoc.c
··· 3693 3693 pa->pa_free = pa->pa_len; 3694 3694 atomic_set(&pa->pa_count, 1); 3695 3695 spin_lock_init(&pa->pa_lock); 3696 + INIT_LIST_HEAD(&pa->pa_inode_list); 3697 + INIT_LIST_HEAD(&pa->pa_group_list); 3696 3698 pa->pa_deleted = 0; 3697 3699 pa->pa_linear = 0; 3698 3700 ··· 3757 3755 atomic_set(&pa->pa_count, 1); 3758 3756 spin_lock_init(&pa->pa_lock); 3759 3757 INIT_LIST_HEAD(&pa->pa_inode_list); 3758 + INIT_LIST_HEAD(&pa->pa_group_list); 3760 3759 pa->pa_deleted = 0; 3761 3760 pa->pa_linear = 1; 3762 3761 ··· 4479 4476 pa->pa_free -= ac->ac_b_ex.fe_len; 4480 4477 pa->pa_len -= ac->ac_b_ex.fe_len; 4481 4478 spin_unlock(&pa->pa_lock); 4482 - /* 4483 - * We want to add the pa to the right bucket. 4484 - * Remove it from the list and while adding 4485 - * make sure the list to which we are adding 4486 - * doesn't grow big. 4487 - */ 4488 - if (likely(pa->pa_free)) { 4489 - spin_lock(pa->pa_obj_lock); 4490 - list_del_rcu(&pa->pa_inode_list); 4491 - spin_unlock(pa->pa_obj_lock); 4492 - ext4_mb_add_n_trim(ac); 4493 - } 4494 4479 } 4495 - ext4_mb_put_pa(ac, ac->ac_sb, pa); 4496 4480 } 4497 4481 if (ac->alloc_semp) 4498 4482 up_read(ac->alloc_semp); 4483 + if (pa) { 4484 + /* 4485 + * We want to add the pa to the right bucket. 4486 + * Remove it from the list and while adding 4487 + * make sure the list to which we are adding 4488 + * doesn't grow big. We need to release 4489 + * alloc_semp before calling ext4_mb_add_n_trim() 4490 + */ 4491 + if (pa->pa_linear && likely(pa->pa_free)) { 4492 + spin_lock(pa->pa_obj_lock); 4493 + list_del_rcu(&pa->pa_inode_list); 4494 + spin_unlock(pa->pa_obj_lock); 4495 + ext4_mb_add_n_trim(ac); 4496 + } 4497 + ext4_mb_put_pa(ac, ac->ac_sb, pa); 4498 + } 4499 4499 if (ac->ac_bitmap_page) 4500 4500 page_cache_release(ac->ac_bitmap_page); 4501 4501 if (ac->ac_buddy_page)
+3 -5
fs/ext4/migrate.c
··· 481 481 + 1); 482 482 if (IS_ERR(handle)) { 483 483 retval = PTR_ERR(handle); 484 - goto err_out; 484 + return retval; 485 485 } 486 486 tmp_inode = ext4_new_inode(handle, 487 487 inode->i_sb->s_root->d_inode, ··· 489 489 if (IS_ERR(tmp_inode)) { 490 490 retval = -ENOMEM; 491 491 ext4_journal_stop(handle); 492 - tmp_inode = NULL; 493 - goto err_out; 492 + return retval; 494 493 } 495 494 i_size_write(tmp_inode, i_size_read(inode)); 496 495 /* ··· 617 618 618 619 ext4_journal_stop(handle); 619 620 620 - if (tmp_inode) 621 - iput(tmp_inode); 621 + iput(tmp_inode); 622 622 623 623 return retval; 624 624 }
+7 -4
fs/ext4/super.c
··· 3046 3046 static int ext4_sync_fs(struct super_block *sb, int wait) 3047 3047 { 3048 3048 int ret = 0; 3049 + tid_t target; 3049 3050 3050 3051 trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); 3051 3052 sb->s_dirt = 0; 3052 3053 if (EXT4_SB(sb)->s_journal) { 3053 - if (wait) 3054 - ret = ext4_force_commit(sb); 3055 - else 3056 - jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); 3054 + if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, 3055 + &target)) { 3056 + if (wait) 3057 + jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, 3058 + target); 3059 + } 3057 3060 } else { 3058 3061 ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); 3059 3062 }
+11 -6
fs/jbd2/journal.c
··· 450 450 } 451 451 452 452 /* 453 - * Called under j_state_lock. Returns true if a transaction was started. 453 + * Called under j_state_lock. Returns true if a transaction commit was started. 454 454 */ 455 455 int __jbd2_log_start_commit(journal_t *journal, tid_t target) 456 456 { ··· 518 518 519 519 /* 520 520 * Start a commit of the current running transaction (if any). Returns true 521 - * if a transaction was started, and fills its tid in at *ptid 521 + * if a transaction is going to be committed (or is currently already 522 + * committing), and fills its tid in at *ptid 522 523 */ 523 524 int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) 524 525 { ··· 529 528 if (journal->j_running_transaction) { 530 529 tid_t tid = journal->j_running_transaction->t_tid; 531 530 532 - ret = __jbd2_log_start_commit(journal, tid); 533 - if (ret && ptid) 531 + __jbd2_log_start_commit(journal, tid); 532 + /* There's a running transaction and we've just made sure 533 + * it's commit has been scheduled. */ 534 + if (ptid) 534 535 *ptid = tid; 535 - } else if (journal->j_committing_transaction && ptid) { 536 + ret = 1; 537 + } else if (journal->j_committing_transaction) { 536 538 /* 537 539 * If ext3_write_super() recently started a commit, then we 538 540 * have to wait for completion of that transaction 539 541 */ 540 - *ptid = journal->j_committing_transaction->t_tid; 542 + if (ptid) 543 + *ptid = journal->j_committing_transaction->t_tid; 541 544 ret = 1; 542 545 } 543 546 spin_unlock(&journal->j_state_lock);
+31 -11
fs/jbd2/transaction.c
··· 2129 2129 } 2130 2130 2131 2131 /* 2132 - * This function must be called when inode is journaled in ordered mode 2133 - * before truncation happens. It starts writeout of truncated part in 2134 - * case it is in the committing transaction so that we stand to ordered 2135 - * mode consistency guarantees. 2132 + * File truncate and transaction commit interact with each other in a 2133 + * non-trivial way. If a transaction writing data block A is 2134 + * committing, we cannot discard the data by truncate until we have 2135 + * written them. Otherwise if we crashed after the transaction with 2136 + * write has committed but before the transaction with truncate has 2137 + * committed, we could see stale data in block A. This function is a 2138 + * helper to solve this problem. It starts writeout of the truncated 2139 + * part in case it is in the committing transaction. 2140 + * 2141 + * Filesystem code must call this function when inode is journaled in 2142 + * ordered mode before truncation happens and after the inode has been 2143 + * placed on orphan list with the new inode size. The second condition 2144 + * avoids the race that someone writes new data and we start 2145 + * committing the transaction after this function has been called but 2146 + * before a transaction for truncate is started (and furthermore it 2147 + * allows us to optimize the case where the addition to orphan list 2148 + * happens in the same transaction as write --- we don't have to write 2149 + * any data in such case). 2136 2150 */ 2137 - int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, 2151 + int jbd2_journal_begin_ordered_truncate(journal_t *journal, 2152 + struct jbd2_inode *jinode, 2138 2153 loff_t new_size) 2139 2154 { 2140 - journal_t *journal; 2141 - transaction_t *commit_trans; 2155 + transaction_t *inode_trans, *commit_trans; 2142 2156 int ret = 0; 2143 2157 2144 - if (!inode->i_transaction && !inode->i_next_transaction) 2158 + /* This is a quick check to avoid locking if not necessary */ 2159 + if (!jinode->i_transaction) 2145 2160 goto out; 2146 - journal = inode->i_transaction->t_journal; 2161 + /* Locks are here just to force reading of recent values, it is 2162 + * enough that the transaction was not committing before we started 2163 + * a transaction adding the inode to orphan list */ 2147 2164 spin_lock(&journal->j_state_lock); 2148 2165 commit_trans = journal->j_committing_transaction; 2149 2166 spin_unlock(&journal->j_state_lock); 2150 - if (inode->i_transaction == commit_trans) { 2151 - ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping, 2167 + spin_lock(&journal->j_list_lock); 2168 + inode_trans = jinode->i_transaction; 2169 + spin_unlock(&journal->j_list_lock); 2170 + if (inode_trans == commit_trans) { 2171 + ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping, 2152 2172 new_size, LLONG_MAX); 2153 2173 if (ret) 2154 2174 jbd2_journal_abort(journal, ret);
+4 -2
fs/namespace.c
··· 614 614 */ 615 615 for_each_possible_cpu(cpu) { 616 616 struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); 617 - if (cpu_writer->mnt != mnt) 618 - continue; 619 617 spin_lock(&cpu_writer->lock); 618 + if (cpu_writer->mnt != mnt) { 619 + spin_unlock(&cpu_writer->lock); 620 + continue; 621 + } 620 622 atomic_add(cpu_writer->count, &mnt->__mnt_writers); 621 623 cpu_writer->count = 0; 622 624 /*
+1 -1
fs/notify/inotify/inotify.c
··· 156 156 int ret; 157 157 158 158 do { 159 - if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL))) 159 + if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS))) 160 160 return -ENOSPC; 161 161 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); 162 162 } while (ret == -EAGAIN);
+4 -2
fs/ocfs2/journal.h
··· 513 513 static inline int ocfs2_begin_ordered_truncate(struct inode *inode, 514 514 loff_t new_size) 515 515 { 516 - return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode, 517 - new_size); 516 + return jbd2_journal_begin_ordered_truncate( 517 + OCFS2_SB(inode->i_sb)->journal->j_journal, 518 + &OCFS2_I(inode)->ip_jinode, 519 + new_size); 518 520 } 519 521 520 522 #endif /* OCFS2_JOURNAL_H */
+32 -4
fs/seq_file.c
··· 48 48 */ 49 49 file->f_version = 0; 50 50 51 - /* SEQ files support lseek, but not pread/pwrite */ 52 - file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 51 + /* 52 + * seq_files support lseek() and pread(). They do not implement 53 + * write() at all, but we clear FMODE_PWRITE here for historical 54 + * reasons. 55 + * 56 + * If a client of seq_files a) implements file.write() and b) wishes to 57 + * support pwrite() then that client will need to implement its own 58 + * file.open() which calls seq_open() and then sets FMODE_PWRITE. 59 + */ 60 + file->f_mode &= ~FMODE_PWRITE; 53 61 return 0; 54 62 } 55 63 EXPORT_SYMBOL(seq_open); ··· 139 131 int err = 0; 140 132 141 133 mutex_lock(&m->lock); 134 + 135 + /* Don't assume *ppos is where we left it */ 136 + if (unlikely(*ppos != m->read_pos)) { 137 + m->read_pos = *ppos; 138 + while ((err = traverse(m, *ppos)) == -EAGAIN) 139 + ; 140 + if (err) { 141 + /* With prejudice... */ 142 + m->read_pos = 0; 143 + m->version = 0; 144 + m->index = 0; 145 + m->count = 0; 146 + goto Done; 147 + } 148 + } 149 + 142 150 /* 143 151 * seq_file->op->..m_start/m_stop/m_next may do special actions 144 152 * or optimisations based on the file->f_version, so we want to ··· 254 230 Done: 255 231 if (!copied) 256 232 copied = err; 257 - else 233 + else { 258 234 *ppos += copied; 235 + m->read_pos += copied; 236 + } 259 237 file->f_version = m->version; 260 238 mutex_unlock(&m->lock); 261 239 return copied; ··· 292 266 if (offset < 0) 293 267 break; 294 268 retval = offset; 295 - if (offset != file->f_pos) { 269 + if (offset != m->read_pos) { 296 270 while ((retval=traverse(m, offset)) == -EAGAIN) 297 271 ; 298 272 if (retval) { 299 273 /* with extreme prejudice... */ 300 274 file->f_pos = 0; 275 + m->read_pos = 0; 301 276 m->version = 0; 302 277 m->index = 0; 303 278 m->count = 0; 304 279 } else { 280 + m->read_pos = offset; 305 281 retval = file->f_pos = offset; 306 282 } 307 283 }
+16 -1
fs/super.c
··· 82 82 * lock ordering than usbfs: 83 83 */ 84 84 lockdep_set_class(&s->s_lock, &type->s_lock_key); 85 - down_write(&s->s_umount); 85 + /* 86 + * sget() can have s_umount recursion. 87 + * 88 + * When it cannot find a suitable sb, it allocates a new 89 + * one (this one), and tries again to find a suitable old 90 + * one. 91 + * 92 + * In case that succeeds, it will acquire the s_umount 93 + * lock of the old one. Since these are clearly distrinct 94 + * locks, and this object isn't exposed yet, there's no 95 + * risk of deadlocks. 96 + * 97 + * Annotate this by putting this lock in a different 98 + * subclass. 99 + */ 100 + down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); 86 101 s->s_count = S_BIAS; 87 102 atomic_set(&s->s_active, 1); 88 103 mutex_init(&s->s_vfs_rename_mutex);
+6 -6
fs/timerfd.c
··· 186 186 BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); 187 187 BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); 188 188 189 - if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) 190 - return -EINVAL; 191 - if (clockid != CLOCK_MONOTONIC && 192 - clockid != CLOCK_REALTIME) 189 + if ((flags & ~TFD_CREATE_FLAGS) || 190 + (clockid != CLOCK_MONOTONIC && 191 + clockid != CLOCK_REALTIME)) 193 192 return -EINVAL; 194 193 195 194 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ··· 200 201 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); 201 202 202 203 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, 203 - flags & (O_CLOEXEC | O_NONBLOCK)); 204 + flags & TFD_SHARED_FCNTL_FLAGS); 204 205 if (ufd < 0) 205 206 kfree(ctx); 206 207 ··· 218 219 if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) 219 220 return -EFAULT; 220 221 221 - if (!timespec_valid(&ktmr.it_value) || 222 + if ((flags & ~TFD_SETTIME_FLAGS) || 223 + !timespec_valid(&ktmr.it_value) || 222 224 !timespec_valid(&ktmr.it_interval)) 223 225 return -EINVAL; 224 226
+1 -1
include/asm-frv/pgtable.h
··· 478 478 #define __swp_type(x) (((x).val >> 2) & 0x1f) 479 479 #define __swp_offset(x) ((x).val >> 8) 480 480 #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) 481 - #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte }) 481 + #define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte }) 482 482 #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 483 483 484 484 static inline int pte_file(pte_t pte)
-2
include/linux/bio.h
··· 171 171 #define BIO_RW_FAILFAST_TRANSPORT 8 172 172 #define BIO_RW_FAILFAST_DRIVER 9 173 173 174 - #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) 175 - 176 174 #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 177 175 178 176 /*
+1
include/linux/blktrace_api.h
··· 15 15 BLK_TC_WRITE = 1 << 1, /* writes */ 16 16 BLK_TC_BARRIER = 1 << 2, /* barrier */ 17 17 BLK_TC_SYNC = 1 << 3, /* sync IO */ 18 + BLK_TC_SYNCIO = BLK_TC_SYNC, 18 19 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 19 20 BLK_TC_REQUEUE = 1 << 5, /* requeueing */ 20 21 BLK_TC_ISSUE = 1 << 6, /* issue */
+2
include/linux/dmaengine.h
··· 121 121 * @local: per-cpu pointer to a struct dma_chan_percpu 122 122 * @client-count: how many clients are using this channel 123 123 * @table_count: number of appearances in the mem-to-mem allocation table 124 + * @private: private data for certain client-channel associations 124 125 */ 125 126 struct dma_chan { 126 127 struct dma_device *device; ··· 135 134 struct dma_chan_percpu *local; 136 135 int client_count; 137 136 int table_count; 137 + void *private; 138 138 }; 139 139 140 140 /**
+1 -1
include/linux/firmware-map.h
··· 1 1 /* 2 2 * include/linux/firmware-map.h: 3 3 * Copyright (C) 2008 SUSE LINUX Products GmbH 4 - * by Bernhard Walle <bwalle@suse.de> 4 + * by Bernhard Walle <bernhard.walle@gmx.de> 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License v2.0 as published by
+15 -9
include/linux/fs.h
··· 54 54 #define MAY_ACCESS 16 55 55 #define MAY_OPEN 32 56 56 57 + /* 58 + * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 59 + * to O_WRONLY and O_RDWR via the strange trick in __dentry_open() 60 + */ 61 + 57 62 /* file is open for reading */ 58 63 #define FMODE_READ ((__force fmode_t)1) 59 64 /* file is open for writing */ 60 65 #define FMODE_WRITE ((__force fmode_t)2) 61 66 /* file is seekable */ 62 67 #define FMODE_LSEEK ((__force fmode_t)4) 63 - /* file can be accessed using pread/pwrite */ 68 + /* file can be accessed using pread */ 64 69 #define FMODE_PREAD ((__force fmode_t)8) 65 - #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 70 + /* file can be accessed using pwrite */ 71 + #define FMODE_PWRITE ((__force fmode_t)16) 66 72 /* File is opened for execution with sys_execve / sys_uselib */ 67 - #define FMODE_EXEC ((__force fmode_t)16) 73 + #define FMODE_EXEC ((__force fmode_t)32) 68 74 /* File is opened with O_NDELAY (only set for block devices) */ 69 - #define FMODE_NDELAY ((__force fmode_t)32) 75 + #define FMODE_NDELAY ((__force fmode_t)64) 70 76 /* File is opened with O_EXCL (only set for block devices) */ 71 - #define FMODE_EXCL ((__force fmode_t)64) 77 + #define FMODE_EXCL ((__force fmode_t)128) 72 78 /* File is opened using open(.., 3, ..) and is writeable only for ioctls 73 79 (specialy hack for floppy.c) */ 74 - #define FMODE_WRITE_IOCTL ((__force fmode_t)128) 80 + #define FMODE_WRITE_IOCTL ((__force fmode_t)256) 75 81 76 82 /* 77 83 * Don't update ctime and mtime. ··· 93 87 #define WRITE 1 94 88 #define READA 2 /* read-ahead - don't block if no resources */ 95 89 #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 96 - #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 90 + #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 97 91 #define READ_META (READ | (1 << BIO_RW_META)) 98 - #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 99 - #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 92 + #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 93 + #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 100 94 #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 101 95 #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 102 96 #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
+2 -1
include/linux/jbd2.h
··· 1150 1150 extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1151 1151 extern int jbd2_journal_force_commit(journal_t *); 1152 1152 extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); 1153 - extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size); 1153 + extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, 1154 + struct jbd2_inode *inode, loff_t new_size); 1154 1155 extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); 1155 1156 extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); 1156 1157
+5 -5
include/linux/kvm.h
··· 58 58 __u32 pad; 59 59 union { 60 60 char dummy[512]; /* reserving space */ 61 - #ifdef CONFIG_X86 61 + #ifdef __KVM_HAVE_PIT 62 62 struct kvm_pic_state pic; 63 63 #endif 64 - #if defined(CONFIG_X86) || defined(CONFIG_IA64) 64 + #ifdef __KVM_HAVE_IOAPIC 65 65 struct kvm_ioapic_state ioapic; 66 66 #endif 67 67 } chip; ··· 384 384 #define KVM_CAP_MP_STATE 14 385 385 #define KVM_CAP_COALESCED_MMIO 15 386 386 #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 387 - #if defined(CONFIG_X86)||defined(CONFIG_IA64) 387 + #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 388 388 #define KVM_CAP_DEVICE_ASSIGNMENT 17 389 389 #endif 390 390 #define KVM_CAP_IOMMU 18 391 - #if defined(CONFIG_X86) 391 + #ifdef __KVM_HAVE_MSI 392 392 #define KVM_CAP_DEVICE_MSI 20 393 393 #endif 394 394 /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ 395 395 #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 396 - #if defined(CONFIG_X86) 396 + #ifdef __KVM_HAVE_USER_NMI 397 397 #define KVM_CAP_USER_NMI 22 398 398 #endif 399 399
+1
include/linux/kvm_host.h
··· 285 285 struct kvm *kvm_arch_create_vm(void); 286 286 void kvm_arch_destroy_vm(struct kvm *kvm); 287 287 void kvm_free_all_assigned_devices(struct kvm *kvm); 288 + void kvm_arch_sync_events(struct kvm *kvm); 288 289 289 290 int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 290 291 int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
+18 -3
include/linux/mm.h
··· 1041 1041 typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1042 1042 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); 1043 1043 extern void sparse_memory_present_with_active_regions(int nid); 1044 - #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 1045 - extern int early_pfn_to_nid(unsigned long pfn); 1046 - #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ 1047 1044 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 1045 + 1046 + #if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ 1047 + !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) 1048 + static inline int __early_pfn_to_nid(unsigned long pfn) 1049 + { 1050 + return 0; 1051 + } 1052 + #else 1053 + /* please see mm/page_alloc.c */ 1054 + extern int __meminit early_pfn_to_nid(unsigned long pfn); 1055 + #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 1056 + /* there is a per-arch backend function. */ 1057 + extern int __meminit __early_pfn_to_nid(unsigned long pfn); 1058 + #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ 1059 + #endif 1060 + 1048 1061 extern void set_dma_reserve(unsigned long new_dma_reserve); 1049 1062 extern void memmap_init_zone(unsigned long, int, unsigned long, 1050 1063 unsigned long, enum memmap_context); ··· 1172 1159 1173 1160 /* mm/page-writeback.c */ 1174 1161 int write_one_page(struct page *page, int wait); 1162 + void task_dirty_inc(struct task_struct *tsk); 1175 1163 1176 1164 /* readahead.c */ 1177 1165 #define VM_MAX_READAHEAD 128 /* kbytes */ ··· 1318 1304 1319 1305 extern void *alloc_locked_buffer(size_t size); 1320 1306 extern void free_locked_buffer(void *buffer, size_t size); 1307 + extern void release_locked_buffer(void *buffer, size_t size); 1321 1308 #endif /* __KERNEL__ */ 1322 1309 #endif /* _LINUX_MM_H */
+1 -1
include/linux/mmzone.h
··· 1071 1071 #endif /* CONFIG_SPARSEMEM */ 1072 1072 1073 1073 #ifdef CONFIG_NODES_SPAN_OTHER_NODES 1074 - #define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) 1074 + bool early_pfn_in_nid(unsigned long pfn, int nid); 1075 1075 #else 1076 1076 #define early_pfn_in_nid(pfn, nid) (1) 1077 1077 #endif
+2
include/linux/pci_ids.h
··· 1312 1312 #define PCI_DEVICE_ID_VIA_VT3351 0x0351 1313 1313 #define PCI_DEVICE_ID_VIA_VT3364 0x0364 1314 1314 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 1315 + #define PCI_DEVICE_ID_VIA_6415 0x0415 1315 1316 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 1316 1317 #define PCI_DEVICE_ID_VIA_82C561 0x0561 1317 1318 #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 ··· 1445 1444 #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 1446 1445 #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 1447 1446 #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 1447 + #define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1 1448 1448 #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 1449 1449 #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 1450 1450 #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
+1
include/linux/seq_file.h
··· 19 19 size_t from; 20 20 size_t count; 21 21 loff_t index; 22 + loff_t read_pos; 22 23 u64 version; 23 24 struct mutex lock; 24 25 const struct seq_operations *op;
+12 -4
include/linux/timerfd.h
··· 11 11 /* For O_CLOEXEC and O_NONBLOCK */ 12 12 #include <linux/fcntl.h> 13 13 14 - /* Flags for timerfd_settime. */ 14 + /* 15 + * CAREFUL: Check include/asm-generic/fcntl.h when defining 16 + * new flags, since they might collide with O_* ones. We want 17 + * to re-use O_* flags that couldn't possibly have a meaning 18 + * from eventfd, in order to leave a free define-space for 19 + * shared O_* flags. 20 + */ 15 21 #define TFD_TIMER_ABSTIME (1 << 0) 16 - 17 - /* Flags for timerfd_create. */ 18 22 #define TFD_CLOEXEC O_CLOEXEC 19 23 #define TFD_NONBLOCK O_NONBLOCK 20 24 25 + #define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK) 26 + /* Flags for timerfd_create. */ 27 + #define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS 28 + /* Flags for timerfd_settime. */ 29 + #define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME 21 30 22 31 #endif /* _LINUX_TIMERFD_H */ 23 -
+4
include/linux/vmalloc.h
··· 84 84 unsigned long flags, void *caller); 85 85 extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 86 86 unsigned long start, unsigned long end); 87 + extern struct vm_struct *__get_vm_area_caller(unsigned long size, 88 + unsigned long flags, 89 + unsigned long start, unsigned long end, 90 + void *caller); 87 91 extern struct vm_struct *get_vm_area_node(unsigned long size, 88 92 unsigned long flags, int node, 89 93 gfp_t gfp_mask);
+1
kernel/Makefile
··· 51 51 obj-$(CONFIG_MODULES) += module.o 52 52 obj-$(CONFIG_KALLSYMS) += kallsyms.o 53 53 obj-$(CONFIG_PM) += power/ 54 + obj-$(CONFIG_FREEZER) += power/ 54 55 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o 55 56 obj-$(CONFIG_KEXEC) += kexec.o 56 57 obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
+1 -1
kernel/cgroup.c
··· 1122 1122 1123 1123 mutex_unlock(&cgroup_mutex); 1124 1124 1125 - kfree(root); 1126 1125 kill_litter_super(sb); 1126 + kfree(root); 1127 1127 } 1128 1128 1129 1129 static struct file_system_type cgroup_fs_type = {
+27 -24
kernel/futex.c
··· 1165 1165 u32 val, ktime_t *abs_time, u32 bitset, int clockrt) 1166 1166 { 1167 1167 struct task_struct *curr = current; 1168 + struct restart_block *restart; 1168 1169 DECLARE_WAITQUEUE(wait, curr); 1169 1170 struct futex_hash_bucket *hb; 1170 1171 struct futex_q q; ··· 1217 1216 1218 1217 if (!ret) 1219 1218 goto retry; 1220 - return ret; 1219 + goto out; 1221 1220 } 1222 1221 ret = -EWOULDBLOCK; 1223 - if (uval != val) 1224 - goto out_unlock_put_key; 1222 + if (unlikely(uval != val)) { 1223 + queue_unlock(&q, hb); 1224 + goto out_put_key; 1225 + } 1225 1226 1226 1227 /* Only actually queue if *uaddr contained val. */ 1227 1228 queue_me(&q, hb); ··· 1287 1284 */ 1288 1285 1289 1286 /* If we were woken (and unqueued), we succeeded, whatever. */ 1287 + ret = 0; 1290 1288 if (!unqueue_me(&q)) 1291 - return 0; 1289 + goto out_put_key; 1290 + ret = -ETIMEDOUT; 1292 1291 if (rem) 1293 - return -ETIMEDOUT; 1292 + goto out_put_key; 1294 1293 1295 1294 /* 1296 1295 * We expect signal_pending(current), but another thread may 1297 1296 * have handled it for us already. 1298 1297 */ 1298 + ret = -ERESTARTSYS; 1299 1299 if (!abs_time) 1300 - return -ERESTARTSYS; 1301 - else { 1302 - struct restart_block *restart; 1303 - restart = &current_thread_info()->restart_block; 1304 - restart->fn = futex_wait_restart; 1305 - restart->futex.uaddr = (u32 *)uaddr; 1306 - restart->futex.val = val; 1307 - restart->futex.time = abs_time->tv64; 1308 - restart->futex.bitset = bitset; 1309 - restart->futex.flags = 0; 1300 + goto out_put_key; 1310 1301 1311 - if (fshared) 1312 - restart->futex.flags |= FLAGS_SHARED; 1313 - if (clockrt) 1314 - restart->futex.flags |= FLAGS_CLOCKRT; 1315 - return -ERESTART_RESTARTBLOCK; 1316 - } 1302 + restart = &current_thread_info()->restart_block; 1303 + restart->fn = futex_wait_restart; 1304 + restart->futex.uaddr = (u32 *)uaddr; 1305 + restart->futex.val = val; 1306 + restart->futex.time = abs_time->tv64; 1307 + restart->futex.bitset = bitset; 1308 + restart->futex.flags = 0; 1317 1309 1318 - out_unlock_put_key: 1319 - queue_unlock(&q, hb); 1310 + if (fshared) 1311 + restart->futex.flags |= FLAGS_SHARED; 1312 + if (clockrt) 1313 + restart->futex.flags |= FLAGS_CLOCKRT; 1314 + 1315 + ret = -ERESTART_RESTARTBLOCK; 1316 + 1317 + out_put_key: 1320 1318 put_futex_key(fshared, &q.key); 1321 - 1322 1319 out: 1323 1320 return ret; 1324 1321 }
+30 -30
kernel/posix-cpu-timers.c
··· 681 681 } 682 682 683 683 /* 684 + * Sample a process (thread group) timer for the given group_leader task. 685 + * Must be called with tasklist_lock held for reading. 686 + */ 687 + static int cpu_timer_sample_group(const clockid_t which_clock, 688 + struct task_struct *p, 689 + union cpu_time_count *cpu) 690 + { 691 + struct task_cputime cputime; 692 + 693 + thread_group_cputimer(p, &cputime); 694 + switch (CPUCLOCK_WHICH(which_clock)) { 695 + default: 696 + return -EINVAL; 697 + case CPUCLOCK_PROF: 698 + cpu->cpu = cputime_add(cputime.utime, cputime.stime); 699 + break; 700 + case CPUCLOCK_VIRT: 701 + cpu->cpu = cputime.utime; 702 + break; 703 + case CPUCLOCK_SCHED: 704 + cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p); 705 + break; 706 + } 707 + return 0; 708 + } 709 + 710 + /* 684 711 * Guts of sys_timer_settime for CPU timers. 685 712 * This is called with the timer locked and interrupts disabled. 686 713 * If we return TIMER_RETRY, it's necessary to release the timer's lock ··· 768 741 if (CPUCLOCK_PERTHREAD(timer->it_clock)) { 769 742 cpu_clock_sample(timer->it_clock, p, &val); 770 743 } else { 771 - cpu_clock_sample_group(timer->it_clock, p, &val); 744 + cpu_timer_sample_group(timer->it_clock, p, &val); 772 745 } 773 746 774 747 if (old) { ··· 916 889 read_unlock(&tasklist_lock); 917 890 goto dead; 918 891 } else { 919 - cpu_clock_sample_group(timer->it_clock, p, &now); 892 + cpu_timer_sample_group(timer->it_clock, p, &now); 920 893 clear_dead = (unlikely(p->exit_state) && 921 894 thread_group_empty(p)); 922 895 } ··· 1271 1244 clear_dead_task(timer, now); 1272 1245 goto out_unlock; 1273 1246 } 1274 - cpu_clock_sample_group(timer->it_clock, p, &now); 1247 + cpu_timer_sample_group(timer->it_clock, p, &now); 1275 1248 bump_cpu_timer(timer, now); 1276 1249 /* Leave the tasklist_lock locked for the call below. */ 1277 1250 } ··· 1433 1406 } 1434 1407 spin_unlock(&timer->it_lock); 1435 1408 } 1436 - } 1437 - 1438 - /* 1439 - * Sample a process (thread group) timer for the given group_leader task. 1440 - * Must be called with tasklist_lock held for reading. 1441 - */ 1442 - static int cpu_timer_sample_group(const clockid_t which_clock, 1443 - struct task_struct *p, 1444 - union cpu_time_count *cpu) 1445 - { 1446 - struct task_cputime cputime; 1447 - 1448 - thread_group_cputimer(p, &cputime); 1449 - switch (CPUCLOCK_WHICH(which_clock)) { 1450 - default: 1451 - return -EINVAL; 1452 - case CPUCLOCK_PROF: 1453 - cpu->cpu = cputime_add(cputime.utime, cputime.stime); 1454 - break; 1455 - case CPUCLOCK_VIRT: 1456 - cpu->cpu = cputime.utime; 1457 - break; 1458 - case CPUCLOCK_SCHED: 1459 - cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p); 1460 - break; 1461 - } 1462 - return 0; 1463 1409 } 1464 1410 1465 1411 /*
+1 -1
kernel/power/Makefile
··· 3 3 EXTRA_CFLAGS += -DDEBUG 4 4 endif 5 5 6 - obj-y := main.o 6 + obj-$(CONFIG_PM) += main.o 7 7 obj-$(CONFIG_PM_SLEEP) += console.o 8 8 obj-$(CONFIG_FREEZER) += process.o 9 9 obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o
+3 -2
kernel/power/swap.c
··· 60 60 static int submit(int rw, pgoff_t page_off, struct page *page, 61 61 struct bio **bio_chain) 62 62 { 63 + const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 63 64 struct bio *bio; 64 65 65 66 bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); ··· 81 80 bio_get(bio); 82 81 83 82 if (bio_chain == NULL) { 84 - submit_bio(rw | (1 << BIO_RW_SYNC), bio); 83 + submit_bio(bio_rw, bio); 85 84 wait_on_page_locked(page); 86 85 if (rw == READ) 87 86 bio_set_pages_dirty(bio); ··· 91 90 get_page(page); /* These pages are freed later */ 92 91 bio->bi_private = *bio_chain; 93 92 *bio_chain = bio; 94 - submit_bio(rw | (1 << BIO_RW_SYNC), bio); 93 + submit_bio(bio_rw, bio); 95 94 } 96 95 return 0; 97 96 }
+12 -3
kernel/sched.c
··· 6944 6944 6945 6945 static void rq_attach_root(struct rq *rq, struct root_domain *rd) 6946 6946 { 6947 + struct root_domain *old_rd = NULL; 6947 6948 unsigned long flags; 6948 6949 6949 6950 spin_lock_irqsave(&rq->lock, flags); 6950 6951 6951 6952 if (rq->rd) { 6952 - struct root_domain *old_rd = rq->rd; 6953 + old_rd = rq->rd; 6953 6954 6954 6955 if (cpumask_test_cpu(rq->cpu, old_rd->online)) 6955 6956 set_rq_offline(rq); 6956 6957 6957 6958 cpumask_clear_cpu(rq->cpu, old_rd->span); 6958 6959 6959 - if (atomic_dec_and_test(&old_rd->refcount)) 6960 - free_rootdomain(old_rd); 6960 + /* 6961 + * If we dont want to free the old_rt yet then 6962 + * set old_rd to NULL to skip the freeing later 6963 + * in this function: 6964 + */ 6965 + if (!atomic_dec_and_test(&old_rd->refcount)) 6966 + old_rd = NULL; 6961 6967 } 6962 6968 6963 6969 atomic_inc(&rd->refcount); ··· 6974 6968 set_rq_online(rq); 6975 6969 6976 6970 spin_unlock_irqrestore(&rq->lock, flags); 6971 + 6972 + if (old_rd) 6973 + free_rootdomain(old_rd); 6977 6974 } 6978 6975 6979 6976 static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
+1 -1
kernel/trace/blktrace.c
··· 176 176 177 177 what |= ddir_act[rw & WRITE]; 178 178 what |= MASK_TC_BIT(rw, BARRIER); 179 - what |= MASK_TC_BIT(rw, SYNC); 179 + what |= MASK_TC_BIT(rw, SYNCIO); 180 180 what |= MASK_TC_BIT(rw, AHEAD); 181 181 what |= MASK_TC_BIT(rw, META); 182 182 what |= MASK_TC_BIT(rw, DISCARD);
+6 -1
mm/mlock.c
··· 660 660 return buffer; 661 661 } 662 662 663 - void free_locked_buffer(void *buffer, size_t size) 663 + void release_locked_buffer(void *buffer, size_t size) 664 664 { 665 665 unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; 666 666 ··· 670 670 current->mm->locked_vm -= pgsz; 671 671 672 672 up_write(&current->mm->mmap_sem); 673 + } 674 + 675 + void free_locked_buffer(void *buffer, size_t size) 676 + { 677 + release_locked_buffer(buffer, size); 673 678 674 679 kfree(buffer); 675 680 }
+3 -10
mm/page-writeback.c
··· 240 240 } 241 241 EXPORT_SYMBOL_GPL(bdi_writeout_inc); 242 242 243 - static inline void task_dirty_inc(struct task_struct *tsk) 243 + void task_dirty_inc(struct task_struct *tsk) 244 244 { 245 245 prop_inc_single(&vm_dirties, &tsk->dirties); 246 246 } ··· 1230 1230 __inc_zone_page_state(page, NR_FILE_DIRTY); 1231 1231 __inc_bdi_stat(mapping->backing_dev_info, 1232 1232 BDI_RECLAIMABLE); 1233 + task_dirty_inc(current); 1233 1234 task_io_account_write(PAGE_CACHE_SIZE); 1234 1235 } 1235 1236 radix_tree_tag_set(&mapping->page_tree, ··· 1263 1262 * If the mapping doesn't provide a set_page_dirty a_op, then 1264 1263 * just fall through and assume that it wants buffer_heads. 1265 1264 */ 1266 - static int __set_page_dirty(struct page *page) 1265 + int set_page_dirty(struct page *page) 1267 1266 { 1268 1267 struct address_space *mapping = page_mapping(page); 1269 1268 ··· 1280 1279 return 1; 1281 1280 } 1282 1281 return 0; 1283 - } 1284 - 1285 - int set_page_dirty(struct page *page) 1286 - { 1287 - int ret = __set_page_dirty(page); 1288 - if (ret) 1289 - task_dirty_inc(current); 1290 - return ret; 1291 1282 } 1292 1283 EXPORT_SYMBOL(set_page_dirty); 1293 1284
+26 -3
mm/page_alloc.c
··· 2989 2989 * was used and there are no special requirements, this is a convenient 2990 2990 * alternative 2991 2991 */ 2992 - int __meminit early_pfn_to_nid(unsigned long pfn) 2992 + int __meminit __early_pfn_to_nid(unsigned long pfn) 2993 2993 { 2994 2994 int i; 2995 2995 ··· 3000 3000 if (start_pfn <= pfn && pfn < end_pfn) 3001 3001 return early_node_map[i].nid; 3002 3002 } 3003 - 3004 - return 0; 3003 + /* This is a memory hole */ 3004 + return -1; 3005 3005 } 3006 3006 #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ 3007 + 3008 + int __meminit early_pfn_to_nid(unsigned long pfn) 3009 + { 3010 + int nid; 3011 + 3012 + nid = __early_pfn_to_nid(pfn); 3013 + if (nid >= 0) 3014 + return nid; 3015 + /* just returns 0 */ 3016 + return 0; 3017 + } 3018 + 3019 + #ifdef CONFIG_NODES_SPAN_OTHER_NODES 3020 + bool __meminit early_pfn_in_nid(unsigned long pfn, int node) 3021 + { 3022 + int nid; 3023 + 3024 + nid = __early_pfn_to_nid(pfn); 3025 + if (nid >= 0 && nid != node) 3026 + return false; 3027 + return true; 3028 + } 3029 + #endif 3007 3030 3008 3031 /* Basic iterator support to walk early_node_map[] */ 3009 3032 #define for_each_active_range_index_in_nid(i, nid) \
+1 -1
mm/page_io.c
··· 111 111 goto out; 112 112 } 113 113 if (wbc->sync_mode == WB_SYNC_ALL) 114 - rw |= (1 << BIO_RW_SYNC); 114 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 115 115 count_vm_event(PSWPOUT); 116 116 set_page_writeback(page); 117 117 unlock_page(page);
+8
mm/vmalloc.c
··· 1106 1106 } 1107 1107 EXPORT_SYMBOL_GPL(__get_vm_area); 1108 1108 1109 + struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, 1110 + unsigned long start, unsigned long end, 1111 + void *caller) 1112 + { 1113 + return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL, 1114 + caller); 1115 + } 1116 + 1109 1117 /** 1110 1118 * get_vm_area - reserve a contiguous kernel virtual area 1111 1119 * @size: size of the area
+2 -2
scripts/bootgraph.pl
··· 51 51 52 52 while (<>) { 53 53 my $line = $_; 54 - if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { 54 + if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { 55 55 my $func = $2; 56 56 if ($done == 0) { 57 57 $start{$func} = $1; ··· 87 87 $count = $count + 1; 88 88 } 89 89 90 - if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { 90 + if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) { 91 91 if ($done == 0) { 92 92 $end{$2} = $1; 93 93 $maxtime = $1;
+158 -13
scripts/markup_oops.pl
··· 1 - #!/usr/bin/perl -w 1 + #!/usr/bin/perl 2 2 3 3 use File::Basename; 4 4 ··· 29 29 my $target = "0"; 30 30 my $function; 31 31 my $module = ""; 32 - my $func_offset; 32 + my $func_offset = 0; 33 33 my $vmaoffset = 0; 34 34 35 + my %regs; 36 + 37 + 38 + sub parse_x86_regs 39 + { 40 + my ($line) = @_; 41 + if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) { 42 + $regs{"%eax"} = $1; 43 + $regs{"%ebx"} = $2; 44 + $regs{"%ecx"} = $3; 45 + $regs{"%edx"} = $4; 46 + } 47 + if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) { 48 + $regs{"%esi"} = $1; 49 + $regs{"%edi"} = $2; 50 + $regs{"%esp"} = $4; 51 + } 52 + if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) { 53 + $regs{"%eax"} = $1; 54 + $regs{"%ebx"} = $2; 55 + $regs{"%ecx"} = $3; 56 + } 57 + if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) { 58 + $regs{"%edx"} = $1; 59 + $regs{"%esi"} = $2; 60 + $regs{"%edi"} = $3; 61 + } 62 + if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) { 63 + $regs{"%r08"} = $2; 64 + $regs{"%r09"} = $3; 65 + } 66 + if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) { 67 + $regs{"%r10"} = $1; 68 + $regs{"%r11"} = $2; 69 + $regs{"%r12"} = $3; 70 + } 71 + if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) { 72 + $regs{"%r13"} = $1; 73 + $regs{"%r14"} = $2; 74 + $regs{"%r15"} = $3; 75 + } 76 + } 77 + 78 + sub reg_name 79 + { 80 + my ($reg) = @_; 81 + $reg =~ s/r(.)x/e\1x/; 82 + $reg =~ s/r(.)i/e\1i/; 83 + $reg =~ s/r(.)p/e\1p/; 84 + return $reg; 85 + } 86 + 87 + sub process_x86_regs 88 + { 89 + my ($line, $cntr) = @_; 90 + my $str = ""; 91 + if (length($line) < 40) { 92 + return ""; # not an asm istruction 93 + } 94 + 95 + # find the arguments to the instruction 96 + if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) { 97 + $lastword = $1; 98 + } else { 99 + return ""; 100 + } 101 + 102 + # we need to find the registers that get clobbered, 103 + # since their value is no longer relevant for previous 104 + # instructions in the stream. 105 + 106 + $clobber = $lastword; 107 + # first, remove all memory operands, they're read only 108 + $clobber =~ s/\([a-z0-9\%\,]+\)//g; 109 + # then, remove everything before the comma, thats the read part 110 + $clobber =~ s/.*\,//g; 111 + 112 + # if this is the instruction that faulted, we haven't actually done 113 + # the write yet... nothing is clobbered. 114 + if ($cntr == 0) { 115 + $clobber = ""; 116 + } 117 + 118 + foreach $reg (keys(%regs)) { 119 + my $clobberprime = reg_name($clobber); 120 + my $lastwordprime = reg_name($lastword); 121 + my $val = $regs{$reg}; 122 + if ($val =~ /^[0]+$/) { 123 + $val = "0"; 124 + } else { 125 + $val =~ s/^0*//; 126 + } 127 + 128 + # first check if we're clobbering this register; if we do 129 + # we print it with a =>, and then delete its value 130 + if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) { 131 + if (length($val) > 0) { 132 + $str = $str . " $reg => $val "; 133 + } 134 + $regs{$reg} = ""; 135 + $val = ""; 136 + } 137 + # now check if we're reading this register 138 + if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) { 139 + if (length($val) > 0) { 140 + $str = $str . " $reg = $val "; 141 + } 142 + } 143 + } 144 + return $str; 145 + } 146 + 147 + # parse the oops 35 148 while (<STDIN>) { 36 149 my $line = $_; 37 150 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { 38 151 $target = $1; 39 152 } 153 + if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) { 154 + $target = $1; 155 + } 40 156 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { 157 + $function = $1; 158 + $func_offset = $2; 159 + } 160 + if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { 41 161 $function = $1; 42 162 $func_offset = $2; 43 163 } ··· 166 46 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { 167 47 $module = $3; 168 48 } 49 + if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { 50 + $module = $3; 51 + } 52 + parse_x86_regs($line); 169 53 } 170 54 171 55 my $decodestart = hex($target) - hex($func_offset); 172 - my $decodestop = $decodestart + 8192; 56 + my $decodestop = hex($target) + 8192; 173 57 if ($target eq "0") { 174 58 print "No oops found!\n"; 175 59 print "Usage: \n"; ··· 208 84 my $state = 0; 209 85 my $center = 0; 210 86 my @lines; 87 + my @reglines; 211 88 212 89 sub InRange { 213 90 my ($address, $target) = @_; ··· 313 188 314 189 my $i; 315 190 316 - my $fulltext = ""; 317 - $i = $start; 318 - while ($i < $finish) { 319 - if ($i == $center) { 320 - $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n"; 321 - } else { 322 - $fulltext = $fulltext . " $lines[$i]\n"; 323 - } 324 - $i = $i +1; 191 + 192 + # start annotating the registers in the asm. 193 + # this goes from the oopsing point back, so that the annotator 194 + # can track (opportunistically) which registers got written and 195 + # whos value no longer is relevant. 196 + 197 + $i = $center; 198 + while ($i >= $start) { 199 + $reglines[$i] = process_x86_regs($lines[$i], $center - $i); 200 + $i = $i - 1; 325 201 } 326 202 327 - print $fulltext; 203 + $i = $start; 204 + while ($i < $finish) { 205 + my $line; 206 + if ($i == $center) { 207 + $line = "*$lines[$i] "; 208 + } else { 209 + $line = " $lines[$i] "; 210 + } 211 + print $line; 212 + if (defined($reglines[$i]) && length($reglines[$i]) > 0) { 213 + my $c = 60 - length($line); 214 + while ($c > 0) { print " "; $c = $c - 1; }; 215 + print "| $reglines[$i]"; 216 + } 217 + if ($i == $center) { 218 + print "<--- faulting instruction"; 219 + } 220 + print "\n"; 221 + $i = $i +1; 222 + } 328 223
+1
scripts/mod/file2alias.c
··· 210 210 static int do_hid_entry(const char *filename, 211 211 struct hid_device_id *id, char *alias) 212 212 { 213 + id->bus = TO_NATIVE(id->bus); 213 214 id->vendor = TO_NATIVE(id->vendor); 214 215 id->product = TO_NATIVE(id->product); 215 216
+8
scripts/package/mkspec
··· 86 86 echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" 87 87 88 88 echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" 89 + 90 + echo "%ifnarch ppc64" 91 + echo 'cp vmlinux vmlinux.orig' 92 + echo 'bzip2 -9 vmlinux' 93 + echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" 94 + echo 'mv vmlinux.orig vmlinux' 95 + echo "%endif" 96 + 89 97 echo "" 90 98 echo "%clean" 91 99 echo '#echo -rf $RPM_BUILD_ROOT'
+1 -8
scripts/setlocalversion
··· 58 58 # Check for svn and a svn repo. 59 59 if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then 60 60 rev=`echo $rev | awk '{print $NF}'` 61 - changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` 62 - 63 - # Are there uncommitted changes? 64 - if [ $changes != 0 ]; then 65 - printf -- '-svn%s%s' "$rev" -dirty 66 - else 67 - printf -- '-svn%s' "$rev" 68 - fi 61 + printf -- '-svn%s' "$rev" 69 62 70 63 # All done with svn 71 64 exit
+9 -3
scripts/tags.sh
··· 76 76 77 77 all_kconfigs() 78 78 { 79 - find_sources $ALLSOURCE_ARCHS 'Kconfig*' 79 + for arch in $ALLSOURCE_ARCHS; do 80 + find_sources $arch 'Kconfig*' 81 + done 82 + find_other_sources 'Kconfig*' 80 83 } 81 84 82 85 all_defconfigs() ··· 102 99 -I ____cacheline_internodealigned_in_smp \ 103 100 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 104 101 --extra=+f --c-kinds=+px \ 105 - --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' 102 + --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ 103 + --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' 106 104 107 105 all_kconfigs | xargs $1 -a \ 108 106 --langdef=kconfig --language-force=kconfig \ ··· 121 117 122 118 emacs() 123 119 { 124 - all_sources | xargs $1 -a 120 + all_sources | xargs $1 -a \ 121 + --regex='/^ENTRY(\([^)]*\)).*/\1/' \ 122 + --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' 125 123 126 124 all_kconfigs | xargs $1 -a \ 127 125 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
+2 -4
virt/kvm/iommu.c
··· 73 73 { 74 74 int i, r = 0; 75 75 76 - down_read(&kvm->slots_lock); 77 76 for (i = 0; i < kvm->nmemslots; i++) { 78 77 r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, 79 78 kvm->memslots[i].npages); 80 79 if (r) 81 80 break; 82 81 } 83 - up_read(&kvm->slots_lock); 82 + 84 83 return r; 85 84 } 86 85 ··· 189 190 static int kvm_iommu_unmap_memslots(struct kvm *kvm) 190 191 { 191 192 int i; 192 - down_read(&kvm->slots_lock); 193 + 193 194 for (i = 0; i < kvm->nmemslots; i++) { 194 195 kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, 195 196 kvm->memslots[i].npages); 196 197 } 197 - up_read(&kvm->slots_lock); 198 198 199 199 return 0; 200 200 }
+33 -10
virt/kvm/kvm_main.c
··· 173 173 assigned_dev->host_irq_disabled = false; 174 174 } 175 175 mutex_unlock(&assigned_dev->kvm->lock); 176 - kvm_put_kvm(assigned_dev->kvm); 177 176 } 178 177 179 178 static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) 180 179 { 181 180 struct kvm_assigned_dev_kernel *assigned_dev = 182 181 (struct kvm_assigned_dev_kernel *) dev_id; 183 - 184 - kvm_get_kvm(assigned_dev->kvm); 185 182 186 183 schedule_work(&assigned_dev->interrupt_work); 187 184 ··· 210 213 } 211 214 } 212 215 216 + /* The function implicit hold kvm->lock mutex due to cancel_work_sync() */ 213 217 static void kvm_free_assigned_irq(struct kvm *kvm, 214 218 struct kvm_assigned_dev_kernel *assigned_dev) 215 219 { ··· 226 228 if (!assigned_dev->irq_requested_type) 227 229 return; 228 230 229 - if (cancel_work_sync(&assigned_dev->interrupt_work)) 230 - /* We had pending work. That means we will have to take 231 - * care of kvm_put_kvm. 232 - */ 233 - kvm_put_kvm(kvm); 231 + /* 232 + * In kvm_free_device_irq, cancel_work_sync return true if: 233 + * 1. work is scheduled, and then cancelled. 234 + * 2. work callback is executed. 235 + * 236 + * The first one ensured that the irq is disabled and no more events 237 + * would happen. But for the second one, the irq may be enabled (e.g. 238 + * for MSI). So we disable irq here to prevent further events. 239 + * 240 + * Notice this maybe result in nested disable if the interrupt type is 241 + * INTx, but it's OK for we are going to free it. 242 + * 243 + * If this function is a part of VM destroy, please ensure that till 244 + * now, the kvm state is still legal for probably we also have to wait 245 + * interrupt_work done. 246 + */ 247 + disable_irq_nosync(assigned_dev->host_irq); 248 + cancel_work_sync(&assigned_dev->interrupt_work); 234 249 235 250 free_irq(assigned_dev->host_irq, (void *)assigned_dev); 236 251 ··· 296 285 297 286 if (irqchip_in_kernel(kvm)) { 298 287 if (!msi2intx && 299 - adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) { 300 - free_irq(adev->host_irq, (void *)kvm); 288 + (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) { 289 + free_irq(adev->host_irq, (void *)adev); 301 290 pci_disable_msi(adev->dev); 302 291 } 303 292 ··· 466 455 struct kvm_assigned_dev_kernel *match; 467 456 struct pci_dev *dev; 468 457 458 + down_read(&kvm->slots_lock); 469 459 mutex_lock(&kvm->lock); 470 460 471 461 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, ··· 528 516 529 517 out: 530 518 mutex_unlock(&kvm->lock); 519 + up_read(&kvm->slots_lock); 531 520 return r; 532 521 out_list_del: 533 522 list_del(&match->list); ··· 540 527 out_free: 541 528 kfree(match); 542 529 mutex_unlock(&kvm->lock); 530 + up_read(&kvm->slots_lock); 543 531 return r; 544 532 } 545 533 #endif ··· 803 789 return young; 804 790 } 805 791 792 + static void kvm_mmu_notifier_release(struct mmu_notifier *mn, 793 + struct mm_struct *mm) 794 + { 795 + struct kvm *kvm = mmu_notifier_to_kvm(mn); 796 + kvm_arch_flush_shadow(kvm); 797 + } 798 + 806 799 static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { 807 800 .invalidate_page = kvm_mmu_notifier_invalidate_page, 808 801 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, 809 802 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, 810 803 .clear_flush_young = kvm_mmu_notifier_clear_flush_young, 804 + .release = kvm_mmu_notifier_release, 811 805 }; 812 806 #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ 813 807 ··· 905 883 { 906 884 struct mm_struct *mm = kvm->mm; 907 885 886 + kvm_arch_sync_events(kvm); 908 887 spin_lock(&kvm_lock); 909 888 list_del(&kvm->vm_list); 910 889 spin_unlock(&kvm_lock);