diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-19 03:00:35 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-19 03:00:35 -0500 |
commit | 72c26c9a26ea7f2f3d14f162c2ebb07805f724ea (patch) | |
tree | bf1b4bc0b69f96c79474f9edb9cf0e811c95f2dc | |
parent | 37bd824a35a60abc73e5fa8816bd5f50c913d69b (diff) | |
parent | ba95fd47d177d46743ad94055908d22840370e06 (diff) |
Merge branch 'linus' into tracing/blktrace
Conflicts:
block/blktrace.c
Semantic merge:
kernel/trace/blktrace.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
181 files changed, 1995 insertions, 817 deletions
@@ -2166,7 +2166,6 @@ D: Initial implementation of VC's, pty's and select() | |||
2166 | 2166 | ||
2167 | N: Pavel Machek | 2167 | N: Pavel Machek |
2168 | E: pavel@ucw.cz | 2168 | E: pavel@ucw.cz |
2169 | E: pavel@suse.cz | ||
2170 | D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd | 2169 | D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd |
2171 | D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, | 2170 | D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, |
2172 | D: work on suspend-to-ram/disk, killing duplicates from ioctl32 | 2171 | D: work on suspend-to-ram/disk, killing duplicates from ioctl32 |
diff --git a/Documentation/ABI/testing/sysfs-firmware-memmap b/Documentation/ABI/testing/sysfs-firmware-memmap index 0d99ee6ae02e..eca0d65087dc 100644 --- a/Documentation/ABI/testing/sysfs-firmware-memmap +++ b/Documentation/ABI/testing/sysfs-firmware-memmap | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/firmware/memmap/ | 1 | What: /sys/firmware/memmap/ |
2 | Date: June 2008 | 2 | Date: June 2008 |
3 | Contact: Bernhard Walle <bwalle@suse.de> | 3 | Contact: Bernhard Walle <bernhard.walle@gmx.de> |
4 | Description: | 4 | Description: |
5 | On all platforms, the firmware provides a memory map which the | 5 | On all platforms, the firmware provides a memory map which the |
6 | kernel reads. The resources from that memory map are registered | 6 | kernel reads. The resources from that memory map are registered |
diff --git a/Documentation/PCI/PCIEBUS-HOWTO.txt b/Documentation/PCI/PCIEBUS-HOWTO.txt index 9a07e38631b0..6bd5f372adec 100644 --- a/Documentation/PCI/PCIEBUS-HOWTO.txt +++ b/Documentation/PCI/PCIEBUS-HOWTO.txt | |||
@@ -93,7 +93,7 @@ the PCI Express Port Bus driver from loading a service driver. | |||
93 | 93 | ||
94 | int pcie_port_service_register(struct pcie_port_service_driver *new) | 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 | service driver should always calls pcie_port_service_register at | 97 | service driver should always calls pcie_port_service_register at |
98 | module init. Note that after service driver being loaded, calls | 98 | module init. Note that after service driver being loaded, calls |
99 | such as pci_enable_device(dev) and pci_set_master(dev) are no longer | 99 | such as pci_enable_device(dev) and pci_set_master(dev) are no longer |
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index d9e5d6f41b92..93feb8444489 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -252,10 +252,8 @@ cgroup file system directories. | |||
252 | When a task is moved from one cgroup to another, it gets a new | 252 | When a task is moved from one cgroup to another, it gets a new |
253 | css_set pointer - if there's an already existing css_set with the | 253 | css_set pointer - if there's an already existing css_set with the |
254 | desired collection of cgroups then that group is reused, else a new | 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 | 255 | css_set is allocated. The appropriate existing css_set is located by |
256 | linear search to locate an appropriate existing css_set, so isn't | 256 | looking into a hash table. |
257 | very efficient. A future version will use a hash table for better | ||
258 | performance. | ||
259 | 257 | ||
260 | To allow access from a cgroup to the css_sets (and hence tasks) | 258 | To allow access from a cgroup to the css_sets (and hence tasks) |
261 | that comprise it, a set of cg_cgroup_link objects form a lattice; | 259 | that comprise it, a set of cg_cgroup_link objects form a lattice; |
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c new file mode 100644 index 000000000000..bbea1ccfd46a --- /dev/null +++ b/Documentation/hwmon/hpfall.c | |||
@@ -0,0 +1,101 @@ | |||
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 | } | ||
diff --git a/Documentation/hwmon/lis3lv02d b/Documentation/hwmon/lis3lv02d index 0fcfc4a7ccdc..287f8c902656 100644 --- a/Documentation/hwmon/lis3lv02d +++ b/Documentation/hwmon/lis3lv02d | |||
@@ -33,6 +33,14 @@ rate - reports the sampling rate of the accelerometer device in HZ | |||
33 | This driver also provides an absolute input class device, allowing | 33 | This driver also provides an absolute input class device, allowing |
34 | the laptop to act as a pinball machine-esque joystick. | 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 | Axes orientation | 44 | Axes orientation |
37 | ---------------- | 45 | ---------------- |
38 | 46 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index b7e4afc4bc44..4c2e406fab61 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1905,10 +1905,10 @@ W: http://gigaset307x.sourceforge.net/ | |||
1905 | S: Maintained | 1905 | S: Maintained |
1906 | 1906 | ||
1907 | HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER | 1907 | HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER |
1908 | P: Robert Love | 1908 | P: Frank Seidel |
1909 | M: rlove@rlove.org | 1909 | M: frank@f-seidel.de |
1910 | M: linux-kernel@vger.kernel.org | 1910 | L: lm-sensors@lm-sensors.org |
1911 | W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/ | 1911 | W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/ |
1912 | S: Maintained | 1912 | S: Maintained |
1913 | 1913 | ||
1914 | GSPCA FINEPIX SUBDRIVER | 1914 | GSPCA FINEPIX SUBDRIVER |
@@ -2001,7 +2001,7 @@ S: Maintained | |||
2001 | 2001 | ||
2002 | HIBERNATION (aka Software Suspend, aka swsusp) | 2002 | HIBERNATION (aka Software Suspend, aka swsusp) |
2003 | P: Pavel Machek | 2003 | P: Pavel Machek |
2004 | M: pavel@suse.cz | 2004 | M: pavel@ucw.cz |
2005 | P: Rafael J. Wysocki | 2005 | P: Rafael J. Wysocki |
2006 | M: rjw@sisk.pl | 2006 | M: rjw@sisk.pl |
2007 | L: linux-pm@lists.linux-foundation.org | 2007 | L: linux-pm@lists.linux-foundation.org |
@@ -4178,7 +4178,7 @@ SUSPEND TO RAM | |||
4178 | P: Len Brown | 4178 | P: Len Brown |
4179 | M: len.brown@intel.com | 4179 | M: len.brown@intel.com |
4180 | P: Pavel Machek | 4180 | P: Pavel Machek |
4181 | M: pavel@suse.cz | 4181 | M: pavel@ucw.cz |
4182 | P: Rafael J. Wysocki | 4182 | P: Rafael J. Wysocki |
4183 | M: rjw@sisk.pl | 4183 | M: rjw@sisk.pl |
4184 | L: linux-pm@lists.linux-foundation.org | 4184 | L: linux-pm@lists.linux-foundation.org |
@@ -4930,11 +4930,11 @@ L: zd1211-devs@lists.sourceforge.net (subscribers-only) | |||
4930 | S: Maintained | 4930 | S: Maintained |
4931 | 4931 | ||
4932 | ZR36067 VIDEO FOR LINUX DRIVER | 4932 | ZR36067 VIDEO FOR LINUX DRIVER |
4933 | P: Ronald Bultje | ||
4934 | M: rbultje@ronald.bitfreak.net | ||
4935 | L: mjpeg-users@lists.sourceforge.net | 4933 | L: mjpeg-users@lists.sourceforge.net |
4934 | L: linux-media@vger.kernel.org | ||
4936 | W: http://mjpeg.sourceforge.net/driver-zoran/ | 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 | ZS DECSTATION Z85C30 SERIAL DRIVER | 4939 | ZS DECSTATION Z85C30 SERIAL DRIVER |
4940 | P: Maciej W. Rozycki | 4940 | P: Maciej W. Rozycki |
@@ -389,6 +389,7 @@ PHONY += outputmakefile | |||
389 | # output directory. | 389 | # output directory. |
390 | outputmakefile: | 390 | outputmakefile: |
391 | ifneq ($(KBUILD_SRC),) | 391 | ifneq ($(KBUILD_SRC),) |
392 | $(Q)ln -fsn $(srctree) source | ||
392 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ | 393 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ |
393 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 394 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
394 | endif | 395 | endif |
@@ -946,7 +947,6 @@ ifneq ($(KBUILD_SRC),) | |||
946 | mkdir -p include2; \ | 947 | mkdir -p include2; \ |
947 | ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ | 948 | ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ |
948 | fi | 949 | fi |
949 | ln -fsn $(srctree) source | ||
950 | endif | 950 | endif |
951 | 951 | ||
952 | # prepare2 creates a makefile if using a separate output directory | 952 | # prepare2 creates a makefile if using a separate output directory |
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index f238370c907d..8d0097f10208 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -93,8 +93,8 @@ common_shutdown_1(void *generic_ptr) | |||
93 | if (cpuid != boot_cpuid) { | 93 | if (cpuid != boot_cpuid) { |
94 | flags |= 0x00040000UL; /* "remain halted" */ | 94 | flags |= 0x00040000UL; /* "remain halted" */ |
95 | *pflags = flags; | 95 | *pflags = flags; |
96 | cpu_clear(cpuid, cpu_present_map); | 96 | set_cpu_present(cpuid, false); |
97 | cpu_clear(cpuid, cpu_possible_map); | 97 | set_cpu_possible(cpuid, false); |
98 | halt(); | 98 | halt(); |
99 | } | 99 | } |
100 | #endif | 100 | #endif |
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr) | |||
120 | 120 | ||
121 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
122 | /* Wait for the secondaries to halt. */ | 122 | /* Wait for the secondaries to halt. */ |
123 | cpu_clear(boot_cpuid, cpu_present_map); | 123 | set_cpu_present(boot_cpuid, false); |
124 | cpu_clear(boot_cpuid, cpu_possible_map); | 124 | set_cpu_possible(boot_cpuid, false); |
125 | while (cpus_weight(cpu_present_map)) | 125 | while (cpus_weight(cpu_present_map)) |
126 | barrier(); | 126 | barrier(); |
127 | #endif | 127 | #endif |
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 00f1dc3dfd5f..b1fe5674c3a1 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -120,12 +120,12 @@ void __cpuinit | |||
120 | smp_callin(void) | 120 | smp_callin(void) |
121 | { | 121 | { |
122 | int cpuid = hard_smp_processor_id(); | 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 | printk("??, cpu 0x%x already present??\n", cpuid); | 125 | printk("??, cpu 0x%x already present??\n", cpuid); |
127 | BUG(); | 126 | BUG(); |
128 | } | 127 | } |
128 | set_cpu_online(cpuid, true); | ||
129 | 129 | ||
130 | /* Turn on machine checks. */ | 130 | /* Turn on machine checks. */ |
131 | wrmces(7); | 131 | wrmces(7); |
@@ -436,8 +436,8 @@ setup_smp(void) | |||
436 | ((char *)cpubase + i*hwrpb->processor_size); | 436 | ((char *)cpubase + i*hwrpb->processor_size); |
437 | if ((cpu->flags & 0x1cc) == 0x1cc) { | 437 | if ((cpu->flags & 0x1cc) == 0x1cc) { |
438 | smp_num_probed++; | 438 | smp_num_probed++; |
439 | cpu_set(i, cpu_possible_map); | 439 | set_cpu_possible(i, true); |
440 | cpu_set(i, cpu_present_map); | 440 | set_cpu_present(i, true); |
441 | cpu->pal_revision = boot_cpu_palrev; | 441 | cpu->pal_revision = boot_cpu_palrev; |
442 | } | 442 | } |
443 | 443 | ||
@@ -470,8 +470,8 @@ smp_prepare_cpus(unsigned int max_cpus) | |||
470 | 470 | ||
471 | /* Nothing to do on a UP box, or when told not to. */ | 471 | /* Nothing to do on a UP box, or when told not to. */ |
472 | if (smp_num_probed == 1 || max_cpus == 0) { | 472 | if (smp_num_probed == 1 || max_cpus == 0) { |
473 | cpu_possible_map = cpumask_of_cpu(boot_cpuid); | 473 | init_cpu_possible(cpumask_of(boot_cpuid)); |
474 | cpu_present_map = cpumask_of_cpu(boot_cpuid); | 474 | init_cpu_present(cpumask_of(boot_cpuid)); |
475 | printk(KERN_INFO "SMP mode deactivated.\n"); | 475 | printk(KERN_INFO "SMP mode deactivated.\n"); |
476 | return; | 476 | return; |
477 | } | 477 | } |
diff --git a/arch/ia64/include/asm/kvm.h b/arch/ia64/include/asm/kvm.h index 68aa6da807c1..bfa86b6af7cd 100644 --- a/arch/ia64/include/asm/kvm.h +++ b/arch/ia64/include/asm/kvm.h | |||
@@ -25,6 +25,10 @@ | |||
25 | 25 | ||
26 | #include <linux/ioctl.h> | 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 | /* Architectural interrupt line count. */ | 32 | /* Architectural interrupt line count. */ |
29 | #define KVM_NR_INTERRUPTS 256 | 33 | #define KVM_NR_INTERRUPTS 256 |
30 | 34 | ||
diff --git a/arch/ia64/include/asm/mmzone.h b/arch/ia64/include/asm/mmzone.h index 34efe88eb849..f2ca32069b3f 100644 --- a/arch/ia64/include/asm/mmzone.h +++ b/arch/ia64/include/asm/mmzone.h | |||
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
31 | #endif | 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 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ | 34 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ |
39 | # define MAX_PHYSNODE_ID 8 | 35 | # define MAX_PHYSNODE_ID 8 |
40 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) | 36 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 4e586f6110aa..28f982045f29 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1337,6 +1337,10 @@ static void kvm_release_vm_pages(struct kvm *kvm) | |||
1337 | } | 1337 | } |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | void kvm_arch_sync_events(struct kvm *kvm) | ||
1341 | { | ||
1342 | } | ||
1343 | |||
1340 | void kvm_arch_destroy_vm(struct kvm *kvm) | 1344 | void kvm_arch_destroy_vm(struct kvm *kvm) |
1341 | { | 1345 | { |
1342 | kvm_iommu_unmap_guest(kvm); | 1346 | kvm_iommu_unmap_guest(kvm); |
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c index 552d07724207..230eae482f32 100644 --- a/arch/ia64/kvm/process.c +++ b/arch/ia64/kvm/process.c | |||
@@ -455,13 +455,18 @@ fpswa_ret_t vmm_fp_emulate(int fp_fault, void *bundle, unsigned long *ipsr, | |||
455 | if (!vmm_fpswa_interface) | 455 | if (!vmm_fpswa_interface) |
456 | return (fpswa_ret_t) {-1, 0, 0, 0}; | 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 | memset(&fp_state, 0, sizeof(fp_state_t)); | 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 *) ®s->f6; | ||
468 | |||
469 | /* | ||
465 | * unsigned long (*EFI_FPSWA) ( | 470 | * unsigned long (*EFI_FPSWA) ( |
466 | * unsigned long trap_type, | 471 | * unsigned long trap_type, |
467 | * void *Bundle, | 472 | * void *Bundle, |
@@ -545,10 +550,6 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim, | |||
545 | status = vmm_handle_fpu_swa(0, regs, isr); | 550 | status = vmm_handle_fpu_swa(0, regs, isr); |
546 | if (!status) | 551 | if (!status) |
547 | return ; | 552 | return ; |
548 | else if (-EAGAIN == status) { | ||
549 | vcpu_decrement_iip(vcpu); | ||
550 | return ; | ||
551 | } | ||
552 | break; | 553 | break; |
553 | } | 554 | } |
554 | 555 | ||
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index b73bf1838e57..3efea7d0a351 100644 --- a/arch/ia64/mm/numa.c +++ b/arch/ia64/mm/numa.c | |||
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr) | |||
58 | * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where | 58 | * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where |
59 | * the section resides. | 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 | int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; | 63 | int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; |
64 | 64 | ||
@@ -70,7 +70,7 @@ int early_pfn_to_nid(unsigned long pfn) | |||
70 | return node_memblk[i].nid; | 70 | return node_memblk[i].nid; |
71 | } | 71 | } |
72 | 72 | ||
73 | return 0; | 73 | return -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | #ifdef CONFIG_MEMORY_HOTPLUG | 76 | #ifdef CONFIG_MEMORY_HOTPLUG |
diff --git a/arch/powerpc/include/asm/pgtable-4k.h b/arch/powerpc/include/asm/pgtable-4k.h index 6b18ba9d2d85..1dbca4e7de67 100644 --- a/arch/powerpc/include/asm/pgtable-4k.h +++ b/arch/powerpc/include/asm/pgtable-4k.h | |||
@@ -60,7 +60,7 @@ | |||
60 | /* It should be preserving the high 48 bits and then specifically */ | 60 | /* It should be preserving the high 48 bits and then specifically */ |
61 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | 61 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ |
62 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ | 62 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ |
63 | _PAGE_HPTEFLAGS) | 63 | _PAGE_HPTEFLAGS | _PAGE_SPECIAL) |
64 | 64 | ||
65 | /* Bits to mask out from a PMD to get to the PTE page */ | 65 | /* Bits to mask out from a PMD to get to the PTE page */ |
66 | #define PMD_MASKED_BITS 0 | 66 | #define PMD_MASKED_BITS 0 |
diff --git a/arch/powerpc/include/asm/pgtable-64k.h b/arch/powerpc/include/asm/pgtable-64k.h index 07b0d8f09cb6..7389003349a6 100644 --- a/arch/powerpc/include/asm/pgtable-64k.h +++ b/arch/powerpc/include/asm/pgtable-64k.h | |||
@@ -114,7 +114,7 @@ static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd) | |||
114 | * pgprot changes | 114 | * pgprot changes |
115 | */ | 115 | */ |
116 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ | 116 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
117 | _PAGE_ACCESSED) | 117 | _PAGE_ACCESSED | _PAGE_SPECIAL) |
118 | 118 | ||
119 | /* Bits to mask out from a PMD to get to the PTE page */ | 119 | /* Bits to mask out from a PMD to get to the PTE page */ |
120 | #define PMD_MASKED_BITS 0x1ff | 120 | #define PMD_MASKED_BITS 0x1ff |
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h index f69a4d977729..820b5f0a35ce 100644 --- a/arch/powerpc/include/asm/pgtable-ppc32.h +++ b/arch/powerpc/include/asm/pgtable-ppc32.h | |||
@@ -429,7 +429,8 @@ extern int icache_44x_need_flush; | |||
429 | #define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() | 429 | #define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() |
430 | #endif | 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 | #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ | 436 | #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ |
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c index 5af4e9b2dbe2..ada06924a423 100644 --- a/arch/powerpc/kernel/align.c +++ b/arch/powerpc/kernel/align.c | |||
@@ -646,11 +646,16 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg, | |||
646 | unsigned int areg, struct pt_regs *regs, | 646 | unsigned int areg, struct pt_regs *regs, |
647 | unsigned int flags, unsigned int length) | 647 | unsigned int flags, unsigned int length) |
648 | { | 648 | { |
649 | char *ptr = (char *) ¤t->thread.TS_FPR(reg); | 649 | char *ptr; |
650 | int ret = 0; | 650 | int ret = 0; |
651 | 651 | ||
652 | flush_vsx_to_thread(current); | 652 | flush_vsx_to_thread(current); |
653 | 653 | ||
654 | if (reg < 32) | ||
655 | ptr = (char *) ¤t->thread.TS_FPR(reg); | ||
656 | else | ||
657 | ptr = (char *) ¤t->thread.vr[reg - 32]; | ||
658 | |||
654 | if (flags & ST) | 659 | if (flags & ST) |
655 | ret = __copy_to_user(addr, ptr, length); | 660 | ret = __copy_to_user(addr, ptr, length); |
656 | else { | 661 | else { |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 2822c8ccfaaf..5f81256287f5 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -125,6 +125,10 @@ static void kvmppc_free_vcpus(struct kvm *kvm) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void kvm_arch_sync_events(struct kvm *kvm) | ||
129 | { | ||
130 | } | ||
131 | |||
128 | void kvm_arch_destroy_vm(struct kvm *kvm) | 132 | void kvm_arch_destroy_vm(struct kvm *kvm) |
129 | { | 133 | { |
130 | kvmppc_free_vcpus(kvm); | 134 | kvmppc_free_vcpus(kvm); |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 7393bd76d698..5ac08b8ab654 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
20 | #include <linux/lmb.h> | 20 | #include <linux/lmb.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/pfn.h> | ||
22 | #include <asm/sparsemem.h> | 23 | #include <asm/sparsemem.h> |
23 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
@@ -882,7 +883,7 @@ static void mark_reserved_regions_for_nid(int nid) | |||
882 | unsigned long physbase = lmb.reserved.region[i].base; | 883 | unsigned long physbase = lmb.reserved.region[i].base; |
883 | unsigned long size = lmb.reserved.region[i].size; | 884 | unsigned long size = lmb.reserved.region[i].size; |
884 | unsigned long start_pfn = physbase >> PAGE_SHIFT; | 885 | unsigned long start_pfn = physbase >> PAGE_SHIFT; |
885 | unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); | 886 | unsigned long end_pfn = PFN_UP(physbase + size); |
886 | struct node_active_region node_ar; | 887 | struct node_active_region node_ar; |
887 | unsigned long node_end_pfn = node->node_start_pfn + | 888 | unsigned long node_end_pfn = node->node_start_pfn + |
888 | node->node_spanned_pages; | 889 | node->node_spanned_pages; |
@@ -908,7 +909,7 @@ static void mark_reserved_regions_for_nid(int nid) | |||
908 | */ | 909 | */ |
909 | if (end_pfn > node_ar.end_pfn) | 910 | if (end_pfn > node_ar.end_pfn) |
910 | reserve_size = (node_ar.end_pfn << PAGE_SHIFT) | 911 | reserve_size = (node_ar.end_pfn << PAGE_SHIFT) |
911 | - (start_pfn << PAGE_SHIFT); | 912 | - physbase; |
912 | /* | 913 | /* |
913 | * Only worry about *this* node, others may not | 914 | * Only worry about *this* node, others may not |
914 | * yet have valid NODE_DATA(). | 915 | * yet have valid NODE_DATA(). |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 67de6bf3db3d..d281cc0bca71 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -328,7 +328,7 @@ static int __init ps3_mm_add_memory(void) | |||
328 | return result; | 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 | /* dma routines */ | 334 | /* dma routines */ |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index be8497186b96..0d33893e1e89 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -212,6 +212,10 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | void kvm_arch_sync_events(struct kvm *kvm) | ||
216 | { | ||
217 | } | ||
218 | |||
215 | void kvm_arch_destroy_vm(struct kvm *kvm) | 219 | void kvm_arch_destroy_vm(struct kvm *kvm) |
216 | { | 220 | { |
217 | kvm_free_vcpus(kvm); | 221 | kvm_free_vcpus(kvm); |
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h index d2e3bf3608af..886c9402ec45 100644 --- a/arch/x86/include/asm/kvm.h +++ b/arch/x86/include/asm/kvm.h | |||
@@ -9,6 +9,13 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/ioctl.h> | 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 | /* Architectural interrupt line count. */ | 19 | /* Architectural interrupt line count. */ |
13 | #define KVM_NR_INTERRUPTS 256 | 20 | #define KVM_NR_INTERRUPTS 256 |
14 | 21 | ||
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h index 07f1af494ca5..105fb90a0635 100644 --- a/arch/x86/include/asm/mmzone_32.h +++ b/arch/x86/include/asm/mmzone_32.h | |||
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void) | |||
32 | get_memcfg_numa_flat(); | 32 | get_memcfg_numa_flat(); |
33 | } | 33 | } |
34 | 34 | ||
35 | extern int early_pfn_to_nid(unsigned long pfn); | ||
36 | |||
37 | extern void resume_map_numa_kva(pgd_t *pgd); | 35 | extern void resume_map_numa_kva(pgd_t *pgd); |
38 | 36 | ||
39 | #else /* !CONFIG_NUMA */ | 37 | #else /* !CONFIG_NUMA */ |
diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h index a5b3817d4b9e..a29f48c2a322 100644 --- a/arch/x86/include/asm/mmzone_64.h +++ b/arch/x86/include/asm/mmzone_64.h | |||
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
40 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | 40 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ |
41 | NODE_DATA(nid)->node_spanned_pages) | 41 | NODE_DATA(nid)->node_spanned_pages) |
42 | 42 | ||
43 | extern int early_pfn_to_nid(unsigned long pfn); | ||
44 | |||
45 | #ifdef CONFIG_NUMA_EMU | 43 | #ifdef CONFIG_NUMA_EMU |
46 | #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) | 44 | #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) |
47 | #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) | 45 | #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) |
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index e9873a2e8695..776579119a00 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -57,7 +57,6 @@ typedef struct { pgdval_t pgd; } pgd_t; | |||
57 | typedef struct { pgprotval_t pgprot; } pgprot_t; | 57 | typedef struct { pgprotval_t pgprot; } pgprot_t; |
58 | 58 | ||
59 | extern int page_is_ram(unsigned long pagenr); | 59 | extern int page_is_ram(unsigned long pagenr); |
60 | extern int pagerange_is_ram(unsigned long start, unsigned long end); | ||
61 | extern int devmem_is_allowed(unsigned long pagenr); | 60 | extern int devmem_is_allowed(unsigned long pagenr); |
62 | extern void map_devmem(unsigned long pfn, unsigned long size, | 61 | extern void map_devmem(unsigned long pfn, unsigned long size, |
63 | pgprot_t vma_prot); | 62 | pgprot_t vma_prot); |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index c09a14127584..e299287e8e33 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -1352,14 +1352,7 @@ static inline void arch_leave_lazy_cpu_mode(void) | |||
1352 | PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave); | 1352 | PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static inline void arch_flush_lazy_cpu_mode(void) | 1355 | 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 | |||
1363 | 1356 | ||
1364 | #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE | 1357 | #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE |
1365 | static inline void arch_enter_lazy_mmu_mode(void) | 1358 | static inline void arch_enter_lazy_mmu_mode(void) |
@@ -1372,13 +1365,7 @@ static inline void arch_leave_lazy_mmu_mode(void) | |||
1372 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); | 1365 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); |
1373 | } | 1366 | } |
1374 | 1367 | ||
1375 | static inline void arch_flush_lazy_mmu_mode(void) | 1368 | void arch_flush_lazy_mmu_mode(void); |
1376 | { | ||
1377 | if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) { | ||
1378 | arch_leave_lazy_mmu_mode(); | ||
1379 | arch_enter_lazy_mmu_mode(); | ||
1380 | } | ||
1381 | } | ||
1382 | 1369 | ||
1383 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | 1370 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, |
1384 | unsigned long phys, pgprot_t flags) | 1371 | unsigned long phys, pgprot_t flags) |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index fb039cd345d8..6428aa17b40e 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1157,8 +1157,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1157 | data->cpu = pol->cpu; | 1157 | data->cpu = pol->cpu; |
1158 | data->currpstate = HW_PSTATE_INVALID; | 1158 | data->currpstate = HW_PSTATE_INVALID; |
1159 | 1159 | ||
1160 | rc = powernow_k8_cpu_init_acpi(data); | 1160 | if (powernow_k8_cpu_init_acpi(data)) { |
1161 | if (rc) { | ||
1162 | /* | 1161 | /* |
1163 | * Use the PSB BIOS structure. This is only availabe on | 1162 | * Use the PSB BIOS structure. This is only availabe on |
1164 | * an UP version, and is deprecated by AMD. | 1163 | * an UP version, and is deprecated by AMD. |
@@ -1176,17 +1175,20 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1176 | "ACPI maintainers and complain to your BIOS " | 1175 | "ACPI maintainers and complain to your BIOS " |
1177 | "vendor.\n"); | 1176 | "vendor.\n"); |
1178 | #endif | 1177 | #endif |
1179 | goto err_out; | 1178 | kfree(data); |
1179 | return -ENODEV; | ||
1180 | } | 1180 | } |
1181 | if (pol->cpu != 0) { | 1181 | if (pol->cpu != 0) { |
1182 | printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " | 1182 | printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " |
1183 | "CPU other than CPU0. Complain to your BIOS " | 1183 | "CPU other than CPU0. Complain to your BIOS " |
1184 | "vendor.\n"); | 1184 | "vendor.\n"); |
1185 | goto err_out; | 1185 | kfree(data); |
1186 | return -ENODEV; | ||
1186 | } | 1187 | } |
1187 | rc = find_psb_table(data); | 1188 | rc = find_psb_table(data); |
1188 | if (rc) { | 1189 | if (rc) { |
1189 | goto err_out; | 1190 | kfree(data); |
1191 | return -ENODEV; | ||
1190 | } | 1192 | } |
1191 | /* Take a crude guess here. | 1193 | /* Take a crude guess here. |
1192 | * That guess was in microseconds, so multiply with 1000 */ | 1194 | * That guess was in microseconds, so multiply with 1000 */ |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 388254f69a2a..a00545fe5cdd 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -269,6 +269,8 @@ static void hpet_set_mode(enum clock_event_mode mode, | |||
269 | now = hpet_readl(HPET_COUNTER); | 269 | now = hpet_readl(HPET_COUNTER); |
270 | cmp = now + (unsigned long) delta; | 270 | cmp = now + (unsigned long) delta; |
271 | cfg = hpet_readl(HPET_Tn_CFG(timer)); | 271 | cfg = hpet_readl(HPET_Tn_CFG(timer)); |
272 | /* Make sure we use edge triggered interrupts */ | ||
273 | cfg &= ~HPET_TN_LEVEL; | ||
272 | cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC | | 274 | cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC | |
273 | HPET_TN_SETVAL | HPET_TN_32BIT; | 275 | HPET_TN_SETVAL | HPET_TN_32BIT; |
274 | hpet_writel(cfg, HPET_Tn_CFG(timer)); | 276 | hpet_writel(cfg, HPET_Tn_CFG(timer)); |
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c index 7a13fac63a1f..4006c522adc7 100644 --- a/arch/x86/kernel/olpc.c +++ b/arch/x86/kernel/olpc.c | |||
@@ -203,7 +203,7 @@ static void __init platform_detect(void) | |||
203 | static void __init platform_detect(void) | 203 | static void __init platform_detect(void) |
204 | { | 204 | { |
205 | /* stopgap until OFW support is added to the kernel */ | 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 | #endif | 208 | #endif |
209 | 209 | ||
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index e4c8fb608873..c6520a4e85d4 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -268,6 +268,32 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void) | |||
268 | return __get_cpu_var(paravirt_lazy_mode); | 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 | struct pv_info pv_info = { | 297 | struct pv_info pv_info = { |
272 | .name = "bare hardware", | 298 | .name = "bare hardware", |
273 | .paravirt_enabled = 0, | 299 | .paravirt_enabled = 0, |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 0a5df5f82fb9..5a4c23d89892 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -810,12 +810,16 @@ static void ptrace_bts_untrace(struct task_struct *child) | |||
810 | 810 | ||
811 | static void ptrace_bts_detach(struct task_struct *child) | 811 | static void ptrace_bts_detach(struct task_struct *child) |
812 | { | 812 | { |
813 | if (unlikely(child->bts)) { | 813 | /* |
814 | ds_release_bts(child->bts); | 814 | * Ptrace_detach() races with ptrace_untrace() in case |
815 | child->bts = NULL; | 815 | * the child dies and is reaped by another thread. |
816 | 816 | * | |
817 | ptrace_bts_free_buffer(child); | 817 | * We only do the memory accounting at this point and |
818 | } | 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 | #else | 824 | #else |
821 | static inline void ptrace_bts_fork(struct task_struct *tsk) {} | 825 | static inline void ptrace_bts_fork(struct task_struct *tsk) {} |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 7932338d7cb3..a9e7548e1790 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -99,6 +99,12 @@ static inline void preempt_conditional_sti(struct pt_regs *regs) | |||
99 | local_irq_enable(); | 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 | static inline void preempt_conditional_cli(struct pt_regs *regs) | 108 | static inline void preempt_conditional_cli(struct pt_regs *regs) |
103 | { | 109 | { |
104 | if (regs->flags & X86_EFLAGS_IF) | 110 | if (regs->flags & X86_EFLAGS_IF) |
@@ -626,8 +632,10 @@ clear_dr7: | |||
626 | 632 | ||
627 | #ifdef CONFIG_X86_32 | 633 | #ifdef CONFIG_X86_32 |
628 | debug_vm86: | 634 | debug_vm86: |
635 | /* reenable preemption: handle_vm86_trap() might sleep */ | ||
636 | dec_preempt_count(); | ||
629 | handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); | 637 | handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); |
630 | preempt_conditional_cli(regs); | 638 | conditional_cli(regs); |
631 | return; | 639 | return; |
632 | #endif | 640 | #endif |
633 | 641 | ||
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index e665d1c623ca..72bd275a9b5c 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -207,7 +207,7 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps) | |||
207 | hrtimer_add_expires_ns(&pt->timer, pt->period); | 207 | hrtimer_add_expires_ns(&pt->timer, pt->period); |
208 | pt->scheduled = hrtimer_get_expires_ns(&pt->timer); | 208 | pt->scheduled = hrtimer_get_expires_ns(&pt->timer); |
209 | if (pt->period) | 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 | return (pt->period == 0 ? 0 : 1); | 212 | return (pt->period == 0 ? 0 : 1); |
213 | } | 213 | } |
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c index c019b8edcdb7..cf17ed52f6fb 100644 --- a/arch/x86/kvm/irq.c +++ b/arch/x86/kvm/irq.c | |||
@@ -87,13 +87,6 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) | |||
87 | } | 87 | } |
88 | EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); | 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 | void __kvm_migrate_timers(struct kvm_vcpu *vcpu) | 90 | void __kvm_migrate_timers(struct kvm_vcpu *vcpu) |
98 | { | 91 | { |
99 | __kvm_migrate_apic_timer(vcpu); | 92 | __kvm_migrate_apic_timer(vcpu); |
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h index 2bf32a03ceec..82579ee538d0 100644 --- a/arch/x86/kvm/irq.h +++ b/arch/x86/kvm/irq.h | |||
@@ -89,7 +89,6 @@ static inline int irqchip_in_kernel(struct kvm *kvm) | |||
89 | 89 | ||
90 | void kvm_pic_reset(struct kvm_kpic_state *s); | 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 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); | 92 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); |
94 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); | 93 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); |
95 | void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); | 94 | void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index afac68c0815c..f0b67f2cdd69 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -35,6 +35,12 @@ | |||
35 | #include "kvm_cache_regs.h" | 35 | #include "kvm_cache_regs.h" |
36 | #include "irq.h" | 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 | #define PRId64 "d" | 44 | #define PRId64 "d" |
39 | #define PRIx64 "llx" | 45 | #define PRIx64 "llx" |
40 | #define PRIu64 "u" | 46 | #define PRIu64 "u" |
@@ -511,52 +517,22 @@ static void apic_send_ipi(struct kvm_lapic *apic) | |||
511 | 517 | ||
512 | static u32 apic_get_tmcct(struct kvm_lapic *apic) | 518 | static u32 apic_get_tmcct(struct kvm_lapic *apic) |
513 | { | 519 | { |
514 | u64 counter_passed; | 520 | ktime_t remaining; |
515 | ktime_t passed, now; | 521 | s64 ns; |
516 | u32 tmcct; | 522 | u32 tmcct; |
517 | 523 | ||
518 | ASSERT(apic != NULL); | 524 | ASSERT(apic != NULL); |
519 | 525 | ||
520 | now = apic->timer.dev.base->get_time(); | ||
521 | tmcct = apic_get_reg(apic, APIC_TMICT); | ||
522 | |||
523 | /* if initial count is 0, current count should also be 0 */ | 526 | /* if initial count is 0, current count should also be 0 */ |
524 | if (tmcct == 0) | 527 | if (apic_get_reg(apic, APIC_TMICT) == 0) |
525 | return 0; | 528 | return 0; |
526 | 529 | ||
527 | if (unlikely(ktime_to_ns(now) <= | 530 | remaining = hrtimer_expires_remaining(&apic->timer.dev); |
528 | ktime_to_ns(apic->timer.last_update))) { | 531 | if (ktime_to_ns(remaining) < 0) |
529 | /* Wrap around */ | 532 | remaining = ktime_set(0, 0); |
530 | passed = ktime_add(( { | 533 | |
531 | (ktime_t) { | 534 | ns = mod_64(ktime_to_ns(remaining), apic->timer.period); |
532 | .tv64 = KTIME_MAX - | 535 | tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); |
533 | (apic->timer.last_update).tv64}; } | ||
534 | ), now); | ||
535 | apic_debug("time elapsed\n"); | ||
536 | } else | ||
537 | passed = ktime_sub(now, apic->timer.last_update); | ||
538 | |||
539 | counter_passed = div64_u64(ktime_to_ns(passed), | ||
540 | (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); | ||
541 | |||
542 | if (counter_passed > tmcct) { | ||
543 | if (unlikely(!apic_lvtt_period(apic))) { | ||
544 | /* one-shot timers stick at 0 until reset */ | ||
545 | tmcct = 0; | ||
546 | } else { | ||
547 | /* | ||
548 | * periodic timers reset to APIC_TMICT when they | ||
549 | * hit 0. The while loop simulates this happening N | ||
550 | * times. (counter_passed %= tmcct) would also work, | ||
551 | * but might be slower or not work on 32-bit?? | ||
552 | */ | ||
553 | while (counter_passed > tmcct) | ||
554 | counter_passed -= tmcct; | ||
555 | tmcct -= counter_passed; | ||
556 | } | ||
557 | } else { | ||
558 | tmcct -= counter_passed; | ||
559 | } | ||
560 | 536 | ||
561 | return tmcct; | 537 | return tmcct; |
562 | } | 538 | } |
@@ -653,8 +629,6 @@ static void start_apic_timer(struct kvm_lapic *apic) | |||
653 | { | 629 | { |
654 | ktime_t now = apic->timer.dev.base->get_time(); | 630 | ktime_t now = apic->timer.dev.base->get_time(); |
655 | 631 | ||
656 | apic->timer.last_update = now; | ||
657 | |||
658 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * | 632 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * |
659 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; | 633 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; |
660 | atomic_set(&apic->timer.pending, 0); | 634 | atomic_set(&apic->timer.pending, 0); |
@@ -1110,16 +1084,6 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu) | |||
1110 | } | 1084 | } |
1111 | } | 1085 | } |
1112 | 1086 | ||
1113 | void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec) | ||
1114 | { | ||
1115 | struct kvm_lapic *apic = vcpu->arch.apic; | ||
1116 | |||
1117 | if (apic && apic_lvt_vector(apic, APIC_LVTT) == vec) | ||
1118 | apic->timer.last_update = ktime_add_ns( | ||
1119 | apic->timer.last_update, | ||
1120 | apic->timer.period); | ||
1121 | } | ||
1122 | |||
1123 | int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) | 1087 | int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) |
1124 | { | 1088 | { |
1125 | int vector = kvm_apic_has_interrupt(vcpu); | 1089 | int vector = kvm_apic_has_interrupt(vcpu); |
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index 81858881287e..45ab6ee71209 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h | |||
@@ -12,7 +12,6 @@ struct kvm_lapic { | |||
12 | atomic_t pending; | 12 | atomic_t pending; |
13 | s64 period; /* unit: ns */ | 13 | s64 period; /* unit: ns */ |
14 | u32 divide_count; | 14 | u32 divide_count; |
15 | ktime_t last_update; | ||
16 | struct hrtimer dev; | 15 | struct hrtimer dev; |
17 | } timer; | 16 | } timer; |
18 | struct kvm_vcpu *vcpu; | 17 | struct kvm_vcpu *vcpu; |
@@ -42,7 +41,6 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); | |||
42 | void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); | 41 | void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); |
43 | int kvm_lapic_enabled(struct kvm_vcpu *vcpu); | 42 | int kvm_lapic_enabled(struct kvm_vcpu *vcpu); |
44 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); | 43 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); |
45 | void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec); | ||
46 | 44 | ||
47 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); | 45 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); |
48 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); | 46 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 83f11c7474a1..2d4477c71473 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1698,8 +1698,13 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1698 | if (largepage) | 1698 | if (largepage) |
1699 | spte |= PT_PAGE_SIZE_MASK; | 1699 | spte |= PT_PAGE_SIZE_MASK; |
1700 | if (mt_mask) { | 1700 | if (mt_mask) { |
1701 | mt_mask = get_memory_type(vcpu, gfn) << | 1701 | if (!kvm_is_mmio_pfn(pfn)) { |
1702 | kvm_x86_ops->get_mt_mask_shift(); | 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 | spte |= mt_mask; | 1708 | spte |= mt_mask; |
1704 | } | 1709 | } |
1705 | 1710 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1452851ae258..a9e769e4e251 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1600,7 +1600,6 @@ static void svm_intr_assist(struct kvm_vcpu *vcpu) | |||
1600 | /* Okay, we can deliver the interrupt: grab it and update PIC state. */ | 1600 | /* Okay, we can deliver the interrupt: grab it and update PIC state. */ |
1601 | intr_vector = kvm_cpu_get_interrupt(vcpu); | 1601 | intr_vector = kvm_cpu_get_interrupt(vcpu); |
1602 | svm_inject_irq(svm, intr_vector); | 1602 | svm_inject_irq(svm, intr_vector); |
1603 | kvm_timer_intr_post(vcpu, intr_vector); | ||
1604 | out: | 1603 | out: |
1605 | update_cr8_intercept(vcpu); | 1604 | update_cr8_intercept(vcpu); |
1606 | } | 1605 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6259d7467648..7611af576829 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -903,6 +903,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) | |||
903 | data = vmcs_readl(GUEST_SYSENTER_ESP); | 903 | data = vmcs_readl(GUEST_SYSENTER_ESP); |
904 | break; | 904 | break; |
905 | default: | 905 | default: |
906 | vmx_load_host_state(to_vmx(vcpu)); | ||
906 | msr = find_msr_entry(to_vmx(vcpu), msr_index); | 907 | msr = find_msr_entry(to_vmx(vcpu), msr_index); |
907 | if (msr) { | 908 | if (msr) { |
908 | data = msr->data; | 909 | data = msr->data; |
@@ -3285,7 +3286,6 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) | |||
3285 | } | 3286 | } |
3286 | if (vcpu->arch.interrupt.pending) { | 3287 | if (vcpu->arch.interrupt.pending) { |
3287 | vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); | 3288 | vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); |
3288 | kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr); | ||
3289 | if (kvm_cpu_has_interrupt(vcpu)) | 3289 | if (kvm_cpu_has_interrupt(vcpu)) |
3290 | enable_irq_window(vcpu); | 3290 | enable_irq_window(vcpu); |
3291 | } | 3291 | } |
@@ -3687,8 +3687,7 @@ static int __init vmx_init(void) | |||
3687 | if (vm_need_ept()) { | 3687 | if (vm_need_ept()) { |
3688 | bypass_guest_pf = 0; | 3688 | bypass_guest_pf = 0; |
3689 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | 3689 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | |
3690 | VMX_EPT_WRITABLE_MASK | | 3690 | VMX_EPT_WRITABLE_MASK); |
3691 | VMX_EPT_IGMT_BIT); | ||
3692 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, | 3691 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, |
3693 | VMX_EPT_EXECUTABLE_MASK, | 3692 | VMX_EPT_EXECUTABLE_MASK, |
3694 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | 3693 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cc17546a2406..758b7a155ae9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -967,7 +967,6 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
967 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: | 967 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: |
968 | case KVM_CAP_SET_TSS_ADDR: | 968 | case KVM_CAP_SET_TSS_ADDR: |
969 | case KVM_CAP_EXT_CPUID: | 969 | case KVM_CAP_EXT_CPUID: |
970 | case KVM_CAP_CLOCKSOURCE: | ||
971 | case KVM_CAP_PIT: | 970 | case KVM_CAP_PIT: |
972 | case KVM_CAP_NOP_IO_DELAY: | 971 | case KVM_CAP_NOP_IO_DELAY: |
973 | case KVM_CAP_MP_STATE: | 972 | case KVM_CAP_MP_STATE: |
@@ -992,6 +991,9 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
992 | case KVM_CAP_IOMMU: | 991 | case KVM_CAP_IOMMU: |
993 | r = iommu_found(); | 992 | r = iommu_found(); |
994 | break; | 993 | break; |
994 | case KVM_CAP_CLOCKSOURCE: | ||
995 | r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC); | ||
996 | break; | ||
995 | default: | 997 | default: |
996 | r = 0; | 998 | r = 0; |
997 | break; | 999 | break; |
@@ -4127,9 +4129,13 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
4127 | 4129 | ||
4128 | } | 4130 | } |
4129 | 4131 | ||
4130 | void kvm_arch_destroy_vm(struct kvm *kvm) | 4132 | void kvm_arch_sync_events(struct kvm *kvm) |
4131 | { | 4133 | { |
4132 | kvm_free_all_assigned_devices(kvm); | 4134 | kvm_free_all_assigned_devices(kvm); |
4135 | } | ||
4136 | |||
4137 | void kvm_arch_destroy_vm(struct kvm *kvm) | ||
4138 | { | ||
4133 | kvm_iommu_unmap_guest(kvm); | 4139 | kvm_iommu_unmap_guest(kvm); |
4134 | kvm_free_pit(kvm); | 4140 | kvm_free_pit(kvm); |
4135 | kfree(kvm->arch.vpic); | 4141 | kfree(kvm->arch.vpic); |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index af750ab973b6..f45d5e29a72e 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -134,25 +134,6 @@ int page_is_ram(unsigned long pagenr) | |||
134 | return 0; | 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 | * Fix up the linear direct mapping of the kernel to avoid cache attribute | 138 | * Fix up the linear direct mapping of the kernel to avoid cache attribute |
158 | * conflicts. | 139 | * conflicts. |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 71a14f89f89e..f3516da035d1 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -145,7 +145,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes, | |||
145 | return shift; | 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 | return phys_to_nid(pfn << PAGE_SHIFT); | 150 | return phys_to_nid(pfn << PAGE_SHIFT); |
151 | } | 151 | } |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 84ba74820ad6..8ca0d8566fc8 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -575,7 +575,6 @@ static int __change_page_attr(struct cpa_data *cpa, int primary) | |||
575 | address = cpa->vaddr[cpa->curpage]; | 575 | address = cpa->vaddr[cpa->curpage]; |
576 | else | 576 | else |
577 | address = *cpa->vaddr; | 577 | address = *cpa->vaddr; |
578 | |||
579 | repeat: | 578 | repeat: |
580 | kpte = lookup_address(address, &level); | 579 | kpte = lookup_address(address, &level); |
581 | if (!kpte) | 580 | if (!kpte) |
@@ -812,6 +811,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages, | |||
812 | 811 | ||
813 | vm_unmap_aliases(); | 812 | vm_unmap_aliases(); |
814 | 813 | ||
814 | /* | ||
815 | * If we're called with lazy mmu updates enabled, the | ||
816 | * in-memory pte state may be stale. Flush pending updates to | ||
817 | * bring them up to date. | ||
818 | */ | ||
819 | arch_flush_lazy_mmu_mode(); | ||
820 | |||
815 | cpa.vaddr = addr; | 821 | cpa.vaddr = addr; |
816 | cpa.numpages = numpages; | 822 | cpa.numpages = numpages; |
817 | cpa.mask_set = mask_set; | 823 | cpa.mask_set = mask_set; |
@@ -854,6 +860,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages, | |||
854 | } else | 860 | } else |
855 | cpa_flush_all(cache); | 861 | cpa_flush_all(cache); |
856 | 862 | ||
863 | /* | ||
864 | * If we've been called with lazy mmu updates enabled, then | ||
865 | * make sure that everything gets flushed out before we | ||
866 | * return. | ||
867 | */ | ||
868 | arch_flush_lazy_mmu_mode(); | ||
869 | |||
857 | out: | 870 | out: |
858 | return ret; | 871 | return ret; |
859 | } | 872 | } |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 7b61036427df..aebbf67a79d0 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -211,6 +211,33 @@ chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type) | |||
211 | static struct memtype *cached_entry; | 211 | static struct memtype *cached_entry; |
212 | static u64 cached_start; | 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 | * For RAM pages, mark the pages as non WB memory type using | 242 | * For RAM pages, mark the pages as non WB memory type using |
216 | * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or | 243 | * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or |
@@ -336,20 +363,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
336 | if (new_type) | 363 | if (new_type) |
337 | *new_type = actual_type; | 364 | *new_type = actual_type; |
338 | 365 | ||
339 | /* | 366 | is_range_ram = pat_pagerange_is_ram(start, end); |
340 | * For legacy reasons, some parts of the physical address range in the | 367 | if (is_range_ram == 1) |
341 | * legacy 1MB region is treated as non-RAM (even when listed as RAM in | 368 | return reserve_ram_pages_type(start, end, req_type, |
342 | * the e820 tables). So we will track the memory attributes of this | 369 | new_type); |
343 | * legacy 1MB region using the linear memtype_list always. | 370 | else if (is_range_ram < 0) |
344 | */ | 371 | return -EINVAL; |
345 | if (end >= ISA_END_ADDRESS) { | ||
346 | is_range_ram = pagerange_is_ram(start, end); | ||
347 | if (is_range_ram == 1) | ||
348 | return reserve_ram_pages_type(start, end, req_type, | ||
349 | new_type); | ||
350 | else if (is_range_ram < 0) | ||
351 | return -EINVAL; | ||
352 | } | ||
353 | 372 | ||
354 | new = kmalloc(sizeof(struct memtype), GFP_KERNEL); | 373 | new = kmalloc(sizeof(struct memtype), GFP_KERNEL); |
355 | if (!new) | 374 | if (!new) |
@@ -446,19 +465,11 @@ int free_memtype(u64 start, u64 end) | |||
446 | if (is_ISA_range(start, end - 1)) | 465 | if (is_ISA_range(start, end - 1)) |
447 | return 0; | 466 | return 0; |
448 | 467 | ||
449 | /* | 468 | is_range_ram = pat_pagerange_is_ram(start, end); |
450 | * For legacy reasons, some parts of the physical address range in the | 469 | if (is_range_ram == 1) |
451 | * legacy 1MB region is treated as non-RAM (even when listed as RAM in | 470 | return free_ram_pages_type(start, end); |
452 | * the e820 tables). So we will track the memory attributes of this | 471 | else if (is_range_ram < 0) |
453 | * legacy 1MB region using the linear memtype_list always. | 472 | return -EINVAL; |
454 | */ | ||
455 | if (end >= ISA_END_ADDRESS) { | ||
456 | is_range_ram = pagerange_is_ram(start, end); | ||
457 | if (is_range_ram == 1) | ||
458 | return free_ram_pages_type(start, end); | ||
459 | else if (is_range_ram < 0) | ||
460 | return -EINVAL; | ||
461 | } | ||
462 | 473 | ||
463 | spin_lock(&memtype_lock); | 474 | spin_lock(&memtype_lock); |
464 | list_for_each_entry(entry, &memtype_list, nd) { | 475 | list_for_each_entry(entry, &memtype_list, nd) { |
@@ -626,17 +637,13 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot, | |||
626 | unsigned long flags; | 637 | unsigned long flags; |
627 | unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); | 638 | unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); |
628 | 639 | ||
629 | is_ram = pagerange_is_ram(paddr, paddr + size); | 640 | is_ram = pat_pagerange_is_ram(paddr, paddr + size); |
630 | 641 | ||
631 | if (is_ram != 0) { | 642 | /* |
632 | /* | 643 | * reserve_pfn_range() doesn't support RAM pages. |
633 | * For mapping RAM pages, drivers need to call | 644 | */ |
634 | * set_memory_[uc|wc|wb] directly, for reserve and free, before | 645 | if (is_ram != 0) |
635 | * setting up the PTE. | 646 | return -EINVAL; |
636 | */ | ||
637 | WARN_ON_ONCE(1); | ||
638 | return 0; | ||
639 | } | ||
640 | 647 | ||
641 | ret = reserve_memtype(paddr, paddr + size, want_flags, &flags); | 648 | ret = reserve_memtype(paddr, paddr + size, want_flags, &flags); |
642 | if (ret) | 649 | if (ret) |
@@ -693,7 +700,7 @@ static void free_pfn_range(u64 paddr, unsigned long size) | |||
693 | { | 700 | { |
694 | int is_ram; | 701 | int is_ram; |
695 | 702 | ||
696 | is_ram = pagerange_is_ram(paddr, paddr + size); | 703 | is_ram = pat_pagerange_is_ram(paddr, paddr + size); |
697 | if (is_ram == 0) | 704 | if (is_ram == 0) |
698 | free_memtype(paddr, paddr + size); | 705 | free_memtype(paddr, paddr + size); |
699 | } | 706 | } |
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index a09535377a94..bbbdc4b8ccf2 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
@@ -209,12 +209,19 @@ void blk_abort_queue(struct request_queue *q) | |||
209 | { | 209 | { |
210 | unsigned long flags; | 210 | unsigned long flags; |
211 | struct request *rq, *tmp; | 211 | struct request *rq, *tmp; |
212 | LIST_HEAD(list); | ||
212 | 213 | ||
213 | spin_lock_irqsave(q->queue_lock, flags); | 214 | spin_lock_irqsave(q->queue_lock, flags); |
214 | 215 | ||
215 | elv_abort_queue(q); | 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 | blk_abort_request(rq); | 225 | blk_abort_request(rq); |
219 | 226 | ||
220 | spin_unlock_irqrestore(q->queue_lock, flags); | 227 | spin_unlock_irqrestore(q->queue_lock, flags); |
diff --git a/block/bsg.c b/block/bsg.c index d414bb5607e8..0ce8806dd0c1 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -244,7 +244,8 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw) | |||
244 | * map sg_io_v4 to a request. | 244 | * map sg_io_v4 to a request. |
245 | */ | 245 | */ |
246 | static struct request * | 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 | struct request_queue *q = bd->queue; | 250 | struct request_queue *q = bd->queue; |
250 | struct request *rq, *next_rq = NULL; | 251 | struct request *rq, *next_rq = NULL; |
@@ -306,6 +307,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) | |||
306 | if (ret) | 307 | if (ret) |
307 | goto out; | 308 | goto out; |
308 | } | 309 | } |
310 | |||
311 | rq->sense = sense; | ||
312 | rq->sense_len = 0; | ||
313 | |||
309 | return rq; | 314 | return rq; |
310 | out: | 315 | out: |
311 | if (rq->cmd != rq->__cmd) | 316 | if (rq->cmd != rq->__cmd) |
@@ -348,9 +353,6 @@ static void bsg_rq_end_io(struct request *rq, int uptodate) | |||
348 | static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, | 353 | static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, |
349 | struct bsg_command *bc, struct request *rq) | 354 | struct bsg_command *bc, struct request *rq) |
350 | { | 355 | { |
351 | rq->sense = bc->sense; | ||
352 | rq->sense_len = 0; | ||
353 | |||
354 | /* | 356 | /* |
355 | * add bc command to busy queue and submit rq for io | 357 | * add bc command to busy queue and submit rq for io |
356 | */ | 358 | */ |
@@ -419,7 +421,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
419 | { | 421 | { |
420 | int ret = 0; | 422 | int ret = 0; |
421 | 423 | ||
422 | dprintk("rq %p bio %p %u\n", rq, bio, rq->errors); | 424 | dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors); |
423 | /* | 425 | /* |
424 | * fill in all the output members | 426 | * fill in all the output members |
425 | */ | 427 | */ |
@@ -635,7 +637,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf, | |||
635 | /* | 637 | /* |
636 | * get a request, fill in the blanks, and add to request queue | 638 | * get a request, fill in the blanks, and add to request queue |
637 | */ | 639 | */ |
638 | rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm); | 640 | rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense); |
639 | if (IS_ERR(rq)) { | 641 | if (IS_ERR(rq)) { |
640 | ret = PTR_ERR(rq); | 642 | ret = PTR_ERR(rq); |
641 | rq = NULL; | 643 | rq = NULL; |
@@ -922,11 +924,12 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
922 | struct request *rq; | 924 | struct request *rq; |
923 | struct bio *bio, *bidi_bio = NULL; | 925 | struct bio *bio, *bidi_bio = NULL; |
924 | struct sg_io_v4 hdr; | 926 | struct sg_io_v4 hdr; |
927 | u8 sense[SCSI_SENSE_BUFFERSIZE]; | ||
925 | 928 | ||
926 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) | 929 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) |
927 | return -EFAULT; | 930 | return -EFAULT; |
928 | 931 | ||
929 | rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE); | 932 | rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense); |
930 | if (IS_ERR(rq)) | 933 | if (IS_ERR(rq)) |
931 | return PTR_ERR(rq); | 934 | return PTR_ERR(rq); |
932 | 935 | ||
diff --git a/block/genhd.c b/block/genhd.c index 397960cf26af..e1eadcc9546a 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno) | |||
1087 | if (strcmp(dev_name(dev), name)) | 1087 | if (strcmp(dev_name(dev), name)) |
1088 | continue; | 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 | part = disk_get_part(disk, partno); | 1098 | part = disk_get_part(disk, partno); |
1091 | if (part) { | 1099 | if (part) { |
1092 | devt = part_devt(part); | 1100 | devt = part_devt(part); |
diff --git a/crypto/lrw.c b/crypto/lrw.c index 8ef664e3bcd9..358f80be2bf9 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -45,7 +45,13 @@ struct priv { | |||
45 | 45 | ||
46 | static inline void setbit128_bbe(void *b, int bit) | 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 | static int setkey(struct crypto_tfm *parent, const u8 *key, | 57 | static int setkey(struct crypto_tfm *parent, const u8 *key, |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 0b299b0f8172..714cb046b594 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -773,18 +773,32 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, | |||
773 | else | 773 | else |
774 | iowrite32_rep(data_addr, buf, words); | 774 | iowrite32_rep(data_addr, buf, words); |
775 | 775 | ||
776 | /* Transfer trailing bytes, if any */ | ||
776 | if (unlikely(slop)) { | 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 | if (rw == READ) { | 787 | if (rw == READ) { |
779 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | 788 | if (slop < 3) |
780 | memcpy(buf + buflen - slop, &pad, slop); | 789 | ioread16_rep(data_addr, pad, 1); |
790 | else | ||
791 | ioread32_rep(data_addr, pad, 1); | ||
792 | memcpy(buf, pad, slop); | ||
781 | } else { | 793 | } else { |
782 | memcpy(&pad, buf + buflen - slop, slop); | 794 | memcpy(pad, buf, slop); |
783 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | 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 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); | 803 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); |
790 | 804 | ||
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 79a6c9a0b721..ba556d3e6963 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -110,7 +110,8 @@ static const struct via_isa_bridge { | |||
110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 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 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
115 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
116 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
@@ -593,6 +594,7 @@ static int via_reinit_one(struct pci_dev *pdev) | |||
593 | #endif | 594 | #endif |
594 | 595 | ||
595 | static const struct pci_device_id via[] = { | 596 | static const struct pci_device_id via[] = { |
597 | { PCI_VDEVICE(VIA, 0x0415), }, | ||
596 | { PCI_VDEVICE(VIA, 0x0571), }, | 598 | { PCI_VDEVICE(VIA, 0x0571), }, |
597 | { PCI_VDEVICE(VIA, 0x0581), }, | 599 | { PCI_VDEVICE(VIA, 0x0581), }, |
598 | { PCI_VDEVICE(VIA, 0x1571), }, | 600 | { PCI_VDEVICE(VIA, 0x1571), }, |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 444af0415ca1..55a8eed3f3a3 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -421,19 +421,21 @@ static struct ata_port_operations nv_generic_ops = { | |||
421 | .hardreset = ATA_OP_NULL, | 421 | .hardreset = ATA_OP_NULL, |
422 | }; | 422 | }; |
423 | 423 | ||
424 | /* OSDL bz3352 reports that nf2/3 controllers can't determine device | 424 | /* nf2 is ripe with hardreset related problems. |
425 | * signature reliably. Also, the following thread reports detection | 425 | * |
426 | * failure on cold boot with the standard debouncing timing. | 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 | * http://thread.gmane.org/gmane.linux.ide/34098 | 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 | static struct ata_port_operations nv_nf2_ops = { | 435 | static struct ata_port_operations nv_nf2_ops = { |
433 | .inherits = &nv_common_ops, | 436 | .inherits = &nv_generic_ops, |
434 | .freeze = nv_nf2_freeze, | 437 | .freeze = nv_nf2_freeze, |
435 | .thaw = nv_nf2_thaw, | 438 | .thaw = nv_nf2_thaw, |
436 | .hardreset = nv_noclassify_hardreset, | ||
437 | }; | 439 | }; |
438 | 440 | ||
439 | /* For initial probing after boot and hot plugging, hardreset mostly | 441 | /* For initial probing after boot and hot plugging, hardreset mostly |
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index c237527b1aa5..5e41e6dd657b 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -18,6 +18,7 @@ | |||
18 | enum { | 18 | enum { |
19 | AOECMD_ATA, | 19 | AOECMD_ATA, |
20 | AOECMD_CFG, | 20 | AOECMD_CFG, |
21 | AOECMD_VEND_MIN = 0xf0, | ||
21 | 22 | ||
22 | AOEFL_RSP = (1<<3), | 23 | AOEFL_RSP = (1<<3), |
23 | AOEFL_ERR = (1<<2), | 24 | AOEFL_ERR = (1<<2), |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 30de5b1c647e..c6099ba9a4b8 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -142,6 +142,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
142 | aoecmd_cfg_rsp(skb); | 142 | aoecmd_cfg_rsp(skb); |
143 | break; | 143 | break; |
144 | default: | 144 | default: |
145 | if (h->cmd >= AOECMD_VEND_MIN) | ||
146 | break; /* don't complain about vendor commands */ | ||
145 | printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); | 147 | printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); |
146 | } | 148 | } |
147 | exit: | 149 | exit: |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 01e69383d9c0..d2cb67b61176 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -3390,6 +3390,203 @@ static void free_hba(int i) | |||
3390 | kfree(p); | 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 | * This is it. Find all the controllers and register them. I really hate | 3591 | * This is it. Find all the controllers and register them. I really hate |
3395 | * stealing all these major device numbers. | 3592 | * stealing all these major device numbers. |
@@ -3404,6 +3601,24 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3404 | int dac, return_code; | 3601 | int dac, return_code; |
3405 | InquiryData_struct *inq_buff = NULL; | 3602 | InquiryData_struct *inq_buff = NULL; |
3406 | 3603 | ||
3604 | if (reset_devices) { | ||
3605 | /* Reset the controller with a PCI power-cycle */ | ||
3606 | if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev)) | ||
3607 | return -ENODEV; | ||
3608 | |||
3609 | /* Some devices (notably the HP Smart Array 5i Controller) | ||
3610 | need a little pause here */ | ||
3611 | schedule_timeout_uninterruptible(30*HZ); | ||
3612 | |||
3613 | /* Now try to get the controller to respond to a no-op */ | ||
3614 | for (i=0; i<12; i++) { | ||
3615 | if (cciss_noop(pdev) == 0) | ||
3616 | break; | ||
3617 | else | ||
3618 | printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : "")); | ||
3619 | } | ||
3620 | } | ||
3621 | |||
3407 | i = alloc_cciss_hba(); | 3622 | i = alloc_cciss_hba(); |
3408 | if (i < 0) | 3623 | if (i < 0) |
3409 | return -1; | 3624 | return -1; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cf29cc4e6ab7..83d8ed39433d 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -558,6 +558,8 @@ static void process_fd_request(void); | |||
558 | static void recalibrate_floppy(void); | 558 | static void recalibrate_floppy(void); |
559 | static void floppy_shutdown(unsigned long); | 559 | static void floppy_shutdown(unsigned long); |
560 | 560 | ||
561 | static int floppy_request_regions(int); | ||
562 | static void floppy_release_regions(int); | ||
561 | static int floppy_grab_irq_and_dma(void); | 563 | static int floppy_grab_irq_and_dma(void); |
562 | static void floppy_release_irq_and_dma(void); | 564 | static void floppy_release_irq_and_dma(void); |
563 | 565 | ||
@@ -4274,8 +4276,7 @@ static int __init floppy_init(void) | |||
4274 | FDCS->rawcmd = 2; | 4276 | FDCS->rawcmd = 2; |
4275 | if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { | 4277 | if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { |
4276 | /* free ioports reserved by floppy_grab_irq_and_dma() */ | 4278 | /* free ioports reserved by floppy_grab_irq_and_dma() */ |
4277 | release_region(FDCS->address + 2, 4); | 4279 | floppy_release_regions(fdc); |
4278 | release_region(FDCS->address + 7, 1); | ||
4279 | FDCS->address = -1; | 4280 | FDCS->address = -1; |
4280 | FDCS->version = FDC_NONE; | 4281 | FDCS->version = FDC_NONE; |
4281 | continue; | 4282 | continue; |
@@ -4284,8 +4285,7 @@ static int __init floppy_init(void) | |||
4284 | FDCS->version = get_fdc_version(); | 4285 | FDCS->version = get_fdc_version(); |
4285 | if (FDCS->version == FDC_NONE) { | 4286 | if (FDCS->version == FDC_NONE) { |
4286 | /* free ioports reserved by floppy_grab_irq_and_dma() */ | 4287 | /* free ioports reserved by floppy_grab_irq_and_dma() */ |
4287 | release_region(FDCS->address + 2, 4); | 4288 | floppy_release_regions(fdc); |
4288 | release_region(FDCS->address + 7, 1); | ||
4289 | FDCS->address = -1; | 4289 | FDCS->address = -1; |
4290 | continue; | 4290 | continue; |
4291 | } | 4291 | } |
@@ -4358,6 +4358,47 @@ out_put_disk: | |||
4358 | 4358 | ||
4359 | static DEFINE_SPINLOCK(floppy_usage_lock); | 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 | static int floppy_grab_irq_and_dma(void) | 4402 | static int floppy_grab_irq_and_dma(void) |
4362 | { | 4403 | { |
4363 | unsigned long flags; | 4404 | unsigned long flags; |
@@ -4399,18 +4440,8 @@ static int floppy_grab_irq_and_dma(void) | |||
4399 | 4440 | ||
4400 | for (fdc = 0; fdc < N_FDC; fdc++) { | 4441 | for (fdc = 0; fdc < N_FDC; fdc++) { |
4401 | if (FDCS->address != -1) { | 4442 | if (FDCS->address != -1) { |
4402 | if (!request_region(FDCS->address + 2, 4, "floppy")) { | 4443 | if (floppy_request_regions(fdc)) |
4403 | DPRINT("Floppy io-port 0x%04lx in use\n", | 4444 | goto cleanup; |
4404 | FDCS->address + 2); | ||
4405 | goto cleanup1; | ||
4406 | } | ||
4407 | if (!request_region(FDCS->address + 7, 1, "floppy DIR")) { | ||
4408 | DPRINT("Floppy io-port 0x%04lx in use\n", | ||
4409 | FDCS->address + 7); | ||
4410 | goto cleanup2; | ||
4411 | } | ||
4412 | /* address + 6 is reserved, and may be taken by IDE. | ||
4413 | * Unfortunately, Adaptec doesn't know this :-(, */ | ||
4414 | } | 4445 | } |
4415 | } | 4446 | } |
4416 | for (fdc = 0; fdc < N_FDC; fdc++) { | 4447 | for (fdc = 0; fdc < N_FDC; fdc++) { |
@@ -4432,15 +4463,11 @@ static int floppy_grab_irq_and_dma(void) | |||
4432 | fdc = 0; | 4463 | fdc = 0; |
4433 | irqdma_allocated = 1; | 4464 | irqdma_allocated = 1; |
4434 | return 0; | 4465 | return 0; |
4435 | cleanup2: | 4466 | cleanup: |
4436 | release_region(FDCS->address + 2, 4); | ||
4437 | cleanup1: | ||
4438 | fd_free_irq(); | 4467 | fd_free_irq(); |
4439 | fd_free_dma(); | 4468 | fd_free_dma(); |
4440 | while (--fdc >= 0) { | 4469 | while (--fdc >= 0) |
4441 | release_region(FDCS->address + 2, 4); | 4470 | floppy_release_regions(fdc); |
4442 | release_region(FDCS->address + 7, 1); | ||
4443 | } | ||
4444 | spin_lock_irqsave(&floppy_usage_lock, flags); | 4471 | spin_lock_irqsave(&floppy_usage_lock, flags); |
4445 | usage_count--; | 4472 | usage_count--; |
4446 | spin_unlock_irqrestore(&floppy_usage_lock, flags); | 4473 | spin_unlock_irqrestore(&floppy_usage_lock, flags); |
@@ -4501,10 +4528,8 @@ static void floppy_release_irq_and_dma(void) | |||
4501 | #endif | 4528 | #endif |
4502 | old_fdc = fdc; | 4529 | old_fdc = fdc; |
4503 | for (fdc = 0; fdc < N_FDC; fdc++) | 4530 | for (fdc = 0; fdc < N_FDC; fdc++) |
4504 | if (FDCS->address != -1) { | 4531 | if (FDCS->address != -1) |
4505 | release_region(FDCS->address + 2, 4); | 4532 | floppy_release_regions(fdc); |
4506 | release_region(FDCS->address + 7, 1); | ||
4507 | } | ||
4508 | fdc = old_fdc; | 4533 | fdc = old_fdc; |
4509 | } | 4534 | } |
4510 | 4535 | ||
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 9dfa27163001..c397b3ddba9b 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -422,7 +422,7 @@ static void xs(char *buf, char *targ, int len) | |||
422 | 422 | ||
423 | for (k = 0; k < len; k++) { | 423 | for (k = 0; k < len; k++) { |
424 | char c = *buf++; | 424 | char c = *buf++; |
425 | if (c != ' ' || c != l) | 425 | if (c != ' ' && c != l) |
426 | l = *targ++ = c; | 426 | l = *targ++ = c; |
427 | } | 427 | } |
428 | if (l == ' ') | 428 | if (l == ' ') |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index a58993011edb..280a9d263eb3 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -518,6 +518,7 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v | |||
518 | dma_chan_name(chan), err); | 518 | dma_chan_name(chan), err); |
519 | else | 519 | else |
520 | break; | 520 | break; |
521 | chan->private = NULL; | ||
521 | chan = NULL; | 522 | chan = NULL; |
522 | } | 523 | } |
523 | } | 524 | } |
@@ -536,6 +537,7 @@ void dma_release_channel(struct dma_chan *chan) | |||
536 | WARN_ONCE(chan->client_count != 1, | 537 | WARN_ONCE(chan->client_count != 1, |
537 | "chan reference count %d != 1\n", chan->client_count); | 538 | "chan reference count %d != 1\n", chan->client_count); |
538 | dma_chan_put(chan); | 539 | dma_chan_put(chan); |
540 | chan->private = NULL; | ||
539 | mutex_unlock(&dma_list_mutex); | 541 | mutex_unlock(&dma_list_mutex); |
540 | } | 542 | } |
541 | EXPORT_SYMBOL_GPL(dma_release_channel); | 543 | EXPORT_SYMBOL_GPL(dma_release_channel); |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 6b702cc46b3d..a97c07eef7ec 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -560,7 +560,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
560 | unsigned long flags) | 560 | unsigned long flags) |
561 | { | 561 | { |
562 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); | 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 | struct dw_desc *prev; | 564 | struct dw_desc *prev; |
565 | struct dw_desc *first; | 565 | struct dw_desc *first; |
566 | u32 ctllo; | 566 | u32 ctllo; |
@@ -790,7 +790,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan) | |||
790 | cfghi = DWC_CFGH_FIFO_MODE; | 790 | cfghi = DWC_CFGH_FIFO_MODE; |
791 | cfglo = 0; | 791 | cfglo = 0; |
792 | 792 | ||
793 | dws = dwc->dws; | 793 | dws = chan->private; |
794 | if (dws) { | 794 | if (dws) { |
795 | /* | 795 | /* |
796 | * We need controller-specific data to set up slave | 796 | * We need controller-specific data to set up slave |
@@ -866,7 +866,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan) | |||
866 | spin_lock_bh(&dwc->lock); | 866 | spin_lock_bh(&dwc->lock); |
867 | list_splice_init(&dwc->free_list, &list); | 867 | list_splice_init(&dwc->free_list, &list); |
868 | dwc->descs_allocated = 0; | 868 | dwc->descs_allocated = 0; |
869 | dwc->dws = NULL; | ||
870 | 869 | ||
871 | /* Disable interrupts */ | 870 | /* Disable interrupts */ |
872 | channel_clear_bit(dw, MASK.XFER, dwc->mask); | 871 | channel_clear_bit(dw, MASK.XFER, dwc->mask); |
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index 00fdd187bb0c..b252b202c5cf 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -139,8 +139,6 @@ struct dw_dma_chan { | |||
139 | struct list_head queue; | 139 | struct list_head queue; |
140 | struct list_head free_list; | 140 | struct list_head free_list; |
141 | 141 | ||
142 | struct dw_dma_slave *dws; | ||
143 | |||
144 | unsigned int descs_allocated; | 142 | unsigned int descs_allocated; |
145 | }; | 143 | }; |
146 | 144 | ||
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index 261b9aa3f248..05aa2d406ac6 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/firmware/memmap.c | 2 | * linux/drivers/firmware/memmap.c |
3 | * Copyright (C) 2008 SUSE LINUX Products GmbH | 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 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License v2.0 as published by | 7 | * it under the terms of the GNU General Public License v2.0 as published by |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4be3acbaaf9a..3a22eb9be378 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -80,18 +80,17 @@ config DRM_I915 | |||
80 | XFree86 4.4 and above. If unsure, build this and i830 as modules and | 80 | XFree86 4.4 and above. If unsure, build this and i830 as modules and |
81 | the X server will load the correct one. | 81 | the X server will load the correct one. |
82 | 82 | ||
83 | endchoice | ||
84 | |||
85 | config DRM_I915_KMS | 83 | config DRM_I915_KMS |
86 | bool "Enable modesetting on intel by default" | 84 | bool "Enable modesetting on intel by default" |
87 | depends on DRM_I915 | 85 | depends on DRM_I915 |
88 | help | 86 | help |
89 | Choose this option if you want kernel modesetting enabled by default, | 87 | Choose this option if you want kernel modesetting enabled by default, |
90 | and you have a new enough userspace to support this. Running old | 88 | and you have a new enough userspace to support this. Running old |
91 | userspaces with this enabled will cause pain. Note that this causes | 89 | userspaces with this enabled will cause pain. Note that this causes |
92 | the driver to bind to PCI devices, which precludes loading things | 90 | the driver to bind to PCI devices, which precludes loading things |
93 | like intelfb. | 91 | like intelfb. |
94 | 92 | ||
93 | endchoice | ||
95 | 94 | ||
96 | config DRM_MGA | 95 | config DRM_MGA |
97 | tristate "Matrox g200/g400" | 96 | tristate "Matrox g200/g400" |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 6cad69ed21c5..1cc967448f4d 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1300,7 +1300,13 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1300 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1300 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1301 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | 1301 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1302 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 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 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 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 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, | 1311 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, |
1306 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | 1312 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, |
@@ -1605,6 +1611,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1605 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, | 1611 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, |
1606 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, | 1612 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, |
1607 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, | 1613 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, |
1614 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, | ||
1608 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, | 1615 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, |
1609 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, | 1616 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, |
1610 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, | 1617 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, |
@@ -1612,10 +1619,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1612 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, | 1619 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, |
1613 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, | 1620 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, |
1614 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, | 1621 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, |
1615 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | ||
1616 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | ||
1617 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | ||
1618 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | ||
1619 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | 1622 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, |
1620 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | 1623 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, |
1621 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | 1624 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
@@ -1626,8 +1629,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1626 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, | 1629 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, |
1627 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, | 1630 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, |
1628 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, | 1631 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, |
1629 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | ||
1630 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | ||
1631 | { } | 1632 | { } |
1632 | }; | 1633 | }; |
1633 | 1634 | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index e899f510ebeb..88511970508d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -348,6 +348,9 @@ | |||
348 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 | 348 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 |
349 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 | 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 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 354 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
352 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 355 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
353 | 356 | ||
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 732449628971..02b19db5442e 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -267,8 +267,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
267 | default: | 267 | default: |
268 | { | 268 | { |
269 | struct hid_device *hid = dev->hid; | 269 | struct hid_device *hid = dev->hid; |
270 | if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) | 270 | if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) { |
271 | return -EINVAL; | 271 | ret = -EINVAL; |
272 | break; | ||
273 | } | ||
272 | 274 | ||
273 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { | 275 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { |
274 | int len; | 276 | int len; |
@@ -277,8 +279,9 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
277 | len = strlen(hid->name) + 1; | 279 | len = strlen(hid->name) + 1; |
278 | if (len > _IOC_SIZE(cmd)) | 280 | if (len > _IOC_SIZE(cmd)) |
279 | len = _IOC_SIZE(cmd); | 281 | len = _IOC_SIZE(cmd); |
280 | return copy_to_user(user_arg, hid->name, len) ? | 282 | ret = copy_to_user(user_arg, hid->name, len) ? |
281 | -EFAULT : len; | 283 | -EFAULT : len; |
284 | break; | ||
282 | } | 285 | } |
283 | 286 | ||
284 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { | 287 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { |
@@ -288,12 +291,13 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
288 | len = strlen(hid->phys) + 1; | 291 | len = strlen(hid->phys) + 1; |
289 | if (len > _IOC_SIZE(cmd)) | 292 | if (len > _IOC_SIZE(cmd)) |
290 | len = _IOC_SIZE(cmd); | 293 | len = _IOC_SIZE(cmd); |
291 | return copy_to_user(user_arg, hid->phys, len) ? | 294 | ret = copy_to_user(user_arg, hid->phys, len) ? |
292 | -EFAULT : len; | 295 | -EFAULT : len; |
296 | break; | ||
293 | } | 297 | } |
294 | } | 298 | } |
295 | 299 | ||
296 | ret = -ENOTTY; | 300 | ret = -ENOTTY; |
297 | } | 301 | } |
298 | unlock_kernel(); | 302 | unlock_kernel(); |
299 | return ret; | 303 | return ret; |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 609cafff86bc..5f81ddf71508 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -1872,7 +1872,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
1872 | 1872 | ||
1873 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 1873 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
1874 | if (devid != SIO_FINTEK_ID) { | 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 | goto exit; | 1876 | goto exit; |
1877 | } | 1877 | } |
1878 | 1878 | ||
@@ -1932,7 +1932,7 @@ static int __init f71882fg_device_add(unsigned short address, | |||
1932 | res.name = f71882fg_pdev->name; | 1932 | res.name = f71882fg_pdev->name; |
1933 | err = acpi_check_resource_conflict(&res); | 1933 | err = acpi_check_resource_conflict(&res); |
1934 | if (err) | 1934 | if (err) |
1935 | return err; | 1935 | goto exit_device_put; |
1936 | 1936 | ||
1937 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); | 1937 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); |
1938 | if (err) { | 1938 | if (err) { |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index abf4dfc8ec22..29c83b5b9697 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -166,6 +166,18 @@ static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3}; | |||
166 | }, \ | 166 | }, \ |
167 | .driver_data = &lis3lv02d_axis_##_axis \ | 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 | static struct dmi_system_id lis3lv02d_dmi_ids[] = { | 181 | static struct dmi_system_id lis3lv02d_dmi_ids[] = { |
170 | /* product names are truncated to match all kinds of a same model */ | 182 | /* product names are truncated to match all kinds of a same model */ |
171 | AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), | 183 | AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), |
@@ -179,6 +191,16 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
179 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), | 191 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), |
180 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), | 192 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), |
181 | AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), | 193 | AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), |
194 | /* Intel-based HP Pavilion dv5 */ | ||
195 | AXIS_DMI_MATCH2("HPDV5_I", | ||
196 | PRODUCT_NAME, "HP Pavilion dv5", | ||
197 | BOARD_NAME, "3603", | ||
198 | x_inverted), | ||
199 | /* AMD-based HP Pavilion dv5 */ | ||
200 | AXIS_DMI_MATCH2("HPDV5_A", | ||
201 | PRODUCT_NAME, "HP Pavilion dv5", | ||
202 | BOARD_NAME, "3600", | ||
203 | y_inverted), | ||
182 | { NULL, } | 204 | { NULL, } |
183 | /* Laptop models without axis info (yet): | 205 | /* Laptop models without axis info (yet): |
184 | * "NC6910" "HP Compaq 6910" | 206 | * "NC6910" "HP Compaq 6910" |
@@ -213,9 +235,49 @@ static struct delayed_led_classdev hpled_led = { | |||
213 | .set_brightness = hpled_set, | 235 | .set_brightness = hpled_set, |
214 | }; | 236 | }; |
215 | 237 | ||
238 | static acpi_status | ||
239 | lis3lv02d_get_resource(struct acpi_resource *resource, void *context) | ||
240 | { | ||
241 | if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { | ||
242 | struct acpi_resource_extended_irq *irq; | ||
243 | u32 *device_irq = context; | ||
244 | |||
245 | irq = &resource->data.extended_irq; | ||
246 | *device_irq = irq->interrupts[0]; | ||
247 | } | ||
248 | |||
249 | return AE_OK; | ||
250 | } | ||
251 | |||
252 | static void lis3lv02d_enum_resources(struct acpi_device *device) | ||
253 | { | ||
254 | acpi_status status; | ||
255 | |||
256 | status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, | ||
257 | lis3lv02d_get_resource, &adev.irq); | ||
258 | if (ACPI_FAILURE(status)) | ||
259 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); | ||
260 | } | ||
261 | |||
262 | static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | ||
263 | { | ||
264 | u8 lo, hi; | ||
265 | |||
266 | adev.read(handle, reg - 1, &lo); | ||
267 | adev.read(handle, reg, &hi); | ||
268 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | ||
269 | return (s16)((hi << 8) | lo); | ||
270 | } | ||
271 | |||
272 | static s16 lis3lv02d_read_8(acpi_handle handle, int reg) | ||
273 | { | ||
274 | s8 lo; | ||
275 | adev.read(handle, reg, &lo); | ||
276 | return lo; | ||
277 | } | ||
278 | |||
216 | static int lis3lv02d_add(struct acpi_device *device) | 279 | static int lis3lv02d_add(struct acpi_device *device) |
217 | { | 280 | { |
218 | u8 val; | ||
219 | int ret; | 281 | int ret; |
220 | 282 | ||
221 | if (!device) | 283 | if (!device) |
@@ -229,10 +291,22 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
229 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); | 291 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); |
230 | device->driver_data = &adev; | 292 | device->driver_data = &adev; |
231 | 293 | ||
232 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val); | 294 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami); |
233 | if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) { | 295 | switch (adev.whoami) { |
296 | case LIS_DOUBLE_ID: | ||
297 | printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n"); | ||
298 | adev.read_data = lis3lv02d_read_16; | ||
299 | adev.mdps_max_val = 2048; | ||
300 | break; | ||
301 | case LIS_SINGLE_ID: | ||
302 | printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n"); | ||
303 | adev.read_data = lis3lv02d_read_8; | ||
304 | adev.mdps_max_val = 128; | ||
305 | break; | ||
306 | default: | ||
234 | printk(KERN_ERR DRIVER_NAME | 307 | printk(KERN_ERR DRIVER_NAME |
235 | ": Accelerometer chip not LIS3LV02D{L,Q}\n"); | 308 | ": unknown sensor type 0x%X\n", adev.whoami); |
309 | return -EINVAL; | ||
236 | } | 310 | } |
237 | 311 | ||
238 | /* If possible use a "standard" axes order */ | 312 | /* If possible use a "standard" axes order */ |
@@ -247,6 +321,9 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
247 | if (ret) | 321 | if (ret) |
248 | return ret; | 322 | return ret; |
249 | 323 | ||
324 | /* obtain IRQ number of our device from ACPI */ | ||
325 | lis3lv02d_enum_resources(adev.device); | ||
326 | |||
250 | ret = lis3lv02d_init_device(&adev); | 327 | ret = lis3lv02d_init_device(&adev); |
251 | if (ret) { | 328 | if (ret) { |
252 | flush_work(&hpled_led.work); | 329 | flush_work(&hpled_led.work); |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 219d2d0d5a62..8bb2158f0453 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Yan Burman | 4 | * Copyright (C) 2007-2008 Yan Burman |
5 | * Copyright (C) 2008 Eric Piel | 5 | * Copyright (C) 2008 Eric Piel |
6 | * Copyright (C) 2008 Pavel Machek | 6 | * Copyright (C) 2008-2009 Pavel Machek |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/poll.h> | 35 | #include <linux/poll.h> |
36 | #include <linux/freezer.h> | 36 | #include <linux/freezer.h> |
37 | #include <linux/uaccess.h> | 37 | #include <linux/uaccess.h> |
38 | #include <linux/miscdevice.h> | ||
38 | #include <acpi/acpi_drivers.h> | 39 | #include <acpi/acpi_drivers.h> |
39 | #include <asm/atomic.h> | 40 | #include <asm/atomic.h> |
40 | #include "lis3lv02d.h" | 41 | #include "lis3lv02d.h" |
@@ -52,24 +53,14 @@ | |||
52 | * joystick. | 53 | * joystick. |
53 | */ | 54 | */ |
54 | 55 | ||
55 | /* Maximum value our axis may get for the input device (signed 12 bits) */ | 56 | struct acpi_lis3lv02d adev = { |
56 | #define MDPS_MAX_VAL 2048 | 57 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait), |
58 | }; | ||
57 | 59 | ||
58 | struct acpi_lis3lv02d adev; | ||
59 | EXPORT_SYMBOL_GPL(adev); | 60 | EXPORT_SYMBOL_GPL(adev); |
60 | 61 | ||
61 | static int lis3lv02d_add_fs(struct acpi_device *device); | 62 | static int lis3lv02d_add_fs(struct acpi_device *device); |
62 | 63 | ||
63 | static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | ||
64 | { | ||
65 | u8 lo, hi; | ||
66 | |||
67 | adev.read(handle, reg, &lo); | ||
68 | adev.read(handle, reg + 1, &hi); | ||
69 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | ||
70 | return (s16)((hi << 8) | lo); | ||
71 | } | ||
72 | |||
73 | /** | 64 | /** |
74 | * lis3lv02d_get_axis - For the given axis, give the value converted | 65 | * lis3lv02d_get_axis - For the given axis, give the value converted |
75 | * @axis: 1,2,3 - can also be negative | 66 | * @axis: 1,2,3 - can also be negative |
@@ -98,9 +89,9 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z) | |||
98 | { | 89 | { |
99 | int position[3]; | 90 | int position[3]; |
100 | 91 | ||
101 | position[0] = lis3lv02d_read_16(handle, OUTX_L); | 92 | position[0] = adev.read_data(handle, OUTX); |
102 | position[1] = lis3lv02d_read_16(handle, OUTY_L); | 93 | position[1] = adev.read_data(handle, OUTY); |
103 | position[2] = lis3lv02d_read_16(handle, OUTZ_L); | 94 | position[2] = adev.read_data(handle, OUTZ); |
104 | 95 | ||
105 | *x = lis3lv02d_get_axis(adev.ac.x, position); | 96 | *x = lis3lv02d_get_axis(adev.ac.x, position); |
106 | *y = lis3lv02d_get_axis(adev.ac.y, position); | 97 | *y = lis3lv02d_get_axis(adev.ac.y, position); |
@@ -110,26 +101,13 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z) | |||
110 | void lis3lv02d_poweroff(acpi_handle handle) | 101 | void lis3lv02d_poweroff(acpi_handle handle) |
111 | { | 102 | { |
112 | adev.is_on = 0; | 103 | adev.is_on = 0; |
113 | /* disable X,Y,Z axis and power down */ | ||
114 | adev.write(handle, CTRL_REG1, 0x00); | ||
115 | } | 104 | } |
116 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); | 105 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); |
117 | 106 | ||
118 | void lis3lv02d_poweron(acpi_handle handle) | 107 | void lis3lv02d_poweron(acpi_handle handle) |
119 | { | 108 | { |
120 | u8 val; | ||
121 | |||
122 | adev.is_on = 1; | 109 | adev.is_on = 1; |
123 | adev.init(handle); | 110 | adev.init(handle); |
124 | adev.write(handle, FF_WU_CFG, 0); | ||
125 | /* | ||
126 | * BDU: LSB and MSB values are not updated until both have been read. | ||
127 | * So the value read will always be correct. | ||
128 | * IEN: Interrupt for free-fall and DD, not for data-ready. | ||
129 | */ | ||
130 | adev.read(handle, CTRL_REG2, &val); | ||
131 | val |= CTRL2_BDU | CTRL2_IEN; | ||
132 | adev.write(handle, CTRL_REG2, val); | ||
133 | } | 111 | } |
134 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); | 112 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); |
135 | 113 | ||
@@ -162,6 +140,140 @@ static void lis3lv02d_decrease_use(struct acpi_lis3lv02d *dev) | |||
162 | mutex_unlock(&dev->lock); | 140 | mutex_unlock(&dev->lock); |
163 | } | 141 | } |
164 | 142 | ||
143 | static irqreturn_t lis302dl_interrupt(int irq, void *dummy) | ||
144 | { | ||
145 | /* | ||
146 | * Be careful: on some HP laptops the bios force DD when on battery and | ||
147 | * the lid is closed. This leads to interrupts as soon as a little move | ||
148 | * is done. | ||
149 | */ | ||
150 | atomic_inc(&adev.count); | ||
151 | |||
152 | wake_up_interruptible(&adev.misc_wait); | ||
153 | kill_fasync(&adev.async_queue, SIGIO, POLL_IN); | ||
154 | return IRQ_HANDLED; | ||
155 | } | ||
156 | |||
157 | static int lis3lv02d_misc_open(struct inode *inode, struct file *file) | ||
158 | { | ||
159 | int ret; | ||
160 | |||
161 | if (test_and_set_bit(0, &adev.misc_opened)) | ||
162 | return -EBUSY; /* already open */ | ||
163 | |||
164 | atomic_set(&adev.count, 0); | ||
165 | |||
166 | /* | ||
167 | * The sensor can generate interrupts for free-fall and direction | ||
168 | * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep | ||
169 | * the things simple and _fast_ we activate it only for free-fall, so | ||
170 | * no need to read register (very slow with ACPI). For the same reason, | ||
171 | * we forbid shared interrupts. | ||
172 | * | ||
173 | * IRQF_TRIGGER_RISING seems pointless on HP laptops because the | ||
174 | * io-apic is not configurable (and generates a warning) but I keep it | ||
175 | * in case of support for other hardware. | ||
176 | */ | ||
177 | ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING, | ||
178 | DRIVER_NAME, &adev); | ||
179 | |||
180 | if (ret) { | ||
181 | clear_bit(0, &adev.misc_opened); | ||
182 | printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq); | ||
183 | return -EBUSY; | ||
184 | } | ||
185 | lis3lv02d_increase_use(&adev); | ||
186 | printk("lis3: registered interrupt %d\n", adev.irq); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static int lis3lv02d_misc_release(struct inode *inode, struct file *file) | ||
191 | { | ||
192 | fasync_helper(-1, file, 0, &adev.async_queue); | ||
193 | lis3lv02d_decrease_use(&adev); | ||
194 | free_irq(adev.irq, &adev); | ||
195 | clear_bit(0, &adev.misc_opened); /* release the device */ | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, | ||
200 | size_t count, loff_t *pos) | ||
201 | { | ||
202 | DECLARE_WAITQUEUE(wait, current); | ||
203 | u32 data; | ||
204 | unsigned char byte_data; | ||
205 | ssize_t retval = 1; | ||
206 | |||
207 | if (count < 1) | ||
208 | return -EINVAL; | ||
209 | |||
210 | add_wait_queue(&adev.misc_wait, &wait); | ||
211 | while (true) { | ||
212 | set_current_state(TASK_INTERRUPTIBLE); | ||
213 | data = atomic_xchg(&adev.count, 0); | ||
214 | if (data) | ||
215 | break; | ||
216 | |||
217 | if (file->f_flags & O_NONBLOCK) { | ||
218 | retval = -EAGAIN; | ||
219 | goto out; | ||
220 | } | ||
221 | |||
222 | if (signal_pending(current)) { | ||
223 | retval = -ERESTARTSYS; | ||
224 | goto out; | ||
225 | } | ||
226 | |||
227 | schedule(); | ||
228 | } | ||
229 | |||
230 | if (data < 255) | ||
231 | byte_data = data; | ||
232 | else | ||
233 | byte_data = 255; | ||
234 | |||
235 | /* make sure we are not going into copy_to_user() with | ||
236 | * TASK_INTERRUPTIBLE state */ | ||
237 | set_current_state(TASK_RUNNING); | ||
238 | if (copy_to_user(buf, &byte_data, sizeof(byte_data))) | ||
239 | retval = -EFAULT; | ||
240 | |||
241 | out: | ||
242 | __set_current_state(TASK_RUNNING); | ||
243 | remove_wait_queue(&adev.misc_wait, &wait); | ||
244 | |||
245 | return retval; | ||
246 | } | ||
247 | |||
248 | static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait) | ||
249 | { | ||
250 | poll_wait(file, &adev.misc_wait, wait); | ||
251 | if (atomic_read(&adev.count)) | ||
252 | return POLLIN | POLLRDNORM; | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static int lis3lv02d_misc_fasync(int fd, struct file *file, int on) | ||
257 | { | ||
258 | return fasync_helper(fd, file, on, &adev.async_queue); | ||
259 | } | ||
260 | |||
261 | static const struct file_operations lis3lv02d_misc_fops = { | ||
262 | .owner = THIS_MODULE, | ||
263 | .llseek = no_llseek, | ||
264 | .read = lis3lv02d_misc_read, | ||
265 | .open = lis3lv02d_misc_open, | ||
266 | .release = lis3lv02d_misc_release, | ||
267 | .poll = lis3lv02d_misc_poll, | ||
268 | .fasync = lis3lv02d_misc_fasync, | ||
269 | }; | ||
270 | |||
271 | static struct miscdevice lis3lv02d_misc_device = { | ||
272 | .minor = MISC_DYNAMIC_MINOR, | ||
273 | .name = "freefall", | ||
274 | .fops = &lis3lv02d_misc_fops, | ||
275 | }; | ||
276 | |||
165 | /** | 277 | /** |
166 | * lis3lv02d_joystick_kthread - Kthread polling function | 278 | * lis3lv02d_joystick_kthread - Kthread polling function |
167 | * @data: unused - here to conform to threadfn prototype | 279 | * @data: unused - here to conform to threadfn prototype |
@@ -203,7 +315,6 @@ static void lis3lv02d_joystick_close(struct input_dev *input) | |||
203 | lis3lv02d_decrease_use(&adev); | 315 | lis3lv02d_decrease_use(&adev); |
204 | } | 316 | } |
205 | 317 | ||
206 | |||
207 | static inline void lis3lv02d_calibrate_joystick(void) | 318 | static inline void lis3lv02d_calibrate_joystick(void) |
208 | { | 319 | { |
209 | lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); | 320 | lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); |
@@ -231,9 +342,9 @@ int lis3lv02d_joystick_enable(void) | |||
231 | adev.idev->close = lis3lv02d_joystick_close; | 342 | adev.idev->close = lis3lv02d_joystick_close; |
232 | 343 | ||
233 | set_bit(EV_ABS, adev.idev->evbit); | 344 | set_bit(EV_ABS, adev.idev->evbit); |
234 | input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 345 | 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, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 346 | 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, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 347 | input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); |
237 | 348 | ||
238 | err = input_register_device(adev.idev); | 349 | err = input_register_device(adev.idev); |
239 | if (err) { | 350 | if (err) { |
@@ -250,6 +361,7 @@ void lis3lv02d_joystick_disable(void) | |||
250 | if (!adev.idev) | 361 | if (!adev.idev) |
251 | return; | 362 | return; |
252 | 363 | ||
364 | misc_deregister(&lis3lv02d_misc_device); | ||
253 | input_unregister_device(adev.idev); | 365 | input_unregister_device(adev.idev); |
254 | adev.idev = NULL; | 366 | adev.idev = NULL; |
255 | } | 367 | } |
@@ -268,6 +380,19 @@ int lis3lv02d_init_device(struct acpi_lis3lv02d *dev) | |||
268 | if (lis3lv02d_joystick_enable()) | 380 | if (lis3lv02d_joystick_enable()) |
269 | printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); | 381 | printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); |
270 | 382 | ||
383 | printk("lis3_init_device: irq %d\n", dev->irq); | ||
384 | |||
385 | /* if we did not get an IRQ from ACPI - we have nothing more to do */ | ||
386 | if (!dev->irq) { | ||
387 | printk(KERN_ERR DRIVER_NAME | ||
388 | ": No IRQ in ACPI. Disabling /dev/freefall\n"); | ||
389 | goto out; | ||
390 | } | ||
391 | |||
392 | printk("lis3: registering device\n"); | ||
393 | if (misc_register(&lis3lv02d_misc_device)) | ||
394 | printk(KERN_ERR DRIVER_NAME ": misc_register failed\n"); | ||
395 | out: | ||
271 | lis3lv02d_decrease_use(dev); | 396 | lis3lv02d_decrease_use(dev); |
272 | return 0; | 397 | return 0; |
273 | } | 398 | } |
@@ -351,6 +476,6 @@ int lis3lv02d_remove_fs(void) | |||
351 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); | 476 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); |
352 | 477 | ||
353 | MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); | 478 | MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); |
354 | MODULE_AUTHOR("Yan Burman and Eric Piel"); | 479 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); |
355 | MODULE_LICENSE("GPL"); | 480 | MODULE_LICENSE("GPL"); |
356 | 481 | ||
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h index 223f1c0763bb..75972bf372ff 100644 --- a/drivers/hwmon/lis3lv02d.h +++ b/drivers/hwmon/lis3lv02d.h | |||
@@ -22,12 +22,15 @@ | |||
22 | /* | 22 | /* |
23 | * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to | 23 | * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to |
24 | * be connected via SPI. There exists also several similar chips (such as LIS302DL or | 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 | * They can also be connected via I²C. | 27 | * They can also be connected via I²C. |
27 | */ | 28 | */ |
28 | 29 | ||
29 | #define LIS3LV02DL_ID 0x3A /* Also the LIS3LV02DQ */ | 30 | /* 2-byte registers */ |
30 | #define LIS302DL_ID 0x3B /* Also the LIS202DL! */ | 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 | enum lis3lv02d_reg { | 35 | enum lis3lv02d_reg { |
33 | WHO_AM_I = 0x0F, | 36 | WHO_AM_I = 0x0F, |
@@ -44,10 +47,13 @@ enum lis3lv02d_reg { | |||
44 | STATUS_REG = 0x27, | 47 | STATUS_REG = 0x27, |
45 | OUTX_L = 0x28, | 48 | OUTX_L = 0x28, |
46 | OUTX_H = 0x29, | 49 | OUTX_H = 0x29, |
50 | OUTX = 0x29, | ||
47 | OUTY_L = 0x2A, | 51 | OUTY_L = 0x2A, |
48 | OUTY_H = 0x2B, | 52 | OUTY_H = 0x2B, |
53 | OUTY = 0x2B, | ||
49 | OUTZ_L = 0x2C, | 54 | OUTZ_L = 0x2C, |
50 | OUTZ_H = 0x2D, | 55 | OUTZ_H = 0x2D, |
56 | OUTZ = 0x2D, | ||
51 | FF_WU_CFG = 0x30, | 57 | FF_WU_CFG = 0x30, |
52 | FF_WU_SRC = 0x31, | 58 | FF_WU_SRC = 0x31, |
53 | FF_WU_ACK = 0x32, | 59 | FF_WU_ACK = 0x32, |
@@ -159,6 +165,10 @@ struct acpi_lis3lv02d { | |||
159 | acpi_status (*write) (acpi_handle handle, int reg, u8 val); | 165 | acpi_status (*write) (acpi_handle handle, int reg, u8 val); |
160 | acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); | 166 | acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); |
161 | 167 | ||
168 | u8 whoami; /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */ | ||
169 | s16 (*read_data) (acpi_handle handle, int reg); | ||
170 | int mdps_max_val; | ||
171 | |||
162 | struct input_dev *idev; /* input device */ | 172 | struct input_dev *idev; /* input device */ |
163 | struct task_struct *kthread; /* kthread for input */ | 173 | struct task_struct *kthread; /* kthread for input */ |
164 | struct mutex lock; | 174 | struct mutex lock; |
@@ -170,6 +180,11 @@ struct acpi_lis3lv02d { | |||
170 | unsigned char is_on; /* whether the device is on or off */ | 180 | unsigned char is_on; /* whether the device is on or off */ |
171 | unsigned char usage; /* usage counter */ | 181 | unsigned char usage; /* usage counter */ |
172 | struct axis_conversion ac; /* hw -> logical axis */ | 182 | struct axis_conversion ac; /* hw -> logical axis */ |
183 | |||
184 | u32 irq; /* IRQ number */ | ||
185 | struct fasync_struct *async_queue; /* queue for the misc device */ | ||
186 | wait_queue_head_t misc_wait; /* Wait queue for the misc device */ | ||
187 | unsigned long misc_opened; /* bit0: whether the device is open */ | ||
173 | }; | 188 | }; |
174 | 189 | ||
175 | int lis3lv02d_init_device(struct acpi_lis3lv02d *dev); | 190 | int lis3lv02d_init_device(struct acpi_lis3lv02d *dev); |
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index b0ce37852281..73f77a9b8b18 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c | |||
@@ -1262,7 +1262,7 @@ static int __init vt1211_device_add(unsigned short address) | |||
1262 | res.name = pdev->name; | 1262 | res.name = pdev->name; |
1263 | err = acpi_check_resource_conflict(&res); | 1263 | err = acpi_check_resource_conflict(&res); |
1264 | if (err) | 1264 | if (err) |
1265 | goto EXIT; | 1265 | goto EXIT_DEV_PUT; |
1266 | 1266 | ||
1267 | err = platform_device_add_resources(pdev, &res, 1); | 1267 | err = platform_device_add_resources(pdev, &res, 1); |
1268 | if (err) { | 1268 | if (err) { |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index cb808d015361..feae743ba991 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1548,7 +1548,7 @@ static int __init sensors_w83627ehf_init(void) | |||
1548 | 1548 | ||
1549 | err = acpi_check_resource_conflict(&res); | 1549 | err = acpi_check_resource_conflict(&res); |
1550 | if (err) | 1550 | if (err) |
1551 | goto exit; | 1551 | goto exit_device_put; |
1552 | 1552 | ||
1553 | err = platform_device_add_resources(pdev, &res, 1); | 1553 | err = platform_device_add_resources(pdev, &res, 1); |
1554 | if (err) { | 1554 | if (err) { |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index a34338567a2a..f14813be4eff 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -328,7 +328,7 @@ static void dispatch_io(int rw, unsigned int num_regions, | |||
328 | struct dpages old_pages = *dp; | 328 | struct dpages old_pages = *dp; |
329 | 329 | ||
330 | if (sync) | 330 | if (sync) |
331 | rw |= (1 << BIO_RW_SYNC); | 331 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
332 | 332 | ||
333 | /* | 333 | /* |
334 | * For multiple regions we need to be careful to rewind | 334 | * For multiple regions we need to be careful to rewind |
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 3073618269ea..0a225da21272 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c | |||
@@ -344,7 +344,7 @@ static int run_io_job(struct kcopyd_job *job) | |||
344 | { | 344 | { |
345 | int r; | 345 | int r; |
346 | struct dm_io_request io_req = { | 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 | .mem.type = DM_IO_PAGE_LIST, | 348 | .mem.type = DM_IO_PAGE_LIST, |
349 | .mem.ptr.pl = job->pages, | 349 | .mem.ptr.pl = job->pages, |
350 | .mem.offset = job->offset, | 350 | .mem.offset = job->offset, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4495104f6c9f..03b4cd0a6344 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -474,7 +474,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | |||
474 | * causes ENOTSUPP, we allocate a spare bio... | 474 | * causes ENOTSUPP, we allocate a spare bio... |
475 | */ | 475 | */ |
476 | struct bio *bio = bio_alloc(GFP_NOIO, 1); | 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 | bio->bi_bdev = rdev->bdev; | 479 | bio->bi_bdev = rdev->bdev; |
480 | bio->bi_sector = sector; | 480 | bio->bi_sector = sector; |
@@ -531,7 +531,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size, | |||
531 | struct completion event; | 531 | struct completion event; |
532 | int ret; | 532 | int ret; |
533 | 533 | ||
534 | rw |= (1 << BIO_RW_SYNC); | 534 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
535 | 535 | ||
536 | bio->bi_bdev = bdev; | 536 | bio->bi_bdev = bdev; |
537 | bio->bi_sector = sector; | 537 | bio->bi_sector = sector; |
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c index de7adaf5fa5b..78412c9c424a 100644 --- a/drivers/media/common/tuners/tuner-simple.c +++ b/drivers/media/common/tuners/tuner-simple.c | |||
@@ -318,7 +318,6 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
318 | u8 *config, u8 *cb) | 318 | u8 *config, u8 *cb) |
319 | { | 319 | { |
320 | struct tuner_simple_priv *priv = fe->tuner_priv; | 320 | struct tuner_simple_priv *priv = fe->tuner_priv; |
321 | u8 tuneraddr; | ||
322 | int rc; | 321 | int rc; |
323 | 322 | ||
324 | /* tv norm specific stuff for multi-norm tuners */ | 323 | /* tv norm specific stuff for multi-norm tuners */ |
@@ -387,6 +386,7 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
387 | 386 | ||
388 | case TUNER_PHILIPS_TUV1236D: | 387 | case TUNER_PHILIPS_TUV1236D: |
389 | { | 388 | { |
389 | struct tuner_i2c_props i2c = priv->i2c_props; | ||
390 | /* 0x40 -> ATSC antenna input 1 */ | 390 | /* 0x40 -> ATSC antenna input 1 */ |
391 | /* 0x48 -> ATSC antenna input 2 */ | 391 | /* 0x48 -> ATSC antenna input 2 */ |
392 | /* 0x00 -> NTSC antenna input 1 */ | 392 | /* 0x00 -> NTSC antenna input 1 */ |
@@ -398,17 +398,15 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
398 | buffer[1] = 0x04; | 398 | buffer[1] = 0x04; |
399 | } | 399 | } |
400 | /* set to the correct mode (analog or digital) */ | 400 | /* set to the correct mode (analog or digital) */ |
401 | tuneraddr = priv->i2c_props.addr; | 401 | i2c.addr = 0x0a; |
402 | priv->i2c_props.addr = 0x0a; | 402 | rc = tuner_i2c_xfer_send(&i2c, &buffer[0], 2); |
403 | rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[0], 2); | ||
404 | if (2 != rc) | 403 | if (2 != rc) |
405 | tuner_warn("i2c i/o error: rc == %d " | 404 | tuner_warn("i2c i/o error: rc == %d " |
406 | "(should be 2)\n", rc); | 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 | if (2 != rc) | 407 | if (2 != rc) |
409 | tuner_warn("i2c i/o error: rc == %d " | 408 | tuner_warn("i2c i/o error: rc == %d " |
410 | "(should be 2)\n", rc); | 409 | "(should be 2)\n", rc); |
411 | priv->i2c_props.addr = tuneraddr; | ||
412 | break; | 410 | break; |
413 | } | 411 | } |
414 | } | 412 | } |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 0c733c66a441..069d847ba887 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -364,16 +364,15 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, | |||
364 | enum dmx_success success) | 364 | enum dmx_success success) |
365 | { | 365 | { |
366 | struct dmxdev_filter *dmxdevfilter = filter->priv; | 366 | struct dmxdev_filter *dmxdevfilter = filter->priv; |
367 | unsigned long flags; | ||
368 | int ret; | 367 | int ret; |
369 | 368 | ||
370 | if (dmxdevfilter->buffer.error) { | 369 | if (dmxdevfilter->buffer.error) { |
371 | wake_up(&dmxdevfilter->buffer.queue); | 370 | wake_up(&dmxdevfilter->buffer.queue); |
372 | return 0; | 371 | return 0; |
373 | } | 372 | } |
374 | spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); | 373 | spin_lock(&dmxdevfilter->dev->lock); |
375 | if (dmxdevfilter->state != DMXDEV_STATE_GO) { | 374 | if (dmxdevfilter->state != DMXDEV_STATE_GO) { |
376 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 375 | spin_unlock(&dmxdevfilter->dev->lock); |
377 | return 0; | 376 | return 0; |
378 | } | 377 | } |
379 | del_timer(&dmxdevfilter->timer); | 378 | del_timer(&dmxdevfilter->timer); |
@@ -392,7 +391,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, | |||
392 | } | 391 | } |
393 | if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) | 392 | if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) |
394 | dmxdevfilter->state = DMXDEV_STATE_DONE; | 393 | dmxdevfilter->state = DMXDEV_STATE_DONE; |
395 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 394 | spin_unlock(&dmxdevfilter->dev->lock); |
396 | wake_up(&dmxdevfilter->buffer.queue); | 395 | wake_up(&dmxdevfilter->buffer.queue); |
397 | return 0; | 396 | return 0; |
398 | } | 397 | } |
@@ -404,12 +403,11 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
404 | { | 403 | { |
405 | struct dmxdev_filter *dmxdevfilter = feed->priv; | 404 | struct dmxdev_filter *dmxdevfilter = feed->priv; |
406 | struct dvb_ringbuffer *buffer; | 405 | struct dvb_ringbuffer *buffer; |
407 | unsigned long flags; | ||
408 | int ret; | 406 | int ret; |
409 | 407 | ||
410 | spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); | 408 | spin_lock(&dmxdevfilter->dev->lock); |
411 | if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { | 409 | if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { |
412 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 410 | spin_unlock(&dmxdevfilter->dev->lock); |
413 | return 0; | 411 | return 0; |
414 | } | 412 | } |
415 | 413 | ||
@@ -419,7 +417,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
419 | else | 417 | else |
420 | buffer = &dmxdevfilter->dev->dvr_buffer; | 418 | buffer = &dmxdevfilter->dev->dvr_buffer; |
421 | if (buffer->error) { | 419 | if (buffer->error) { |
422 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 420 | spin_unlock(&dmxdevfilter->dev->lock); |
423 | wake_up(&buffer->queue); | 421 | wake_up(&buffer->queue); |
424 | return 0; | 422 | return 0; |
425 | } | 423 | } |
@@ -430,7 +428,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
430 | dvb_ringbuffer_flush(buffer); | 428 | dvb_ringbuffer_flush(buffer); |
431 | buffer->error = ret; | 429 | buffer->error = ret; |
432 | } | 430 | } |
433 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 431 | spin_unlock(&dmxdevfilter->dev->lock); |
434 | wake_up(&buffer->queue); | 432 | wake_up(&buffer->queue); |
435 | return 0; | 433 | return 0; |
436 | } | 434 | } |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index a2c1fd5d2f67..e2eca0b1fe7c 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -399,9 +399,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
399 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, | 399 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, |
400 | size_t count) | 400 | size_t count) |
401 | { | 401 | { |
402 | unsigned long flags; | 402 | spin_lock(&demux->lock); |
403 | |||
404 | spin_lock_irqsave(&demux->lock, flags); | ||
405 | 403 | ||
406 | while (count--) { | 404 | while (count--) { |
407 | if (buf[0] == 0x47) | 405 | if (buf[0] == 0x47) |
@@ -409,17 +407,16 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, | |||
409 | buf += 188; | 407 | buf += 188; |
410 | } | 408 | } |
411 | 409 | ||
412 | spin_unlock_irqrestore(&demux->lock, flags); | 410 | spin_unlock(&demux->lock); |
413 | } | 411 | } |
414 | 412 | ||
415 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); | 413 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); |
416 | 414 | ||
417 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | 415 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) |
418 | { | 416 | { |
419 | unsigned long flags; | ||
420 | int p = 0, i, j; | 417 | int p = 0, i, j; |
421 | 418 | ||
422 | spin_lock_irqsave(&demux->lock, flags); | 419 | spin_lock(&demux->lock); |
423 | 420 | ||
424 | if (demux->tsbufp) { | 421 | if (demux->tsbufp) { |
425 | i = demux->tsbufp; | 422 | i = demux->tsbufp; |
@@ -452,18 +449,17 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
452 | } | 449 | } |
453 | 450 | ||
454 | bailout: | 451 | bailout: |
455 | spin_unlock_irqrestore(&demux->lock, flags); | 452 | spin_unlock(&demux->lock); |
456 | } | 453 | } |
457 | 454 | ||
458 | EXPORT_SYMBOL(dvb_dmx_swfilter); | 455 | EXPORT_SYMBOL(dvb_dmx_swfilter); |
459 | 456 | ||
460 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | 457 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) |
461 | { | 458 | { |
462 | unsigned long flags; | ||
463 | int p = 0, i, j; | 459 | int p = 0, i, j; |
464 | u8 tmppack[188]; | 460 | u8 tmppack[188]; |
465 | 461 | ||
466 | spin_lock_irqsave(&demux->lock, flags); | 462 | spin_lock(&demux->lock); |
467 | 463 | ||
468 | if (demux->tsbufp) { | 464 | if (demux->tsbufp) { |
469 | i = demux->tsbufp; | 465 | i = demux->tsbufp; |
@@ -504,7 +500,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
504 | } | 500 | } |
505 | 501 | ||
506 | bailout: | 502 | bailout: |
507 | spin_unlock_irqrestore(&demux->lock, flags); | 503 | spin_unlock(&demux->lock); |
508 | } | 504 | } |
509 | 505 | ||
510 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); | 506 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 67cbce82cb91..4dfed6aa2dbc 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -98,11 +98,16 @@ | |||
98 | * - blacklisted KWorld radio in hid-core.c and hid-ids.h | 98 | * - blacklisted KWorld radio in hid-core.c and hid-ids.h |
99 | * 2008-12-03 Mark Lord <mlord@pobox.com> | 99 | * 2008-12-03 Mark Lord <mlord@pobox.com> |
100 | * - add support for DealExtreme USB Radio | 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 | * ToDo: | 108 | * ToDo: |
103 | * - add firmware download/update support | 109 | * - add firmware download/update support |
104 | * - RDS support: interrupt mode, instead of polling | 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 | ||
@@ -882,6 +887,30 @@ static int si470x_rds_on(struct si470x_device *radio) | |||
882 | 887 | ||
883 | 888 | ||
884 | /************************************************************************** | 889 | /************************************************************************** |
890 | * General Driver Functions - LED_REPORT | ||
891 | **************************************************************************/ | ||
892 | |||
893 | /* | ||
894 | * si470x_set_led_state - sets the led state | ||
895 | */ | ||
896 | static int si470x_set_led_state(struct si470x_device *radio, | ||
897 | unsigned char led_state) | ||
898 | { | ||
899 | unsigned char buf[LED_REPORT_SIZE]; | ||
900 | int retval; | ||
901 | |||
902 | buf[0] = LED_REPORT; | ||
903 | buf[1] = LED_COMMAND; | ||
904 | buf[2] = led_state; | ||
905 | |||
906 | retval = si470x_set_report(radio, (void *) &buf, sizeof(buf)); | ||
907 | |||
908 | return (retval < 0) ? -EINVAL : 0; | ||
909 | } | ||
910 | |||
911 | |||
912 | |||
913 | /************************************************************************** | ||
885 | * RDS Driver Functions | 914 | * RDS Driver Functions |
886 | **************************************************************************/ | 915 | **************************************************************************/ |
887 | 916 | ||
@@ -1385,20 +1414,22 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
1385 | }; | 1414 | }; |
1386 | 1415 | ||
1387 | /* stereo indicator == stereo (instead of mono) */ | 1416 | /* stereo indicator == stereo (instead of mono) */ |
1388 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) | 1417 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 0) |
1389 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
1390 | else | ||
1391 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; | 1418 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; |
1419 | else | ||
1420 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
1392 | 1421 | ||
1393 | /* mono/stereo selector */ | 1422 | /* mono/stereo selector */ |
1394 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1) | 1423 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) |
1395 | tuner->audmode = V4L2_TUNER_MODE_MONO; | ||
1396 | else | ||
1397 | tuner->audmode = V4L2_TUNER_MODE_STEREO; | 1424 | tuner->audmode = V4L2_TUNER_MODE_STEREO; |
1425 | else | ||
1426 | tuner->audmode = V4L2_TUNER_MODE_MONO; | ||
1398 | 1427 | ||
1399 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ | 1428 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ |
1400 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) | 1429 | /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */ |
1401 | * 0x0101; | 1430 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI); |
1431 | /* the ideal factor is 0xffff/75 = 873,8 */ | ||
1432 | tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10); | ||
1402 | 1433 | ||
1403 | /* automatic frequency control: -1: freq to low, 1 freq to high */ | 1434 | /* automatic frequency control: -1: freq to low, 1 freq to high */ |
1404 | /* AFCRL does only indicate that freq. differs, not if too low/high */ | 1435 | /* AFCRL does only indicate that freq. differs, not if too low/high */ |
@@ -1632,6 +1663,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1632 | /* set initial frequency */ | 1663 | /* set initial frequency */ |
1633 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ | 1664 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ |
1634 | 1665 | ||
1666 | /* set led to connect state */ | ||
1667 | si470x_set_led_state(radio, BLINK_GREEN_LED); | ||
1668 | |||
1635 | /* rds buffer allocation */ | 1669 | /* rds buffer allocation */ |
1636 | radio->buf_size = rds_buf * 3; | 1670 | radio->buf_size = rds_buf * 3; |
1637 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); | 1671 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); |
@@ -1715,6 +1749,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf) | |||
1715 | cancel_delayed_work_sync(&radio->work); | 1749 | cancel_delayed_work_sync(&radio->work); |
1716 | usb_set_intfdata(intf, NULL); | 1750 | usb_set_intfdata(intf, NULL); |
1717 | if (radio->users == 0) { | 1751 | if (radio->users == 0) { |
1752 | /* set led to disconnect state */ | ||
1753 | si470x_set_led_state(radio, BLINK_ORANGE_LED); | ||
1754 | |||
1718 | video_unregister_device(radio->videodev); | 1755 | video_unregister_device(radio->videodev); |
1719 | kfree(radio->buffer); | 1756 | kfree(radio->buffer); |
1720 | kfree(radio); | 1757 | kfree(radio); |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 2ed24527ecd6..65e4901f4db7 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -422,6 +422,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) | |||
422 | if (urb == NULL) | 422 | if (urb == NULL) |
423 | break; | 423 | break; |
424 | 424 | ||
425 | BUG_ON(!gspca_dev->dev); | ||
425 | gspca_dev->urb[i] = NULL; | 426 | gspca_dev->urb[i] = NULL; |
426 | if (!gspca_dev->present) | 427 | if (!gspca_dev->present) |
427 | usb_kill_urb(urb); | 428 | usb_kill_urb(urb); |
@@ -1950,8 +1951,12 @@ void gspca_disconnect(struct usb_interface *intf) | |||
1950 | { | 1951 | { |
1951 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); | 1952 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); |
1952 | 1953 | ||
1954 | mutex_lock(&gspca_dev->usb_lock); | ||
1953 | gspca_dev->present = 0; | 1955 | gspca_dev->present = 0; |
1956 | mutex_unlock(&gspca_dev->usb_lock); | ||
1954 | 1957 | ||
1958 | destroy_urbs(gspca_dev); | ||
1959 | gspca_dev->dev = NULL; | ||
1955 | usb_set_intfdata(intf, NULL); | 1960 | usb_set_intfdata(intf, NULL); |
1956 | 1961 | ||
1957 | /* release the device */ | 1962 | /* release the device */ |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index f6b3ef6e691b..c13bd2aa0bea 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -393,7 +393,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo | |||
393 | return 0; | 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 | vbifmt->service_set = ivtv_get_service_set(vbifmt); | 397 | vbifmt->service_set = ivtv_get_service_set(vbifmt); |
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
@@ -1748,6 +1748,18 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg) | |||
1748 | break; | 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 | default: | 1763 | default: |
1752 | return -EINVAL; | 1764 | return -EINVAL; |
1753 | } | 1765 | } |
@@ -1790,18 +1802,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1790 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | 1802 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); |
1791 | return 0; | 1803 | return 0; |
1792 | 1804 | ||
1793 | case IVTV_IOC_DMA_FRAME: | ||
1794 | case VIDEO_GET_PTS: | ||
1795 | case VIDEO_GET_FRAME_COUNT: | ||
1796 | case VIDEO_GET_EVENT: | ||
1797 | case VIDEO_PLAY: | ||
1798 | case VIDEO_STOP: | ||
1799 | case VIDEO_FREEZE: | ||
1800 | case VIDEO_CONTINUE: | ||
1801 | case VIDEO_COMMAND: | ||
1802 | case VIDEO_TRY_COMMAND: | ||
1803 | return ivtv_decoder_ioctls(filp, cmd, (void *)arg); | ||
1804 | |||
1805 | default: | 1805 | default: |
1806 | break; | 1806 | break; |
1807 | } | 1807 | } |
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index 1a4d04664d6d..aa266e1f69b2 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c | |||
@@ -286,7 +286,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
287 | if (!res) | 287 | if (!res) |
288 | goto fail; | 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 | if (!ei->base_addr) | 290 | if (!ei->base_addr) |
291 | goto fail; | 291 | goto fail; |
292 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); | 292 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); |
@@ -307,7 +307,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
307 | 307 | ||
308 | ei->nchips = pdata->num_chips; | 308 | ei->nchips = pdata->num_chips; |
309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); | 309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); |
310 | if (!ei) { | 310 | if (!ei->chip) { |
311 | ret = -ENOMEM; | 311 | ret = -ENOMEM; |
312 | goto fail; | 312 | goto fail; |
313 | } | 313 | } |
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index ea9488e7ad6d..2e36057659e1 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
@@ -678,6 +678,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client) | |||
678 | 678 | ||
679 | static struct i2c_device_id pcf50633_id_table[] = { | 679 | static struct i2c_device_id pcf50633_id_table[] = { |
680 | {"pcf50633", 0x73}, | 680 | {"pcf50633", 0x73}, |
681 | {/* end of list */} | ||
681 | }; | 682 | }; |
682 | 683 | ||
683 | static struct i2c_driver pcf50633_driver = { | 684 | static struct i2c_driver pcf50633_driver = { |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 0e5761f12634..4c7b7962f6b8 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -1050,7 +1050,7 @@ static int __devinit sm501_gpio_register_chip(struct sm501_devdata *sm, | |||
1050 | return gpiochip_add(gchip); | 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 | struct sm501_gpio *gpio = &sm->gpio; | 1055 | struct sm501_gpio *gpio = &sm->gpio; |
1056 | resource_size_t iobase = sm->io_res->start + SM501_GPIO; | 1056 | resource_size_t iobase = sm->io_res->start + SM501_GPIO; |
@@ -1321,7 +1321,7 @@ static unsigned int sm501_mem_local[] = { | |||
1321 | * Common init code for an SM501 | 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 | struct sm501_initdata *idata; | 1326 | struct sm501_initdata *idata; |
1327 | struct sm501_platdata *pdata; | 1327 | struct sm501_platdata *pdata; |
@@ -1397,7 +1397,7 @@ static int sm501_init_dev(struct sm501_devdata *sm) | |||
1397 | return 0; | 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 | struct sm501_devdata *sm; | 1402 | struct sm501_devdata *sm; |
1403 | int ret; | 1403 | int ret; |
@@ -1586,8 +1586,8 @@ static struct sm501_platdata sm501_pci_platdata = { | |||
1586 | .gpio_base = -1, | 1586 | .gpio_base = -1, |
1587 | }; | 1587 | }; |
1588 | 1588 | ||
1589 | static int sm501_pci_probe(struct pci_dev *dev, | 1589 | static int __devinit sm501_pci_probe(struct pci_dev *dev, |
1590 | const struct pci_device_id *id) | 1590 | const struct pci_device_id *id) |
1591 | { | 1591 | { |
1592 | struct sm501_devdata *sm; | 1592 | struct sm501_devdata *sm; |
1593 | int err; | 1593 | int err; |
@@ -1693,7 +1693,7 @@ static void sm501_dev_remove(struct sm501_devdata *sm) | |||
1693 | sm501_gpio_remove(sm); | 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 | struct sm501_devdata *sm = pci_get_drvdata(dev); | 1698 | struct sm501_devdata *sm = pci_get_drvdata(dev); |
1699 | 1699 | ||
@@ -1727,16 +1727,16 @@ static struct pci_device_id sm501_pci_tbl[] = { | |||
1727 | 1727 | ||
1728 | MODULE_DEVICE_TABLE(pci, sm501_pci_tbl); | 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 | .name = "sm501", | 1731 | .name = "sm501", |
1732 | .id_table = sm501_pci_tbl, | 1732 | .id_table = sm501_pci_tbl, |
1733 | .probe = sm501_pci_probe, | 1733 | .probe = sm501_pci_probe, |
1734 | .remove = sm501_pci_remove, | 1734 | .remove = __devexit_p(sm501_pci_remove), |
1735 | }; | 1735 | }; |
1736 | 1736 | ||
1737 | MODULE_ALIAS("platform:sm501"); | 1737 | MODULE_ALIAS("platform:sm501"); |
1738 | 1738 | ||
1739 | static struct platform_driver sm501_plat_drv = { | 1739 | static struct platform_driver sm501_plat_driver = { |
1740 | .driver = { | 1740 | .driver = { |
1741 | .name = "sm501", | 1741 | .name = "sm501", |
1742 | .owner = THIS_MODULE, | 1742 | .owner = THIS_MODULE, |
@@ -1749,14 +1749,14 @@ static struct platform_driver sm501_plat_drv = { | |||
1749 | 1749 | ||
1750 | static int __init sm501_base_init(void) | 1750 | static int __init sm501_base_init(void) |
1751 | { | 1751 | { |
1752 | platform_driver_register(&sm501_plat_drv); | 1752 | platform_driver_register(&sm501_plat_driver); |
1753 | return pci_register_driver(&sm501_pci_drv); | 1753 | return pci_register_driver(&sm501_pci_driver); |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | static void __exit sm501_base_exit(void) | 1756 | static void __exit sm501_base_exit(void) |
1757 | { | 1757 | { |
1758 | platform_driver_unregister(&sm501_plat_drv); | 1758 | platform_driver_unregister(&sm501_plat_driver); |
1759 | pci_unregister_driver(&sm501_pci_drv); | 1759 | pci_unregister_driver(&sm501_pci_driver); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | module_init(sm501_base_init); | 1762 | module_init(sm501_base_init); |
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e7ab0035d305..68826f1e36bc 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/i2c.h> | 38 | #include <linux/i2c.h> |
39 | #include <linux/i2c/twl4030.h> | 39 | #include <linux/i2c/twl4030.h> |
40 | 40 | ||
41 | #ifdef CONFIG_ARM | 41 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
42 | #include <mach/cpu.h> | 42 | #include <mach/cpu.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index f92595c8f165..84d5ea1ec171 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) | |||
1111 | do { | 1111 | do { |
1112 | schedule_timeout_interruptible(1); | 1112 | schedule_timeout_interruptible(1); |
1113 | reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); | 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 | if (!tries) | 1116 | if (!tries) |
1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); | 1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); |
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350, | |||
1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, | 1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, |
1298 | struct wm8350_platform_data *pdata) | 1298 | struct wm8350_platform_data *pdata) |
1299 | { | 1299 | { |
1300 | int ret = -EINVAL; | 1300 | int ret; |
1301 | u16 id1, id2, mask_rev; | 1301 | u16 id1, id2, mask_rev; |
1302 | u16 cust_id, mode, chip_rev; | 1302 | u16 cust_id, mode, chip_rev; |
1303 | 1303 | ||
1304 | /* get WM8350 revision and config mode */ | 1304 | /* get WM8350 revision and config mode */ |
1305 | wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); | 1305 | ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); |
1306 | wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); | 1306 | if (ret != 0) { |
1307 | wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); | 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 | id1 = be16_to_cpu(id1); | 1324 | id1 = be16_to_cpu(id1); |
1310 | id2 = be16_to_cpu(id2); | 1325 | id2 = be16_to_cpu(id2); |
@@ -1404,14 +1419,12 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1404 | return ret; | 1419 | return ret; |
1405 | } | 1420 | } |
1406 | 1421 | ||
1407 | if (pdata && pdata->init) { | 1422 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF); |
1408 | ret = pdata->init(wm8350); | 1423 | wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF); |
1409 | if (ret != 0) { | 1424 | wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF); |
1410 | dev_err(wm8350->dev, "Platform init() failed: %d\n", | 1425 | wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF); |
1411 | ret); | 1426 | wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF); |
1412 | goto err; | 1427 | wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF); |
1413 | } | ||
1414 | } | ||
1415 | 1428 | ||
1416 | mutex_init(&wm8350->auxadc_mutex); | 1429 | mutex_init(&wm8350->auxadc_mutex); |
1417 | mutex_init(&wm8350->irq_mutex); | 1430 | mutex_init(&wm8350->irq_mutex); |
@@ -1430,6 +1443,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1430 | } | 1443 | } |
1431 | wm8350->chip_irq = irq; | 1444 | wm8350->chip_irq = irq; |
1432 | 1445 | ||
1446 | if (pdata && pdata->init) { | ||
1447 | ret = pdata->init(wm8350); | ||
1448 | if (ret != 0) { | ||
1449 | dev_err(wm8350->dev, "Platform init() failed: %d\n", | ||
1450 | ret); | ||
1451 | goto err; | ||
1452 | } | ||
1453 | } | ||
1454 | |||
1433 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); | 1455 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); |
1434 | 1456 | ||
1435 | wm8350_client_dev_register(wm8350, "wm8350-codec", | 1457 | wm8350_client_dev_register(wm8350, "wm8350-codec", |
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c index 68887b817d17..9a4cc954cb7c 100644 --- a/drivers/mfd/wm8350-regmap.c +++ b/drivers/mfd/wm8350-regmap.c | |||
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = { | |||
3188 | { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ | 3188 | { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ |
3189 | { 0x0000, 0x0000, 0x0000 }, /* R2 */ | 3189 | { 0x0000, 0x0000, 0x0000 }, /* R2 */ |
3190 | { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */ | 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 | { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ | 3192 | { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ |
3193 | { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ | 3193 | { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ |
3194 | { 0x0000, 0x0000, 0x0000 }, /* R7 */ | 3194 | { 0x0000, 0x0000, 0x0000 }, /* R7 */ |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 45b1f430685f..513eb09a638f 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -584,7 +584,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
584 | if (err) | 584 | if (err) |
585 | goto out; | 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 | cap_str, sizeof(cap_str)); | 588 | cap_str, sizeof(cap_str)); |
589 | printk(KERN_INFO "%s: %s %s %s %s\n", | 589 | printk(KERN_INFO "%s: %s %s %s %s\n", |
590 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), | 590 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index b92b172074ee..b9f1e84897cc 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test) | |||
494 | 494 | ||
495 | sg_init_one(&sg, test->buffer, 512); | 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 | if (ret) | 498 | if (ret) |
499 | return ret; | 499 | return ret; |
500 | 500 | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 76bfe16c09b1..2b1196e6142c 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -1548,9 +1548,10 @@ static bool filter(struct dma_chan *chan, void *slave) | |||
1548 | { | 1548 | { |
1549 | struct dw_dma_slave *dws = slave; | 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 | return true; | 1553 | return true; |
1553 | else | 1554 | } else |
1554 | return false; | 1555 | return false; |
1555 | } | 1556 | } |
1556 | #endif | 1557 | #endif |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index db37490f67ec..a631c81dce12 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #define VS30 (1 << 25) | 55 | #define VS30 (1 << 25) |
56 | #define SDVS18 (0x5 << 9) | 56 | #define SDVS18 (0x5 << 9) |
57 | #define SDVS30 (0x6 << 9) | 57 | #define SDVS30 (0x6 << 9) |
58 | #define SDVS33 (0x7 << 9) | ||
58 | #define SDVSCLR 0xFFFFF1FF | 59 | #define SDVSCLR 0xFFFFF1FF |
59 | #define SDVSDET 0x00000400 | 60 | #define SDVSDET 0x00000400 |
60 | #define AUTOIDLE 0x1 | 61 | #define AUTOIDLE 0x1 |
@@ -375,6 +376,32 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status) | |||
375 | } | 376 | } |
376 | #endif /* CONFIG_MMC_DEBUG */ | 377 | #endif /* CONFIG_MMC_DEBUG */ |
377 | 378 | ||
379 | /* | ||
380 | * MMC controller internal state machines reset | ||
381 | * | ||
382 | * Used to reset command or data internal state machines, using respectively | ||
383 | * SRC or SRD bit of SYSCTL register | ||
384 | * Can be called from interrupt context | ||
385 | */ | ||
386 | static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host, | ||
387 | unsigned long bit) | ||
388 | { | ||
389 | unsigned long i = 0; | ||
390 | unsigned long limit = (loops_per_jiffy * | ||
391 | msecs_to_jiffies(MMC_TIMEOUT_MS)); | ||
392 | |||
393 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | ||
394 | OMAP_HSMMC_READ(host->base, SYSCTL) | bit); | ||
395 | |||
396 | while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) && | ||
397 | (i++ < limit)) | ||
398 | cpu_relax(); | ||
399 | |||
400 | if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit) | ||
401 | dev_err(mmc_dev(host->mmc), | ||
402 | "Timeout waiting on controller reset in %s\n", | ||
403 | __func__); | ||
404 | } | ||
378 | 405 | ||
379 | /* | 406 | /* |
380 | * MMC controller IRQ handler | 407 | * MMC controller IRQ handler |
@@ -403,21 +430,17 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
403 | (status & CMD_CRC)) { | 430 | (status & CMD_CRC)) { |
404 | if (host->cmd) { | 431 | if (host->cmd) { |
405 | if (status & CMD_TIMEOUT) { | 432 | if (status & CMD_TIMEOUT) { |
406 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 433 | mmc_omap_reset_controller_fsm(host, SRC); |
407 | OMAP_HSMMC_READ(host->base, | ||
408 | SYSCTL) | SRC); | ||
409 | while (OMAP_HSMMC_READ(host->base, | ||
410 | SYSCTL) & SRC) | ||
411 | ; | ||
412 | |||
413 | host->cmd->error = -ETIMEDOUT; | 434 | host->cmd->error = -ETIMEDOUT; |
414 | } else { | 435 | } else { |
415 | host->cmd->error = -EILSEQ; | 436 | host->cmd->error = -EILSEQ; |
416 | } | 437 | } |
417 | end_cmd = 1; | 438 | end_cmd = 1; |
418 | } | 439 | } |
419 | if (host->data) | 440 | if (host->data) { |
420 | mmc_dma_cleanup(host); | 441 | mmc_dma_cleanup(host); |
442 | mmc_omap_reset_controller_fsm(host, SRD); | ||
443 | } | ||
421 | } | 444 | } |
422 | if ((status & DATA_TIMEOUT) || | 445 | if ((status & DATA_TIMEOUT) || |
423 | (status & DATA_CRC)) { | 446 | (status & DATA_CRC)) { |
@@ -426,12 +449,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
426 | mmc_dma_cleanup(host); | 449 | mmc_dma_cleanup(host); |
427 | else | 450 | else |
428 | host->data->error = -EILSEQ; | 451 | host->data->error = -EILSEQ; |
429 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 452 | mmc_omap_reset_controller_fsm(host, SRD); |
430 | OMAP_HSMMC_READ(host->base, | ||
431 | SYSCTL) | SRD); | ||
432 | while (OMAP_HSMMC_READ(host->base, | ||
433 | SYSCTL) & SRD) | ||
434 | ; | ||
435 | end_trans = 1; | 453 | end_trans = 1; |
436 | } | 454 | } |
437 | } | 455 | } |
@@ -456,13 +474,20 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
456 | } | 474 | } |
457 | 475 | ||
458 | /* | 476 | /* |
459 | * Switch MMC operating voltage | 477 | * Switch MMC interface voltage ... only relevant for MMC1. |
478 | * | ||
479 | * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver. | ||
480 | * The MMC2 transceiver controls are used instead of DAT4..DAT7. | ||
481 | * Some chips, like eMMC ones, use internal transceivers. | ||
460 | */ | 482 | */ |
461 | static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) | 483 | static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) |
462 | { | 484 | { |
463 | u32 reg_val = 0; | 485 | u32 reg_val = 0; |
464 | int ret; | 486 | int ret; |
465 | 487 | ||
488 | if (host->id != OMAP_MMC1_DEVID) | ||
489 | return 0; | ||
490 | |||
466 | /* Disable the clocks */ | 491 | /* Disable the clocks */ |
467 | clk_disable(host->fclk); | 492 | clk_disable(host->fclk); |
468 | clk_disable(host->iclk); | 493 | clk_disable(host->iclk); |
@@ -485,19 +510,26 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) | |||
485 | OMAP_HSMMC_WRITE(host->base, HCTL, | 510 | OMAP_HSMMC_WRITE(host->base, HCTL, |
486 | OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); | 511 | OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); |
487 | reg_val = OMAP_HSMMC_READ(host->base, HCTL); | 512 | reg_val = OMAP_HSMMC_READ(host->base, HCTL); |
513 | |||
488 | /* | 514 | /* |
489 | * If a MMC dual voltage card is detected, the set_ios fn calls | 515 | * If a MMC dual voltage card is detected, the set_ios fn calls |
490 | * this fn with VDD bit set for 1.8V. Upon card removal from the | 516 | * this fn with VDD bit set for 1.8V. Upon card removal from the |
491 | * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. | 517 | * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. |
492 | * | 518 | * |
493 | * Only MMC1 supports 3.0V. MMC2 will not function if SDVS30 is | 519 | * Cope with a bit of slop in the range ... per data sheets: |
494 | * set in HCTL. | 520 | * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max, |
521 | * but recommended values are 1.71V to 1.89V | ||
522 | * - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max, | ||
523 | * but recommended values are 2.7V to 3.3V | ||
524 | * | ||
525 | * Board setup code shouldn't permit anything very out-of-range. | ||
526 | * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the | ||
527 | * middle range) but VSIM can't power DAT4..DAT7 at more than 3V. | ||
495 | */ | 528 | */ |
496 | if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) || | 529 | if ((1 << vdd) <= MMC_VDD_23_24) |
497 | ((1 << vdd) == MMC_VDD_33_34))) | ||
498 | reg_val |= SDVS30; | ||
499 | if ((1 << vdd) == MMC_VDD_165_195) | ||
500 | reg_val |= SDVS18; | 530 | reg_val |= SDVS18; |
531 | else | ||
532 | reg_val |= SDVS30; | ||
501 | 533 | ||
502 | OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); | 534 | OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); |
503 | 535 | ||
@@ -517,16 +549,15 @@ static void mmc_omap_detect(struct work_struct *work) | |||
517 | { | 549 | { |
518 | struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, | 550 | struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, |
519 | mmc_carddetect_work); | 551 | mmc_carddetect_work); |
552 | struct omap_mmc_slot_data *slot = &mmc_slot(host); | ||
553 | |||
554 | host->carddetect = slot->card_detect(slot->card_detect_irq); | ||
520 | 555 | ||
521 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); | 556 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
522 | if (host->carddetect) { | 557 | if (host->carddetect) { |
523 | mmc_detect_change(host->mmc, (HZ * 200) / 1000); | 558 | mmc_detect_change(host->mmc, (HZ * 200) / 1000); |
524 | } else { | 559 | } else { |
525 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 560 | mmc_omap_reset_controller_fsm(host, SRD); |
526 | OMAP_HSMMC_READ(host->base, SYSCTL) | SRD); | ||
527 | while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD) | ||
528 | ; | ||
529 | |||
530 | mmc_detect_change(host->mmc, (HZ * 50) / 1000); | 561 | mmc_detect_change(host->mmc, (HZ * 50) / 1000); |
531 | } | 562 | } |
532 | } | 563 | } |
@@ -538,7 +569,6 @@ static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id) | |||
538 | { | 569 | { |
539 | struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; | 570 | struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; |
540 | 571 | ||
541 | host->carddetect = mmc_slot(host).card_detect(irq); | ||
542 | schedule_work(&host->mmc_carddetect_work); | 572 | schedule_work(&host->mmc_carddetect_work); |
543 | 573 | ||
544 | return IRQ_HANDLED; | 574 | return IRQ_HANDLED; |
@@ -757,10 +787,14 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
757 | case MMC_POWER_OFF: | 787 | case MMC_POWER_OFF: |
758 | mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); | 788 | mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); |
759 | /* | 789 | /* |
760 | * Reset bus voltage to 3V if it got set to 1.8V earlier. | 790 | * Reset interface voltage to 3V if it's 1.8V now; |
791 | * only relevant on MMC-1, the others always use 1.8V. | ||
792 | * | ||
761 | * REVISIT: If we are able to detect cards after unplugging | 793 | * REVISIT: If we are able to detect cards after unplugging |
762 | * a 1.8V card, this code should not be needed. | 794 | * a 1.8V card, this code should not be needed. |
763 | */ | 795 | */ |
796 | if (host->id != OMAP_MMC1_DEVID) | ||
797 | break; | ||
764 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { | 798 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { |
765 | int vdd = fls(host->mmc->ocr_avail) - 1; | 799 | int vdd = fls(host->mmc->ocr_avail) - 1; |
766 | if (omap_mmc_switch_opcond(host, vdd) != 0) | 800 | if (omap_mmc_switch_opcond(host, vdd) != 0) |
@@ -784,7 +818,9 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
784 | } | 818 | } |
785 | 819 | ||
786 | if (host->id == OMAP_MMC1_DEVID) { | 820 | if (host->id == OMAP_MMC1_DEVID) { |
787 | /* Only MMC1 can operate at 3V/1.8V */ | 821 | /* Only MMC1 can interface at 3V without some flavor |
822 | * of external transceiver; but they all handle 1.8V. | ||
823 | */ | ||
788 | if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && | 824 | if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && |
789 | (ios->vdd == DUAL_VOLT_OCR_BIT)) { | 825 | (ios->vdd == DUAL_VOLT_OCR_BIT)) { |
790 | /* | 826 | /* |
@@ -1137,7 +1173,9 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state) | |||
1137 | " level suspend\n"); | 1173 | " level suspend\n"); |
1138 | } | 1174 | } |
1139 | 1175 | ||
1140 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { | 1176 | if (host->id == OMAP_MMC1_DEVID |
1177 | && !(OMAP_HSMMC_READ(host->base, HCTL) | ||
1178 | & SDVSDET)) { | ||
1141 | OMAP_HSMMC_WRITE(host->base, HCTL, | 1179 | OMAP_HSMMC_WRITE(host->base, HCTL, |
1142 | OMAP_HSMMC_READ(host->base, HCTL) | 1180 | OMAP_HSMMC_READ(host->base, HCTL) |
1143 | & SDVSCLR); | 1181 | & SDVSCLR); |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 35a98eec7414..f4a67c65d301 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host) | |||
329 | 329 | ||
330 | to_ptr = host->base + host->sdidata; | 330 | to_ptr = host->base + host->sdidata; |
331 | 331 | ||
332 | while ((fifo = fifo_free(host))) { | 332 | while ((fifo = fifo_free(host)) > 3) { |
333 | if (!host->pio_bytes) { | 333 | if (!host->pio_bytes) { |
334 | res = get_data_buffer(host, &host->pio_bytes, | 334 | res = get_data_buffer(host, &host->pio_bytes, |
335 | &host->pio_ptr); | 335 | &host->pio_ptr); |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index f07255cb17ee..8cff5f5e7f86 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -144,8 +144,7 @@ static int jmicron_probe(struct sdhci_pci_chip *chip) | |||
144 | SDHCI_QUIRK_32BIT_DMA_SIZE | | 144 | SDHCI_QUIRK_32BIT_DMA_SIZE | |
145 | SDHCI_QUIRK_32BIT_ADMA_SIZE | | 145 | SDHCI_QUIRK_32BIT_ADMA_SIZE | |
146 | SDHCI_QUIRK_RESET_AFTER_REQUEST | | 146 | SDHCI_QUIRK_RESET_AFTER_REQUEST | |
147 | SDHCI_QUIRK_BROKEN_SMALL_PIO | | 147 | SDHCI_QUIRK_BROKEN_SMALL_PIO; |
148 | SDHCI_QUIRK_FORCE_HIGHSPEED; | ||
149 | } | 148 | } |
150 | 149 | ||
151 | /* | 150 | /* |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6b2d1f99af67..f52f3053ed92 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1636,8 +1636,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1636 | mmc->f_max = host->max_clk; | 1636 | mmc->f_max = host->max_clk; |
1637 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; | 1637 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; |
1638 | 1638 | ||
1639 | if ((caps & SDHCI_CAN_DO_HISPD) || | 1639 | if (caps & SDHCI_CAN_DO_HISPD) |
1640 | (host->quirks & SDHCI_QUIRK_FORCE_HIGHSPEED)) | ||
1641 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; | 1640 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; |
1642 | 1641 | ||
1643 | mmc->ocr_avail = 0; | 1642 | mmc->ocr_avail = 0; |
@@ -1723,7 +1722,9 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1723 | #endif | 1722 | #endif |
1724 | 1723 | ||
1725 | #ifdef SDHCI_USE_LEDS_CLASS | 1724 | #ifdef SDHCI_USE_LEDS_CLASS |
1726 | host->led.name = mmc_hostname(mmc); | 1725 | snprintf(host->led_name, sizeof(host->led_name), |
1726 | "%s::", mmc_hostname(mmc)); | ||
1727 | host->led.name = host->led_name; | ||
1727 | host->led.brightness = LED_OFF; | 1728 | host->led.brightness = LED_OFF; |
1728 | host->led.default_trigger = mmc_hostname(mmc); | 1729 | host->led.default_trigger = mmc_hostname(mmc); |
1729 | host->led.brightness_set = sdhci_led_control; | 1730 | host->led.brightness_set = sdhci_led_control; |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 3efba2363941..ebb83657e27a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -208,8 +208,6 @@ struct sdhci_host { | |||
208 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) | 208 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) |
209 | /* Controller has an issue with buffer bits for small transfers */ | 209 | /* Controller has an issue with buffer bits for small transfers */ |
210 | #define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) | 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 | int irq; /* Device IRQ */ | 212 | int irq; /* Device IRQ */ |
215 | void __iomem * ioaddr; /* Mapped address */ | 213 | void __iomem * ioaddr; /* Mapped address */ |
@@ -222,6 +220,7 @@ struct sdhci_host { | |||
222 | 220 | ||
223 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 221 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
224 | struct led_classdev led; /* LED control */ | 222 | struct led_classdev led; /* LED control */ |
223 | char led_name[32]; | ||
225 | #endif | 224 | #endif |
226 | 225 | ||
227 | spinlock_t lock; /* Mutex */ | 226 | spinlock_t lock; /* Mutex */ |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index f4b7c79023ff..f3f686581a90 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -61,6 +61,8 @@ | |||
61 | /* global iommu list, set NULL for ignored DMAR units */ | 61 | /* global iommu list, set NULL for ignored DMAR units */ |
62 | static struct intel_iommu **g_iommus; | 62 | static struct intel_iommu **g_iommus; |
63 | 63 | ||
64 | static int rwbf_quirk; | ||
65 | |||
64 | /* | 66 | /* |
65 | * 0: Present | 67 | * 0: Present |
66 | * 1-11: Reserved | 68 | * 1-11: Reserved |
@@ -785,7 +787,7 @@ static void iommu_flush_write_buffer(struct intel_iommu *iommu) | |||
785 | u32 val; | 787 | u32 val; |
786 | unsigned long flag; | 788 | unsigned long flag; |
787 | 789 | ||
788 | if (!cap_rwbf(iommu->cap)) | 790 | if (!rwbf_quirk && !cap_rwbf(iommu->cap)) |
789 | return; | 791 | return; |
790 | val = iommu->gcmd | DMA_GCMD_WBF; | 792 | val = iommu->gcmd | DMA_GCMD_WBF; |
791 | 793 | ||
@@ -3137,3 +3139,15 @@ static struct iommu_ops intel_iommu_ops = { | |||
3137 | .unmap = intel_iommu_unmap_range, | 3139 | .unmap = intel_iommu_unmap_range, |
3138 | .iova_to_phys = intel_iommu_iova_to_phys, | 3140 | .iova_to_phys = intel_iommu_iova_to_phys, |
3139 | }; | 3141 | }; |
3142 | |||
3143 | static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | ||
3144 | { | ||
3145 | /* | ||
3146 | * Mobile 4 Series Chipset neglects to set RWBF capability, | ||
3147 | * but needs it: | ||
3148 | */ | ||
3149 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); | ||
3150 | rwbf_quirk = 1; | ||
3151 | } | ||
3152 | |||
3153 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 44f15ff70c1d..baba2eb5367d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -103,14 +103,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable) | |||
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 | static inline __attribute_const__ u32 msi_mask(unsigned x) | 106 | static inline __attribute_const__ u32 msi_mask(unsigned x) |
111 | { | 107 | { |
112 | static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff }; | 108 | /* Don't shift by >= width of type */ |
113 | return mask[x]; | 109 | if (x >= 5) |
110 | return 0xffffffff; | ||
111 | return (1 << (1 << x)) - 1; | ||
114 | } | 112 | } |
115 | 113 | ||
116 | static void msix_flush_writes(struct irq_desc *desc) | 114 | static void msix_flush_writes(struct irq_desc *desc) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e3efe6b19ee7..6d6120007af4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1540,16 +1540,21 @@ void pci_release_region(struct pci_dev *pdev, int bar) | |||
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 | * @pdev: PCI device whose resources are to be reserved | 1544 | * @pdev: PCI device whose resources are to be reserved |
1545 | * @bar: BAR to be reserved | 1545 | * @bar: BAR to be reserved |
1546 | * @res_name: Name to be associated with resource. | 1546 | * @res_name: Name to be associated with resource. |
1547 | * @exclusive: whether the region access is exclusive or not | ||
1547 | * | 1548 | * |
1548 | * Mark the PCI region associated with PCI device @pdev BR @bar as | 1549 | * Mark the PCI region associated with PCI device @pdev BR @bar as |
1549 | * being reserved by owner @res_name. Do not access any | 1550 | * being reserved by owner @res_name. Do not access any |
1550 | * address inside the PCI regions unless this call returns | 1551 | * address inside the PCI regions unless this call returns |
1551 | * successfully. | 1552 | * successfully. |
1552 | * | 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. | ||
1557 | * | ||
1553 | * Returns 0 on success, or %EBUSY on error. A warning | 1558 | * Returns 0 on success, or %EBUSY on error. A warning |
1554 | * message is also printed on failure. | 1559 | * message is also printed on failure. |
1555 | */ | 1560 | */ |
@@ -1588,12 +1593,12 @@ err_out: | |||
1588 | } | 1593 | } |
1589 | 1594 | ||
1590 | /** | 1595 | /** |
1591 | * pci_request_region - Reserved PCI I/O and memory resource | 1596 | * pci_request_region - Reserve PCI I/O and memory resource |
1592 | * @pdev: PCI device whose resources are to be reserved | 1597 | * @pdev: PCI device whose resources are to be reserved |
1593 | * @bar: BAR to be reserved | 1598 | * @bar: BAR to be reserved |
1594 | * @res_name: Name to be associated with resource. | 1599 | * @res_name: Name to be associated with resource |
1595 | * | 1600 | * |
1596 | * Mark the PCI region associated with PCI device @pdev BR @bar as | 1601 | * Mark the PCI region associated with PCI device @pdev BAR @bar as |
1597 | * being reserved by owner @res_name. Do not access any | 1602 | * being reserved by owner @res_name. Do not access any |
1598 | * address inside the PCI regions unless this call returns | 1603 | * address inside the PCI regions unless this call returns |
1599 | * successfully. | 1604 | * successfully. |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 26ddf78ac300..07c0aa5275e6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -16,21 +16,21 @@ extern int pci_mmap_fits(struct pci_dev *pdev, int resno, | |||
16 | #endif | 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 | 21 | * @is_manageable: returns 'true' if given device is power manageable by the |
22 | * platform firmware | 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 | 26 | * @choose_state: returns PCI power state of given device preferred by the |
27 | * platform; to be used during system-wide transitions from a | 27 | * platform; to be used during system-wide transitions from a |
28 | * sleeping state to the working state and vice versa | 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 | 30 | * @can_wakeup: returns 'true' if given device is capable of waking up the |
31 | * system from a sleeping state | 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 | * If given platform is generally capable of power managing PCI devices, all of | 35 | * If given platform is generally capable of power managing PCI devices, all of |
36 | * these callbacks are mandatory. | 36 | * these callbacks are mandatory. |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 29cbe47f219f..36864a935d68 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -55,6 +55,7 @@ void pci_disable_rom(struct pci_dev *pdev) | |||
55 | 55 | ||
56 | /** | 56 | /** |
57 | * pci_get_rom_size - obtain the actual size of the ROM image | 57 | * pci_get_rom_size - obtain the actual size of the ROM image |
58 | * @pdev: target PCI device | ||
58 | * @rom: kernel virtual pointer to image of ROM | 59 | * @rom: kernel virtual pointer to image of ROM |
59 | * @size: size of PCI window | 60 | * @size: size of PCI window |
60 | * return: size of actual ROM image | 61 | * return: size of actual ROM image |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 94363115a42a..b3866ad50227 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -62,6 +62,7 @@ config DELL_LAPTOP | |||
62 | depends on EXPERIMENTAL | 62 | depends on EXPERIMENTAL |
63 | depends on BACKLIGHT_CLASS_DEVICE | 63 | depends on BACKLIGHT_CLASS_DEVICE |
64 | depends on RFKILL | 64 | depends on RFKILL |
65 | depends on POWER_SUPPLY | ||
65 | default n | 66 | default n |
66 | ---help--- | 67 | ---help--- |
67 | This driver adds support for rfkill and backlight control to Dell | 68 | This driver adds support for rfkill and backlight control to Dell |
@@ -301,6 +302,7 @@ config INTEL_MENLOW | |||
301 | config EEEPC_LAPTOP | 302 | config EEEPC_LAPTOP |
302 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" | 303 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" |
303 | depends on ACPI | 304 | depends on ACPI |
305 | depends on INPUT | ||
304 | depends on EXPERIMENTAL | 306 | depends on EXPERIMENTAL |
305 | select BACKLIGHT_CLASS_DEVICE | 307 | select BACKLIGHT_CLASS_DEVICE |
306 | select HWMON | 308 | select HWMON |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 89362d733d62..8f58f7ff0dd7 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -877,6 +877,10 @@ static int atmel_startup(struct uart_port *port) | |||
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 | * Finally, enable the serial port | 885 | * Finally, enable the serial port |
882 | */ | 886 | */ |
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index 92187e28608a..ac79cbe4c2cf 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
@@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
84 | brd->pci_dev = pdev; | 84 | brd->pci_dev = pdev; |
85 | if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) | 85 | if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) |
86 | brd->maxports = 4; | 86 | brd->maxports = 4; |
87 | else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8) | ||
88 | brd->maxports = 8; | ||
87 | else | 89 | else |
88 | brd->maxports = 2; | 90 | brd->maxports = 2; |
89 | 91 | ||
@@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = { | |||
212 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, | 214 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, |
213 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, | 215 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, |
214 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, | 216 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, |
217 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 }, | ||
215 | { 0, } | 218 | { 0, } |
216 | }; | 219 | }; |
217 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); | 220 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); |
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c index 49698cabc30d..f5ed9721aabb 100644 --- a/drivers/spi/spi_gpio.c +++ b/drivers/spi/spi_gpio.c | |||
@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on) | |||
114 | 114 | ||
115 | static inline int getmiso(const struct spi_device *spi) | 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 | #undef pdata | 120 | #undef pdata |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index c54fc40458b1..a4301dc02d27 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -298,19 +298,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) | |||
298 | EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); | 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 | * usb_hcd_pci_resume - power management resume of a PCI-based HCD | 301 | * usb_hcd_pci_resume - power management resume of a PCI-based HCD |
315 | * @dev: USB Host Controller being resumed | 302 | * @dev: USB Host Controller being resumed |
316 | * | 303 | * |
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev) | |||
333 | } | 320 | } |
334 | #endif | 321 | #endif |
335 | 322 | ||
323 | pci_restore_state(dev); | ||
324 | |||
336 | hcd = pci_get_drvdata(dev); | 325 | hcd = pci_get_drvdata(dev); |
337 | if (hcd->state != HC_STATE_SUSPENDED) { | 326 | if (hcd->state != HC_STATE_SUSPENDED) { |
338 | dev_dbg(hcd->self.controller, | 327 | dev_dbg(hcd->self.controller, |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 5b94a56bec23..f750eb1ab595 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pci_dev *dev); | |||
257 | 257 | ||
258 | #ifdef CONFIG_PM | 258 | #ifdef CONFIG_PM |
259 | extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg); | 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 | extern int usb_hcd_pci_resume(struct pci_dev *dev); | 260 | extern int usb_hcd_pci_resume(struct pci_dev *dev); |
262 | #endif /* CONFIG_PM */ | 261 | #endif /* CONFIG_PM */ |
263 | 262 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index bb21fb0a4969..abb9a7706ec7 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver = { | |||
432 | 432 | ||
433 | #ifdef CONFIG_PM | 433 | #ifdef CONFIG_PM |
434 | .suspend = usb_hcd_pci_suspend, | 434 | .suspend = usb_hcd_pci_suspend, |
435 | .resume_early = usb_hcd_pci_resume_early, | ||
436 | .resume = usb_hcd_pci_resume, | 435 | .resume = usb_hcd_pci_resume, |
437 | #endif | 436 | #endif |
438 | .shutdown = usb_hcd_pci_shutdown, | 437 | .shutdown = usb_hcd_pci_shutdown, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 5d625c3fd423..f9961b4c0da3 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver = { | |||
487 | 487 | ||
488 | #ifdef CONFIG_PM | 488 | #ifdef CONFIG_PM |
489 | .suspend = usb_hcd_pci_suspend, | 489 | .suspend = usb_hcd_pci_suspend, |
490 | .resume_early = usb_hcd_pci_resume_early, | ||
491 | .resume = usb_hcd_pci_resume, | 490 | .resume = usb_hcd_pci_resume, |
492 | #endif | 491 | #endif |
493 | 492 | ||
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 944f7e0ca4df..cf5e4cf7ea42 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver = { | |||
942 | 942 | ||
943 | #ifdef CONFIG_PM | 943 | #ifdef CONFIG_PM |
944 | .suspend = usb_hcd_pci_suspend, | 944 | .suspend = usb_hcd_pci_suspend, |
945 | .resume_early = usb_hcd_pci_resume_early, | ||
946 | .resume = usb_hcd_pci_resume, | 945 | .resume = usb_hcd_pci_resume, |
947 | #endif /* PM */ | 946 | #endif /* PM */ |
948 | }; | 947 | }; |
diff --git a/drivers/usb/host/whci/asl.c b/drivers/usb/host/whci/asl.c index 2291c5f5af51..958751ccea43 100644 --- a/drivers/usb/host/whci/asl.c +++ b/drivers/usb/host/whci/asl.c | |||
@@ -227,13 +227,13 @@ void scan_async_work(struct work_struct *work) | |||
227 | * Now that the ASL is updated, complete the removal of any | 227 | * Now that the ASL is updated, complete the removal of any |
228 | * removed qsets. | 228 | * removed qsets. |
229 | */ | 229 | */ |
230 | spin_lock(&whc->lock); | 230 | spin_lock_irq(&whc->lock); |
231 | 231 | ||
232 | list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { | 232 | list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { |
233 | qset_remove_complete(whc, qset); | 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 | /** |
diff --git a/drivers/usb/host/whci/pzl.c b/drivers/usb/host/whci/pzl.c index 7dc85a0bee7c..df8b85f07092 100644 --- a/drivers/usb/host/whci/pzl.c +++ b/drivers/usb/host/whci/pzl.c | |||
@@ -255,13 +255,13 @@ void scan_periodic_work(struct work_struct *work) | |||
255 | * Now that the PZL is updated, complete the removal of any | 255 | * Now that the PZL is updated, complete the removal of any |
256 | * removed qsets. | 256 | * removed qsets. |
257 | */ | 257 | */ |
258 | spin_lock(&whc->lock); | 258 | spin_lock_irq(&whc->lock); |
259 | 259 | ||
260 | list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { | 260 | list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { |
261 | qset_remove_complete(whc, qset); | 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 | /** |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index bf0af660df8a..fb19803060cf 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1054,10 +1054,7 @@ config FB_RIVA_BACKLIGHT | |||
1054 | 1054 | ||
1055 | config FB_I810 | 1055 | config FB_I810 |
1056 | tristate "Intel 810/815 support (EXPERIMENTAL)" | 1056 | tristate "Intel 810/815 support (EXPERIMENTAL)" |
1057 | depends on EXPERIMENTAL && PCI && X86_32 | 1057 | depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL |
1058 | select AGP | ||
1059 | select AGP_INTEL | ||
1060 | select FB | ||
1061 | select FB_MODE_HELPERS | 1058 | select FB_MODE_HELPERS |
1062 | select FB_CFB_FILLRECT | 1059 | select FB_CFB_FILLRECT |
1063 | select FB_CFB_COPYAREA | 1060 | select FB_CFB_COPYAREA |
@@ -1120,10 +1117,7 @@ config FB_CARILLO_RANCH | |||
1120 | 1117 | ||
1121 | config FB_INTEL | 1118 | config FB_INTEL |
1122 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" | 1119 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" |
1123 | depends on EXPERIMENTAL && PCI && X86 | 1120 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL |
1124 | select FB | ||
1125 | select AGP | ||
1126 | select AGP_INTEL | ||
1127 | select FB_MODE_HELPERS | 1121 | select FB_MODE_HELPERS |
1128 | select FB_CFB_FILLRECT | 1122 | select FB_CFB_FILLRECT |
1129 | select FB_CFB_COPYAREA | 1123 | select FB_CFB_COPYAREA |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 09a3d5522b43..325c10ff6a2c 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -406,7 +406,7 @@ config ITCO_WDT | |||
406 | ---help--- | 406 | ---help--- |
407 | Hardware driver for the intel TCO timer based watchdog devices. | 407 | Hardware driver for the intel TCO timer based watchdog devices. |
408 | These drivers are included in the Intel 82801 I/O Controller | 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 | controller hub. | 410 | controller hub. |
411 | 411 | ||
412 | The TCO (Total Cost of Ownership) timer is a watchdog timer | 412 | The TCO (Total Cost of Ownership) timer is a watchdog timer |
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c index 2474ebca88f6..d8264ad0be41 100644 --- a/drivers/watchdog/iTCO_vendor_support.c +++ b/drivers/watchdog/iTCO_vendor_support.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * intel TCO vendor specific watchdog driver support | 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 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | /* Module and version information */ | 20 | /* Module and version information */ |
21 | #define DRV_NAME "iTCO_vendor_support" | 21 | #define DRV_NAME "iTCO_vendor_support" |
22 | #define DRV_VERSION "1.02" | 22 | #define DRV_VERSION "1.03" |
23 | #define PFX DRV_NAME ": " | 23 | #define PFX DRV_NAME ": " |
24 | 24 | ||
25 | /* Includes */ | 25 | /* Includes */ |
@@ -77,6 +77,26 @@ MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (n | |||
77 | * 20.6 seconds. | 77 | * 20.6 seconds. |
78 | */ | 78 | */ |
79 | 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 | } | ||
99 | |||
80 | static void supermicro_old_pre_keepalive(unsigned long acpibase) | 100 | static void supermicro_old_pre_keepalive(unsigned long acpibase) |
81 | { | 101 | { |
82 | /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ | 102 | /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ |
@@ -228,14 +248,18 @@ static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat) | |||
228 | void iTCO_vendor_pre_start(unsigned long acpibase, | 248 | void iTCO_vendor_pre_start(unsigned long acpibase, |
229 | unsigned int heartbeat) | 249 | unsigned int heartbeat) |
230 | { | 250 | { |
231 | if (vendorsupport == SUPERMICRO_NEW_BOARD) | 251 | if (vendorsupport == SUPERMICRO_OLD_BOARD) |
252 | supermicro_old_pre_start(acpibase); | ||
253 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
232 | supermicro_new_pre_start(heartbeat); | 254 | supermicro_new_pre_start(heartbeat); |
233 | } | 255 | } |
234 | EXPORT_SYMBOL(iTCO_vendor_pre_start); | 256 | EXPORT_SYMBOL(iTCO_vendor_pre_start); |
235 | 257 | ||
236 | void iTCO_vendor_pre_stop(unsigned long acpibase) | 258 | void iTCO_vendor_pre_stop(unsigned long acpibase) |
237 | { | 259 | { |
238 | if (vendorsupport == SUPERMICRO_NEW_BOARD) | 260 | if (vendorsupport == SUPERMICRO_OLD_BOARD) |
261 | supermicro_old_pre_stop(acpibase); | ||
262 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
239 | supermicro_new_pre_stop(); | 263 | supermicro_new_pre_stop(); |
240 | } | 264 | } |
241 | EXPORT_SYMBOL(iTCO_vendor_pre_stop); | 265 | EXPORT_SYMBOL(iTCO_vendor_pre_stop); |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 5b395a4ddfdf..352334947ea3 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -1,7 +1,7 @@ | |||
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 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Module and version information */ | 64 | /* Module and version information */ |
65 | #define DRV_NAME "iTCO_wdt" | 65 | #define DRV_NAME "iTCO_wdt" |
66 | #define DRV_VERSION "1.04" | 66 | #define DRV_VERSION "1.05" |
67 | #define PFX DRV_NAME ": " | 67 | #define PFX DRV_NAME ": " |
68 | 68 | ||
69 | /* Includes */ | 69 | /* Includes */ |
@@ -236,16 +236,16 @@ MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); | |||
236 | 236 | ||
237 | /* Address definitions for the TCO */ | 237 | /* Address definitions for the TCO */ |
238 | /* TCO base address */ | 238 | /* TCO base address */ |
239 | #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 | 239 | #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 |
240 | /* SMI Control and Enable Register */ | 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 | #define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ | 243 | #define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ |
244 | #define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ | 244 | #define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ |
245 | #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ | 245 | #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ |
246 | #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ | 246 | #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ |
247 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ | 247 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ |
248 | #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ | 248 | #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ |
249 | #define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ | 249 | #define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ |
250 | #define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ | 250 | #define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ |
251 | #define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ | 251 | #define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ |
@@ -338,7 +338,6 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(void) | |||
338 | static int iTCO_wdt_start(void) | 338 | static int iTCO_wdt_start(void) |
339 | { | 339 | { |
340 | unsigned int val; | 340 | unsigned int val; |
341 | unsigned long val32; | ||
342 | 341 | ||
343 | spin_lock(&iTCO_wdt_private.io_lock); | 342 | spin_lock(&iTCO_wdt_private.io_lock); |
344 | 343 | ||
@@ -351,11 +350,6 @@ static int iTCO_wdt_start(void) | |||
351 | return -EIO; | 350 | return -EIO; |
352 | } | 351 | } |
353 | 352 | ||
354 | /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ | ||
355 | val32 = inl(SMI_EN); | ||
356 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
357 | outl(val32, SMI_EN); | ||
358 | |||
359 | /* Force the timer to its reload value by writing to the TCO_RLD | 353 | /* Force the timer to its reload value by writing to the TCO_RLD |
360 | register */ | 354 | register */ |
361 | if (iTCO_wdt_private.iTCO_version == 2) | 355 | if (iTCO_wdt_private.iTCO_version == 2) |
@@ -378,7 +372,6 @@ static int iTCO_wdt_start(void) | |||
378 | static int iTCO_wdt_stop(void) | 372 | static int iTCO_wdt_stop(void) |
379 | { | 373 | { |
380 | unsigned int val; | 374 | unsigned int val; |
381 | unsigned long val32; | ||
382 | 375 | ||
383 | spin_lock(&iTCO_wdt_private.io_lock); | 376 | spin_lock(&iTCO_wdt_private.io_lock); |
384 | 377 | ||
@@ -390,11 +383,6 @@ static int iTCO_wdt_stop(void) | |||
390 | outw(val, TCO1_CNT); | 383 | outw(val, TCO1_CNT); |
391 | val = inw(TCO1_CNT); | 384 | val = inw(TCO1_CNT); |
392 | 385 | ||
393 | /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ | ||
394 | val32 = inl(SMI_EN); | ||
395 | val32 |= 0x00002000; | ||
396 | outl(val32, SMI_EN); | ||
397 | |||
398 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ | 386 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ |
399 | iTCO_wdt_set_NO_REBOOT_bit(); | 387 | iTCO_wdt_set_NO_REBOOT_bit(); |
400 | 388 | ||
@@ -649,6 +637,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
649 | int ret; | 637 | int ret; |
650 | u32 base_address; | 638 | u32 base_address; |
651 | unsigned long RCBA; | 639 | unsigned long RCBA; |
640 | unsigned long val32; | ||
652 | 641 | ||
653 | /* | 642 | /* |
654 | * Find the ACPI/PM base I/O address which is the base | 643 | * Find the ACPI/PM base I/O address which is the base |
@@ -695,6 +684,10 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
695 | ret = -EIO; | 684 | ret = -EIO; |
696 | goto out; | 685 | goto out; |
697 | } | 686 | } |
687 | /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ | ||
688 | val32 = inl(SMI_EN); | ||
689 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
690 | outl(val32, SMI_EN); | ||
698 | 691 | ||
699 | /* The TCO I/O registers reside in a 32-byte range pointed to | 692 | /* The TCO I/O registers reside in a 32-byte range pointed to |
700 | by the TCOBASE value */ | 693 | by the TCOBASE value */ |
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio) | |||
302 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | 302 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) |
303 | { | 303 | { |
304 | struct bio *bio = NULL; | 304 | struct bio *bio = NULL; |
305 | void *p; | ||
305 | 306 | ||
306 | if (bs) { | 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 | if (p) | 310 | if (p) |
310 | bio = p + bs->front_pad; | 311 | bio = p + bs->front_pad; |
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | |||
329 | } | 330 | } |
330 | if (unlikely(!bvl)) { | 331 | if (unlikely(!bvl)) { |
331 | if (bs) | 332 | if (bs) |
332 | mempool_free(bio, bs->bio_pool); | 333 | mempool_free(p, bs->bio_pool); |
333 | else | 334 | else |
334 | kfree(bio); | 335 | kfree(bio); |
335 | bio = NULL; | 336 | bio = NULL; |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 35443cc4b9a9..42491d728e99 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -38,19 +38,12 @@ static int balance_node_right(struct btrfs_trans_handle *trans, | |||
38 | static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 38 | static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
39 | struct btrfs_path *path, int level, int slot); | 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 | struct btrfs_path *btrfs_alloc_path(void) | 41 | struct btrfs_path *btrfs_alloc_path(void) |
47 | { | 42 | { |
48 | struct btrfs_path *path; | 43 | struct btrfs_path *path; |
49 | path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS); | 44 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); |
50 | if (path) { | 45 | if (path) |
51 | btrfs_init_path(path); | ||
52 | path->reada = 1; | 46 | path->reada = 1; |
53 | } | ||
54 | return path; | 47 | return path; |
55 | } | 48 | } |
56 | 49 | ||
@@ -69,14 +62,38 @@ noinline void btrfs_set_path_blocking(struct btrfs_path *p) | |||
69 | 62 | ||
70 | /* | 63 | /* |
71 | * reset all the locked nodes in the patch to spinning locks. | 64 | * reset all the locked nodes in the patch to spinning locks. |
65 | * | ||
66 | * held is used to keep lockdep happy, when lockdep is enabled | ||
67 | * we set held to a blocking lock before we go around and | ||
68 | * retake all the spinlocks in the path. You can safely use NULL | ||
69 | * for held | ||
72 | */ | 70 | */ |
73 | noinline void btrfs_clear_path_blocking(struct btrfs_path *p) | 71 | noinline void btrfs_clear_path_blocking(struct btrfs_path *p, |
72 | struct extent_buffer *held) | ||
74 | { | 73 | { |
75 | int i; | 74 | int i; |
76 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) { | 75 | |
76 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
77 | /* lockdep really cares that we take all of these spinlocks | ||
78 | * in the right order. If any of the locks in the path are not | ||
79 | * currently blocking, it is going to complain. So, make really | ||
80 | * really sure by forcing the path to blocking before we clear | ||
81 | * the path blocking. | ||
82 | */ | ||
83 | if (held) | ||
84 | btrfs_set_lock_blocking(held); | ||
85 | btrfs_set_path_blocking(p); | ||
86 | #endif | ||
87 | |||
88 | for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { | ||
77 | if (p->nodes[i] && p->locks[i]) | 89 | if (p->nodes[i] && p->locks[i]) |
78 | btrfs_clear_lock_blocking(p->nodes[i]); | 90 | btrfs_clear_lock_blocking(p->nodes[i]); |
79 | } | 91 | } |
92 | |||
93 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
94 | if (held) | ||
95 | btrfs_clear_lock_blocking(held); | ||
96 | #endif | ||
80 | } | 97 | } |
81 | 98 | ||
82 | /* this also releases the path */ | 99 | /* this also releases the path */ |
@@ -286,7 +303,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
286 | trans->transid, level, &ins); | 303 | trans->transid, level, &ins); |
287 | BUG_ON(ret); | 304 | BUG_ON(ret); |
288 | cow = btrfs_init_new_buffer(trans, root, prealloc_dest, | 305 | cow = btrfs_init_new_buffer(trans, root, prealloc_dest, |
289 | buf->len); | 306 | buf->len, level); |
290 | } else { | 307 | } else { |
291 | cow = btrfs_alloc_free_block(trans, root, buf->len, | 308 | cow = btrfs_alloc_free_block(trans, root, buf->len, |
292 | parent_start, | 309 | parent_start, |
@@ -917,9 +934,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
917 | 934 | ||
918 | /* promote the child to a root */ | 935 | /* promote the child to a root */ |
919 | child = read_node_slot(root, mid, 0); | 936 | child = read_node_slot(root, mid, 0); |
937 | BUG_ON(!child); | ||
920 | btrfs_tree_lock(child); | 938 | btrfs_tree_lock(child); |
921 | btrfs_set_lock_blocking(child); | 939 | btrfs_set_lock_blocking(child); |
922 | BUG_ON(!child); | ||
923 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); | 940 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); |
924 | BUG_ON(ret); | 941 | BUG_ON(ret); |
925 | 942 | ||
@@ -1566,7 +1583,7 @@ cow_done: | |||
1566 | if (!p->skip_locking) | 1583 | if (!p->skip_locking) |
1567 | p->locks[level] = 1; | 1584 | p->locks[level] = 1; |
1568 | 1585 | ||
1569 | btrfs_clear_path_blocking(p); | 1586 | btrfs_clear_path_blocking(p, NULL); |
1570 | 1587 | ||
1571 | /* | 1588 | /* |
1572 | * we have a lock on b and as long as we aren't changing | 1589 | * we have a lock on b and as long as we aren't changing |
@@ -1605,7 +1622,7 @@ cow_done: | |||
1605 | 1622 | ||
1606 | btrfs_set_path_blocking(p); | 1623 | btrfs_set_path_blocking(p); |
1607 | sret = split_node(trans, root, p, level); | 1624 | sret = split_node(trans, root, p, level); |
1608 | btrfs_clear_path_blocking(p); | 1625 | btrfs_clear_path_blocking(p, NULL); |
1609 | 1626 | ||
1610 | BUG_ON(sret > 0); | 1627 | BUG_ON(sret > 0); |
1611 | if (sret) { | 1628 | if (sret) { |
@@ -1625,7 +1642,7 @@ cow_done: | |||
1625 | 1642 | ||
1626 | btrfs_set_path_blocking(p); | 1643 | btrfs_set_path_blocking(p); |
1627 | sret = balance_level(trans, root, p, level); | 1644 | sret = balance_level(trans, root, p, level); |
1628 | btrfs_clear_path_blocking(p); | 1645 | btrfs_clear_path_blocking(p, NULL); |
1629 | 1646 | ||
1630 | if (sret) { | 1647 | if (sret) { |
1631 | ret = sret; | 1648 | ret = sret; |
@@ -1688,13 +1705,13 @@ cow_done: | |||
1688 | if (!p->skip_locking) { | 1705 | if (!p->skip_locking) { |
1689 | int lret; | 1706 | int lret; |
1690 | 1707 | ||
1691 | btrfs_clear_path_blocking(p); | 1708 | btrfs_clear_path_blocking(p, NULL); |
1692 | lret = btrfs_try_spin_lock(b); | 1709 | lret = btrfs_try_spin_lock(b); |
1693 | 1710 | ||
1694 | if (!lret) { | 1711 | if (!lret) { |
1695 | btrfs_set_path_blocking(p); | 1712 | btrfs_set_path_blocking(p); |
1696 | btrfs_tree_lock(b); | 1713 | btrfs_tree_lock(b); |
1697 | btrfs_clear_path_blocking(p); | 1714 | btrfs_clear_path_blocking(p, b); |
1698 | } | 1715 | } |
1699 | } | 1716 | } |
1700 | } else { | 1717 | } else { |
@@ -1706,7 +1723,7 @@ cow_done: | |||
1706 | btrfs_set_path_blocking(p); | 1723 | btrfs_set_path_blocking(p); |
1707 | sret = split_leaf(trans, root, key, | 1724 | sret = split_leaf(trans, root, key, |
1708 | p, ins_len, ret == 0); | 1725 | p, ins_len, ret == 0); |
1709 | btrfs_clear_path_blocking(p); | 1726 | btrfs_clear_path_blocking(p, NULL); |
1710 | 1727 | ||
1711 | BUG_ON(sret > 0); | 1728 | BUG_ON(sret > 0); |
1712 | if (sret) { | 1729 | if (sret) { |
@@ -3926,7 +3943,6 @@ find_next_key: | |||
3926 | btrfs_release_path(root, path); | 3943 | btrfs_release_path(root, path); |
3927 | goto again; | 3944 | goto again; |
3928 | } else { | 3945 | } else { |
3929 | btrfs_clear_path_blocking(path); | ||
3930 | goto out; | 3946 | goto out; |
3931 | } | 3947 | } |
3932 | } | 3948 | } |
@@ -3946,7 +3962,7 @@ find_next_key: | |||
3946 | path->locks[level - 1] = 1; | 3962 | path->locks[level - 1] = 1; |
3947 | path->nodes[level - 1] = cur; | 3963 | path->nodes[level - 1] = cur; |
3948 | unlock_up(path, level, 1); | 3964 | unlock_up(path, level, 1); |
3949 | btrfs_clear_path_blocking(path); | 3965 | btrfs_clear_path_blocking(path, NULL); |
3950 | } | 3966 | } |
3951 | out: | 3967 | out: |
3952 | if (ret == 0) | 3968 | if (ret == 0) |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 531db112c8bd..766b31ae3186 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -43,11 +43,7 @@ struct btrfs_ordered_sum; | |||
43 | 43 | ||
44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) | 44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) |
45 | 45 | ||
46 | #ifdef CONFIG_LOCKDEP | 46 | #define BTRFS_MAX_LEVEL 8 |
47 | # define BTRFS_MAX_LEVEL 7 | ||
48 | #else | ||
49 | # define BTRFS_MAX_LEVEL 8 | ||
50 | #endif | ||
51 | 47 | ||
52 | /* holds pointers to all of the tree roots */ | 48 | /* holds pointers to all of the tree roots */ |
53 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL | 49 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL |
@@ -1715,7 +1711,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
1715 | u64 empty_size); | 1711 | u64 empty_size); |
1716 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 1712 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
1717 | struct btrfs_root *root, | 1713 | struct btrfs_root *root, |
1718 | u64 bytenr, u32 blocksize); | 1714 | u64 bytenr, u32 blocksize, |
1715 | int level); | ||
1719 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | 1716 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, |
1720 | struct btrfs_root *root, | 1717 | struct btrfs_root *root, |
1721 | u64 num_bytes, u64 parent, u64 min_bytes, | 1718 | u64 num_bytes, u64 parent, u64 min_bytes, |
@@ -1834,9 +1831,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
1834 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); | 1831 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); |
1835 | struct btrfs_path *btrfs_alloc_path(void); | 1832 | struct btrfs_path *btrfs_alloc_path(void); |
1836 | void btrfs_free_path(struct btrfs_path *p); | 1833 | void btrfs_free_path(struct btrfs_path *p); |
1837 | void btrfs_init_path(struct btrfs_path *p); | ||
1838 | void btrfs_set_path_blocking(struct btrfs_path *p); | 1834 | void btrfs_set_path_blocking(struct btrfs_path *p); |
1839 | void btrfs_clear_path_blocking(struct btrfs_path *p); | ||
1840 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); | 1835 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); |
1841 | 1836 | ||
1842 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1837 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5aebddd71193..adda739a0215 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -75,6 +75,40 @@ struct async_submit_bio { | |||
75 | struct btrfs_work work; | 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 | * extents on the btree inode are pretty simple, there's one extent | 113 | * extents on the btree inode are pretty simple, there's one extent |
80 | * that covers the entire device | 114 | * that covers the entire device |
@@ -347,6 +381,15 @@ static int check_tree_block_fsid(struct btrfs_root *root, | |||
347 | return ret; | 381 | return ret; |
348 | } | 382 | } |
349 | 383 | ||
384 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
385 | void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level) | ||
386 | { | ||
387 | lockdep_set_class_and_name(&eb->lock, | ||
388 | &btrfs_eb_class[level], | ||
389 | btrfs_eb_name[level]); | ||
390 | } | ||
391 | #endif | ||
392 | |||
350 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | 393 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, |
351 | struct extent_state *state) | 394 | struct extent_state *state) |
352 | { | 395 | { |
@@ -392,6 +435,8 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | |||
392 | } | 435 | } |
393 | found_level = btrfs_header_level(eb); | 436 | found_level = btrfs_header_level(eb); |
394 | 437 | ||
438 | btrfs_set_buffer_lockdep_class(eb, found_level); | ||
439 | |||
395 | ret = csum_tree_block(root, eb, 1); | 440 | ret = csum_tree_block(root, eb, 1); |
396 | if (ret) | 441 | if (ret) |
397 | ret = -EIO; | 442 | ret = -EIO; |
@@ -1777,7 +1822,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1777 | ret = find_and_setup_root(tree_root, fs_info, | 1822 | ret = find_and_setup_root(tree_root, fs_info, |
1778 | BTRFS_DEV_TREE_OBJECTID, dev_root); | 1823 | BTRFS_DEV_TREE_OBJECTID, dev_root); |
1779 | dev_root->track_dirty = 1; | 1824 | dev_root->track_dirty = 1; |
1780 | |||
1781 | if (ret) | 1825 | if (ret) |
1782 | goto fail_extent_root; | 1826 | goto fail_extent_root; |
1783 | 1827 | ||
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 494a56eb2986..95029db227be 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -101,4 +101,14 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | |||
101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | 101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, |
102 | struct btrfs_root *root); | 102 | struct btrfs_root *root); |
103 | int btree_lock_page_hook(struct page *page); | 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 | #endif | 114 | #endif |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7527523c2d2d..0a5d796c9f7e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1323,8 +1323,25 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
1323 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, | 1323 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, |
1324 | struct btrfs_root *root) | 1324 | struct btrfs_root *root) |
1325 | { | 1325 | { |
1326 | finish_current_insert(trans, root->fs_info->extent_root, 1); | 1326 | u64 start; |
1327 | del_pending_extents(trans, root->fs_info->extent_root, 1); | 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 | return 0; | 1345 | return 0; |
1329 | } | 1346 | } |
1330 | 1347 | ||
@@ -2211,13 +2228,12 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, | |||
2211 | u64 end; | 2228 | u64 end; |
2212 | u64 priv; | 2229 | u64 priv; |
2213 | u64 search = 0; | 2230 | u64 search = 0; |
2214 | u64 skipped = 0; | ||
2215 | struct btrfs_fs_info *info = extent_root->fs_info; | 2231 | struct btrfs_fs_info *info = extent_root->fs_info; |
2216 | struct btrfs_path *path; | 2232 | struct btrfs_path *path; |
2217 | struct pending_extent_op *extent_op, *tmp; | 2233 | struct pending_extent_op *extent_op, *tmp; |
2218 | struct list_head insert_list, update_list; | 2234 | struct list_head insert_list, update_list; |
2219 | int ret; | 2235 | int ret; |
2220 | int num_inserts = 0, max_inserts; | 2236 | int num_inserts = 0, max_inserts, restart = 0; |
2221 | 2237 | ||
2222 | path = btrfs_alloc_path(); | 2238 | path = btrfs_alloc_path(); |
2223 | INIT_LIST_HEAD(&insert_list); | 2239 | INIT_LIST_HEAD(&insert_list); |
@@ -2233,19 +2249,19 @@ again: | |||
2233 | ret = find_first_extent_bit(&info->extent_ins, search, &start, | 2249 | ret = find_first_extent_bit(&info->extent_ins, search, &start, |
2234 | &end, EXTENT_WRITEBACK); | 2250 | &end, EXTENT_WRITEBACK); |
2235 | if (ret) { | 2251 | if (ret) { |
2236 | if (skipped && all && !num_inserts && | 2252 | if (restart && !num_inserts && |
2237 | list_empty(&update_list)) { | 2253 | list_empty(&update_list)) { |
2238 | skipped = 0; | 2254 | restart = 0; |
2239 | search = 0; | 2255 | search = 0; |
2240 | continue; | 2256 | continue; |
2241 | } | 2257 | } |
2242 | mutex_unlock(&info->extent_ins_mutex); | ||
2243 | break; | 2258 | break; |
2244 | } | 2259 | } |
2245 | 2260 | ||
2246 | ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); | 2261 | ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); |
2247 | if (!ret) { | 2262 | if (!ret) { |
2248 | skipped = 1; | 2263 | if (all) |
2264 | restart = 1; | ||
2249 | search = end + 1; | 2265 | search = end + 1; |
2250 | if (need_resched()) { | 2266 | if (need_resched()) { |
2251 | mutex_unlock(&info->extent_ins_mutex); | 2267 | mutex_unlock(&info->extent_ins_mutex); |
@@ -2264,7 +2280,7 @@ again: | |||
2264 | list_add_tail(&extent_op->list, &insert_list); | 2280 | list_add_tail(&extent_op->list, &insert_list); |
2265 | search = end + 1; | 2281 | search = end + 1; |
2266 | if (num_inserts == max_inserts) { | 2282 | if (num_inserts == max_inserts) { |
2267 | mutex_unlock(&info->extent_ins_mutex); | 2283 | restart = 1; |
2268 | break; | 2284 | break; |
2269 | } | 2285 | } |
2270 | } else if (extent_op->type == PENDING_BACKREF_UPDATE) { | 2286 | } else if (extent_op->type == PENDING_BACKREF_UPDATE) { |
@@ -2280,7 +2296,6 @@ again: | |||
2280 | * somebody marked this thing for deletion then just unlock it and be | 2296 | * somebody marked this thing for deletion then just unlock it and be |
2281 | * done, the free_extents will handle it | 2297 | * done, the free_extents will handle it |
2282 | */ | 2298 | */ |
2283 | mutex_lock(&info->extent_ins_mutex); | ||
2284 | list_for_each_entry_safe(extent_op, tmp, &update_list, list) { | 2299 | list_for_each_entry_safe(extent_op, tmp, &update_list, list) { |
2285 | clear_extent_bits(&info->extent_ins, extent_op->bytenr, | 2300 | clear_extent_bits(&info->extent_ins, extent_op->bytenr, |
2286 | extent_op->bytenr + extent_op->num_bytes - 1, | 2301 | extent_op->bytenr + extent_op->num_bytes - 1, |
@@ -2302,6 +2317,10 @@ again: | |||
2302 | if (!list_empty(&update_list)) { | 2317 | if (!list_empty(&update_list)) { |
2303 | ret = update_backrefs(trans, extent_root, path, &update_list); | 2318 | ret = update_backrefs(trans, extent_root, path, &update_list); |
2304 | BUG_ON(ret); | 2319 | BUG_ON(ret); |
2320 | |||
2321 | /* we may have COW'ed new blocks, so lets start over */ | ||
2322 | if (all) | ||
2323 | restart = 1; | ||
2305 | } | 2324 | } |
2306 | 2325 | ||
2307 | /* | 2326 | /* |
@@ -2309,9 +2328,9 @@ again: | |||
2309 | * need to make sure everything is cleaned then reset everything and | 2328 | * need to make sure everything is cleaned then reset everything and |
2310 | * go back to the beginning | 2329 | * go back to the beginning |
2311 | */ | 2330 | */ |
2312 | if (!num_inserts && all && skipped) { | 2331 | if (!num_inserts && restart) { |
2313 | search = 0; | 2332 | search = 0; |
2314 | skipped = 0; | 2333 | restart = 0; |
2315 | INIT_LIST_HEAD(&update_list); | 2334 | INIT_LIST_HEAD(&update_list); |
2316 | INIT_LIST_HEAD(&insert_list); | 2335 | INIT_LIST_HEAD(&insert_list); |
2317 | goto again; | 2336 | goto again; |
@@ -2368,27 +2387,19 @@ again: | |||
2368 | BUG_ON(ret); | 2387 | BUG_ON(ret); |
2369 | 2388 | ||
2370 | /* | 2389 | /* |
2371 | * if we broke out of the loop in order to insert stuff because we hit | 2390 | * if restart is set for whatever reason we need to go back and start |
2372 | * the maximum number of inserts at a time we can handle, then loop | 2391 | * searching through the pending list again. |
2373 | * back and pick up where we left off | 2392 | * |
2393 | * We just inserted some extents, which could have resulted in new | ||
2394 | * blocks being allocated, which would result in new blocks needing | ||
2395 | * updates, so if all is set we _must_ restart to get the updated | ||
2396 | * blocks. | ||
2374 | */ | 2397 | */ |
2375 | if (num_inserts == max_inserts) { | 2398 | if (restart || all) { |
2376 | INIT_LIST_HEAD(&insert_list); | ||
2377 | INIT_LIST_HEAD(&update_list); | ||
2378 | num_inserts = 0; | ||
2379 | goto again; | ||
2380 | } | ||
2381 | |||
2382 | /* | ||
2383 | * again, if we need to make absolutely sure there are no more pending | ||
2384 | * extent operations left and we know that we skipped some, go back to | ||
2385 | * the beginning and do it all again | ||
2386 | */ | ||
2387 | if (all && skipped) { | ||
2388 | INIT_LIST_HEAD(&insert_list); | 2399 | INIT_LIST_HEAD(&insert_list); |
2389 | INIT_LIST_HEAD(&update_list); | 2400 | INIT_LIST_HEAD(&update_list); |
2390 | search = 0; | 2401 | search = 0; |
2391 | skipped = 0; | 2402 | restart = 0; |
2392 | num_inserts = 0; | 2403 | num_inserts = 0; |
2393 | goto again; | 2404 | goto again; |
2394 | } | 2405 | } |
@@ -2709,6 +2720,8 @@ again: | |||
2709 | goto again; | 2720 | goto again; |
2710 | } | 2721 | } |
2711 | 2722 | ||
2723 | if (!err) | ||
2724 | finish_current_insert(trans, extent_root, 0); | ||
2712 | return err; | 2725 | return err; |
2713 | } | 2726 | } |
2714 | 2727 | ||
@@ -2859,7 +2872,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
2859 | 2872 | ||
2860 | if (data & BTRFS_BLOCK_GROUP_METADATA) { | 2873 | if (data & BTRFS_BLOCK_GROUP_METADATA) { |
2861 | last_ptr = &root->fs_info->last_alloc; | 2874 | last_ptr = &root->fs_info->last_alloc; |
2862 | empty_cluster = 64 * 1024; | 2875 | if (!btrfs_test_opt(root, SSD)) |
2876 | empty_cluster = 64 * 1024; | ||
2863 | } | 2877 | } |
2864 | 2878 | ||
2865 | if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) | 2879 | if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) |
@@ -3402,7 +3416,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | |||
3402 | 3416 | ||
3403 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 3417 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
3404 | struct btrfs_root *root, | 3418 | struct btrfs_root *root, |
3405 | u64 bytenr, u32 blocksize) | 3419 | u64 bytenr, u32 blocksize, |
3420 | int level) | ||
3406 | { | 3421 | { |
3407 | struct extent_buffer *buf; | 3422 | struct extent_buffer *buf; |
3408 | 3423 | ||
@@ -3410,6 +3425,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | |||
3410 | if (!buf) | 3425 | if (!buf) |
3411 | return ERR_PTR(-ENOMEM); | 3426 | return ERR_PTR(-ENOMEM); |
3412 | btrfs_set_header_generation(buf, trans->transid); | 3427 | btrfs_set_header_generation(buf, trans->transid); |
3428 | btrfs_set_buffer_lockdep_class(buf, level); | ||
3413 | btrfs_tree_lock(buf); | 3429 | btrfs_tree_lock(buf); |
3414 | clean_tree_block(trans, root, buf); | 3430 | clean_tree_block(trans, root, buf); |
3415 | 3431 | ||
@@ -3453,7 +3469,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
3453 | return ERR_PTR(ret); | 3469 | return ERR_PTR(ret); |
3454 | } | 3470 | } |
3455 | 3471 | ||
3456 | buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize); | 3472 | buf = btrfs_init_new_buffer(trans, root, ins.objectid, |
3473 | blocksize, level); | ||
3457 | return buf; | 3474 | return buf; |
3458 | } | 3475 | } |
3459 | 3476 | ||
@@ -5641,7 +5658,9 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
5641 | prev_block = block_start; | 5658 | prev_block = block_start; |
5642 | } | 5659 | } |
5643 | 5660 | ||
5661 | mutex_lock(&extent_root->fs_info->trans_mutex); | ||
5644 | btrfs_record_root_in_trans(found_root); | 5662 | btrfs_record_root_in_trans(found_root); |
5663 | mutex_unlock(&extent_root->fs_info->trans_mutex); | ||
5645 | if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { | 5664 | if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { |
5646 | /* | 5665 | /* |
5647 | * try to update data extent references while | 5666 | * try to update data extent references while |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 37d43b516b79..ebe6b29e6069 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -415,8 +415,6 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig, | |||
415 | 415 | ||
416 | node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); | 416 | node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); |
417 | if (node) { | 417 | if (node) { |
418 | struct extent_state *found; | ||
419 | found = rb_entry(node, struct extent_state, rb_node); | ||
420 | free_extent_state(prealloc); | 418 | free_extent_state(prealloc); |
421 | return -EEXIST; | 419 | return -EEXIST; |
422 | } | 420 | } |
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 2aa79873eb46..cc7334d833c9 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c | |||
@@ -84,7 +84,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, | |||
84 | search_key.type = 0; | 84 | search_key.type = 0; |
85 | search_key.offset = 0; | 85 | search_key.offset = 0; |
86 | 86 | ||
87 | btrfs_init_path(path); | ||
88 | start_found = 0; | 87 | start_found = 0; |
89 | ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); | 88 | ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); |
90 | if (ret < 0) | 89 | if (ret < 0) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8f0706210a47..3cee77ae03c8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2531,8 +2531,6 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | |||
2531 | key.offset = (u64)-1; | 2531 | key.offset = (u64)-1; |
2532 | key.type = (u8)-1; | 2532 | key.type = (u8)-1; |
2533 | 2533 | ||
2534 | btrfs_init_path(path); | ||
2535 | |||
2536 | search_again: | 2534 | search_again: |
2537 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); | 2535 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); |
2538 | if (ret < 0) | 2536 | if (ret < 0) |
@@ -4263,7 +4261,7 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags) | |||
4263 | { | 4261 | { |
4264 | if (PageWriteback(page) || PageDirty(page)) | 4262 | if (PageWriteback(page) || PageDirty(page)) |
4265 | return 0; | 4263 | return 0; |
4266 | return __btrfs_releasepage(page, gfp_flags); | 4264 | return __btrfs_releasepage(page, gfp_flags & GFP_NOFS); |
4267 | } | 4265 | } |
4268 | 4266 | ||
4269 | static void btrfs_invalidatepage(struct page *page, unsigned long offset) | 4267 | static void btrfs_invalidatepage(struct page *page, unsigned long offset) |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 9ebe9385129b..85506c4a3af7 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -25,21 +25,10 @@ | |||
25 | #include "extent_io.h" | 25 | #include "extent_io.h" |
26 | #include "locking.h" | 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 | static inline void spin_nested(struct extent_buffer *eb) | 28 | static inline void spin_nested(struct extent_buffer *eb) |
39 | { | 29 | { |
40 | spin_lock(&eb->lock); | 30 | spin_lock(&eb->lock); |
41 | } | 31 | } |
42 | #endif | ||
43 | 32 | ||
44 | /* | 33 | /* |
45 | * Setting a lock to blocking will drop the spinlock and set the | 34 | * Setting a lock to blocking will drop the spinlock and set the |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f3fd7e2cbc38..19a4daf03ccb 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -379,7 +379,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
379 | btrfs_start_delalloc_inodes(root); | 379 | btrfs_start_delalloc_inodes(root); |
380 | btrfs_wait_ordered_extents(root, 0); | 380 | btrfs_wait_ordered_extents(root, 0); |
381 | 381 | ||
382 | btrfs_clean_old_snapshots(root); | ||
383 | trans = btrfs_start_transaction(root, 1); | 382 | trans = btrfs_start_transaction(root, 1); |
384 | ret = btrfs_commit_transaction(trans, root); | 383 | ret = btrfs_commit_transaction(trans, root); |
385 | sb->s_dirt = 0; | 384 | sb->s_dirt = 0; |
@@ -511,6 +510,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
511 | struct btrfs_root *root = btrfs_sb(sb); | 510 | struct btrfs_root *root = btrfs_sb(sb); |
512 | int ret; | 511 | int ret; |
513 | 512 | ||
513 | ret = btrfs_parse_options(root, data); | ||
514 | if (ret) | ||
515 | return -EINVAL; | ||
516 | |||
514 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 517 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) |
515 | return 0; | 518 | return 0; |
516 | 519 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 919172de5c9a..4112d53d4f4d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -688,7 +688,9 @@ static noinline int drop_dirty_roots(struct btrfs_root *tree_root, | |||
688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); | 688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); |
689 | bytes_used = btrfs_root_used(&root->root_item); | 689 | bytes_used = btrfs_root_used(&root->root_item); |
690 | if (num_bytes) { | 690 | if (num_bytes) { |
691 | mutex_lock(&root->fs_info->trans_mutex); | ||
691 | btrfs_record_root_in_trans(root); | 692 | btrfs_record_root_in_trans(root); |
693 | mutex_unlock(&root->fs_info->trans_mutex); | ||
692 | btrfs_set_root_used(&root->root_item, | 694 | btrfs_set_root_used(&root->root_item, |
693 | bytes_used - num_bytes); | 695 | bytes_used - num_bytes); |
694 | } | 696 | } |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 20794290256b..9c462fbd60fa 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2832,7 +2832,9 @@ again: | |||
2832 | BUG_ON(!wc.replay_dest); | 2832 | BUG_ON(!wc.replay_dest); |
2833 | 2833 | ||
2834 | wc.replay_dest->log_root = log; | 2834 | wc.replay_dest->log_root = log; |
2835 | mutex_lock(&fs_info->trans_mutex); | ||
2835 | btrfs_record_root_in_trans(wc.replay_dest); | 2836 | btrfs_record_root_in_trans(wc.replay_dest); |
2837 | mutex_unlock(&fs_info->trans_mutex); | ||
2836 | ret = walk_log_tree(trans, log, &wc); | 2838 | ret = walk_log_tree(trans, log, &wc); |
2837 | BUG_ON(ret); | 2839 | BUG_ON(ret); |
2838 | 2840 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index bcd14ebccae1..1316139bf9e8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2894,10 +2894,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
2894 | free_extent_map(em); | 2894 | free_extent_map(em); |
2895 | } | 2895 | } |
2896 | 2896 | ||
2897 | map = kzalloc(sizeof(*map), GFP_NOFS); | ||
2898 | if (!map) | ||
2899 | return -ENOMEM; | ||
2900 | |||
2901 | em = alloc_extent_map(GFP_NOFS); | 2897 | em = alloc_extent_map(GFP_NOFS); |
2902 | if (!em) | 2898 | if (!em) |
2903 | return -ENOMEM; | 2899 | return -ENOMEM; |
@@ -3106,6 +3102,8 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
3106 | if (!sb) | 3102 | if (!sb) |
3107 | return -ENOMEM; | 3103 | return -ENOMEM; |
3108 | btrfs_set_buffer_uptodate(sb); | 3104 | btrfs_set_buffer_uptodate(sb); |
3105 | btrfs_set_buffer_lockdep_class(sb, 0); | ||
3106 | |||
3109 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); | 3107 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); |
3110 | array_size = btrfs_super_sys_array_size(super_copy); | 3108 | array_size = btrfs_super_sys_array_size(super_copy); |
3111 | 3109 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 665d446b25bc..9f697419ed8e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -777,6 +777,7 @@ static int __set_page_dirty(struct page *page, | |||
777 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 777 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
778 | __inc_bdi_stat(mapping->backing_dev_info, | 778 | __inc_bdi_stat(mapping->backing_dev_info, |
779 | BDI_RECLAIMABLE); | 779 | BDI_RECLAIMABLE); |
780 | task_dirty_inc(current); | ||
780 | task_io_account_write(PAGE_CACHE_SIZE); | 781 | task_io_account_write(PAGE_CACHE_SIZE); |
781 | } | 782 | } |
782 | radix_tree_tag_set(&mapping->page_tree, | 783 | radix_tree_tag_set(&mapping->page_tree, |
@@ -3108,7 +3109,7 @@ int sync_dirty_buffer(struct buffer_head *bh) | |||
3108 | if (test_clear_buffer_dirty(bh)) { | 3109 | if (test_clear_buffer_dirty(bh)) { |
3109 | get_bh(bh); | 3110 | get_bh(bh); |
3110 | bh->b_end_io = end_buffer_write_sync; | 3111 | bh->b_end_io = end_buffer_write_sync; |
3111 | ret = submit_bh(WRITE_SYNC, bh); | 3112 | ret = submit_bh(WRITE, bh); |
3112 | wait_on_buffer(bh); | 3113 | wait_on_buffer(bh); |
3113 | if (buffer_eopnotsupp(bh)) { | 3114 | if (buffer_eopnotsupp(bh)) { |
3114 | clear_buffer_eopnotsupp(bh); | 3115 | clear_buffer_eopnotsupp(bh); |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9c6d815dd191..39bd4d38e889 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1938,6 +1938,8 @@ ULONG_IOCTL(SET_BITMAP_FILE) | |||
1938 | /* Big K */ | 1938 | /* Big K */ |
1939 | COMPATIBLE_IOCTL(PIO_FONT) | 1939 | COMPATIBLE_IOCTL(PIO_FONT) |
1940 | COMPATIBLE_IOCTL(GIO_FONT) | 1940 | COMPATIBLE_IOCTL(GIO_FONT) |
1941 | COMPATIBLE_IOCTL(PIO_CMAP) | ||
1942 | COMPATIBLE_IOCTL(GIO_CMAP) | ||
1941 | ULONG_IOCTL(KDSIGACCEPT) | 1943 | ULONG_IOCTL(KDSIGACCEPT) |
1942 | COMPATIBLE_IOCTL(KDGETKEYCODE) | 1944 | COMPATIBLE_IOCTL(KDGETKEYCODE) |
1943 | COMPATIBLE_IOCTL(KDSETKEYCODE) | 1945 | COMPATIBLE_IOCTL(KDSETKEYCODE) |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index aafc9eba1c25..b0c87dce66a3 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -868,7 +868,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | |||
868 | { | 868 | { |
869 | unsigned len = le16_to_cpu(dlen); | 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 | return 1 << 16; | 872 | return 1 << 16; |
873 | return len; | 873 | return len; |
874 | } | 874 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 03ba20be1329..cbd2ca99d113 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -47,8 +47,10 @@ | |||
47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, | 47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, |
48 | loff_t new_size) | 48 | loff_t new_size) |
49 | { | 49 | { |
50 | return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode, | 50 | return jbd2_journal_begin_ordered_truncate( |
51 | new_size); | 51 | EXT4_SB(inode->i_sb)->s_journal, |
52 | &EXT4_I(inode)->jinode, | ||
53 | new_size); | ||
52 | } | 54 | } |
53 | 55 | ||
54 | static void ext4_invalidatepage(struct page *page, unsigned long offset); | 56 | static void ext4_invalidatepage(struct page *page, unsigned long offset); |
@@ -2437,6 +2439,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2437 | int no_nrwrite_index_update; | 2439 | int no_nrwrite_index_update; |
2438 | int pages_written = 0; | 2440 | int pages_written = 0; |
2439 | long pages_skipped; | 2441 | long pages_skipped; |
2442 | int range_cyclic, cycled = 1, io_done = 0; | ||
2440 | int needed_blocks, ret = 0, nr_to_writebump = 0; | 2443 | int needed_blocks, ret = 0, nr_to_writebump = 0; |
2441 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); | 2444 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); |
2442 | 2445 | ||
@@ -2488,9 +2491,15 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2488 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) | 2491 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
2489 | range_whole = 1; | 2492 | range_whole = 1; |
2490 | 2493 | ||
2491 | if (wbc->range_cyclic) | 2494 | range_cyclic = wbc->range_cyclic; |
2495 | if (wbc->range_cyclic) { | ||
2492 | index = mapping->writeback_index; | 2496 | index = mapping->writeback_index; |
2493 | else | 2497 | if (index) |
2498 | cycled = 0; | ||
2499 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2500 | wbc->range_end = LLONG_MAX; | ||
2501 | wbc->range_cyclic = 0; | ||
2502 | } else | ||
2494 | index = wbc->range_start >> PAGE_CACHE_SHIFT; | 2503 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
2495 | 2504 | ||
2496 | mpd.wbc = wbc; | 2505 | mpd.wbc = wbc; |
@@ -2504,6 +2513,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2504 | wbc->no_nrwrite_index_update = 1; | 2513 | wbc->no_nrwrite_index_update = 1; |
2505 | pages_skipped = wbc->pages_skipped; | 2514 | pages_skipped = wbc->pages_skipped; |
2506 | 2515 | ||
2516 | retry: | ||
2507 | while (!ret && wbc->nr_to_write > 0) { | 2517 | while (!ret && wbc->nr_to_write > 0) { |
2508 | 2518 | ||
2509 | /* | 2519 | /* |
@@ -2546,6 +2556,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2546 | pages_written += mpd.pages_written; | 2556 | pages_written += mpd.pages_written; |
2547 | wbc->pages_skipped = pages_skipped; | 2557 | wbc->pages_skipped = pages_skipped; |
2548 | ret = 0; | 2558 | ret = 0; |
2559 | io_done = 1; | ||
2549 | } else if (wbc->nr_to_write) | 2560 | } else if (wbc->nr_to_write) |
2550 | /* | 2561 | /* |
2551 | * There is no more writeout needed | 2562 | * There is no more writeout needed |
@@ -2554,6 +2565,13 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2554 | */ | 2565 | */ |
2555 | break; | 2566 | break; |
2556 | } | 2567 | } |
2568 | if (!io_done && !cycled) { | ||
2569 | cycled = 1; | ||
2570 | index = 0; | ||
2571 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2572 | wbc->range_end = mapping->writeback_index - 1; | ||
2573 | goto retry; | ||
2574 | } | ||
2557 | if (pages_skipped != wbc->pages_skipped) | 2575 | if (pages_skipped != wbc->pages_skipped) |
2558 | printk(KERN_EMERG "This should not happen leaving %s " | 2576 | printk(KERN_EMERG "This should not happen leaving %s " |
2559 | "with nr_to_write = %ld ret = %d\n", | 2577 | "with nr_to_write = %ld ret = %d\n", |
@@ -2561,6 +2579,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2561 | 2579 | ||
2562 | /* Update index */ | 2580 | /* Update index */ |
2563 | index += pages_written; | 2581 | index += pages_written; |
2582 | wbc->range_cyclic = range_cyclic; | ||
2564 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) | 2583 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
2565 | /* | 2584 | /* |
2566 | * set the writeback_index so that range_cyclic | 2585 | * set the writeback_index so that range_cyclic |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index deba54f6cbed..4415beeb0b62 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3693,6 +3693,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | |||
3693 | pa->pa_free = pa->pa_len; | 3693 | pa->pa_free = pa->pa_len; |
3694 | atomic_set(&pa->pa_count, 1); | 3694 | atomic_set(&pa->pa_count, 1); |
3695 | spin_lock_init(&pa->pa_lock); | 3695 | spin_lock_init(&pa->pa_lock); |
3696 | INIT_LIST_HEAD(&pa->pa_inode_list); | ||
3697 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3696 | pa->pa_deleted = 0; | 3698 | pa->pa_deleted = 0; |
3697 | pa->pa_linear = 0; | 3699 | pa->pa_linear = 0; |
3698 | 3700 | ||
@@ -3755,6 +3757,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac) | |||
3755 | atomic_set(&pa->pa_count, 1); | 3757 | atomic_set(&pa->pa_count, 1); |
3756 | spin_lock_init(&pa->pa_lock); | 3758 | spin_lock_init(&pa->pa_lock); |
3757 | INIT_LIST_HEAD(&pa->pa_inode_list); | 3759 | INIT_LIST_HEAD(&pa->pa_inode_list); |
3760 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3758 | pa->pa_deleted = 0; | 3761 | pa->pa_deleted = 0; |
3759 | pa->pa_linear = 1; | 3762 | pa->pa_linear = 1; |
3760 | 3763 | ||
@@ -4476,23 +4479,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) | |||
4476 | pa->pa_free -= ac->ac_b_ex.fe_len; | 4479 | pa->pa_free -= ac->ac_b_ex.fe_len; |
4477 | pa->pa_len -= ac->ac_b_ex.fe_len; | 4480 | pa->pa_len -= ac->ac_b_ex.fe_len; |
4478 | spin_unlock(&pa->pa_lock); | 4481 | spin_unlock(&pa->pa_lock); |
4479 | /* | ||
4480 | * We want to add the pa to the right bucket. | ||
4481 | * Remove it from the list and while adding | ||
4482 | * make sure the list to which we are adding | ||
4483 | * doesn't grow big. | ||
4484 | */ | ||
4485 | if (likely(pa->pa_free)) { | ||
4486 | spin_lock(pa->pa_obj_lock); | ||
4487 | list_del_rcu(&pa->pa_inode_list); | ||
4488 | spin_unlock(pa->pa_obj_lock); | ||
4489 | ext4_mb_add_n_trim(ac); | ||
4490 | } | ||
4491 | } | 4482 | } |
4492 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4493 | } | 4483 | } |
4494 | if (ac->alloc_semp) | 4484 | if (ac->alloc_semp) |
4495 | up_read(ac->alloc_semp); | 4485 | up_read(ac->alloc_semp); |
4486 | if (pa) { | ||
4487 | /* | ||
4488 | * We want to add the pa to the right bucket. | ||
4489 | * Remove it from the list and while adding | ||
4490 | * make sure the list to which we are adding | ||
4491 | * doesn't grow big. We need to release | ||
4492 | * alloc_semp before calling ext4_mb_add_n_trim() | ||
4493 | */ | ||
4494 | if (pa->pa_linear && likely(pa->pa_free)) { | ||
4495 | spin_lock(pa->pa_obj_lock); | ||
4496 | list_del_rcu(&pa->pa_inode_list); | ||
4497 | spin_unlock(pa->pa_obj_lock); | ||
4498 | ext4_mb_add_n_trim(ac); | ||
4499 | } | ||
4500 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4501 | } | ||
4496 | if (ac->ac_bitmap_page) | 4502 | if (ac->ac_bitmap_page) |
4497 | page_cache_release(ac->ac_bitmap_page); | 4503 | page_cache_release(ac->ac_bitmap_page); |
4498 | if (ac->ac_buddy_page) | 4504 | if (ac->ac_buddy_page) |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 734abca25e35..fe64d9f79852 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -481,7 +481,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
481 | + 1); | 481 | + 1); |
482 | if (IS_ERR(handle)) { | 482 | if (IS_ERR(handle)) { |
483 | retval = PTR_ERR(handle); | 483 | retval = PTR_ERR(handle); |
484 | goto err_out; | 484 | return retval; |
485 | } | 485 | } |
486 | tmp_inode = ext4_new_inode(handle, | 486 | tmp_inode = ext4_new_inode(handle, |
487 | inode->i_sb->s_root->d_inode, | 487 | inode->i_sb->s_root->d_inode, |
@@ -489,8 +489,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
489 | if (IS_ERR(tmp_inode)) { | 489 | if (IS_ERR(tmp_inode)) { |
490 | retval = -ENOMEM; | 490 | retval = -ENOMEM; |
491 | ext4_journal_stop(handle); | 491 | ext4_journal_stop(handle); |
492 | tmp_inode = NULL; | 492 | return retval; |
493 | goto err_out; | ||
494 | } | 493 | } |
495 | i_size_write(tmp_inode, i_size_read(inode)); | 494 | i_size_write(tmp_inode, i_size_read(inode)); |
496 | /* | 495 | /* |
@@ -618,8 +617,7 @@ err_out: | |||
618 | 617 | ||
619 | ext4_journal_stop(handle); | 618 | ext4_journal_stop(handle); |
620 | 619 | ||
621 | if (tmp_inode) | 620 | iput(tmp_inode); |
622 | iput(tmp_inode); | ||
623 | 621 | ||
624 | return retval; | 622 | return retval; |
625 | } | 623 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e5f06a5f045e..a5732c58f676 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3046,14 +3046,17 @@ static void ext4_write_super(struct super_block *sb) | |||
3046 | static int ext4_sync_fs(struct super_block *sb, int wait) | 3046 | static int ext4_sync_fs(struct super_block *sb, int wait) |
3047 | { | 3047 | { |
3048 | int ret = 0; | 3048 | int ret = 0; |
3049 | tid_t target; | ||
3049 | 3050 | ||
3050 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); | 3051 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); |
3051 | sb->s_dirt = 0; | 3052 | sb->s_dirt = 0; |
3052 | if (EXT4_SB(sb)->s_journal) { | 3053 | if (EXT4_SB(sb)->s_journal) { |
3053 | if (wait) | 3054 | if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, |
3054 | ret = ext4_force_commit(sb); | 3055 | &target)) { |
3055 | else | 3056 | if (wait) |
3056 | jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); | 3057 | jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, |
3058 | target); | ||
3059 | } | ||
3057 | } else { | 3060 | } else { |
3058 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); | 3061 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); |
3059 | } | 3062 | } |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index eb343008eded..58144102bf25 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -450,7 +450,7 @@ int __jbd2_log_space_left(journal_t *journal) | |||
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 | int __jbd2_log_start_commit(journal_t *journal, tid_t target) | 455 | int __jbd2_log_start_commit(journal_t *journal, tid_t target) |
456 | { | 456 | { |
@@ -518,7 +518,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal) | |||
518 | 518 | ||
519 | /* | 519 | /* |
520 | * Start a commit of the current running transaction (if any). Returns true | 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 | int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | 524 | int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) |
524 | { | 525 | { |
@@ -528,15 +529,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | |||
528 | if (journal->j_running_transaction) { | 529 | if (journal->j_running_transaction) { |
529 | tid_t tid = journal->j_running_transaction->t_tid; | 530 | tid_t tid = journal->j_running_transaction->t_tid; |
530 | 531 | ||
531 | ret = __jbd2_log_start_commit(journal, tid); | 532 | __jbd2_log_start_commit(journal, tid); |
532 | if (ret && ptid) | 533 | /* There's a running transaction and we've just made sure |
534 | * it's commit has been scheduled. */ | ||
535 | if (ptid) | ||
533 | *ptid = tid; | 536 | *ptid = tid; |
534 | } else if (journal->j_committing_transaction && ptid) { | 537 | ret = 1; |
538 | } else if (journal->j_committing_transaction) { | ||
535 | /* | 539 | /* |
536 | * If ext3_write_super() recently started a commit, then we | 540 | * If ext3_write_super() recently started a commit, then we |
537 | * have to wait for completion of that transaction | 541 | * have to wait for completion of that transaction |
538 | */ | 542 | */ |
539 | *ptid = journal->j_committing_transaction->t_tid; | 543 | if (ptid) |
544 | *ptid = journal->j_committing_transaction->t_tid; | ||
540 | ret = 1; | 545 | ret = 1; |
541 | } | 546 | } |
542 | spin_unlock(&journal->j_state_lock); | 547 | spin_unlock(&journal->j_state_lock); |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 46b4e347ed7d..28ce21d8598e 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -2129,26 +2129,46 @@ done: | |||
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | /* | 2131 | /* |
2132 | * This function must be called when inode is journaled in ordered mode | 2132 | * File truncate and transaction commit interact with each other in a |
2133 | * before truncation happens. It starts writeout of truncated part in | 2133 | * non-trivial way. If a transaction writing data block A is |
2134 | * case it is in the committing transaction so that we stand to ordered | 2134 | * committing, we cannot discard the data by truncate until we have |
2135 | * mode consistency guarantees. | 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 | loff_t new_size) | 2153 | loff_t new_size) |
2139 | { | 2154 | { |
2140 | journal_t *journal; | 2155 | transaction_t *inode_trans, *commit_trans; |
2141 | transaction_t *commit_trans; | ||
2142 | int ret = 0; | 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 | goto out; | 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 | spin_lock(&journal->j_state_lock); | 2164 | spin_lock(&journal->j_state_lock); |
2148 | commit_trans = journal->j_committing_transaction; | 2165 | commit_trans = journal->j_committing_transaction; |
2149 | spin_unlock(&journal->j_state_lock); | 2166 | spin_unlock(&journal->j_state_lock); |
2150 | if (inode->i_transaction == commit_trans) { | 2167 | spin_lock(&journal->j_list_lock); |
2151 | ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping, | 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 | new_size, LLONG_MAX); | 2172 | new_size, LLONG_MAX); |
2153 | if (ret) | 2173 | if (ret) |
2154 | jbd2_journal_abort(journal, ret); | 2174 | jbd2_journal_abort(journal, ret); |
diff --git a/fs/namespace.c b/fs/namespace.c index 228d8c4bfd18..06f8e63f6cb1 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -614,9 +614,11 @@ static inline void __mntput(struct vfsmount *mnt) | |||
614 | */ | 614 | */ |
615 | for_each_possible_cpu(cpu) { | 615 | for_each_possible_cpu(cpu) { |
616 | struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); | 616 | struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); |
617 | if (cpu_writer->mnt != mnt) | ||
618 | continue; | ||
619 | spin_lock(&cpu_writer->lock); | 617 | spin_lock(&cpu_writer->lock); |
618 | if (cpu_writer->mnt != mnt) { | ||
619 | spin_unlock(&cpu_writer->lock); | ||
620 | continue; | ||
621 | } | ||
620 | atomic_add(cpu_writer->count, &mnt->__mnt_writers); | 622 | atomic_add(cpu_writer->count, &mnt->__mnt_writers); |
621 | cpu_writer->count = 0; | 623 | cpu_writer->count = 0; |
622 | /* | 624 | /* |
diff --git a/fs/notify/inotify/inotify.c b/fs/notify/inotify/inotify.c index dae3f28f30d4..331f2e88e284 100644 --- a/fs/notify/inotify/inotify.c +++ b/fs/notify/inotify/inotify.c | |||
@@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih, | |||
156 | int ret; | 156 | int ret; |
157 | 157 | ||
158 | do { | 158 | do { |
159 | if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL))) | 159 | if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS))) |
160 | return -ENOSPC; | 160 | return -ENOSPC; |
161 | ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); | 161 | ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); |
162 | } while (ret == -EAGAIN); | 162 | } while (ret == -EAGAIN); |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 3c3532e1307c..172850a9a12a 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -513,8 +513,10 @@ static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode) | |||
513 | static inline int ocfs2_begin_ordered_truncate(struct inode *inode, | 513 | static inline int ocfs2_begin_ordered_truncate(struct inode *inode, |
514 | loff_t new_size) | 514 | loff_t new_size) |
515 | { | 515 | { |
516 | return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode, | 516 | return jbd2_journal_begin_ordered_truncate( |
517 | new_size); | 517 | OCFS2_SB(inode->i_sb)->journal->j_journal, |
518 | &OCFS2_I(inode)->ip_jinode, | ||
519 | new_size); | ||
518 | } | 520 | } |
519 | 521 | ||
520 | #endif /* OCFS2_JOURNAL_H */ | 522 | #endif /* OCFS2_JOURNAL_H */ |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 5267098532bf..a1a4cfe19210 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -48,8 +48,16 @@ int seq_open(struct file *file, const struct seq_operations *op) | |||
48 | */ | 48 | */ |
49 | file->f_version = 0; | 49 | file->f_version = 0; |
50 | 50 | ||
51 | /* SEQ files support lseek, but not pread/pwrite */ | 51 | /* |
52 | file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); | 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 | return 0; | 61 | return 0; |
54 | } | 62 | } |
55 | EXPORT_SYMBOL(seq_open); | 63 | EXPORT_SYMBOL(seq_open); |
@@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
131 | int err = 0; | 139 | int err = 0; |
132 | 140 | ||
133 | mutex_lock(&m->lock); | 141 | mutex_lock(&m->lock); |
142 | |||
143 | /* Don't assume *ppos is where we left it */ | ||
144 | if (unlikely(*ppos != m->read_pos)) { | ||
145 | m->read_pos = *ppos; | ||
146 | while ((err = traverse(m, *ppos)) == -EAGAIN) | ||
147 | ; | ||
148 | if (err) { | ||
149 | /* With prejudice... */ | ||
150 | m->read_pos = 0; | ||
151 | m->version = 0; | ||
152 | m->index = 0; | ||
153 | m->count = 0; | ||
154 | goto Done; | ||
155 | } | ||
156 | } | ||
157 | |||
134 | /* | 158 | /* |
135 | * seq_file->op->..m_start/m_stop/m_next may do special actions | 159 | * seq_file->op->..m_start/m_stop/m_next may do special actions |
136 | * or optimisations based on the file->f_version, so we want to | 160 | * or optimisations based on the file->f_version, so we want to |
@@ -230,8 +254,10 @@ Fill: | |||
230 | Done: | 254 | Done: |
231 | if (!copied) | 255 | if (!copied) |
232 | copied = err; | 256 | copied = err; |
233 | else | 257 | else { |
234 | *ppos += copied; | 258 | *ppos += copied; |
259 | m->read_pos += copied; | ||
260 | } | ||
235 | file->f_version = m->version; | 261 | file->f_version = m->version; |
236 | mutex_unlock(&m->lock); | 262 | mutex_unlock(&m->lock); |
237 | return copied; | 263 | return copied; |
@@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) | |||
266 | if (offset < 0) | 292 | if (offset < 0) |
267 | break; | 293 | break; |
268 | retval = offset; | 294 | retval = offset; |
269 | if (offset != file->f_pos) { | 295 | if (offset != m->read_pos) { |
270 | while ((retval=traverse(m, offset)) == -EAGAIN) | 296 | while ((retval=traverse(m, offset)) == -EAGAIN) |
271 | ; | 297 | ; |
272 | if (retval) { | 298 | if (retval) { |
273 | /* with extreme prejudice... */ | 299 | /* with extreme prejudice... */ |
274 | file->f_pos = 0; | 300 | file->f_pos = 0; |
301 | m->read_pos = 0; | ||
275 | m->version = 0; | 302 | m->version = 0; |
276 | m->index = 0; | 303 | m->index = 0; |
277 | m->count = 0; | 304 | m->count = 0; |
278 | } else { | 305 | } else { |
306 | m->read_pos = offset; | ||
279 | retval = file->f_pos = offset; | 307 | retval = file->f_pos = offset; |
280 | } | 308 | } |
281 | } | 309 | } |
diff --git a/fs/super.c b/fs/super.c index 61dce001dd57..8349ed6b1412 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -82,7 +82,22 @@ static struct super_block *alloc_super(struct file_system_type *type) | |||
82 | * lock ordering than usbfs: | 82 | * lock ordering than usbfs: |
83 | */ | 83 | */ |
84 | lockdep_set_class(&s->s_lock, &type->s_lock_key); | 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 | s->s_count = S_BIAS; | 101 | s->s_count = S_BIAS; |
87 | atomic_set(&s->s_active, 1); | 102 | atomic_set(&s->s_active, 1); |
88 | mutex_init(&s->s_vfs_rename_mutex); | 103 | mutex_init(&s->s_vfs_rename_mutex); |
diff --git a/fs/timerfd.c b/fs/timerfd.c index 6a123b8ff3f5..b042bd7034b1 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | 186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); |
187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | 187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); |
188 | 188 | ||
189 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | 189 | if ((flags & ~TFD_CREATE_FLAGS) || |
190 | return -EINVAL; | 190 | (clockid != CLOCK_MONOTONIC && |
191 | if (clockid != CLOCK_MONOTONIC && | 191 | clockid != CLOCK_REALTIME)) |
192 | clockid != CLOCK_REALTIME) | ||
193 | return -EINVAL; | 192 | return -EINVAL; |
194 | 193 | ||
195 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); | 194 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
@@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
201 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
202 | 201 | ||
203 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
204 | flags & (O_CLOEXEC | O_NONBLOCK)); | 203 | flags & TFD_SHARED_FCNTL_FLAGS); |
205 | if (ufd < 0) | 204 | if (ufd < 0) |
206 | kfree(ctx); | 205 | kfree(ctx); |
207 | 206 | ||
@@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, | |||
219 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) | 218 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) |
220 | return -EFAULT; | 219 | return -EFAULT; |
221 | 220 | ||
222 | if (!timespec_valid(&ktmr.it_value) || | 221 | if ((flags & ~TFD_SETTIME_FLAGS) || |
222 | !timespec_valid(&ktmr.it_value) || | ||
223 | !timespec_valid(&ktmr.it_interval)) | 223 | !timespec_valid(&ktmr.it_interval)) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | 225 | ||
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 83c51aba534b..e16fdb1f4f4f 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -478,7 +478,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
478 | #define __swp_type(x) (((x).val >> 2) & 0x1f) | 478 | #define __swp_type(x) (((x).val >> 2) & 0x1f) |
479 | #define __swp_offset(x) ((x).val >> 8) | 479 | #define __swp_offset(x) ((x).val >> 8) |
480 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) | 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 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 482 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
483 | 483 | ||
484 | static inline int pte_file(pte_t pte) | 484 | static inline int pte_file(pte_t pte) |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 2aa283ab062b..1b16108a5417 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -171,8 +171,6 @@ struct bio { | |||
171 | #define BIO_RW_FAILFAST_TRANSPORT 8 | 171 | #define BIO_RW_FAILFAST_TRANSPORT 8 |
172 | #define BIO_RW_FAILFAST_DRIVER 9 | 172 | #define BIO_RW_FAILFAST_DRIVER 9 |
173 | 173 | ||
174 | #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) | ||
175 | |||
176 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) | 174 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) |
177 | 175 | ||
178 | /* | 176 | /* |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index ed12e8fd8cf7..d960889e92ef 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -15,6 +15,7 @@ enum blktrace_cat { | |||
15 | BLK_TC_WRITE = 1 << 1, /* writes */ | 15 | BLK_TC_WRITE = 1 << 1, /* writes */ |
16 | BLK_TC_BARRIER = 1 << 2, /* barrier */ | 16 | BLK_TC_BARRIER = 1 << 2, /* barrier */ |
17 | BLK_TC_SYNC = 1 << 3, /* sync IO */ | 17 | BLK_TC_SYNC = 1 << 3, /* sync IO */ |
18 | BLK_TC_SYNCIO = BLK_TC_SYNC, | ||
18 | BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ | 19 | BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ |
19 | BLK_TC_REQUEUE = 1 << 5, /* requeueing */ | 20 | BLK_TC_REQUEUE = 1 << 5, /* requeueing */ |
20 | BLK_TC_ISSUE = 1 << 6, /* issue */ | 21 | BLK_TC_ISSUE = 1 << 6, /* issue */ |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 3e68469c1885..f0413845f20e 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -121,6 +121,7 @@ struct dma_chan_percpu { | |||
121 | * @local: per-cpu pointer to a struct dma_chan_percpu | 121 | * @local: per-cpu pointer to a struct dma_chan_percpu |
122 | * @client-count: how many clients are using this channel | 122 | * @client-count: how many clients are using this channel |
123 | * @table_count: number of appearances in the mem-to-mem allocation table | 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 | struct dma_chan { | 126 | struct dma_chan { |
126 | struct dma_device *device; | 127 | struct dma_device *device; |
@@ -134,6 +135,7 @@ struct dma_chan { | |||
134 | struct dma_chan_percpu *local; | 135 | struct dma_chan_percpu *local; |
135 | int client_count; | 136 | int client_count; |
136 | int table_count; | 137 | int table_count; |
138 | void *private; | ||
137 | }; | 139 | }; |
138 | 140 | ||
139 | /** | 141 | /** |
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h index 6e199c8dfacc..cca686b39123 100644 --- a/include/linux/firmware-map.h +++ b/include/linux/firmware-map.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/firmware-map.h: | 2 | * include/linux/firmware-map.h: |
3 | * Copyright (C) 2008 SUSE LINUX Products GmbH | 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 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License v2.0 as published by | 7 | * it under the terms of the GNU General Public License v2.0 as published by |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6022f44043f2..92734c0012e6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -54,24 +54,30 @@ struct inodes_stat_t { | |||
54 | #define MAY_ACCESS 16 | 54 | #define MAY_ACCESS 16 |
55 | #define MAY_OPEN 32 | 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 | /* file is open for reading */ | 62 | /* file is open for reading */ |
58 | #define FMODE_READ ((__force fmode_t)1) | 63 | #define FMODE_READ ((__force fmode_t)1) |
59 | /* file is open for writing */ | 64 | /* file is open for writing */ |
60 | #define FMODE_WRITE ((__force fmode_t)2) | 65 | #define FMODE_WRITE ((__force fmode_t)2) |
61 | /* file is seekable */ | 66 | /* file is seekable */ |
62 | #define FMODE_LSEEK ((__force fmode_t)4) | 67 | #define FMODE_LSEEK ((__force fmode_t)4) |
63 | /* file can be accessed using pread/pwrite */ | 68 | /* file can be accessed using pread */ |
64 | #define FMODE_PREAD ((__force fmode_t)8) | 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 | /* File is opened for execution with sys_execve / sys_uselib */ | 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 | /* File is opened with O_NDELAY (only set for block devices) */ | 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 | /* File is opened with O_EXCL (only set for block devices) */ | 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 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls | 78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls |
73 | (specialy hack for floppy.c) */ | 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 | * Don't update ctime and mtime. | 83 | * Don't update ctime and mtime. |
@@ -87,10 +93,10 @@ struct inodes_stat_t { | |||
87 | #define WRITE 1 | 93 | #define WRITE 1 |
88 | #define READA 2 /* read-ahead - don't block if no resources */ | 94 | #define READA 2 /* read-ahead - don't block if no resources */ |
89 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ | 95 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ |
90 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) | 96 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
91 | #define READ_META (READ | (1 << BIO_RW_META)) | 97 | #define READ_META (READ | (1 << BIO_RW_META)) |
92 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) | 98 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
93 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) | 99 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
94 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | 100 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) |
95 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | 101 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) |
96 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | 102 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index b28b37eb11c6..4d248b3f1323 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1150,7 +1150,8 @@ extern int jbd2_journal_clear_err (journal_t *); | |||
1150 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); | 1150 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); |
1151 | extern int jbd2_journal_force_commit(journal_t *); | 1151 | extern int jbd2_journal_force_commit(journal_t *); |
1152 | extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); | 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 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); | 1155 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); |
1155 | extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); | 1156 | extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); |
1156 | 1157 | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 5715f1907601..0424326f1679 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -58,10 +58,10 @@ struct kvm_irqchip { | |||
58 | __u32 pad; | 58 | __u32 pad; |
59 | union { | 59 | union { |
60 | char dummy[512]; /* reserving space */ | 60 | char dummy[512]; /* reserving space */ |
61 | #ifdef CONFIG_X86 | 61 | #ifdef __KVM_HAVE_PIT |
62 | struct kvm_pic_state pic; | 62 | struct kvm_pic_state pic; |
63 | #endif | 63 | #endif |
64 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | 64 | #ifdef __KVM_HAVE_IOAPIC |
65 | struct kvm_ioapic_state ioapic; | 65 | struct kvm_ioapic_state ioapic; |
66 | #endif | 66 | #endif |
67 | } chip; | 67 | } chip; |
@@ -384,16 +384,16 @@ struct kvm_trace_rec { | |||
384 | #define KVM_CAP_MP_STATE 14 | 384 | #define KVM_CAP_MP_STATE 14 |
385 | #define KVM_CAP_COALESCED_MMIO 15 | 385 | #define KVM_CAP_COALESCED_MMIO 15 |
386 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | 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 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 | 388 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 |
389 | #endif | 389 | #endif |
390 | #define KVM_CAP_IOMMU 18 | 390 | #define KVM_CAP_IOMMU 18 |
391 | #if defined(CONFIG_X86) | 391 | #ifdef __KVM_HAVE_MSI |
392 | #define KVM_CAP_DEVICE_MSI 20 | 392 | #define KVM_CAP_DEVICE_MSI 20 |
393 | #endif | 393 | #endif |
394 | /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ | 394 | /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ |
395 | #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 | 395 | #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 |
396 | #if defined(CONFIG_X86) | 396 | #ifdef __KVM_HAVE_USER_NMI |
397 | #define KVM_CAP_USER_NMI 22 | 397 | #define KVM_CAP_USER_NMI 22 |
398 | #endif | 398 | #endif |
399 | 399 | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ec49d0be7f52..bf6f703642fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -285,6 +285,7 @@ void kvm_free_physmem(struct kvm *kvm); | |||
285 | struct kvm *kvm_arch_create_vm(void); | 285 | struct kvm *kvm_arch_create_vm(void); |
286 | void kvm_arch_destroy_vm(struct kvm *kvm); | 286 | void kvm_arch_destroy_vm(struct kvm *kvm); |
287 | void kvm_free_all_assigned_devices(struct kvm *kvm); | 287 | void kvm_free_all_assigned_devices(struct kvm *kvm); |
288 | void kvm_arch_sync_events(struct kvm *kvm); | ||
288 | 289 | ||
289 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 290 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
290 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 291 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 323561582c10..065cdf8c09fb 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1041,10 +1041,23 @@ extern void free_bootmem_with_active_regions(int nid, | |||
1041 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1041 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
1042 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1042 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
1043 | extern void sparse_memory_present_with_active_regions(int nid); | 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 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | 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 | extern void set_dma_reserve(unsigned long new_dma_reserve); | 1061 | extern void set_dma_reserve(unsigned long new_dma_reserve); |
1049 | extern void memmap_init_zone(unsigned long, int, unsigned long, | 1062 | extern void memmap_init_zone(unsigned long, int, unsigned long, |
1050 | unsigned long, enum memmap_context); | 1063 | unsigned long, enum memmap_context); |
@@ -1159,6 +1172,7 @@ extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); | |||
1159 | 1172 | ||
1160 | /* mm/page-writeback.c */ | 1173 | /* mm/page-writeback.c */ |
1161 | int write_one_page(struct page *page, int wait); | 1174 | int write_one_page(struct page *page, int wait); |
1175 | void task_dirty_inc(struct task_struct *tsk); | ||
1162 | 1176 | ||
1163 | /* readahead.c */ | 1177 | /* readahead.c */ |
1164 | #define VM_MAX_READAHEAD 128 /* kbytes */ | 1178 | #define VM_MAX_READAHEAD 128 /* kbytes */ |
@@ -1304,5 +1318,6 @@ void vmemmap_populate_print_last(void); | |||
1304 | 1318 | ||
1305 | extern void *alloc_locked_buffer(size_t size); | 1319 | extern void *alloc_locked_buffer(size_t size); |
1306 | extern void free_locked_buffer(void *buffer, size_t size); | 1320 | extern void free_locked_buffer(void *buffer, size_t size); |
1321 | extern void release_locked_buffer(void *buffer, size_t size); | ||
1307 | #endif /* __KERNEL__ */ | 1322 | #endif /* __KERNEL__ */ |
1308 | #endif /* _LINUX_MM_H */ | 1323 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 09c14e213b63..1aca6cebbb78 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -1071,7 +1071,7 @@ void sparse_init(void); | |||
1071 | #endif /* CONFIG_SPARSEMEM */ | 1071 | #endif /* CONFIG_SPARSEMEM */ |
1072 | 1072 | ||
1073 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | 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 | #else | 1075 | #else |
1076 | #define early_pfn_in_nid(pfn, nid) (1) | 1076 | #define early_pfn_in_nid(pfn, nid) (1) |
1077 | #endif | 1077 | #endif |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 52a9fe08451c..114b8192eab9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1312,6 +1312,7 @@ | |||
1312 | #define PCI_DEVICE_ID_VIA_VT3351 0x0351 | 1312 | #define PCI_DEVICE_ID_VIA_VT3351 0x0351 |
1313 | #define PCI_DEVICE_ID_VIA_VT3364 0x0364 | 1313 | #define PCI_DEVICE_ID_VIA_VT3364 0x0364 |
1314 | #define PCI_DEVICE_ID_VIA_8371_0 0x0391 | 1314 | #define PCI_DEVICE_ID_VIA_8371_0 0x0391 |
1315 | #define PCI_DEVICE_ID_VIA_6415 0x0415 | ||
1315 | #define PCI_DEVICE_ID_VIA_8501_0 0x0501 | 1316 | #define PCI_DEVICE_ID_VIA_8501_0 0x0501 |
1316 | #define PCI_DEVICE_ID_VIA_82C561 0x0561 | 1317 | #define PCI_DEVICE_ID_VIA_82C561 0x0561 |
1317 | #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 | 1318 | #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 |
@@ -1444,6 +1445,7 @@ | |||
1444 | #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 | 1445 | #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 |
1445 | #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 | 1446 | #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 |
1446 | #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 | 1447 | #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 |
1448 | #define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1 | ||
1447 | #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 | 1449 | #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 |
1448 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 | 1450 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 |
1449 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA | 1451 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 40ea5058c2ec..f616f31576d7 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -19,6 +19,7 @@ struct seq_file { | |||
19 | size_t from; | 19 | size_t from; |
20 | size_t count; | 20 | size_t count; |
21 | loff_t index; | 21 | loff_t index; |
22 | loff_t read_pos; | ||
22 | u64 version; | 23 | u64 version; |
23 | struct mutex lock; | 24 | struct mutex lock; |
24 | const struct seq_operations *op; | 25 | const struct seq_operations *op; |
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h index 86cb0501d3e2..2d0792983f8c 100644 --- a/include/linux/timerfd.h +++ b/include/linux/timerfd.h | |||
@@ -11,13 +11,21 @@ | |||
11 | /* For O_CLOEXEC and O_NONBLOCK */ | 11 | /* For O_CLOEXEC and O_NONBLOCK */ |
12 | #include <linux/fcntl.h> | 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 | #define TFD_TIMER_ABSTIME (1 << 0) | 21 | #define TFD_TIMER_ABSTIME (1 << 0) |
16 | |||
17 | /* Flags for timerfd_create. */ | ||
18 | #define TFD_CLOEXEC O_CLOEXEC | 22 | #define TFD_CLOEXEC O_CLOEXEC |
19 | #define TFD_NONBLOCK O_NONBLOCK | 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 | #endif /* _LINUX_TIMERFD_H */ | 31 | #endif /* _LINUX_TIMERFD_H */ |
23 | |||
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 506e7620a986..9c0890c7a06a 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -84,6 +84,10 @@ extern struct vm_struct *get_vm_area_caller(unsigned long size, | |||
84 | unsigned long flags, void *caller); | 84 | unsigned long flags, void *caller); |
85 | extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | 85 | extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, |
86 | unsigned long start, unsigned long end); | 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 | extern struct vm_struct *get_vm_area_node(unsigned long size, | 91 | extern struct vm_struct *get_vm_area_node(unsigned long size, |
88 | unsigned long flags, int node, | 92 | unsigned long flags, int node, |
89 | gfp_t gfp_mask); | 93 | gfp_t gfp_mask); |
diff --git a/kernel/Makefile b/kernel/Makefile index 170a9213c1b6..e4791b3ba55d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -51,6 +51,7 @@ obj-$(CONFIG_UID16) += uid16.o | |||
51 | obj-$(CONFIG_MODULES) += module.o | 51 | obj-$(CONFIG_MODULES) += module.o |
52 | obj-$(CONFIG_KALLSYMS) += kallsyms.o | 52 | obj-$(CONFIG_KALLSYMS) += kallsyms.o |
53 | obj-$(CONFIG_PM) += power/ | 53 | obj-$(CONFIG_PM) += power/ |
54 | obj-$(CONFIG_FREEZER) += power/ | ||
54 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o | 55 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o |
55 | obj-$(CONFIG_KEXEC) += kexec.o | 56 | obj-$(CONFIG_KEXEC) += kexec.o |
56 | obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o | 57 | obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e14db9c089b9..9edb5c4b79b4 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1122,8 +1122,8 @@ static void cgroup_kill_sb(struct super_block *sb) { | |||
1122 | 1122 | ||
1123 | mutex_unlock(&cgroup_mutex); | 1123 | mutex_unlock(&cgroup_mutex); |
1124 | 1124 | ||
1125 | kfree(root); | ||
1126 | kill_litter_super(sb); | 1125 | kill_litter_super(sb); |
1126 | kfree(root); | ||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | static struct file_system_type cgroup_fs_type = { | 1129 | static struct file_system_type cgroup_fs_type = { |
diff --git a/kernel/futex.c b/kernel/futex.c index f89d373a9c6d..438701adce23 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1165,6 +1165,7 @@ static int futex_wait(u32 __user *uaddr, int fshared, | |||
1165 | u32 val, ktime_t *abs_time, u32 bitset, int clockrt) | 1165 | u32 val, ktime_t *abs_time, u32 bitset, int clockrt) |
1166 | { | 1166 | { |
1167 | struct task_struct *curr = current; | 1167 | struct task_struct *curr = current; |
1168 | struct restart_block *restart; | ||
1168 | DECLARE_WAITQUEUE(wait, curr); | 1169 | DECLARE_WAITQUEUE(wait, curr); |
1169 | struct futex_hash_bucket *hb; | 1170 | struct futex_hash_bucket *hb; |
1170 | struct futex_q q; | 1171 | struct futex_q q; |
@@ -1216,11 +1217,13 @@ retry: | |||
1216 | 1217 | ||
1217 | if (!ret) | 1218 | if (!ret) |
1218 | goto retry; | 1219 | goto retry; |
1219 | return ret; | 1220 | goto out; |
1220 | } | 1221 | } |
1221 | ret = -EWOULDBLOCK; | 1222 | ret = -EWOULDBLOCK; |
1222 | if (uval != val) | 1223 | if (unlikely(uval != val)) { |
1223 | goto out_unlock_put_key; | 1224 | queue_unlock(&q, hb); |
1225 | goto out_put_key; | ||
1226 | } | ||
1224 | 1227 | ||
1225 | /* Only actually queue if *uaddr contained val. */ | 1228 | /* Only actually queue if *uaddr contained val. */ |
1226 | queue_me(&q, hb); | 1229 | queue_me(&q, hb); |
@@ -1284,38 +1287,38 @@ retry: | |||
1284 | */ | 1287 | */ |
1285 | 1288 | ||
1286 | /* If we were woken (and unqueued), we succeeded, whatever. */ | 1289 | /* If we were woken (and unqueued), we succeeded, whatever. */ |
1290 | ret = 0; | ||
1287 | if (!unqueue_me(&q)) | 1291 | if (!unqueue_me(&q)) |
1288 | return 0; | 1292 | goto out_put_key; |
1293 | ret = -ETIMEDOUT; | ||
1289 | if (rem) | 1294 | if (rem) |
1290 | return -ETIMEDOUT; | 1295 | goto out_put_key; |
1291 | 1296 | ||
1292 | /* | 1297 | /* |
1293 | * We expect signal_pending(current), but another thread may | 1298 | * We expect signal_pending(current), but another thread may |
1294 | * have handled it for us already. | 1299 | * have handled it for us already. |
1295 | */ | 1300 | */ |
1301 | ret = -ERESTARTSYS; | ||
1296 | if (!abs_time) | 1302 | if (!abs_time) |
1297 | return -ERESTARTSYS; | 1303 | goto out_put_key; |
1298 | else { | ||
1299 | struct restart_block *restart; | ||
1300 | restart = ¤t_thread_info()->restart_block; | ||
1301 | restart->fn = futex_wait_restart; | ||
1302 | restart->futex.uaddr = (u32 *)uaddr; | ||
1303 | restart->futex.val = val; | ||
1304 | restart->futex.time = abs_time->tv64; | ||
1305 | restart->futex.bitset = bitset; | ||
1306 | restart->futex.flags = 0; | ||
1307 | |||
1308 | if (fshared) | ||
1309 | restart->futex.flags |= FLAGS_SHARED; | ||
1310 | if (clockrt) | ||
1311 | restart->futex.flags |= FLAGS_CLOCKRT; | ||
1312 | return -ERESTART_RESTARTBLOCK; | ||
1313 | } | ||
1314 | 1304 | ||
1315 | out_unlock_put_key: | 1305 | restart = ¤t_thread_info()->restart_block; |
1316 | queue_unlock(&q, hb); | 1306 | restart->fn = futex_wait_restart; |
1317 | put_futex_key(fshared, &q.key); | 1307 | restart->futex.uaddr = (u32 *)uaddr; |
1308 | restart->futex.val = val; | ||
1309 | restart->futex.time = abs_time->tv64; | ||
1310 | restart->futex.bitset = bitset; | ||
1311 | restart->futex.flags = 0; | ||
1312 | |||
1313 | if (fshared) | ||
1314 | restart->futex.flags |= FLAGS_SHARED; | ||
1315 | if (clockrt) | ||
1316 | restart->futex.flags |= FLAGS_CLOCKRT; | ||
1318 | 1317 | ||
1318 | ret = -ERESTART_RESTARTBLOCK; | ||
1319 | |||
1320 | out_put_key: | ||
1321 | put_futex_key(fshared, &q.key); | ||
1319 | out: | 1322 | out: |
1320 | return ret; | 1323 | return ret; |
1321 | } | 1324 | } |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 2313a4cc14ea..e976e505648d 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -681,6 +681,33 @@ static void cpu_timer_fire(struct k_itimer *timer) | |||
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 | * Guts of sys_timer_settime for CPU timers. | 711 | * Guts of sys_timer_settime for CPU timers. |
685 | * This is called with the timer locked and interrupts disabled. | 712 | * This is called with the timer locked and interrupts disabled. |
686 | * If we return TIMER_RETRY, it's necessary to release the timer's lock | 713 | * If we return TIMER_RETRY, it's necessary to release the timer's lock |
@@ -741,7 +768,7 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
741 | if (CPUCLOCK_PERTHREAD(timer->it_clock)) { | 768 | if (CPUCLOCK_PERTHREAD(timer->it_clock)) { |
742 | cpu_clock_sample(timer->it_clock, p, &val); | 769 | cpu_clock_sample(timer->it_clock, p, &val); |
743 | } else { | 770 | } else { |
744 | cpu_clock_sample_group(timer->it_clock, p, &val); | 771 | cpu_timer_sample_group(timer->it_clock, p, &val); |
745 | } | 772 | } |
746 | 773 | ||
747 | if (old) { | 774 | if (old) { |
@@ -889,7 +916,7 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp) | |||
889 | read_unlock(&tasklist_lock); | 916 | read_unlock(&tasklist_lock); |
890 | goto dead; | 917 | goto dead; |
891 | } else { | 918 | } else { |
892 | cpu_clock_sample_group(timer->it_clock, p, &now); | 919 | cpu_timer_sample_group(timer->it_clock, p, &now); |
893 | clear_dead = (unlikely(p->exit_state) && | 920 | clear_dead = (unlikely(p->exit_state) && |
894 | thread_group_empty(p)); | 921 | thread_group_empty(p)); |
895 | } | 922 | } |
@@ -1244,7 +1271,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer) | |||
1244 | clear_dead_task(timer, now); | 1271 | clear_dead_task(timer, now); |
1245 | goto out_unlock; | 1272 | goto out_unlock; |
1246 | } | 1273 | } |
1247 | cpu_clock_sample_group(timer->it_clock, p, &now); | 1274 | cpu_timer_sample_group(timer->it_clock, p, &now); |
1248 | bump_cpu_timer(timer, now); | 1275 | bump_cpu_timer(timer, now); |
1249 | /* Leave the tasklist_lock locked for the call below. */ | 1276 | /* Leave the tasklist_lock locked for the call below. */ |
1250 | } | 1277 | } |
@@ -1409,33 +1436,6 @@ void run_posix_cpu_timers(struct task_struct *tsk) | |||
1409 | } | 1436 | } |
1410 | 1437 | ||
1411 | /* | 1438 | /* |
1412 | * Sample a process (thread group) timer for the given group_leader task. | ||
1413 | * Must be called with tasklist_lock held for reading. | ||
1414 | */ | ||
1415 | static int cpu_timer_sample_group(const clockid_t which_clock, | ||
1416 | struct task_struct *p, | ||
1417 | union cpu_time_count *cpu) | ||
1418 | { | ||
1419 | struct task_cputime cputime; | ||
1420 | |||
1421 | thread_group_cputimer(p, &cputime); | ||
1422 | switch (CPUCLOCK_WHICH(which_clock)) { | ||
1423 | default: | ||
1424 | return -EINVAL; | ||
1425 | case CPUCLOCK_PROF: | ||
1426 | cpu->cpu = cputime_add(cputime.utime, cputime.stime); | ||
1427 | break; | ||
1428 | case CPUCLOCK_VIRT: | ||
1429 | cpu->cpu = cputime.utime; | ||
1430 | break; | ||
1431 | case CPUCLOCK_SCHED: | ||
1432 | cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p); | ||
1433 | break; | ||
1434 | } | ||
1435 | return 0; | ||
1436 | } | ||
1437 | |||
1438 | /* | ||
1439 | * Set one of the process-wide special case CPU timers. | 1439 | * Set one of the process-wide special case CPU timers. |
1440 | * The tsk->sighand->siglock must be held by the caller. | 1440 | * The tsk->sighand->siglock must be held by the caller. |
1441 | * The *newval argument is relative and we update it to be absolute, *oldval | 1441 | * The *newval argument is relative and we update it to be absolute, *oldval |
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index d7a10167a25b..720ea4f781bd 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -3,7 +3,7 @@ ifeq ($(CONFIG_PM_DEBUG),y) | |||
3 | EXTRA_CFLAGS += -DDEBUG | 3 | EXTRA_CFLAGS += -DDEBUG |
4 | endif | 4 | endif |
5 | 5 | ||
6 | obj-y := main.o | 6 | obj-$(CONFIG_PM) += main.o |
7 | obj-$(CONFIG_PM_SLEEP) += console.o | 7 | obj-$(CONFIG_PM_SLEEP) += console.o |
8 | obj-$(CONFIG_FREEZER) += process.o | 8 | obj-$(CONFIG_FREEZER) += process.o |
9 | obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o | 9 | obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 6da14358537c..505f319e489c 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -60,6 +60,7 @@ static struct block_device *resume_bdev; | |||
60 | static int submit(int rw, pgoff_t page_off, struct page *page, | 60 | static int submit(int rw, pgoff_t page_off, struct page *page, |
61 | struct bio **bio_chain) | 61 | struct bio **bio_chain) |
62 | { | 62 | { |
63 | const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); | ||
63 | struct bio *bio; | 64 | struct bio *bio; |
64 | 65 | ||
65 | bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); | 66 | bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); |
@@ -80,7 +81,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page, | |||
80 | bio_get(bio); | 81 | bio_get(bio); |
81 | 82 | ||
82 | if (bio_chain == NULL) { | 83 | if (bio_chain == NULL) { |
83 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 84 | submit_bio(bio_rw, bio); |
84 | wait_on_page_locked(page); | 85 | wait_on_page_locked(page); |
85 | if (rw == READ) | 86 | if (rw == READ) |
86 | bio_set_pages_dirty(bio); | 87 | bio_set_pages_dirty(bio); |
@@ -90,7 +91,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page, | |||
90 | get_page(page); /* These pages are freed later */ | 91 | get_page(page); /* These pages are freed later */ |
91 | bio->bi_private = *bio_chain; | 92 | bio->bi_private = *bio_chain; |
92 | *bio_chain = bio; | 93 | *bio_chain = bio; |
93 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 94 | submit_bio(bio_rw, bio); |
94 | } | 95 | } |
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
diff --git a/kernel/sched.c b/kernel/sched.c index 5dc3b0a5d35a..2492b9b3fed4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6944,20 +6944,26 @@ static void free_rootdomain(struct root_domain *rd) | |||
6944 | 6944 | ||
6945 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) | 6945 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) |
6946 | { | 6946 | { |
6947 | struct root_domain *old_rd = NULL; | ||
6947 | unsigned long flags; | 6948 | unsigned long flags; |
6948 | 6949 | ||
6949 | spin_lock_irqsave(&rq->lock, flags); | 6950 | spin_lock_irqsave(&rq->lock, flags); |
6950 | 6951 | ||
6951 | if (rq->rd) { | 6952 | if (rq->rd) { |
6952 | struct root_domain *old_rd = rq->rd; | 6953 | old_rd = rq->rd; |
6953 | 6954 | ||
6954 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) | 6955 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) |
6955 | set_rq_offline(rq); | 6956 | set_rq_offline(rq); |
6956 | 6957 | ||
6957 | cpumask_clear_cpu(rq->cpu, old_rd->span); | 6958 | cpumask_clear_cpu(rq->cpu, old_rd->span); |
6958 | 6959 | ||
6959 | if (atomic_dec_and_test(&old_rd->refcount)) | 6960 | /* |
6960 | free_rootdomain(old_rd); | 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 | atomic_inc(&rd->refcount); | 6969 | atomic_inc(&rd->refcount); |
@@ -6968,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
6968 | set_rq_online(rq); | 6974 | set_rq_online(rq); |
6969 | 6975 | ||
6970 | spin_unlock_irqrestore(&rq->lock, flags); | 6976 | spin_unlock_irqrestore(&rq->lock, flags); |
6977 | |||
6978 | if (old_rd) | ||
6979 | free_rootdomain(old_rd); | ||
6971 | } | 6980 | } |
6972 | 6981 | ||
6973 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) | 6982 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 3b91da064820..e82cb9e930cc 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -176,7 +176,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
176 | 176 | ||
177 | what |= ddir_act[rw & WRITE]; | 177 | what |= ddir_act[rw & WRITE]; |
178 | what |= MASK_TC_BIT(rw, BARRIER); | 178 | what |= MASK_TC_BIT(rw, BARRIER); |
179 | what |= MASK_TC_BIT(rw, SYNC); | 179 | what |= MASK_TC_BIT(rw, SYNCIO); |
180 | what |= MASK_TC_BIT(rw, AHEAD); | 180 | what |= MASK_TC_BIT(rw, AHEAD); |
181 | what |= MASK_TC_BIT(rw, META); | 181 | what |= MASK_TC_BIT(rw, META); |
182 | what |= MASK_TC_BIT(rw, DISCARD); | 182 | what |= MASK_TC_BIT(rw, DISCARD); |
diff --git a/mm/mlock.c b/mm/mlock.c index 037161d61b4e..cbe9e0581b75 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -660,7 +660,7 @@ void *alloc_locked_buffer(size_t size) | |||
660 | return buffer; | 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 | unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; | 665 | unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; |
666 | 666 | ||
@@ -670,6 +670,11 @@ void free_locked_buffer(void *buffer, size_t size) | |||
670 | current->mm->locked_vm -= pgsz; | 670 | current->mm->locked_vm -= pgsz; |
671 | 671 | ||
672 | up_write(¤t->mm->mmap_sem); | 672 | up_write(¤t->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 | kfree(buffer); | 679 | kfree(buffer); |
675 | } | 680 | } |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3c84128596ba..74dc57c74349 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -240,7 +240,7 @@ void bdi_writeout_inc(struct backing_dev_info *bdi) | |||
240 | } | 240 | } |
241 | EXPORT_SYMBOL_GPL(bdi_writeout_inc); | 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 | prop_inc_single(&vm_dirties, &tsk->dirties); | 245 | prop_inc_single(&vm_dirties, &tsk->dirties); |
246 | } | 246 | } |
@@ -1230,6 +1230,7 @@ int __set_page_dirty_nobuffers(struct page *page) | |||
1230 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 1230 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
1231 | __inc_bdi_stat(mapping->backing_dev_info, | 1231 | __inc_bdi_stat(mapping->backing_dev_info, |
1232 | BDI_RECLAIMABLE); | 1232 | BDI_RECLAIMABLE); |
1233 | task_dirty_inc(current); | ||
1233 | task_io_account_write(PAGE_CACHE_SIZE); | 1234 | task_io_account_write(PAGE_CACHE_SIZE); |
1234 | } | 1235 | } |
1235 | radix_tree_tag_set(&mapping->page_tree, | 1236 | radix_tree_tag_set(&mapping->page_tree, |
@@ -1262,7 +1263,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage); | |||
1262 | * If the mapping doesn't provide a set_page_dirty a_op, then | 1263 | * If the mapping doesn't provide a set_page_dirty a_op, then |
1263 | * just fall through and assume that it wants buffer_heads. | 1264 | * just fall through and assume that it wants buffer_heads. |
1264 | */ | 1265 | */ |
1265 | static int __set_page_dirty(struct page *page) | 1266 | int set_page_dirty(struct page *page) |
1266 | { | 1267 | { |
1267 | struct address_space *mapping = page_mapping(page); | 1268 | struct address_space *mapping = page_mapping(page); |
1268 | 1269 | ||
@@ -1280,14 +1281,6 @@ static int __set_page_dirty(struct page *page) | |||
1280 | } | 1281 | } |
1281 | return 0; | 1282 | return 0; |
1282 | } | 1283 | } |
1283 | |||
1284 | int set_page_dirty(struct page *page) | ||
1285 | { | ||
1286 | int ret = __set_page_dirty(page); | ||
1287 | if (ret) | ||
1288 | task_dirty_inc(current); | ||
1289 | return ret; | ||
1290 | } | ||
1291 | EXPORT_SYMBOL(set_page_dirty); | 1284 | EXPORT_SYMBOL(set_page_dirty); |
1292 | 1285 | ||
1293 | /* | 1286 | /* |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5675b3073854..5c44ed49ca93 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2989,7 +2989,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid) | |||
2989 | * was used and there are no special requirements, this is a convenient | 2989 | * was used and there are no special requirements, this is a convenient |
2990 | * alternative | 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 | int i; | 2994 | int i; |
2995 | 2995 | ||
@@ -3000,10 +3000,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn) | |||
3000 | if (start_pfn <= pfn && pfn < end_pfn) | 3000 | if (start_pfn <= pfn && pfn < end_pfn) |
3001 | return early_node_map[i].nid; | 3001 | return early_node_map[i].nid; |
3002 | } | 3002 | } |
3003 | /* This is a memory hole */ | ||
3004 | return -1; | ||
3005 | } | ||
3006 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
3007 | |||
3008 | int __meminit early_pfn_to_nid(unsigned long pfn) | ||
3009 | { | ||
3010 | int nid; | ||
3003 | 3011 | ||
3012 | nid = __early_pfn_to_nid(pfn); | ||
3013 | if (nid >= 0) | ||
3014 | return nid; | ||
3015 | /* just returns 0 */ | ||
3004 | return 0; | 3016 | return 0; |
3005 | } | 3017 | } |
3006 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | 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 | /* Basic iterator support to walk early_node_map[] */ | 3031 | /* Basic iterator support to walk early_node_map[] */ |
3009 | #define for_each_active_range_index_in_nid(i, nid) \ | 3032 | #define for_each_active_range_index_in_nid(i, nid) \ |
diff --git a/mm/page_io.c b/mm/page_io.c index dc6ce0afbded..3023c475e041 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -111,7 +111,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) | |||
111 | goto out; | 111 | goto out; |
112 | } | 112 | } |
113 | if (wbc->sync_mode == WB_SYNC_ALL) | 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 | count_vm_event(PSWPOUT); | 115 | count_vm_event(PSWPOUT); |
116 | set_page_writeback(page); | 116 | set_page_writeback(page); |
117 | unlock_page(page); | 117 | unlock_page(page); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 75f49d312e8c..4dd2636d0b92 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1106,6 +1106,14 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | |||
1106 | } | 1106 | } |
1107 | EXPORT_SYMBOL_GPL(__get_vm_area); | 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 | * get_vm_area - reserve a contiguous kernel virtual area | 1118 | * get_vm_area - reserve a contiguous kernel virtual area |
1111 | * @size: size of the area | 1119 | * @size: size of the area |
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index b0246307aac4..12caa822a232 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
@@ -51,7 +51,7 @@ my %pidctr; | |||
51 | 51 | ||
52 | while (<>) { | 52 | while (<>) { |
53 | my $line = $_; | 53 | my $line = $_; |
54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { | 54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { |
55 | my $func = $2; | 55 | my $func = $2; |
56 | if ($done == 0) { | 56 | if ($done == 0) { |
57 | $start{$func} = $1; | 57 | $start{$func} = $1; |
@@ -87,7 +87,7 @@ while (<>) { | |||
87 | $count = $count + 1; | 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 | if ($done == 0) { | 91 | if ($done == 0) { |
92 | $end{$2} = $1; | 92 | $end{$2} = $1; |
93 | $maxtime = $1; | 93 | $maxtime = $1; |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index d40449cafa84..528492bcba5b 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!/usr/bin/perl |
2 | 2 | ||
3 | use File::Basename; | 3 | use File::Basename; |
4 | 4 | ||
@@ -29,27 +29,151 @@ my $filename = $vmlinux_name; | |||
29 | my $target = "0"; | 29 | my $target = "0"; |
30 | my $function; | 30 | my $function; |
31 | my $module = ""; | 31 | my $module = ""; |
32 | my $func_offset; | 32 | my $func_offset = 0; |
33 | my $vmaoffset = 0; | 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 | while (<STDIN>) { | 148 | while (<STDIN>) { |
36 | my $line = $_; | 149 | my $line = $_; |
37 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { | 150 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { |
38 | $target = $1; | 151 | $target = $1; |
39 | } | 152 | } |
153 | if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) { | ||
154 | $target = $1; | ||
155 | } | ||
40 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | 156 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { |
41 | $function = $1; | 157 | $function = $1; |
42 | $func_offset = $2; | 158 | $func_offset = $2; |
43 | } | 159 | } |
160 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | ||
161 | $function = $1; | ||
162 | $func_offset = $2; | ||
163 | } | ||
44 | 164 | ||
45 | # check if it's a module | 165 | # check if it's a module |
46 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { | 166 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { |
47 | $module = $3; | 167 | $module = $3; |
48 | } | 168 | } |
169 | 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\_\-]+)\]/) { | ||
170 | $module = $3; | ||
171 | } | ||
172 | parse_x86_regs($line); | ||
49 | } | 173 | } |
50 | 174 | ||
51 | my $decodestart = hex($target) - hex($func_offset); | 175 | my $decodestart = hex($target) - hex($func_offset); |
52 | my $decodestop = $decodestart + 8192; | 176 | my $decodestop = hex($target) + 8192; |
53 | if ($target eq "0") { | 177 | if ($target eq "0") { |
54 | print "No oops found!\n"; | 178 | print "No oops found!\n"; |
55 | print "Usage: \n"; | 179 | print "Usage: \n"; |
@@ -84,6 +208,7 @@ my $counter = 0; | |||
84 | my $state = 0; | 208 | my $state = 0; |
85 | my $center = 0; | 209 | my $center = 0; |
86 | my @lines; | 210 | my @lines; |
211 | my @reglines; | ||
87 | 212 | ||
88 | sub InRange { | 213 | sub InRange { |
89 | my ($address, $target) = @_; | 214 | my ($address, $target) = @_; |
@@ -188,16 +313,36 @@ while ($finish < $counter) { | |||
188 | 313 | ||
189 | my $i; | 314 | my $i; |
190 | 315 | ||
191 | my $fulltext = ""; | 316 | |
317 | # start annotating the registers in the asm. | ||
318 | # this goes from the oopsing point back, so that the annotator | ||
319 | # can track (opportunistically) which registers got written and | ||
320 | # whos value no longer is relevant. | ||
321 | |||
322 | $i = $center; | ||
323 | while ($i >= $start) { | ||
324 | $reglines[$i] = process_x86_regs($lines[$i], $center - $i); | ||
325 | $i = $i - 1; | ||
326 | } | ||
327 | |||
192 | $i = $start; | 328 | $i = $start; |
193 | while ($i < $finish) { | 329 | while ($i < $finish) { |
330 | my $line; | ||
194 | if ($i == $center) { | 331 | if ($i == $center) { |
195 | $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n"; | 332 | $line = "*$lines[$i] "; |
196 | } else { | 333 | } else { |
197 | $fulltext = $fulltext . " $lines[$i]\n"; | 334 | $line = " $lines[$i] "; |
335 | } | ||
336 | print $line; | ||
337 | if (defined($reglines[$i]) && length($reglines[$i]) > 0) { | ||
338 | my $c = 60 - length($line); | ||
339 | while ($c > 0) { print " "; $c = $c - 1; }; | ||
340 | print "| $reglines[$i]"; | ||
198 | } | 341 | } |
342 | if ($i == $center) { | ||
343 | print "<--- faulting instruction"; | ||
344 | } | ||
345 | print "\n"; | ||
199 | $i = $i +1; | 346 | $i = $i +1; |
200 | } | 347 | } |
201 | 348 | ||
202 | print $fulltext; | ||
203 | |||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 491b8b1b6abf..4eea60b1693e 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size, | |||
210 | static int do_hid_entry(const char *filename, | 210 | static int do_hid_entry(const char *filename, |
211 | struct hid_device_id *id, char *alias) | 211 | struct hid_device_id *id, char *alias) |
212 | { | 212 | { |
213 | id->bus = TO_NATIVE(id->bus); | ||
213 | id->vendor = TO_NATIVE(id->vendor); | 214 | id->vendor = TO_NATIVE(id->vendor); |
214 | id->product = TO_NATIVE(id->product); | 215 | id->product = TO_NATIVE(id->product); |
215 | 216 | ||
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2500886fb90a..ee448cdc6a2b 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -86,6 +86,14 @@ echo "%endif" | |||
86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
87 | 87 | ||
88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 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 | echo "" | 97 | echo "" |
90 | echo "%clean" | 98 | echo "%clean" |
91 | echo '#echo -rf $RPM_BUILD_ROOT' | 99 | echo '#echo -rf $RPM_BUILD_ROOT' |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f6946cf99ce1..f1c4b35bc324 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -58,14 +58,7 @@ fi | |||
58 | # Check for svn and a svn repo. | 58 | # Check for svn and a svn repo. |
59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then | 59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
60 | rev=`echo $rev | awk '{print $NF}'` | 60 | rev=`echo $rev | awk '{print $NF}'` |
61 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` | 61 | printf -- '-svn%s' "$rev" |
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 | ||
69 | 62 | ||
70 | # All done with svn | 63 | # All done with svn |
71 | exit | 64 | exit |
diff --git a/scripts/tags.sh b/scripts/tags.sh index fdbe78bb5e2b..5bd8b1003d44 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -76,7 +76,10 @@ all_sources() | |||
76 | 76 | ||
77 | all_kconfigs() | 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 | all_defconfigs() | 85 | all_defconfigs() |
@@ -99,7 +102,8 @@ exuberant() | |||
99 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
100 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
101 | --extra=+f --c-kinds=+px \ | 104 | --extra=+f --c-kinds=+px \ |
102 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' | 105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | ||
103 | 107 | ||
104 | all_kconfigs | xargs $1 -a \ | 108 | all_kconfigs | xargs $1 -a \ |
105 | --langdef=kconfig --language-force=kconfig \ | 109 | --langdef=kconfig --language-force=kconfig \ |
@@ -117,7 +121,9 @@ exuberant() | |||
117 | 121 | ||
118 | emacs() | 122 | emacs() |
119 | { | 123 | { |
120 | all_sources | xargs $1 -a | 124 | all_sources | xargs $1 -a \ |
125 | --regex='/^ENTRY(\([^)]*\)).*/\1/' \ | ||
126 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' | ||
121 | 127 | ||
122 | all_kconfigs | xargs $1 -a \ | 128 | all_kconfigs | xargs $1 -a \ |
123 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 129 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index e9693a29d00e..4c4037503600 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -73,14 +73,13 @@ static int kvm_iommu_map_memslots(struct kvm *kvm) | |||
73 | { | 73 | { |
74 | int i, r = 0; | 74 | int i, r = 0; |
75 | 75 | ||
76 | down_read(&kvm->slots_lock); | ||
77 | for (i = 0; i < kvm->nmemslots; i++) { | 76 | for (i = 0; i < kvm->nmemslots; i++) { |
78 | r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, | 77 | r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, |
79 | kvm->memslots[i].npages); | 78 | kvm->memslots[i].npages); |
80 | if (r) | 79 | if (r) |
81 | break; | 80 | break; |
82 | } | 81 | } |
83 | up_read(&kvm->slots_lock); | 82 | |
84 | return r; | 83 | return r; |
85 | } | 84 | } |
86 | 85 | ||
@@ -190,12 +189,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | |||
190 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | 189 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) |
191 | { | 190 | { |
192 | int i; | 191 | int i; |
193 | down_read(&kvm->slots_lock); | 192 | |
194 | for (i = 0; i < kvm->nmemslots; i++) { | 193 | for (i = 0; i < kvm->nmemslots; i++) { |
195 | kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, | 194 | kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, |
196 | kvm->memslots[i].npages); | 195 | kvm->memslots[i].npages); |
197 | } | 196 | } |
198 | up_read(&kvm->slots_lock); | ||
199 | 197 | ||
200 | return 0; | 198 | return 0; |
201 | } | 199 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 3a5a08298aab..29a667ce35b0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -173,7 +173,6 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work) | |||
173 | assigned_dev->host_irq_disabled = false; | 173 | assigned_dev->host_irq_disabled = false; |
174 | } | 174 | } |
175 | mutex_unlock(&assigned_dev->kvm->lock); | 175 | mutex_unlock(&assigned_dev->kvm->lock); |
176 | kvm_put_kvm(assigned_dev->kvm); | ||
177 | } | 176 | } |
178 | 177 | ||
179 | static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) | 178 | static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) |
@@ -181,8 +180,6 @@ static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) | |||
181 | struct kvm_assigned_dev_kernel *assigned_dev = | 180 | struct kvm_assigned_dev_kernel *assigned_dev = |
182 | (struct kvm_assigned_dev_kernel *) dev_id; | 181 | (struct kvm_assigned_dev_kernel *) dev_id; |
183 | 182 | ||
184 | kvm_get_kvm(assigned_dev->kvm); | ||
185 | |||
186 | schedule_work(&assigned_dev->interrupt_work); | 183 | schedule_work(&assigned_dev->interrupt_work); |
187 | 184 | ||
188 | disable_irq_nosync(irq); | 185 | disable_irq_nosync(irq); |
@@ -213,6 +210,7 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) | |||
213 | } | 210 | } |
214 | } | 211 | } |
215 | 212 | ||
213 | /* The function implicit hold kvm->lock mutex due to cancel_work_sync() */ | ||
216 | static void kvm_free_assigned_irq(struct kvm *kvm, | 214 | static void kvm_free_assigned_irq(struct kvm *kvm, |
217 | struct kvm_assigned_dev_kernel *assigned_dev) | 215 | struct kvm_assigned_dev_kernel *assigned_dev) |
218 | { | 216 | { |
@@ -228,11 +226,24 @@ static void kvm_free_assigned_irq(struct kvm *kvm, | |||
228 | if (!assigned_dev->irq_requested_type) | 226 | if (!assigned_dev->irq_requested_type) |
229 | return; | 227 | return; |
230 | 228 | ||
231 | if (cancel_work_sync(&assigned_dev->interrupt_work)) | 229 | /* |
232 | /* We had pending work. That means we will have to take | 230 | * In kvm_free_device_irq, cancel_work_sync return true if: |
233 | * care of kvm_put_kvm. | 231 | * 1. work is scheduled, and then cancelled. |
234 | */ | 232 | * 2. work callback is executed. |
235 | kvm_put_kvm(kvm); | 233 | * |
234 | * The first one ensured that the irq is disabled and no more events | ||
235 | * would happen. But for the second one, the irq may be enabled (e.g. | ||
236 | * for MSI). So we disable irq here to prevent further events. | ||
237 | * | ||
238 | * Notice this maybe result in nested disable if the interrupt type is | ||
239 | * INTx, but it's OK for we are going to free it. | ||
240 | * | ||
241 | * If this function is a part of VM destroy, please ensure that till | ||
242 | * now, the kvm state is still legal for probably we also have to wait | ||
243 | * interrupt_work done. | ||
244 | */ | ||
245 | disable_irq_nosync(assigned_dev->host_irq); | ||
246 | cancel_work_sync(&assigned_dev->interrupt_work); | ||
236 | 247 | ||
237 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); | 248 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); |
238 | 249 | ||
@@ -285,8 +296,8 @@ static int assigned_device_update_intx(struct kvm *kvm, | |||
285 | 296 | ||
286 | if (irqchip_in_kernel(kvm)) { | 297 | if (irqchip_in_kernel(kvm)) { |
287 | if (!msi2intx && | 298 | if (!msi2intx && |
288 | adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) { | 299 | (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) { |
289 | free_irq(adev->host_irq, (void *)kvm); | 300 | free_irq(adev->host_irq, (void *)adev); |
290 | pci_disable_msi(adev->dev); | 301 | pci_disable_msi(adev->dev); |
291 | } | 302 | } |
292 | 303 | ||
@@ -455,6 +466,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
455 | struct kvm_assigned_dev_kernel *match; | 466 | struct kvm_assigned_dev_kernel *match; |
456 | struct pci_dev *dev; | 467 | struct pci_dev *dev; |
457 | 468 | ||
469 | down_read(&kvm->slots_lock); | ||
458 | mutex_lock(&kvm->lock); | 470 | mutex_lock(&kvm->lock); |
459 | 471 | ||
460 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, | 472 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, |
@@ -516,6 +528,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
516 | 528 | ||
517 | out: | 529 | out: |
518 | mutex_unlock(&kvm->lock); | 530 | mutex_unlock(&kvm->lock); |
531 | up_read(&kvm->slots_lock); | ||
519 | return r; | 532 | return r; |
520 | out_list_del: | 533 | out_list_del: |
521 | list_del(&match->list); | 534 | list_del(&match->list); |
@@ -527,6 +540,7 @@ out_put: | |||
527 | out_free: | 540 | out_free: |
528 | kfree(match); | 541 | kfree(match); |
529 | mutex_unlock(&kvm->lock); | 542 | mutex_unlock(&kvm->lock); |
543 | up_read(&kvm->slots_lock); | ||
530 | return r; | 544 | return r; |
531 | } | 545 | } |
532 | #endif | 546 | #endif |
@@ -789,11 +803,19 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn, | |||
789 | return young; | 803 | return young; |
790 | } | 804 | } |
791 | 805 | ||
806 | static void kvm_mmu_notifier_release(struct mmu_notifier *mn, | ||
807 | struct mm_struct *mm) | ||
808 | { | ||
809 | struct kvm *kvm = mmu_notifier_to_kvm(mn); | ||
810 | kvm_arch_flush_shadow(kvm); | ||
811 | } | ||
812 | |||
792 | static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { | 813 | static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { |
793 | .invalidate_page = kvm_mmu_notifier_invalidate_page, | 814 | .invalidate_page = kvm_mmu_notifier_invalidate_page, |
794 | .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, | 815 | .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, |
795 | .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, | 816 | .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, |
796 | .clear_flush_young = kvm_mmu_notifier_clear_flush_young, | 817 | .clear_flush_young = kvm_mmu_notifier_clear_flush_young, |
818 | .release = kvm_mmu_notifier_release, | ||
797 | }; | 819 | }; |
798 | #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ | 820 | #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ |
799 | 821 | ||
@@ -883,6 +905,7 @@ static void kvm_destroy_vm(struct kvm *kvm) | |||
883 | { | 905 | { |
884 | struct mm_struct *mm = kvm->mm; | 906 | struct mm_struct *mm = kvm->mm; |
885 | 907 | ||
908 | kvm_arch_sync_events(kvm); | ||
886 | spin_lock(&kvm_lock); | 909 | spin_lock(&kvm_lock); |
887 | list_del(&kvm->vm_list); | 910 | list_del(&kvm->vm_list); |
888 | spin_unlock(&kvm_lock); | 911 | spin_unlock(&kvm_lock); |