diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-10 12:47:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-10 12:47:29 -0400 |
commit | f87f38ec5a5157aa39f44f6018dc58ea62f8e0e2 (patch) | |
tree | 1612249d11d455cfd6a0d691f5564673ae179c5f | |
parent | a6784ad7eafa74a085c8458909eda0699a8fcf57 (diff) | |
parent | 8dd779b19ce5972072ad2372a86c8acbae4da768 (diff) |
Merge branch 'x86/unify-pci' into x86/core
49 files changed, 431 insertions, 277 deletions
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c index 76935e320214..27a5b466c85c 100644 --- a/arch/mips/mm/c-r3k.c +++ b/arch/mips/mm/c-r3k.c | |||
@@ -26,7 +26,7 @@ | |||
26 | static unsigned long icache_size, dcache_size; /* Size in bytes */ | 26 | static unsigned long icache_size, dcache_size; /* Size in bytes */ |
27 | static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */ | 27 | static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */ |
28 | 28 | ||
29 | unsigned long __init r3k_cache_size(unsigned long ca_flags) | 29 | unsigned long __cpuinit r3k_cache_size(unsigned long ca_flags) |
30 | { | 30 | { |
31 | unsigned long flags, status, dummy, size; | 31 | unsigned long flags, status, dummy, size; |
32 | volatile unsigned long *p; | 32 | volatile unsigned long *p; |
@@ -61,7 +61,7 @@ unsigned long __init r3k_cache_size(unsigned long ca_flags) | |||
61 | return size * sizeof(*p); | 61 | return size * sizeof(*p); |
62 | } | 62 | } |
63 | 63 | ||
64 | unsigned long __init r3k_cache_lsize(unsigned long ca_flags) | 64 | unsigned long __cpuinit r3k_cache_lsize(unsigned long ca_flags) |
65 | { | 65 | { |
66 | unsigned long flags, status, lsize, i; | 66 | unsigned long flags, status, lsize, i; |
67 | volatile unsigned long *p; | 67 | volatile unsigned long *p; |
@@ -90,7 +90,7 @@ unsigned long __init r3k_cache_lsize(unsigned long ca_flags) | |||
90 | return lsize * sizeof(*p); | 90 | return lsize * sizeof(*p); |
91 | } | 91 | } |
92 | 92 | ||
93 | static void __init r3k_probe_cache(void) | 93 | static void __cpuinit r3k_probe_cache(void) |
94 | { | 94 | { |
95 | dcache_size = r3k_cache_size(ST0_ISC); | 95 | dcache_size = r3k_cache_size(ST0_ISC); |
96 | if (dcache_size) | 96 | if (dcache_size) |
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index 1edf0cbbeede..1417c6494858 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c | |||
@@ -235,13 +235,12 @@ static void __cpuinit set_prefetch_parameters(void) | |||
235 | } | 235 | } |
236 | /* | 236 | /* |
237 | * Too much unrolling will overflow the available space in | 237 | * Too much unrolling will overflow the available space in |
238 | * clear_space_array / copy_page_array. 8 words sounds generous, | 238 | * clear_space_array / copy_page_array. |
239 | * but a R4000 with 128 byte L2 line length can exceed even that. | ||
240 | */ | 239 | */ |
241 | half_clear_loop_size = min(8 * clear_word_size, | 240 | half_clear_loop_size = min(16 * clear_word_size, |
242 | max(cache_line_size >> 1, | 241 | max(cache_line_size >> 1, |
243 | 4 * clear_word_size)); | 242 | 4 * clear_word_size)); |
244 | half_copy_loop_size = min(8 * copy_word_size, | 243 | half_copy_loop_size = min(16 * copy_word_size, |
245 | max(cache_line_size >> 1, | 244 | max(cache_line_size >> 1, |
246 | 4 * copy_word_size)); | 245 | 4 * copy_word_size)); |
247 | } | 246 | } |
@@ -263,21 +262,23 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off) | |||
263 | if (pref_bias_clear_store) { | 262 | if (pref_bias_clear_store) { |
264 | uasm_i_pref(buf, pref_dst_mode, pref_bias_clear_store + off, | 263 | uasm_i_pref(buf, pref_dst_mode, pref_bias_clear_store + off, |
265 | A0); | 264 | A0); |
266 | } else if (cpu_has_cache_cdex_s) { | 265 | } else if (cache_line_size == (half_clear_loop_size << 1)) { |
267 | uasm_i_cache(buf, Create_Dirty_Excl_SD, off, A0); | 266 | if (cpu_has_cache_cdex_s) { |
268 | } else if (cpu_has_cache_cdex_p) { | 267 | uasm_i_cache(buf, Create_Dirty_Excl_SD, off, A0); |
269 | if (R4600_V1_HIT_CACHEOP_WAR && cpu_is_r4600_v1_x()) { | 268 | } else if (cpu_has_cache_cdex_p) { |
270 | uasm_i_nop(buf); | 269 | if (R4600_V1_HIT_CACHEOP_WAR && cpu_is_r4600_v1_x()) { |
271 | uasm_i_nop(buf); | 270 | uasm_i_nop(buf); |
272 | uasm_i_nop(buf); | 271 | uasm_i_nop(buf); |
273 | uasm_i_nop(buf); | 272 | uasm_i_nop(buf); |
274 | } | 273 | uasm_i_nop(buf); |
274 | } | ||
275 | 275 | ||
276 | if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) | 276 | if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) |
277 | uasm_i_lw(buf, ZERO, ZERO, AT); | 277 | uasm_i_lw(buf, ZERO, ZERO, AT); |
278 | 278 | ||
279 | uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0); | 279 | uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0); |
280 | } | 280 | } |
281 | } | ||
281 | } | 282 | } |
282 | 283 | ||
283 | void __cpuinit build_clear_page(void) | 284 | void __cpuinit build_clear_page(void) |
@@ -403,20 +404,22 @@ static inline void build_copy_store_pref(u32 **buf, int off) | |||
403 | if (pref_bias_copy_store) { | 404 | if (pref_bias_copy_store) { |
404 | uasm_i_pref(buf, pref_dst_mode, pref_bias_copy_store + off, | 405 | uasm_i_pref(buf, pref_dst_mode, pref_bias_copy_store + off, |
405 | A0); | 406 | A0); |
406 | } else if (cpu_has_cache_cdex_s) { | 407 | } else if (cache_line_size == (half_copy_loop_size << 1)) { |
407 | uasm_i_cache(buf, Create_Dirty_Excl_SD, off, A0); | 408 | if (cpu_has_cache_cdex_s) { |
408 | } else if (cpu_has_cache_cdex_p) { | 409 | uasm_i_cache(buf, Create_Dirty_Excl_SD, off, A0); |
409 | if (R4600_V1_HIT_CACHEOP_WAR && cpu_is_r4600_v1_x()) { | 410 | } else if (cpu_has_cache_cdex_p) { |
410 | uasm_i_nop(buf); | 411 | if (R4600_V1_HIT_CACHEOP_WAR && cpu_is_r4600_v1_x()) { |
411 | uasm_i_nop(buf); | 412 | uasm_i_nop(buf); |
412 | uasm_i_nop(buf); | 413 | uasm_i_nop(buf); |
413 | uasm_i_nop(buf); | 414 | uasm_i_nop(buf); |
414 | } | 415 | uasm_i_nop(buf); |
416 | } | ||
415 | 417 | ||
416 | if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) | 418 | if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) |
417 | uasm_i_lw(buf, ZERO, ZERO, AT); | 419 | uasm_i_lw(buf, ZERO, ZERO, AT); |
418 | 420 | ||
419 | uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0); | 421 | uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0); |
422 | } | ||
420 | } | 423 | } |
421 | } | 424 | } |
422 | 425 | ||
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c index fc227f3b1199..e3abfb2d7e86 100644 --- a/arch/mips/mm/sc-rm7k.c +++ b/arch/mips/mm/sc-rm7k.c | |||
@@ -86,7 +86,7 @@ static void rm7k_sc_inv(unsigned long addr, unsigned long size) | |||
86 | /* | 86 | /* |
87 | * This function is executed in uncached address space. | 87 | * This function is executed in uncached address space. |
88 | */ | 88 | */ |
89 | static __init void __rm7k_sc_enable(void) | 89 | static __cpuinit void __rm7k_sc_enable(void) |
90 | { | 90 | { |
91 | int i; | 91 | int i; |
92 | 92 | ||
@@ -107,7 +107,7 @@ static __init void __rm7k_sc_enable(void) | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | static __init void rm7k_sc_enable(void) | 110 | static __cpuinit void rm7k_sc_enable(void) |
111 | { | 111 | { |
112 | if (read_c0_config() & RM7K_CONF_SE) | 112 | if (read_c0_config() & RM7K_CONF_SE) |
113 | return; | 113 | return; |
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index cf37f5ca4b71..4d96e1db55ee 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -33,13 +33,14 @@ static struct legacy_serial_info { | |||
33 | phys_addr_t taddr; | 33 | phys_addr_t taddr; |
34 | } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; | 34 | } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; |
35 | 35 | ||
36 | static struct __initdata of_device_id parents[] = { | 36 | static struct __initdata of_device_id legacy_serial_parents[] = { |
37 | {.type = "soc",}, | 37 | {.type = "soc",}, |
38 | {.type = "tsi-bridge",}, | 38 | {.type = "tsi-bridge",}, |
39 | {.type = "opb", }, | 39 | {.type = "opb", }, |
40 | {.compatible = "ibm,opb",}, | 40 | {.compatible = "ibm,opb",}, |
41 | {.compatible = "simple-bus",}, | 41 | {.compatible = "simple-bus",}, |
42 | {.compatible = "wrs,epld-localbus",}, | 42 | {.compatible = "wrs,epld-localbus",}, |
43 | {}, | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | static unsigned int legacy_serial_count; | 46 | static unsigned int legacy_serial_count; |
@@ -327,7 +328,7 @@ void __init find_legacy_serial_ports(void) | |||
327 | struct device_node *parent = of_get_parent(np); | 328 | struct device_node *parent = of_get_parent(np); |
328 | if (!parent) | 329 | if (!parent) |
329 | continue; | 330 | continue; |
330 | if (of_match_node(parents, parent) != NULL) { | 331 | if (of_match_node(legacy_serial_parents, parent) != NULL) { |
331 | index = add_legacy_soc_port(np, np); | 332 | index = add_legacy_soc_port(np, np); |
332 | if (index >= 0 && np == stdout) | 333 | if (index >= 0 && np == stdout) |
333 | legacy_serial_console = index; | 334 | legacy_serial_console = index; |
diff --git a/arch/um/Makefile b/arch/um/Makefile index dbeab15e7bb7..ca40397017b9 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -77,7 +77,6 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) | |||
77 | KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ | 77 | KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ |
78 | -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) | 78 | -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) |
79 | KBUILD_CFLAGS += $(KERNEL_DEFINES) | 79 | KBUILD_CFLAGS += $(KERNEL_DEFINES) |
80 | KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,) | ||
81 | 80 | ||
82 | PHONY += linux | 81 | PHONY += linux |
83 | 82 | ||
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 561e373bd850..302cbe504543 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 | |||
@@ -32,4 +32,11 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) | |||
32 | # an unresolved reference. | 32 | # an unresolved reference. |
33 | cflags-y += -ffreestanding | 33 | cflags-y += -ffreestanding |
34 | 34 | ||
35 | # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use | ||
36 | # a lot more stack due to the lack of sharing of stacklots. Also, gcc | ||
37 | # 4.3.0 needs -funit-at-a-time for extern inline functions. | ||
38 | KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \ | ||
39 | echo $(call cc-option,-fno-unit-at-a-time); \ | ||
40 | else echo $(call cc-option,-funit-at-a-time); fi ;) | ||
41 | |||
35 | KBUILD_CFLAGS += $(cflags-y) | 42 | KBUILD_CFLAGS += $(cflags-y) |
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index 8ed362f93582..a9cd7e77a7ab 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 | |||
@@ -21,3 +21,6 @@ HEADER_ARCH := x86 | |||
21 | 21 | ||
22 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 | 22 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 |
23 | LINK-y += -m64 | 23 | LINK-y += -m64 |
24 | |||
25 | # Do unit-at-a-time unconditionally on x86_64, following the host | ||
26 | KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) | ||
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile index c5c8e485fc44..99d9f095e4d4 100644 --- a/arch/x86/pci/Makefile +++ b/arch/x86/pci/Makefile | |||
@@ -1,5 +1,19 @@ | |||
1 | ifeq ($(CONFIG_X86_32),y) | 1 | obj-y := i386.o init.o |
2 | include ${srctree}/arch/x86/pci/Makefile_32 | 2 | |
3 | else | 3 | obj-$(CONFIG_PCI_BIOS) += pcbios.o |
4 | include ${srctree}/arch/x86/pci/Makefile_64 | 4 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o |
5 | endif | 5 | obj-$(CONFIG_PCI_DIRECT) += direct.o |
6 | obj-$(CONFIG_PCI_OLPC) += olpc.o | ||
7 | |||
8 | pci-y := fixup.o | ||
9 | pci-$(CONFIG_ACPI) += acpi.o | ||
10 | pci-y += legacy.o irq.o | ||
11 | |||
12 | # Careful: VISWS overrule the pci-y above. The colons are | ||
13 | # therefor correct. This needs a proper fix by distangling the code. | ||
14 | pci-$(CONFIG_X86_VISWS) := visws.o fixup.o | ||
15 | |||
16 | pci-$(CONFIG_X86_NUMAQ) += numa.o | ||
17 | |||
18 | obj-y += $(pci-y) common.o early.o | ||
19 | obj-y += amd_bus.o | ||
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32 deleted file mode 100644 index a34fbf557926..000000000000 --- a/arch/x86/pci/Makefile_32 +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | obj-y := i386.o init.o | ||
2 | |||
3 | obj-$(CONFIG_PCI_BIOS) += pcbios.o | ||
4 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o | ||
5 | obj-$(CONFIG_PCI_DIRECT) += direct.o | ||
6 | obj-$(CONFIG_PCI_OLPC) += olpc.o | ||
7 | |||
8 | pci-y := fixup.o | ||
9 | |||
10 | # Do not change the ordering here. There is a nasty init function | ||
11 | # ordering dependency which breaks when you move acpi.o below | ||
12 | # legacy/irq.o | ||
13 | pci-$(CONFIG_ACPI) += acpi.o | ||
14 | pci-y += legacy.o irq.o | ||
15 | |||
16 | # Careful: VISWS overrule the pci-y above. The colons are | ||
17 | # therefor correct. This needs a proper fix by distangling the code. | ||
18 | pci-$(CONFIG_X86_VISWS) := visws.o fixup.o | ||
19 | |||
20 | pci-$(CONFIG_X86_NUMAQ) += numa.o | ||
21 | |||
22 | # Necessary for NUMAQ as well | ||
23 | pci-$(CONFIG_NUMA) += mp_bus_to_node.o | ||
24 | |||
25 | obj-y += $(pci-y) common.o early.o | ||
26 | obj-y += amd_bus.o | ||
diff --git a/arch/x86/pci/Makefile_64 b/arch/x86/pci/Makefile_64 deleted file mode 100644 index fd47068c95de..000000000000 --- a/arch/x86/pci/Makefile_64 +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for X86_64 specific PCI routines | ||
3 | # | ||
4 | # Reuse the i386 PCI subsystem | ||
5 | # | ||
6 | EXTRA_CFLAGS += -Iarch/x86/pci | ||
7 | |||
8 | obj-y := i386.o | ||
9 | obj-$(CONFIG_PCI_DIRECT)+= direct.o | ||
10 | obj-y += fixup.o init.o | ||
11 | obj-$(CONFIG_ACPI) += acpi.o | ||
12 | obj-y += legacy.o irq.o common.o early.o | ||
13 | # mmconfig has a 64bit special | ||
14 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o | ||
15 | |||
16 | obj-y += amd_bus.o | ||
17 | |||
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 4fa52d3dc848..19af06927fbc 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -223,7 +223,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
223 | return bus; | 223 | return bus; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int __init pci_acpi_init(void) | 226 | int __init pci_acpi_init(void) |
227 | { | 227 | { |
228 | struct pci_dev *dev = NULL; | 228 | struct pci_dev *dev = NULL; |
229 | 229 | ||
@@ -257,4 +257,3 @@ static int __init pci_acpi_init(void) | |||
257 | 257 | ||
258 | return 0; | 258 | return 0; |
259 | } | 259 | } |
260 | subsys_initcall(pci_acpi_init); | ||
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index d02c598451ec..a18141ae3f02 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -1,44 +1,25 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/pci.h> | 2 | #include <linux/pci.h> |
3 | #include <linux/topology.h> | ||
3 | #include "pci.h" | 4 | #include "pci.h" |
4 | 5 | ||
5 | #ifdef CONFIG_X86_64 | 6 | #ifdef CONFIG_X86_64 |
6 | |||
7 | #include <asm/pci-direct.h> | 7 | #include <asm/pci-direct.h> |
8 | #include <asm/mpspec.h> | 8 | #include <asm/mpspec.h> |
9 | #include <linux/cpumask.h> | 9 | #include <linux/cpumask.h> |
10 | #include <linux/topology.h> | 10 | #endif |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * This discovers the pcibus <-> node mapping on AMD K8. | 13 | * This discovers the pcibus <-> node mapping on AMD K8. |
14 | * also get peer root bus resource for io,mmio | 14 | * also get peer root bus resource for io,mmio |
15 | */ | 15 | */ |
16 | 16 | ||
17 | |||
18 | /* | ||
19 | * sub bus (transparent) will use entres from 3 to store extra from root, | ||
20 | * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES? | ||
21 | */ | ||
22 | #define RES_NUM 16 | ||
23 | struct pci_root_info { | ||
24 | char name[12]; | ||
25 | unsigned int res_num; | ||
26 | struct resource res[RES_NUM]; | ||
27 | int bus_min; | ||
28 | int bus_max; | ||
29 | int node; | ||
30 | int link; | ||
31 | }; | ||
32 | |||
33 | /* 4 at this time, it may become to 32 */ | ||
34 | #define PCI_ROOT_NR 4 | ||
35 | static int pci_root_num; | ||
36 | static struct pci_root_info pci_root_info[PCI_ROOT_NR]; | ||
37 | |||
38 | #ifdef CONFIG_NUMA | 17 | #ifdef CONFIG_NUMA |
39 | 18 | ||
40 | #define BUS_NR 256 | 19 | #define BUS_NR 256 |
41 | 20 | ||
21 | #ifdef CONFIG_X86_64 | ||
22 | |||
42 | static int mp_bus_to_node[BUS_NR]; | 23 | static int mp_bus_to_node[BUS_NR]; |
43 | 24 | ||
44 | void set_mp_bus_to_node(int busnum, int node) | 25 | void set_mp_bus_to_node(int busnum, int node) |
@@ -65,7 +46,52 @@ int get_mp_bus_to_node(int busnum) | |||
65 | 46 | ||
66 | return node; | 47 | return node; |
67 | } | 48 | } |
68 | #endif | 49 | |
50 | #else /* CONFIG_X86_32 */ | ||
51 | |||
52 | static unsigned char mp_bus_to_node[BUS_NR]; | ||
53 | |||
54 | void set_mp_bus_to_node(int busnum, int node) | ||
55 | { | ||
56 | if (busnum >= 0 && busnum < BUS_NR) | ||
57 | mp_bus_to_node[busnum] = (unsigned char) node; | ||
58 | } | ||
59 | |||
60 | int get_mp_bus_to_node(int busnum) | ||
61 | { | ||
62 | int node; | ||
63 | |||
64 | if (busnum < 0 || busnum > (BUS_NR - 1)) | ||
65 | return 0; | ||
66 | node = mp_bus_to_node[busnum]; | ||
67 | return node; | ||
68 | } | ||
69 | |||
70 | #endif /* CONFIG_X86_32 */ | ||
71 | |||
72 | #endif /* CONFIG_NUMA */ | ||
73 | |||
74 | #ifdef CONFIG_X86_64 | ||
75 | |||
76 | /* | ||
77 | * sub bus (transparent) will use entres from 3 to store extra from root, | ||
78 | * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES? | ||
79 | */ | ||
80 | #define RES_NUM 16 | ||
81 | struct pci_root_info { | ||
82 | char name[12]; | ||
83 | unsigned int res_num; | ||
84 | struct resource res[RES_NUM]; | ||
85 | int bus_min; | ||
86 | int bus_max; | ||
87 | int node; | ||
88 | int link; | ||
89 | }; | ||
90 | |||
91 | /* 4 at this time, it may become to 32 */ | ||
92 | #define PCI_ROOT_NR 4 | ||
93 | static int pci_root_num; | ||
94 | static struct pci_root_info pci_root_info[PCI_ROOT_NR]; | ||
69 | 95 | ||
70 | void set_pci_bus_resources_arch_default(struct pci_bus *b) | 96 | void set_pci_bus_resources_arch_default(struct pci_bus *b) |
71 | { | 97 | { |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 940185ecaeda..20b9f59f95df 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -328,18 +328,18 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = { | |||
328 | #endif | 328 | #endif |
329 | { | 329 | { |
330 | .callback = set_bf_sort, | 330 | .callback = set_bf_sort, |
331 | .ident = "HP ProLiant DL360", | 331 | .ident = "HP ProLiant DL385 G2", |
332 | .matches = { | 332 | .matches = { |
333 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), | 333 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
334 | DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"), | 334 | DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"), |
335 | }, | 335 | }, |
336 | }, | 336 | }, |
337 | { | 337 | { |
338 | .callback = set_bf_sort, | 338 | .callback = set_bf_sort, |
339 | .ident = "HP ProLiant DL380", | 339 | .ident = "HP ProLiant DL585 G2", |
340 | .matches = { | 340 | .matches = { |
341 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), | 341 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
342 | DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"), | 342 | DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"), |
343 | }, | 343 | }, |
344 | }, | 344 | }, |
345 | {} | 345 | {} |
@@ -384,7 +384,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum) | |||
384 | 384 | ||
385 | extern u8 pci_cache_line_size; | 385 | extern u8 pci_cache_line_size; |
386 | 386 | ||
387 | static int __init pcibios_init(void) | 387 | int __init pcibios_init(void) |
388 | { | 388 | { |
389 | struct cpuinfo_x86 *c = &boot_cpu_data; | 389 | struct cpuinfo_x86 *c = &boot_cpu_data; |
390 | 390 | ||
@@ -411,8 +411,6 @@ static int __init pcibios_init(void) | |||
411 | return 0; | 411 | return 0; |
412 | } | 412 | } |
413 | 413 | ||
414 | subsys_initcall(pcibios_init); | ||
415 | |||
416 | char * __devinit pcibios_setup(char *str) | 414 | char * __devinit pcibios_setup(char *str) |
417 | { | 415 | { |
418 | if (!strcmp(str, "off")) { | 416 | if (!strcmp(str, "off")) { |
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c index b821f4462d99..d6c950f81858 100644 --- a/arch/x86/pci/init.c +++ b/arch/x86/pci/init.c | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | /* arch_initcall has too random ordering, so call the initializers | 5 | /* arch_initcall has too random ordering, so call the initializers |
6 | in the right sequence from here. */ | 6 | in the right sequence from here. */ |
7 | static __init int pci_access_init(void) | 7 | static __init int pci_arch_init(void) |
8 | { | 8 | { |
9 | #ifdef CONFIG_PCI_DIRECT | 9 | #ifdef CONFIG_PCI_DIRECT |
10 | int type = 0; | 10 | int type = 0; |
@@ -40,4 +40,4 @@ static __init int pci_access_init(void) | |||
40 | 40 | ||
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | arch_initcall(pci_access_init); | 43 | arch_initcall(pci_arch_init); |
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index f0859de23e20..dc568c6b83f8 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -1107,7 +1107,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = { | |||
1107 | { } | 1107 | { } |
1108 | }; | 1108 | }; |
1109 | 1109 | ||
1110 | static int __init pcibios_irq_init(void) | 1110 | int __init pcibios_irq_init(void) |
1111 | { | 1111 | { |
1112 | DBG(KERN_DEBUG "PCI: IRQ init\n"); | 1112 | DBG(KERN_DEBUG "PCI: IRQ init\n"); |
1113 | 1113 | ||
@@ -1142,9 +1142,6 @@ static int __init pcibios_irq_init(void) | |||
1142 | return 0; | 1142 | return 0; |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | subsys_initcall(pcibios_irq_init); | ||
1146 | |||
1147 | |||
1148 | static void pirq_penalize_isa_irq(int irq, int active) | 1145 | static void pirq_penalize_isa_irq(int irq, int active) |
1149 | { | 1146 | { |
1150 | /* | 1147 | /* |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index a67921ce60af..3c1d795cbbe9 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -55,4 +55,13 @@ static int __init pci_legacy_init(void) | |||
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | subsys_initcall(pci_legacy_init); | 58 | int __init pci_subsys_init(void) |
59 | { | ||
60 | #ifdef CONFIG_ACPI | ||
61 | pci_acpi_init(); | ||
62 | #endif | ||
63 | pci_legacy_init(); | ||
64 | pcibios_irq_init(); | ||
65 | pcibios_init(); | ||
66 | } | ||
67 | subsys_initcall(pci_subsys_init); | ||
diff --git a/arch/x86/pci/mp_bus_to_node.c b/arch/x86/pci/mp_bus_to_node.c deleted file mode 100644 index 022943999b84..000000000000 --- a/arch/x86/pci/mp_bus_to_node.c +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include <linux/pci.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/topology.h> | ||
4 | |||
5 | #define BUS_NR 256 | ||
6 | |||
7 | static unsigned char mp_bus_to_node[BUS_NR]; | ||
8 | |||
9 | void set_mp_bus_to_node(int busnum, int node) | ||
10 | { | ||
11 | if (busnum >= 0 && busnum < BUS_NR) | ||
12 | mp_bus_to_node[busnum] = (unsigned char) node; | ||
13 | } | ||
14 | |||
15 | int get_mp_bus_to_node(int busnum) | ||
16 | { | ||
17 | int node; | ||
18 | |||
19 | if (busnum < 0 || busnum > (BUS_NR - 1)) | ||
20 | return 0; | ||
21 | node = mp_bus_to_node[busnum]; | ||
22 | return node; | ||
23 | } | ||
diff --git a/arch/x86/pci/numa.c b/arch/x86/pci/numa.c index 99f1ecd485b5..e1620dc8649a 100644 --- a/arch/x86/pci/numa.c +++ b/arch/x86/pci/numa.c | |||
@@ -177,4 +177,10 @@ static int __init pci_numa_init(void) | |||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | subsys_initcall(pci_numa_init); | 180 | static __init int pci_subsys_init(void) |
181 | { | ||
182 | pci_numa_init(); | ||
183 | pcibios_irq_init(); | ||
184 | pcibios_init(); | ||
185 | } | ||
186 | subsys_initcall(pci_subsys_init); | ||
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index ba263e626a68..58241748470f 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
@@ -39,9 +39,6 @@ enum pci_bf_sort_state { | |||
39 | pci_dmi_bf, | 39 | pci_dmi_bf, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | extern void __init dmi_check_pciprobe(void); | ||
43 | extern void __init dmi_check_skip_isa_align(void); | ||
44 | |||
45 | /* pci-i386.c */ | 42 | /* pci-i386.c */ |
46 | 43 | ||
47 | extern unsigned int pcibios_max_latency; | 44 | extern unsigned int pcibios_max_latency; |
@@ -99,10 +96,18 @@ extern struct pci_raw_ops *raw_pci_ext_ops; | |||
99 | 96 | ||
100 | extern struct pci_raw_ops pci_direct_conf1; | 97 | extern struct pci_raw_ops pci_direct_conf1; |
101 | 98 | ||
99 | /* arch_initcall level */ | ||
102 | extern int pci_direct_probe(void); | 100 | extern int pci_direct_probe(void); |
103 | extern void pci_direct_init(int type); | 101 | extern void pci_direct_init(int type); |
104 | extern void pci_pcbios_init(void); | 102 | extern void pci_pcbios_init(void); |
105 | extern int pci_olpc_init(void); | 103 | extern int pci_olpc_init(void); |
104 | extern void __init dmi_check_pciprobe(void); | ||
105 | extern void __init dmi_check_skip_isa_align(void); | ||
106 | |||
107 | /* some common used subsys_initcalls */ | ||
108 | extern int __init pci_acpi_init(void); | ||
109 | extern int __init pcibios_irq_init(void); | ||
110 | extern int __init pcibios_init(void); | ||
106 | 111 | ||
107 | /* pci-mmconfig.c */ | 112 | /* pci-mmconfig.c */ |
108 | 113 | ||
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c index c2df4e97eed6..16e52063ecb3 100644 --- a/arch/x86/pci/visws.c +++ b/arch/x86/pci/visws.c | |||
@@ -85,7 +85,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq) | |||
85 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 85 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
86 | } | 86 | } |
87 | 87 | ||
88 | static int __init pcibios_init(void) | 88 | static int __init pci_visws_init(void) |
89 | { | 89 | { |
90 | /* The VISWS supports configuration access type 1 only */ | 90 | /* The VISWS supports configuration access type 1 only */ |
91 | pci_probe = (pci_probe | PCI_PROBE_CONF1) & | 91 | pci_probe = (pci_probe | PCI_PROBE_CONF1) & |
@@ -105,4 +105,9 @@ static int __init pcibios_init(void) | |||
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
107 | 107 | ||
108 | subsys_initcall(pcibios_init); | 108 | static __init int pci_subsys_init(void) |
109 | { | ||
110 | pci_visws_init(); | ||
111 | pcibios_init(); | ||
112 | } | ||
113 | subsys_initcall(pci_subsys_init); | ||
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index cc24803fadff..2f2b4f4cf229 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
@@ -76,7 +76,7 @@ struct palm_bk3710_udmatiming { | |||
76 | 76 | ||
77 | #include "../ide-timing.h" | 77 | #include "../ide-timing.h" |
78 | 78 | ||
79 | static long ide_palm_clk; | 79 | static unsigned ideclk_period; /* in nanoseconds */ |
80 | 80 | ||
81 | static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { | 81 | static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { |
82 | {160, 240}, /* UDMA Mode 0 */ | 82 | {160, 240}, /* UDMA Mode 0 */ |
@@ -86,8 +86,6 @@ static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { | |||
86 | {85, 60}, /* UDMA Mode 4 */ | 86 | {85, 60}, /* UDMA Mode 4 */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static struct clk *ideclkp; | ||
90 | |||
91 | static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, | 89 | static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, |
92 | unsigned int mode) | 90 | unsigned int mode) |
93 | { | 91 | { |
@@ -97,10 +95,10 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, | |||
97 | 95 | ||
98 | /* DMA Data Setup */ | 96 | /* DMA Data Setup */ |
99 | t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime, | 97 | t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime, |
100 | ide_palm_clk) - 1; | 98 | ideclk_period) - 1; |
101 | tenv = DIV_ROUND_UP(20, ide_palm_clk) - 1; | 99 | tenv = DIV_ROUND_UP(20, ideclk_period) - 1; |
102 | trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime, | 100 | trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime, |
103 | ide_palm_clk) - 1; | 101 | ideclk_period) - 1; |
104 | 102 | ||
105 | /* udmatim Register */ | 103 | /* udmatim Register */ |
106 | val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); | 104 | val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); |
@@ -141,8 +139,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev, | |||
141 | cycletime = max_t(int, t->cycle, min_cycle); | 139 | cycletime = max_t(int, t->cycle, min_cycle); |
142 | 140 | ||
143 | /* DMA Data Setup */ | 141 | /* DMA Data Setup */ |
144 | t0 = DIV_ROUND_UP(cycletime, ide_palm_clk); | 142 | t0 = DIV_ROUND_UP(cycletime, ideclk_period); |
145 | td = DIV_ROUND_UP(t->active, ide_palm_clk); | 143 | td = DIV_ROUND_UP(t->active, ideclk_period); |
146 | tkw = t0 - td - 1; | 144 | tkw = t0 - td - 1; |
147 | td -= 1; | 145 | td -= 1; |
148 | 146 | ||
@@ -168,9 +166,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, | |||
168 | struct ide_timing *t; | 166 | struct ide_timing *t; |
169 | 167 | ||
170 | /* PIO Data Setup */ | 168 | /* PIO Data Setup */ |
171 | t0 = DIV_ROUND_UP(cycletime, ide_palm_clk); | 169 | t0 = DIV_ROUND_UP(cycletime, ideclk_period); |
172 | t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active, | 170 | t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active, |
173 | ide_palm_clk); | 171 | ideclk_period); |
174 | 172 | ||
175 | t2i = t0 - t2 - 1; | 173 | t2i = t0 - t2 - 1; |
176 | t2 -= 1; | 174 | t2 -= 1; |
@@ -192,8 +190,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, | |||
192 | 190 | ||
193 | /* TASKFILE Setup */ | 191 | /* TASKFILE Setup */ |
194 | t = ide_timing_find_mode(XFER_PIO_0 + mode); | 192 | t = ide_timing_find_mode(XFER_PIO_0 + mode); |
195 | t0 = DIV_ROUND_UP(t->cyc8b, ide_palm_clk); | 193 | t0 = DIV_ROUND_UP(t->cyc8b, ideclk_period); |
196 | t2 = DIV_ROUND_UP(t->act8b, ide_palm_clk); | 194 | t2 = DIV_ROUND_UP(t->act8b, ideclk_period); |
197 | 195 | ||
198 | t2i = t0 - t2 - 1; | 196 | t2i = t0 - t2 - 1; |
199 | t2 -= 1; | 197 | t2 -= 1; |
@@ -350,22 +348,22 @@ static const struct ide_port_info __devinitdata palm_bk3710_port_info = { | |||
350 | 348 | ||
351 | static int __devinit palm_bk3710_probe(struct platform_device *pdev) | 349 | static int __devinit palm_bk3710_probe(struct platform_device *pdev) |
352 | { | 350 | { |
353 | struct clk *clkp; | 351 | struct clk *clk; |
354 | struct resource *mem, *irq; | 352 | struct resource *mem, *irq; |
355 | ide_hwif_t *hwif; | 353 | ide_hwif_t *hwif; |
356 | unsigned long base; | 354 | unsigned long base, rate; |
357 | int i; | 355 | int i; |
358 | hw_regs_t hw; | 356 | hw_regs_t hw; |
359 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 357 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
360 | 358 | ||
361 | clkp = clk_get(NULL, "IDECLK"); | 359 | clk = clk_get(NULL, "IDECLK"); |
362 | if (IS_ERR(clkp)) | 360 | if (IS_ERR(clk)) |
363 | return -ENODEV; | 361 | return -ENODEV; |
364 | 362 | ||
365 | ideclkp = clkp; | 363 | clk_enable(clk); |
366 | clk_enable(ideclkp); | 364 | rate = clk_get_rate(clk); |
367 | ide_palm_clk = clk_get_rate(ideclkp)/100000; | 365 | ideclk_period = 1000000000UL / rate; |
368 | ide_palm_clk = (10000/ide_palm_clk) + 1; | 366 | |
369 | /* Register the IDE interface with Linux ATA Interface */ | 367 | /* Register the IDE interface with Linux ATA Interface */ |
370 | memset(&hw, 0, sizeof(hw)); | 368 | memset(&hw, 0, sizeof(hw)); |
371 | 369 | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index d27061b39324..26e68b65b7cf 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1218,16 +1218,12 @@ static void drive_release_dev (struct device *dev) | |||
1218 | complete(&drive->gendev_rel_comp); | 1218 | complete(&drive->gendev_rel_comp); |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | #ifndef ide_default_irq | ||
1222 | #define ide_default_irq(irq) 0 | ||
1223 | #endif | ||
1224 | |||
1225 | static int hwif_init(ide_hwif_t *hwif) | 1221 | static int hwif_init(ide_hwif_t *hwif) |
1226 | { | 1222 | { |
1227 | int old_irq; | 1223 | int old_irq; |
1228 | 1224 | ||
1229 | if (!hwif->irq) { | 1225 | if (!hwif->irq) { |
1230 | hwif->irq = ide_default_irq(hwif->io_ports.data_addr); | 1226 | hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); |
1231 | if (!hwif->irq) { | 1227 | if (!hwif->irq) { |
1232 | printk("%s: DISABLED, NO IRQ\n", hwif->name); | 1228 | printk("%s: DISABLED, NO IRQ\n", hwif->name); |
1233 | return 0; | 1229 | return 0; |
@@ -1257,7 +1253,7 @@ static int hwif_init(ide_hwif_t *hwif) | |||
1257 | * It failed to initialise. Find the default IRQ for | 1253 | * It failed to initialise. Find the default IRQ for |
1258 | * this port and try that. | 1254 | * this port and try that. |
1259 | */ | 1255 | */ |
1260 | hwif->irq = ide_default_irq(hwif->io_ports.data_addr); | 1256 | hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); |
1261 | if (!hwif->irq) { | 1257 | if (!hwif->irq) { |
1262 | printk("%s: Disabled unable to get IRQ %d.\n", | 1258 | printk("%s: Disabled unable to get IRQ %d.\n", |
1263 | hwif->name, old_irq); | 1259 | hwif->name, old_irq); |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 9053c8771e6e..2b71bdf74e73 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -184,8 +184,7 @@ static const struct ide_port_info it8213_chipsets[] __devinitdata = { | |||
184 | 184 | ||
185 | static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 185 | static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
186 | { | 186 | { |
187 | ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]); | 187 | return ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]); |
188 | return 0; | ||
189 | } | 188 | } |
190 | 189 | ||
191 | static const struct pci_device_id it8213_pci_tbl[] = { | 190 | static const struct pci_device_id it8213_pci_tbl[] = { |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index fec4955f449b..a7a41bb82778 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -225,10 +225,6 @@ static int ns87415_dma_setup(ide_drive_t *drive) | |||
225 | return 1; | 225 | return 1; |
226 | } | 226 | } |
227 | 227 | ||
228 | #ifndef ide_default_irq | ||
229 | #define ide_default_irq(irq) 0 | ||
230 | #endif | ||
231 | |||
232 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 228 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
233 | { | 229 | { |
234 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 230 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
@@ -288,7 +284,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | |||
288 | } | 284 | } |
289 | 285 | ||
290 | if (!using_inta) | 286 | if (!using_inta) |
291 | hwif->irq = ide_default_irq(hwif->io_ports.data_addr); | 287 | hwif->irq = __ide_default_irq(hwif->io_ports.data_addr); |
292 | else if (!hwif->irq && hwif->mate && hwif->mate->irq) | 288 | else if (!hwif->irq && hwif->mate && hwif->mate->irq) |
293 | hwif->irq = hwif->mate->irq; /* share IRQ with mate */ | 289 | hwif->irq = hwif->mate->irq; /* share IRQ with mate */ |
294 | 290 | ||
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index fe872fbd671e..e01926b7b5b7 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0091" | 43 | #define DRV_VERSION "EHEA_0092" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
@@ -452,7 +452,7 @@ struct ehea_bcmc_reg_entry { | |||
452 | struct ehea_bcmc_reg_array { | 452 | struct ehea_bcmc_reg_array { |
453 | struct ehea_bcmc_reg_entry *arr; | 453 | struct ehea_bcmc_reg_entry *arr; |
454 | int num_entries; | 454 | int num_entries; |
455 | struct mutex lock; | 455 | spinlock_t lock; |
456 | }; | 456 | }; |
457 | 457 | ||
458 | #define EHEA_PORT_UP 1 | 458 | #define EHEA_PORT_UP 1 |
@@ -478,6 +478,7 @@ struct ehea_port { | |||
478 | int num_add_tx_qps; | 478 | int num_add_tx_qps; |
479 | int num_mcs; | 479 | int num_mcs; |
480 | int resets; | 480 | int resets; |
481 | u64 flags; | ||
481 | u64 mac_addr; | 482 | u64 mac_addr; |
482 | u32 logical_port_id; | 483 | u32 logical_port_id; |
483 | u32 port_speed; | 484 | u32 port_speed; |
@@ -501,7 +502,8 @@ struct port_res_cfg { | |||
501 | }; | 502 | }; |
502 | 503 | ||
503 | enum ehea_flag_bits { | 504 | enum ehea_flag_bits { |
504 | __EHEA_STOP_XFER | 505 | __EHEA_STOP_XFER, |
506 | __EHEA_DISABLE_PORT_RESET | ||
505 | }; | 507 | }; |
506 | 508 | ||
507 | void ehea_set_ethtool_ops(struct net_device *netdev); | 509 | void ehea_set_ethtool_ops(struct net_device *netdev); |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 075fd547421e..0920b796bd78 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -118,6 +118,7 @@ static struct of_device_id ehea_device_table[] = { | |||
118 | }, | 118 | }, |
119 | {}, | 119 | {}, |
120 | }; | 120 | }; |
121 | MODULE_DEVICE_TABLE(of, ehea_device_table); | ||
121 | 122 | ||
122 | static struct of_platform_driver ehea_driver = { | 123 | static struct of_platform_driver ehea_driver = { |
123 | .name = "ehea", | 124 | .name = "ehea", |
@@ -137,6 +138,12 @@ void ehea_dump(void *adr, int len, char *msg) | |||
137 | } | 138 | } |
138 | } | 139 | } |
139 | 140 | ||
141 | void ehea_schedule_port_reset(struct ehea_port *port) | ||
142 | { | ||
143 | if (!test_bit(__EHEA_DISABLE_PORT_RESET, &port->flags)) | ||
144 | schedule_work(&port->reset_task); | ||
145 | } | ||
146 | |||
140 | static void ehea_update_firmware_handles(void) | 147 | static void ehea_update_firmware_handles(void) |
141 | { | 148 | { |
142 | struct ehea_fw_handle_entry *arr = NULL; | 149 | struct ehea_fw_handle_entry *arr = NULL; |
@@ -241,7 +248,7 @@ static void ehea_update_bcmc_registrations(void) | |||
241 | } | 248 | } |
242 | 249 | ||
243 | if (num_registrations) { | 250 | if (num_registrations) { |
244 | arr = kzalloc(num_registrations * sizeof(*arr), GFP_KERNEL); | 251 | arr = kzalloc(num_registrations * sizeof(*arr), GFP_ATOMIC); |
245 | if (!arr) | 252 | if (!arr) |
246 | return; /* Keep the existing array */ | 253 | return; /* Keep the existing array */ |
247 | } else | 254 | } else |
@@ -301,7 +308,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) | |||
301 | 308 | ||
302 | memset(stats, 0, sizeof(*stats)); | 309 | memset(stats, 0, sizeof(*stats)); |
303 | 310 | ||
304 | cb2 = kzalloc(PAGE_SIZE, GFP_KERNEL); | 311 | cb2 = kzalloc(PAGE_SIZE, GFP_ATOMIC); |
305 | if (!cb2) { | 312 | if (!cb2) { |
306 | ehea_error("no mem for cb2"); | 313 | ehea_error("no mem for cb2"); |
307 | goto out; | 314 | goto out; |
@@ -587,7 +594,7 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, | |||
587 | "Resetting port.", pr->qp->init_attr.qp_nr); | 594 | "Resetting port.", pr->qp->init_attr.qp_nr); |
588 | ehea_dump(cqe, sizeof(*cqe), "CQE"); | 595 | ehea_dump(cqe, sizeof(*cqe), "CQE"); |
589 | } | 596 | } |
590 | schedule_work(&pr->port->reset_task); | 597 | ehea_schedule_port_reset(pr->port); |
591 | return 1; | 598 | return 1; |
592 | } | 599 | } |
593 | 600 | ||
@@ -616,7 +623,7 @@ static int get_skb_hdr(struct sk_buff *skb, void **iphdr, | |||
616 | *tcph = tcp_hdr(skb); | 623 | *tcph = tcp_hdr(skb); |
617 | 624 | ||
618 | /* check if ip header and tcp header are complete */ | 625 | /* check if ip header and tcp header are complete */ |
619 | if (iph->tot_len < ip_len + tcp_hdrlen(skb)) | 626 | if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb)) |
620 | return -1; | 627 | return -1; |
621 | 628 | ||
622 | *hdr_flags = LRO_IPV4 | LRO_TCP; | 629 | *hdr_flags = LRO_IPV4 | LRO_TCP; |
@@ -765,7 +772,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
765 | ehea_error("Send Completion Error: Resetting port"); | 772 | ehea_error("Send Completion Error: Resetting port"); |
766 | if (netif_msg_tx_err(pr->port)) | 773 | if (netif_msg_tx_err(pr->port)) |
767 | ehea_dump(cqe, sizeof(*cqe), "Send CQE"); | 774 | ehea_dump(cqe, sizeof(*cqe), "Send CQE"); |
768 | schedule_work(&pr->port->reset_task); | 775 | ehea_schedule_port_reset(pr->port); |
769 | break; | 776 | break; |
770 | } | 777 | } |
771 | 778 | ||
@@ -885,7 +892,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param) | |||
885 | eqe = ehea_poll_eq(port->qp_eq); | 892 | eqe = ehea_poll_eq(port->qp_eq); |
886 | } | 893 | } |
887 | 894 | ||
888 | schedule_work(&port->reset_task); | 895 | ehea_schedule_port_reset(port); |
889 | 896 | ||
890 | return IRQ_HANDLED; | 897 | return IRQ_HANDLED; |
891 | } | 898 | } |
@@ -1763,7 +1770,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1763 | 1770 | ||
1764 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); | 1771 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); |
1765 | 1772 | ||
1766 | mutex_lock(&ehea_bcmc_regs.lock); | 1773 | spin_lock(&ehea_bcmc_regs.lock); |
1767 | 1774 | ||
1768 | /* Deregister old MAC in pHYP */ | 1775 | /* Deregister old MAC in pHYP */ |
1769 | if (port->state == EHEA_PORT_UP) { | 1776 | if (port->state == EHEA_PORT_UP) { |
@@ -1785,7 +1792,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1785 | 1792 | ||
1786 | out_upregs: | 1793 | out_upregs: |
1787 | ehea_update_bcmc_registrations(); | 1794 | ehea_update_bcmc_registrations(); |
1788 | mutex_unlock(&ehea_bcmc_regs.lock); | 1795 | spin_unlock(&ehea_bcmc_regs.lock); |
1789 | out_free: | 1796 | out_free: |
1790 | kfree(cb0); | 1797 | kfree(cb0); |
1791 | out: | 1798 | out: |
@@ -1947,7 +1954,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1947 | } | 1954 | } |
1948 | ehea_promiscuous(dev, 0); | 1955 | ehea_promiscuous(dev, 0); |
1949 | 1956 | ||
1950 | mutex_lock(&ehea_bcmc_regs.lock); | 1957 | spin_lock(&ehea_bcmc_regs.lock); |
1951 | 1958 | ||
1952 | if (dev->flags & IFF_ALLMULTI) { | 1959 | if (dev->flags & IFF_ALLMULTI) { |
1953 | ehea_allmulti(dev, 1); | 1960 | ehea_allmulti(dev, 1); |
@@ -1978,7 +1985,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1978 | } | 1985 | } |
1979 | out: | 1986 | out: |
1980 | ehea_update_bcmc_registrations(); | 1987 | ehea_update_bcmc_registrations(); |
1981 | mutex_unlock(&ehea_bcmc_regs.lock); | 1988 | spin_unlock(&ehea_bcmc_regs.lock); |
1982 | return; | 1989 | return; |
1983 | } | 1990 | } |
1984 | 1991 | ||
@@ -2497,7 +2504,7 @@ static int ehea_up(struct net_device *dev) | |||
2497 | } | 2504 | } |
2498 | } | 2505 | } |
2499 | 2506 | ||
2500 | mutex_lock(&ehea_bcmc_regs.lock); | 2507 | spin_lock(&ehea_bcmc_regs.lock); |
2501 | 2508 | ||
2502 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); | 2509 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); |
2503 | if (ret) { | 2510 | if (ret) { |
@@ -2520,7 +2527,7 @@ out: | |||
2520 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); | 2527 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); |
2521 | 2528 | ||
2522 | ehea_update_bcmc_registrations(); | 2529 | ehea_update_bcmc_registrations(); |
2523 | mutex_unlock(&ehea_bcmc_regs.lock); | 2530 | spin_unlock(&ehea_bcmc_regs.lock); |
2524 | 2531 | ||
2525 | ehea_update_firmware_handles(); | 2532 | ehea_update_firmware_handles(); |
2526 | mutex_unlock(&ehea_fw_handles.lock); | 2533 | mutex_unlock(&ehea_fw_handles.lock); |
@@ -2575,7 +2582,7 @@ static int ehea_down(struct net_device *dev) | |||
2575 | 2582 | ||
2576 | mutex_lock(&ehea_fw_handles.lock); | 2583 | mutex_lock(&ehea_fw_handles.lock); |
2577 | 2584 | ||
2578 | mutex_lock(&ehea_bcmc_regs.lock); | 2585 | spin_lock(&ehea_bcmc_regs.lock); |
2579 | ehea_drop_multicast_list(dev); | 2586 | ehea_drop_multicast_list(dev); |
2580 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2587 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
2581 | 2588 | ||
@@ -2584,7 +2591,7 @@ static int ehea_down(struct net_device *dev) | |||
2584 | port->state = EHEA_PORT_DOWN; | 2591 | port->state = EHEA_PORT_DOWN; |
2585 | 2592 | ||
2586 | ehea_update_bcmc_registrations(); | 2593 | ehea_update_bcmc_registrations(); |
2587 | mutex_unlock(&ehea_bcmc_regs.lock); | 2594 | spin_unlock(&ehea_bcmc_regs.lock); |
2588 | 2595 | ||
2589 | ret = ehea_clean_all_portres(port); | 2596 | ret = ehea_clean_all_portres(port); |
2590 | if (ret) | 2597 | if (ret) |
@@ -2605,13 +2612,14 @@ static int ehea_stop(struct net_device *dev) | |||
2605 | if (netif_msg_ifdown(port)) | 2612 | if (netif_msg_ifdown(port)) |
2606 | ehea_info("disabling port %s", dev->name); | 2613 | ehea_info("disabling port %s", dev->name); |
2607 | 2614 | ||
2615 | set_bit(__EHEA_DISABLE_PORT_RESET, &port->flags); | ||
2608 | cancel_work_sync(&port->reset_task); | 2616 | cancel_work_sync(&port->reset_task); |
2609 | |||
2610 | mutex_lock(&port->port_lock); | 2617 | mutex_lock(&port->port_lock); |
2611 | netif_stop_queue(dev); | 2618 | netif_stop_queue(dev); |
2612 | port_napi_disable(port); | 2619 | port_napi_disable(port); |
2613 | ret = ehea_down(dev); | 2620 | ret = ehea_down(dev); |
2614 | mutex_unlock(&port->port_lock); | 2621 | mutex_unlock(&port->port_lock); |
2622 | clear_bit(__EHEA_DISABLE_PORT_RESET, &port->flags); | ||
2615 | return ret; | 2623 | return ret; |
2616 | } | 2624 | } |
2617 | 2625 | ||
@@ -2941,7 +2949,7 @@ static void ehea_tx_watchdog(struct net_device *dev) | |||
2941 | 2949 | ||
2942 | if (netif_carrier_ok(dev) && | 2950 | if (netif_carrier_ok(dev) && |
2943 | !test_bit(__EHEA_STOP_XFER, &ehea_driver_flags)) | 2951 | !test_bit(__EHEA_STOP_XFER, &ehea_driver_flags)) |
2944 | schedule_work(&port->reset_task); | 2952 | ehea_schedule_port_reset(port); |
2945 | } | 2953 | } |
2946 | 2954 | ||
2947 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) | 2955 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) |
@@ -3590,7 +3598,7 @@ int __init ehea_module_init(void) | |||
3590 | memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); | 3598 | memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); |
3591 | 3599 | ||
3592 | mutex_init(&ehea_fw_handles.lock); | 3600 | mutex_init(&ehea_fw_handles.lock); |
3593 | mutex_init(&ehea_bcmc_regs.lock); | 3601 | spin_lock_init(&ehea_bcmc_regs.lock); |
3594 | 3602 | ||
3595 | ret = check_module_parm(); | 3603 | ret = check_module_parm(); |
3596 | if (ret) | 3604 | if (ret) |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 2cb244763292..20d4fe96a81c 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -4194,12 +4194,23 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
4194 | 4194 | ||
4195 | netif_carrier_off(dev); | 4195 | netif_carrier_off(dev); |
4196 | if (netif_running(dev)) { | 4196 | if (netif_running(dev)) { |
4197 | unsigned long flags; | ||
4198 | |||
4197 | nv_disable_irq(dev); | 4199 | nv_disable_irq(dev); |
4198 | netif_tx_lock_bh(dev); | 4200 | netif_tx_lock_bh(dev); |
4199 | spin_lock(&np->lock); | 4201 | /* with plain spinlock lockdep complains */ |
4202 | spin_lock_irqsave(&np->lock, flags); | ||
4200 | /* stop engines */ | 4203 | /* stop engines */ |
4204 | /* FIXME: | ||
4205 | * this can take some time, and interrupts are disabled | ||
4206 | * due to spin_lock_irqsave, but let's hope no daemon | ||
4207 | * is going to change the settings very often... | ||
4208 | * Worst case: | ||
4209 | * NV_RXSTOP_DELAY1MAX + NV_TXSTOP_DELAY1MAX | ||
4210 | * + some minor delays, which is up to a second approximately | ||
4211 | */ | ||
4201 | nv_stop_rxtx(dev); | 4212 | nv_stop_rxtx(dev); |
4202 | spin_unlock(&np->lock); | 4213 | spin_unlock_irqrestore(&np->lock, flags); |
4203 | netif_tx_unlock_bh(dev); | 4214 | netif_tx_unlock_bh(dev); |
4204 | } | 4215 | } |
4205 | 4216 | ||
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index e36321152d50..8268b3535b30 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -463,6 +463,9 @@ static void restart(struct net_device *dev) | |||
463 | else | 463 | else |
464 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 464 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
465 | 465 | ||
466 | /* Restore multicast and promiscuous settings */ | ||
467 | set_multicast_list(dev); | ||
468 | |||
466 | S32(fccp, fcc_gfmr, FCC_GFMR_ENR | FCC_GFMR_ENT); | 469 | S32(fccp, fcc_gfmr, FCC_GFMR_ENR | FCC_GFMR_ENT); |
467 | } | 470 | } |
468 | 471 | ||
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 5d2108c5ac7c..babc79ad490b 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -1636,6 +1636,12 @@ static int emac_poll_rx(void *param, int budget) | |||
1636 | goto next; | 1636 | goto next; |
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | if (len < ETH_HLEN) { | ||
1640 | ++dev->estats.rx_dropped_stack; | ||
1641 | emac_recycle_rx_skb(dev, slot, len); | ||
1642 | goto next; | ||
1643 | } | ||
1644 | |||
1639 | if (len && len < EMAC_RX_COPY_THRESH) { | 1645 | if (len && len < EMAC_RX_COPY_THRESH) { |
1640 | struct sk_buff *copy_skb = | 1646 | struct sk_buff *copy_skb = |
1641 | alloc_skb(len + EMAC_RX_SKB_HEADROOM + 2, GFP_ATOMIC); | 1647 | alloc_skb(len + EMAC_RX_SKB_HEADROOM + 2, GFP_ATOMIC); |
@@ -2719,6 +2725,8 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2719 | /* Clean rings */ | 2725 | /* Clean rings */ |
2720 | memset(dev->tx_desc, 0, NUM_TX_BUFF * sizeof(struct mal_descriptor)); | 2726 | memset(dev->tx_desc, 0, NUM_TX_BUFF * sizeof(struct mal_descriptor)); |
2721 | memset(dev->rx_desc, 0, NUM_RX_BUFF * sizeof(struct mal_descriptor)); | 2727 | memset(dev->rx_desc, 0, NUM_RX_BUFF * sizeof(struct mal_descriptor)); |
2728 | memset(dev->tx_skb, 0, NUM_TX_BUFF * sizeof(struct sk_buff *)); | ||
2729 | memset(dev->rx_skb, 0, NUM_RX_BUFF * sizeof(struct sk_buff *)); | ||
2722 | 2730 | ||
2723 | /* Attach to ZMII, if needed */ | 2731 | /* Attach to ZMII, if needed */ |
2724 | if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII) && | 2732 | if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII) && |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 3b2a6c598088..993d87c9296f 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -277,7 +277,7 @@ static int get_skb_hdr(struct sk_buff *skb, void **iphdr, | |||
277 | *tcph = tcp_hdr(skb); | 277 | *tcph = tcp_hdr(skb); |
278 | 278 | ||
279 | /* check if ip header and tcp header are complete */ | 279 | /* check if ip header and tcp header are complete */ |
280 | if (iph->tot_len < ip_len + tcp_hdrlen(skb)) | 280 | if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb)) |
281 | return -1; | 281 | return -1; |
282 | 282 | ||
283 | *hdr_flags = LRO_IPV4 | LRO_TCP; | 283 | *hdr_flags = LRO_IPV4 | LRO_TCP; |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 520bb0b1a9a2..6d35155c7145 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -1008,6 +1008,7 @@ static int fr_rx(struct sk_buff *skb) | |||
1008 | stats->rx_bytes += skb->len; | 1008 | stats->rx_bytes += skb->len; |
1009 | if (pvc->state.becn) | 1009 | if (pvc->state.becn) |
1010 | stats->rx_compressed++; | 1010 | stats->rx_compressed++; |
1011 | skb->dev = dev; | ||
1011 | netif_rx(skb); | 1012 | netif_rx(skb); |
1012 | return NET_RX_SUCCESS; | 1013 | return NET_RX_SUCCESS; |
1013 | } else { | 1014 | } else { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 62a3d8f8563e..f5387a7a76c0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -588,8 +588,12 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv, | |||
588 | 588 | ||
589 | if (rate == -1) | 589 | if (rate == -1) |
590 | iwl3945_rt->rt_rate = 0; | 590 | iwl3945_rt->rt_rate = 0; |
591 | else | 591 | else { |
592 | if (stats->band == IEEE80211_BAND_5GHZ) | ||
593 | rate += IWL_FIRST_OFDM_RATE; | ||
594 | |||
592 | iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; | 595 | iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; |
596 | } | ||
593 | 597 | ||
594 | /* antenna number */ | 598 | /* antenna number */ |
595 | antenna = phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK; | 599 | antenna = phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index bf19eb8aafd0..de330ae0ca95 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -3528,8 +3528,12 @@ static void iwl4965_add_radiotap(struct iwl_priv *priv, | |||
3528 | 3528 | ||
3529 | if (rate == -1) | 3529 | if (rate == -1) |
3530 | iwl4965_rt->rt_rate = 0; | 3530 | iwl4965_rt->rt_rate = 0; |
3531 | else | 3531 | else { |
3532 | if (stats->band == IEEE80211_BAND_5GHZ) | ||
3533 | rate += IWL_FIRST_OFDM_RATE; | ||
3534 | |||
3532 | iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee; | 3535 | iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee; |
3536 | } | ||
3533 | 3537 | ||
3534 | /* | 3538 | /* |
3535 | * "antenna number" | 3539 | * "antenna number" |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b1b3c523185d..6027e1119c3f 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -6687,7 +6687,8 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
6687 | 6687 | ||
6688 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | 6688 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { |
6689 | IWL_DEBUG_MAC80211("leave - monitor\n"); | 6689 | IWL_DEBUG_MAC80211("leave - monitor\n"); |
6690 | return -1; | 6690 | dev_kfree_skb_any(skb); |
6691 | return 0; | ||
6691 | } | 6692 | } |
6692 | 6693 | ||
6693 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 6694 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5ed16ce78468..0bd55bb19739 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -6237,7 +6237,8 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
6237 | 6237 | ||
6238 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | 6238 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { |
6239 | IWL_DEBUG_MAC80211("leave - monitor\n"); | 6239 | IWL_DEBUG_MAC80211("leave - monitor\n"); |
6240 | return -1; | 6240 | dev_kfree_skb_any(skb); |
6241 | return 0; | ||
6241 | } | 6242 | } |
6242 | 6243 | ||
6243 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 6244 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 8032df72aaab..36288b29abf7 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -925,6 +925,7 @@ static struct usb_driver if_usb_driver = { | |||
925 | .id_table = if_usb_table, | 925 | .id_table = if_usb_table, |
926 | .suspend = if_usb_suspend, | 926 | .suspend = if_usb_suspend, |
927 | .resume = if_usb_resume, | 927 | .resume = if_usb_resume, |
928 | .reset_resume = if_usb_resume, | ||
928 | }; | 929 | }; |
929 | 930 | ||
930 | static int __init if_usb_init_module(void) | 931 | static int __init if_usb_init_module(void) |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 58d43daec084..982a2064fe4c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -204,7 +204,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | |||
204 | * Note: assumes we have exclusive access to this mapping either | 204 | * Note: assumes we have exclusive access to this mapping either |
205 | * through inode->i_mutex or some other mechanism. | 205 | * through inode->i_mutex or some other mechanism. |
206 | */ | 206 | */ |
207 | if (page->index == 0 && invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1) < 0) { | 207 | if (invalidate_inode_pages2_range(inode->i_mapping, page->index + 1, -1) < 0) { |
208 | /* Should never happen */ | 208 | /* Should never happen */ |
209 | nfs_zap_mapping(inode, inode->i_mapping); | 209 | nfs_zap_mapping(inode, inode->i_mapping); |
210 | } | 210 | } |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 57917932212e..192269698a8a 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -45,6 +45,8 @@ void reiserfs_delete_inode(struct inode *inode) | |||
45 | goto out; | 45 | goto out; |
46 | reiserfs_update_inode_transaction(inode); | 46 | reiserfs_update_inode_transaction(inode); |
47 | 47 | ||
48 | reiserfs_discard_prealloc(&th, inode); | ||
49 | |||
48 | err = reiserfs_delete_object(&th, inode); | 50 | err = reiserfs_delete_object(&th, inode); |
49 | 51 | ||
50 | /* Do quota update inside a transaction for journaled quotas. We must do that | 52 | /* Do quota update inside a transaction for journaled quotas. We must do that |
diff --git a/include/asm-powerpc/hugetlb.h b/include/asm-powerpc/hugetlb.h index 649c6c3b87b3..be32ff02f4a0 100644 --- a/include/asm-powerpc/hugetlb.h +++ b/include/asm-powerpc/hugetlb.h | |||
@@ -49,12 +49,6 @@ static inline pte_t huge_pte_wrprotect(pte_t pte) | |||
49 | return pte_wrprotect(pte); | 49 | return pte_wrprotect(pte); |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, | ||
53 | unsigned long addr, pte_t *ptep) | ||
54 | { | ||
55 | ptep_set_wrprotect(mm, addr, ptep); | ||
56 | } | ||
57 | |||
58 | static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, | 52 | static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, |
59 | unsigned long addr, pte_t *ptep, | 53 | unsigned long addr, pte_t *ptep, |
60 | pte_t pte, int dirty) | 54 | pte_t pte, int dirty) |
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h index cc6a43ba41d0..7686569a0bef 100644 --- a/include/asm-powerpc/pgtable-ppc64.h +++ b/include/asm-powerpc/pgtable-ppc64.h | |||
@@ -314,6 +314,16 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
314 | old = pte_update(mm, addr, ptep, _PAGE_RW, 0); | 314 | old = pte_update(mm, addr, ptep, _PAGE_RW, 0); |
315 | } | 315 | } |
316 | 316 | ||
317 | static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, | ||
318 | unsigned long addr, pte_t *ptep) | ||
319 | { | ||
320 | unsigned long old; | ||
321 | |||
322 | if ((pte_val(*ptep) & _PAGE_RW) == 0) | ||
323 | return; | ||
324 | old = pte_update(mm, addr, ptep, _PAGE_RW, 1); | ||
325 | } | ||
326 | |||
317 | /* | 327 | /* |
318 | * We currently remove entries from the hashtable regardless of whether | 328 | * We currently remove entries from the hashtable regardless of whether |
319 | * the entry was young or dirty. The generic routines only flush if the | 329 | * the entry was young or dirty. The generic routines only flush if the |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index c7f4f8e3e297..bd0ea191dfa9 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -223,6 +223,9 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
223 | #define _PAGE_SPECIAL 0x004 /* SW associated with special page */ | 223 | #define _PAGE_SPECIAL 0x004 /* SW associated with special page */ |
224 | #define __HAVE_ARCH_PTE_SPECIAL | 224 | #define __HAVE_ARCH_PTE_SPECIAL |
225 | 225 | ||
226 | /* Set of bits not changed in pte_modify */ | ||
227 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_SPECIAL) | ||
228 | |||
226 | /* Six different types of pages. */ | 229 | /* Six different types of pages. */ |
227 | #define _PAGE_TYPE_EMPTY 0x400 | 230 | #define _PAGE_TYPE_EMPTY 0x400 |
228 | #define _PAGE_TYPE_NONE 0x401 | 231 | #define _PAGE_TYPE_NONE 0x401 |
@@ -681,7 +684,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
681 | */ | 684 | */ |
682 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 685 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
683 | { | 686 | { |
684 | pte_val(pte) &= PAGE_MASK; | 687 | pte_val(pte) &= _PAGE_CHG_MASK; |
685 | pte_val(pte) |= pgprot_val(newprot); | 688 | pte_val(pte) |= pgprot_val(newprot); |
686 | return pte; | 689 | return pte; |
687 | } | 690 | } |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9918772bf274..eddb6daadf4a 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -189,6 +189,21 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
189 | hw->io_ports.ctl_addr = ctl_addr; | 189 | hw->io_ports.ctl_addr = ctl_addr; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* for IDE PCI controllers in legacy mode, temporary */ | ||
193 | static inline int __ide_default_irq(unsigned long base) | ||
194 | { | ||
195 | switch (base) { | ||
196 | #ifdef CONFIG_IA64 | ||
197 | case 0x1f0: return isa_irq_to_vector(14); | ||
198 | case 0x170: return isa_irq_to_vector(15); | ||
199 | #else | ||
200 | case 0x1f0: return 14; | ||
201 | case 0x170: return 15; | ||
202 | #endif | ||
203 | } | ||
204 | return 0; | ||
205 | } | ||
206 | |||
192 | #include <asm/ide.h> | 207 | #include <asm/ide.h> |
193 | 208 | ||
194 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) | 209 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 6021757a4496..1dc2d1d18fa8 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/ctype.h> | 23 | #include <linux/ctype.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/kallsyms.h> | ||
26 | #include <linux/uaccess.h> | ||
25 | 27 | ||
26 | #include <asm/page.h> /* for PAGE_SIZE */ | 28 | #include <asm/page.h> /* for PAGE_SIZE */ |
27 | #include <asm/div64.h> | 29 | #include <asm/div64.h> |
@@ -482,6 +484,89 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int | |||
482 | return buf; | 484 | return buf; |
483 | } | 485 | } |
484 | 486 | ||
487 | static char *string(char *buf, char *end, char *s, int field_width, int precision, int flags) | ||
488 | { | ||
489 | int len, i; | ||
490 | |||
491 | if ((unsigned long)s < PAGE_SIZE) | ||
492 | s = "<NULL>"; | ||
493 | |||
494 | len = strnlen(s, precision); | ||
495 | |||
496 | if (!(flags & LEFT)) { | ||
497 | while (len < field_width--) { | ||
498 | if (buf < end) | ||
499 | *buf = ' '; | ||
500 | ++buf; | ||
501 | } | ||
502 | } | ||
503 | for (i = 0; i < len; ++i) { | ||
504 | if (buf < end) | ||
505 | *buf = *s; | ||
506 | ++buf; ++s; | ||
507 | } | ||
508 | while (len < field_width--) { | ||
509 | if (buf < end) | ||
510 | *buf = ' '; | ||
511 | ++buf; | ||
512 | } | ||
513 | return buf; | ||
514 | } | ||
515 | |||
516 | static inline void *dereference_function_descriptor(void *ptr) | ||
517 | { | ||
518 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
519 | void *p; | ||
520 | if (!probe_kernel_address(ptr, p)) | ||
521 | ptr = p; | ||
522 | #endif | ||
523 | return ptr; | ||
524 | } | ||
525 | |||
526 | static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags) | ||
527 | { | ||
528 | unsigned long value = (unsigned long) ptr; | ||
529 | #ifdef CONFIG_KALLSYMS | ||
530 | char sym[KSYM_SYMBOL_LEN]; | ||
531 | sprint_symbol(sym, value); | ||
532 | return string(buf, end, sym, field_width, precision, flags); | ||
533 | #else | ||
534 | field_width = 2*sizeof(void *); | ||
535 | flags |= SPECIAL | SMALL | ZEROPAD; | ||
536 | return number(buf, end, value, 16, field_width, precision, flags); | ||
537 | #endif | ||
538 | } | ||
539 | |||
540 | /* | ||
541 | * Show a '%p' thing. A kernel extension is that the '%p' is followed | ||
542 | * by an extra set of alphanumeric characters that are extended format | ||
543 | * specifiers. | ||
544 | * | ||
545 | * Right now we just handle 'F' (for symbolic Function descriptor pointers) | ||
546 | * and 'S' (for Symbolic direct pointers), but this can easily be | ||
547 | * extended in the future (network address types etc). | ||
548 | * | ||
549 | * The difference between 'S' and 'F' is that on ia64 and ppc64 function | ||
550 | * pointers are really function descriptors, which contain a pointer the | ||
551 | * real address. | ||
552 | */ | ||
553 | static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags) | ||
554 | { | ||
555 | switch (*fmt) { | ||
556 | case 'F': | ||
557 | ptr = dereference_function_descriptor(ptr); | ||
558 | /* Fallthrough */ | ||
559 | case 'S': | ||
560 | return symbol_string(buf, end, ptr, field_width, precision, flags); | ||
561 | } | ||
562 | flags |= SMALL; | ||
563 | if (field_width == -1) { | ||
564 | field_width = 2*sizeof(void *); | ||
565 | flags |= ZEROPAD; | ||
566 | } | ||
567 | return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags); | ||
568 | } | ||
569 | |||
485 | /** | 570 | /** |
486 | * vsnprintf - Format a string and place it in a buffer | 571 | * vsnprintf - Format a string and place it in a buffer |
487 | * @buf: The buffer to place the result into | 572 | * @buf: The buffer to place the result into |
@@ -502,11 +587,9 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int | |||
502 | */ | 587 | */ |
503 | int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | 588 | int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) |
504 | { | 589 | { |
505 | int len; | ||
506 | unsigned long long num; | 590 | unsigned long long num; |
507 | int i, base; | 591 | int base; |
508 | char *str, *end, c; | 592 | char *str, *end, c; |
509 | const char *s; | ||
510 | 593 | ||
511 | int flags; /* flags to number() */ | 594 | int flags; /* flags to number() */ |
512 | 595 | ||
@@ -622,43 +705,18 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
622 | continue; | 705 | continue; |
623 | 706 | ||
624 | case 's': | 707 | case 's': |
625 | s = va_arg(args, char *); | 708 | str = string(str, end, va_arg(args, char *), field_width, precision, flags); |
626 | if ((unsigned long)s < PAGE_SIZE) | ||
627 | s = "<NULL>"; | ||
628 | |||
629 | len = strnlen(s, precision); | ||
630 | |||
631 | if (!(flags & LEFT)) { | ||
632 | while (len < field_width--) { | ||
633 | if (str < end) | ||
634 | *str = ' '; | ||
635 | ++str; | ||
636 | } | ||
637 | } | ||
638 | for (i = 0; i < len; ++i) { | ||
639 | if (str < end) | ||
640 | *str = *s; | ||
641 | ++str; ++s; | ||
642 | } | ||
643 | while (len < field_width--) { | ||
644 | if (str < end) | ||
645 | *str = ' '; | ||
646 | ++str; | ||
647 | } | ||
648 | continue; | 709 | continue; |
649 | 710 | ||
650 | case 'p': | 711 | case 'p': |
651 | flags |= SMALL; | 712 | str = pointer(fmt+1, str, end, |
652 | if (field_width == -1) { | 713 | va_arg(args, void *), |
653 | field_width = 2*sizeof(void *); | 714 | field_width, precision, flags); |
654 | flags |= ZEROPAD; | 715 | /* Skip all alphanumeric pointer suffixes */ |
655 | } | 716 | while (isalnum(fmt[1])) |
656 | str = number(str, end, | 717 | fmt++; |
657 | (unsigned long) va_arg(args, void *), | ||
658 | 16, field_width, precision, flags); | ||
659 | continue; | 718 | continue; |
660 | 719 | ||
661 | |||
662 | case 'n': | 720 | case 'n': |
663 | /* FIXME: | 721 | /* FIXME: |
664 | * What does C99 say about the overflow case here? */ | 722 | * What does C99 say about the overflow case here? */ |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index c2397f503b0f..f38cc5317b88 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -442,12 +442,16 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) | |||
442 | 442 | ||
443 | void __exit br_cleanup_bridges(void) | 443 | void __exit br_cleanup_bridges(void) |
444 | { | 444 | { |
445 | struct net_device *dev, *nxt; | 445 | struct net_device *dev; |
446 | 446 | ||
447 | rtnl_lock(); | 447 | rtnl_lock(); |
448 | for_each_netdev_safe(&init_net, dev, nxt) | 448 | restart: |
449 | if (dev->priv_flags & IFF_EBRIDGE) | 449 | for_each_netdev(&init_net, dev) { |
450 | if (dev->priv_flags & IFF_EBRIDGE) { | ||
450 | del_br(dev->priv); | 451 | del_br(dev->priv); |
452 | goto restart; | ||
453 | } | ||
454 | } | ||
451 | rtnl_unlock(); | 455 | rtnl_unlock(); |
452 | 456 | ||
453 | } | 457 | } |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 7e8ca2836452..484bbf6dd032 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -205,12 +205,19 @@ static int can_create(struct net *net, struct socket *sock, int protocol) | |||
205 | * -ENOBUFS on full driver queue (see net_xmit_errno()) | 205 | * -ENOBUFS on full driver queue (see net_xmit_errno()) |
206 | * -ENOMEM when local loopback failed at calling skb_clone() | 206 | * -ENOMEM when local loopback failed at calling skb_clone() |
207 | * -EPERM when trying to send on a non-CAN interface | 207 | * -EPERM when trying to send on a non-CAN interface |
208 | * -EINVAL when the skb->data does not contain a valid CAN frame | ||
208 | */ | 209 | */ |
209 | int can_send(struct sk_buff *skb, int loop) | 210 | int can_send(struct sk_buff *skb, int loop) |
210 | { | 211 | { |
211 | struct sk_buff *newskb = NULL; | 212 | struct sk_buff *newskb = NULL; |
213 | struct can_frame *cf = (struct can_frame *)skb->data; | ||
212 | int err; | 214 | int err; |
213 | 215 | ||
216 | if (skb->len != sizeof(struct can_frame) || cf->can_dlc > 8) { | ||
217 | kfree_skb(skb); | ||
218 | return -EINVAL; | ||
219 | } | ||
220 | |||
214 | if (skb->dev->type != ARPHRD_CAN) { | 221 | if (skb->dev->type != ARPHRD_CAN) { |
215 | kfree_skb(skb); | 222 | kfree_skb(skb); |
216 | return -EPERM; | 223 | return -EPERM; |
@@ -605,6 +612,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, | |||
605 | struct packet_type *pt, struct net_device *orig_dev) | 612 | struct packet_type *pt, struct net_device *orig_dev) |
606 | { | 613 | { |
607 | struct dev_rcv_lists *d; | 614 | struct dev_rcv_lists *d; |
615 | struct can_frame *cf = (struct can_frame *)skb->data; | ||
608 | int matches; | 616 | int matches; |
609 | 617 | ||
610 | if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) { | 618 | if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) { |
@@ -612,6 +620,8 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, | |||
612 | return 0; | 620 | return 0; |
613 | } | 621 | } |
614 | 622 | ||
623 | BUG_ON(skb->len != sizeof(struct can_frame) || cf->can_dlc > 8); | ||
624 | |||
615 | /* update statistics */ | 625 | /* update statistics */ |
616 | can_stats.rx_frames++; | 626 | can_stats.rx_frames++; |
617 | can_stats.rx_frames_delta++; | 627 | can_stats.rx_frames_delta++; |
diff --git a/net/can/bcm.c b/net/can/bcm.c index d9a3a9d13bed..72c2ce904f83 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -298,7 +298,7 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, | |||
298 | 298 | ||
299 | if (head->nframes) { | 299 | if (head->nframes) { |
300 | /* can_frames starting here */ | 300 | /* can_frames starting here */ |
301 | firstframe = (struct can_frame *) skb_tail_pointer(skb); | 301 | firstframe = (struct can_frame *)skb_tail_pointer(skb); |
302 | 302 | ||
303 | memcpy(skb_put(skb, datalen), frames, datalen); | 303 | memcpy(skb_put(skb, datalen), frames, datalen); |
304 | 304 | ||
@@ -826,6 +826,10 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, | |||
826 | for (i = 0; i < msg_head->nframes; i++) { | 826 | for (i = 0; i < msg_head->nframes; i++) { |
827 | err = memcpy_fromiovec((u8 *)&op->frames[i], | 827 | err = memcpy_fromiovec((u8 *)&op->frames[i], |
828 | msg->msg_iov, CFSIZ); | 828 | msg->msg_iov, CFSIZ); |
829 | |||
830 | if (op->frames[i].can_dlc > 8) | ||
831 | err = -EINVAL; | ||
832 | |||
829 | if (err < 0) | 833 | if (err < 0) |
830 | return err; | 834 | return err; |
831 | 835 | ||
@@ -858,6 +862,10 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, | |||
858 | for (i = 0; i < msg_head->nframes; i++) { | 862 | for (i = 0; i < msg_head->nframes; i++) { |
859 | err = memcpy_fromiovec((u8 *)&op->frames[i], | 863 | err = memcpy_fromiovec((u8 *)&op->frames[i], |
860 | msg->msg_iov, CFSIZ); | 864 | msg->msg_iov, CFSIZ); |
865 | |||
866 | if (op->frames[i].can_dlc > 8) | ||
867 | err = -EINVAL; | ||
868 | |||
861 | if (err < 0) { | 869 | if (err < 0) { |
862 | if (op->frames != &op->sframe) | 870 | if (op->frames != &op->sframe) |
863 | kfree(op->frames); | 871 | kfree(op->frames); |
@@ -1164,9 +1172,12 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk) | |||
1164 | 1172 | ||
1165 | skb->dev = dev; | 1173 | skb->dev = dev; |
1166 | skb->sk = sk; | 1174 | skb->sk = sk; |
1167 | can_send(skb, 1); /* send with loopback */ | 1175 | err = can_send(skb, 1); /* send with loopback */ |
1168 | dev_put(dev); | 1176 | dev_put(dev); |
1169 | 1177 | ||
1178 | if (err) | ||
1179 | return err; | ||
1180 | |||
1170 | return CFSIZ + MHSIZ; | 1181 | return CFSIZ + MHSIZ; |
1171 | } | 1182 | } |
1172 | 1183 | ||
@@ -1185,6 +1196,10 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1185 | if (!bo->bound) | 1196 | if (!bo->bound) |
1186 | return -ENOTCONN; | 1197 | return -ENOTCONN; |
1187 | 1198 | ||
1199 | /* check for valid message length from userspace */ | ||
1200 | if (size < MHSIZ || (size - MHSIZ) % CFSIZ) | ||
1201 | return -EINVAL; | ||
1202 | |||
1188 | /* check for alternative ifindex for this bcm_op */ | 1203 | /* check for alternative ifindex for this bcm_op */ |
1189 | 1204 | ||
1190 | if (!ifindex && msg->msg_name) { | 1205 | if (!ifindex && msg->msg_name) { |
@@ -1259,8 +1274,8 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1259 | break; | 1274 | break; |
1260 | 1275 | ||
1261 | case TX_SEND: | 1276 | case TX_SEND: |
1262 | /* we need at least one can_frame */ | 1277 | /* we need exactly one can_frame behind the msg head */ |
1263 | if (msg_head.nframes < 1) | 1278 | if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ)) |
1264 | ret = -EINVAL; | 1279 | ret = -EINVAL; |
1265 | else | 1280 | else |
1266 | ret = bcm_tx_send(msg, ifindex, sk); | 1281 | ret = bcm_tx_send(msg, ifindex, sk); |
diff --git a/net/can/raw.c b/net/can/raw.c index 69877b8e7e9c..3e46ee36a1aa 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -632,6 +632,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
632 | } else | 632 | } else |
633 | ifindex = ro->ifindex; | 633 | ifindex = ro->ifindex; |
634 | 634 | ||
635 | if (size != sizeof(struct can_frame)) | ||
636 | return -EINVAL; | ||
637 | |||
635 | dev = dev_get_by_index(&init_net, ifindex); | 638 | dev = dev_get_by_index(&init_net, ifindex); |
636 | if (!dev) | 639 | if (!dev) |
637 | return -ENXIO; | 640 | return -ENXIO; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 850825dc86e6..1d723de18686 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -255,6 +255,7 @@ | |||
255 | #include <linux/init.h> | 255 | #include <linux/init.h> |
256 | #include <linux/fs.h> | 256 | #include <linux/fs.h> |
257 | #include <linux/skbuff.h> | 257 | #include <linux/skbuff.h> |
258 | #include <linux/scatterlist.h> | ||
258 | #include <linux/splice.h> | 259 | #include <linux/splice.h> |
259 | #include <linux/net.h> | 260 | #include <linux/net.h> |
260 | #include <linux/socket.h> | 261 | #include <linux/socket.h> |
@@ -1208,7 +1209,8 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | |||
1208 | return -ENOTCONN; | 1209 | return -ENOTCONN; |
1209 | while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) { | 1210 | while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) { |
1210 | if (offset < skb->len) { | 1211 | if (offset < skb->len) { |
1211 | size_t used, len; | 1212 | int used; |
1213 | size_t len; | ||
1212 | 1214 | ||
1213 | len = skb->len - offset; | 1215 | len = skb->len - offset; |
1214 | /* Stop reading if we hit a patch of urgent data */ | 1216 | /* Stop reading if we hit a patch of urgent data */ |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 0517967a68bf..e6fb21b19b86 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -243,10 +243,10 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot) | |||
243 | } | 243 | } |
244 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); | 244 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); |
245 | 245 | ||
246 | static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, int version) | 246 | static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, struct rpc_procinfo *proc) |
247 | { | 247 | { |
248 | struct rpc_message msg = { | 248 | struct rpc_message msg = { |
249 | .rpc_proc = rpcb_next_version[version].rpc_proc, | 249 | .rpc_proc = proc, |
250 | .rpc_argp = map, | 250 | .rpc_argp = map, |
251 | .rpc_resp = &map->r_port, | 251 | .rpc_resp = &map->r_port, |
252 | }; | 252 | }; |
@@ -271,6 +271,7 @@ static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbi | |||
271 | void rpcb_getport_async(struct rpc_task *task) | 271 | void rpcb_getport_async(struct rpc_task *task) |
272 | { | 272 | { |
273 | struct rpc_clnt *clnt = task->tk_client; | 273 | struct rpc_clnt *clnt = task->tk_client; |
274 | struct rpc_procinfo *proc; | ||
274 | u32 bind_version; | 275 | u32 bind_version; |
275 | struct rpc_xprt *xprt = task->tk_xprt; | 276 | struct rpc_xprt *xprt = task->tk_xprt; |
276 | struct rpc_clnt *rpcb_clnt; | 277 | struct rpc_clnt *rpcb_clnt; |
@@ -280,7 +281,6 @@ void rpcb_getport_async(struct rpc_task *task) | |||
280 | struct sockaddr *sap = (struct sockaddr *)&addr; | 281 | struct sockaddr *sap = (struct sockaddr *)&addr; |
281 | size_t salen; | 282 | size_t salen; |
282 | int status; | 283 | int status; |
283 | struct rpcb_info *info; | ||
284 | 284 | ||
285 | dprintk("RPC: %5u %s(%s, %u, %u, %d)\n", | 285 | dprintk("RPC: %5u %s(%s, %u, %u, %d)\n", |
286 | task->tk_pid, __func__, | 286 | task->tk_pid, __func__, |
@@ -313,10 +313,12 @@ void rpcb_getport_async(struct rpc_task *task) | |||
313 | /* Don't ever use rpcbind v2 for AF_INET6 requests */ | 313 | /* Don't ever use rpcbind v2 for AF_INET6 requests */ |
314 | switch (sap->sa_family) { | 314 | switch (sap->sa_family) { |
315 | case AF_INET: | 315 | case AF_INET: |
316 | info = rpcb_next_version; | 316 | proc = rpcb_next_version[xprt->bind_index].rpc_proc; |
317 | bind_version = rpcb_next_version[xprt->bind_index].rpc_vers; | ||
317 | break; | 318 | break; |
318 | case AF_INET6: | 319 | case AF_INET6: |
319 | info = rpcb_next_version6; | 320 | proc = rpcb_next_version6[xprt->bind_index].rpc_proc; |
321 | bind_version = rpcb_next_version6[xprt->bind_index].rpc_vers; | ||
320 | break; | 322 | break; |
321 | default: | 323 | default: |
322 | status = -EAFNOSUPPORT; | 324 | status = -EAFNOSUPPORT; |
@@ -324,14 +326,13 @@ void rpcb_getport_async(struct rpc_task *task) | |||
324 | task->tk_pid, __func__); | 326 | task->tk_pid, __func__); |
325 | goto bailout_nofree; | 327 | goto bailout_nofree; |
326 | } | 328 | } |
327 | if (info[xprt->bind_index].rpc_proc == NULL) { | 329 | if (proc == NULL) { |
328 | xprt->bind_index = 0; | 330 | xprt->bind_index = 0; |
329 | status = -EPFNOSUPPORT; | 331 | status = -EPFNOSUPPORT; |
330 | dprintk("RPC: %5u %s: no more getport versions available\n", | 332 | dprintk("RPC: %5u %s: no more getport versions available\n", |
331 | task->tk_pid, __func__); | 333 | task->tk_pid, __func__); |
332 | goto bailout_nofree; | 334 | goto bailout_nofree; |
333 | } | 335 | } |
334 | bind_version = info[xprt->bind_index].rpc_vers; | ||
335 | 336 | ||
336 | dprintk("RPC: %5u %s: trying rpcbind version %u\n", | 337 | dprintk("RPC: %5u %s: trying rpcbind version %u\n", |
337 | task->tk_pid, __func__, bind_version); | 338 | task->tk_pid, __func__, bind_version); |
@@ -361,22 +362,20 @@ void rpcb_getport_async(struct rpc_task *task) | |||
361 | map->r_addr = rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR); | 362 | map->r_addr = rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR); |
362 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ | 363 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ |
363 | 364 | ||
364 | child = rpcb_call_async(rpcb_clnt, map, xprt->bind_index); | 365 | child = rpcb_call_async(rpcb_clnt, map, proc); |
365 | rpc_release_client(rpcb_clnt); | 366 | rpc_release_client(rpcb_clnt); |
366 | if (IS_ERR(child)) { | 367 | if (IS_ERR(child)) { |
367 | status = -EIO; | 368 | status = -EIO; |
369 | /* rpcb_map_release() has freed the arguments */ | ||
368 | dprintk("RPC: %5u %s: rpc_run_task failed\n", | 370 | dprintk("RPC: %5u %s: rpc_run_task failed\n", |
369 | task->tk_pid, __func__); | 371 | task->tk_pid, __func__); |
370 | goto bailout; | 372 | goto bailout_nofree; |
371 | } | 373 | } |
372 | rpc_put_task(child); | 374 | rpc_put_task(child); |
373 | 375 | ||
374 | task->tk_xprt->stat.bind_count++; | 376 | task->tk_xprt->stat.bind_count++; |
375 | return; | 377 | return; |
376 | 378 | ||
377 | bailout: | ||
378 | kfree(map); | ||
379 | xprt_put(xprt); | ||
380 | bailout_nofree: | 379 | bailout_nofree: |
381 | rpcb_wake_rpcbind_waiters(xprt, status); | 380 | rpcb_wake_rpcbind_waiters(xprt, status); |
382 | bailout_nowake: | 381 | bailout_nowake: |