aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/local_ops.txt23
-rw-r--r--Documentation/networking/driver.txt5
-rw-r--r--Documentation/networking/wavelan.txt4
-rw-r--r--Documentation/watchdog/watchdog-api.txt38
-rw-r--r--Makefile6
-rw-r--r--arch/.gitignore2
-rw-r--r--arch/alpha/math-emu/math.c2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/Kconfig.instrumentation52
-rw-r--r--arch/arm/mach-omap1/board-fsample.c14
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c4
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c14
-rw-r--r--arch/arm/mach-pxa/sleep.S6
-rw-r--r--arch/blackfin/Kconfig4
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c1
-rw-r--r--arch/cris/arch-v10/vmlinux.lds.S33
-rw-r--r--arch/ia64/kernel/unaligned.c11
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c2
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c4
-rw-r--r--arch/powerpc/boot/flatdevtree_env.h2
-rw-r--r--arch/powerpc/kernel/iommu.c17
-rw-r--r--arch/powerpc/mm/slb.c10
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c1
-rw-r--r--arch/sparc/kernel/time.c9
-rw-r--r--arch/sparc64/kernel/ktlb.S6
-rw-r--r--arch/sparc64/kernel/sun4v_tlb_miss.S2
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c12
-rw-r--r--arch/x86/kernel/mfgpt_32.c15
-rw-r--r--arch/x86/kernel/nmi_32.c9
-rw-r--r--arch/x86/kernel/traps_32.c1
-rw-r--r--arch/x86/kernel/traps_64.c1
-rw-r--r--arch/x86/mm/init_32.c9
-rw-r--r--arch/x86/oprofile/nmi_int.c2
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/pata_bf54x.c3
-rw-r--r--drivers/ata/pata_legacy.c8
-rw-r--r--drivers/ata/pata_pdc202xx_old.c19
-rw-r--r--drivers/ata/pata_qdi.c8
-rw-r--r--drivers/ata/pata_winbond.c8
-rw-r--r--drivers/atm/idt77105.c2
-rw-r--r--drivers/atm/suni.c2
-rw-r--r--drivers/bluetooth/hci_ll.c23
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c4
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c5
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c4
-rw-r--r--drivers/hwmon/it87.c32
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c44
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/mouse/lifebook.c7
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mousedev.c9
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c55
-rw-r--r--drivers/lguest/Kconfig7
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c3
-rw-r--r--drivers/net/3c515.c60
-rw-r--r--drivers/net/Kconfig6
-rw-r--r--drivers/net/atl1/atl1_main.c8
-rw-r--r--drivers/net/bonding/bond_alb.c23
-rw-r--r--drivers/net/bonding/bond_main.c64
-rw-r--r--drivers/net/bonding/bond_sysfs.c66
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cpmac.c2
-rw-r--r--drivers/net/dl2k.c215
-rw-r--r--drivers/net/dl2k.h157
-rw-r--r--drivers/net/e1000/e1000_main.c10
-rw-r--r--drivers/net/e1000e/netdev.c8
-rw-r--r--drivers/net/ipg.c36
-rw-r--r--drivers/net/ixgb/ixgb_main.c9
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c11
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/niu.c221
-rw-r--r--drivers/net/niu.h33
-rw-r--r--drivers/net/pcmcia/3c574_cs.c31
-rw-r--r--drivers/net/s2io.c17
-rw-r--r--drivers/net/sky2.c24
-rw-r--r--drivers/net/tc35815.c2
-rw-r--r--drivers/net/veth.c14
-rw-r--r--drivers/net/wan/dscc4.c94
-rw-r--r--drivers/net/wan/lmc/lmc_media.c12
-rw-r--r--drivers/net/wan/sbni.h12
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/b43/rfkill.c11
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c6
-rw-r--r--drivers/net/wireless/ipw2200.c2
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c11
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c2
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/usb/serial/keyspan.c2
-rw-r--r--drivers/video/modedb.c4
-rw-r--r--drivers/video/s3c2410fb.c2
-rw-r--r--drivers/w1/slaves/w1_therm.c4
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/hfs/btree.c7
-rw-r--r--fs/jbd/transaction.c2
-rw-r--r--fs/sysfs/dir.c8
-rw-r--r--include/asm-cris/page.h7
-rw-r--r--include/asm-mips/smtc_ipi.h6
-rw-r--r--include/asm-powerpc/mmu-hash64.h1
-rw-r--r--include/asm-x86/msr.h4
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/workqueue.h14
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/kmod.c13
-rw-r--r--kernel/lockdep.c12
-rw-r--r--kernel/rcupdate.c2
-rw-r--r--kernel/sched.c8
-rw-r--r--kernel/timer.c2
-rw-r--r--kernel/workqueue.c5
-rw-r--r--mm/memory.c2
-rw-r--r--mm/page_alloc.c2
-rw-r--r--net/802/tr.c2
-rw-r--r--net/8021q/vlan.c7
-rw-r--r--net/ax25/af_ax25.c51
-rw-r--r--net/bluetooth/rfcomm/tty.c22
-rw-r--r--net/bridge/br_netfilter.c45
-rw-r--r--net/core/rtnetlink.c5
-rw-r--r--net/decnet/dn_route.c6
-rw-r--r--net/ipv4/fib_hash.c23
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/icmp.c1
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/ipv6/inet6_hashtables.c2
-rw-r--r--net/ipv6/netfilter/ip6t_eui64.c2
-rw-r--r--net/ipv6/proc.c4
-rw-r--r--net/ipv6/route.c11
-rw-r--r--net/irda/af_irda.c30
-rw-r--r--net/key/af_key.c16
-rw-r--r--net/netfilter/xt_helper.c4
-rw-r--r--net/rfkill/rfkill.c5
-rw-r--r--security/commoncap.c13
-rw-r--r--security/selinux/netlabel.c7
-rw-r--r--security/selinux/ss/services.c2
-rw-r--r--sound/oss/Kconfig4
140 files changed, 1268 insertions, 896 deletions
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
index 1a45f11e645e..4269a1105b37 100644
--- a/Documentation/local_ops.txt
+++ b/Documentation/local_ops.txt
@@ -68,29 +68,6 @@ typedef struct { atomic_long_t a; } local_t;
68 variable can be read when reading some _other_ cpu's variables. 68 variable can be read when reading some _other_ cpu's variables.
69 69
70 70
71* Rules to follow when using local atomic operations
72
73- Variables touched by local ops must be per cpu variables.
74- _Only_ the CPU owner of these variables must write to them.
75- This CPU can use local ops from any context (process, irq, softirq, nmi, ...)
76 to update its local_t variables.
77- Preemption (or interrupts) must be disabled when using local ops in
78 process context to make sure the process won't be migrated to a
79 different CPU between getting the per-cpu variable and doing the
80 actual local op.
81- When using local ops in interrupt context, no special care must be
82 taken on a mainline kernel, since they will run on the local CPU with
83 preemption already disabled. I suggest, however, to explicitly
84 disable preemption anyway to make sure it will still work correctly on
85 -rt kernels.
86- Reading the local cpu variable will provide the current copy of the
87 variable.
88- Reads of these variables can be done from any CPU, because updates to
89 "long", aligned, variables are always atomic. Since no memory
90 synchronization is done by the writer CPU, an outdated copy of the
91 variable can be read when reading some _other_ cpu's variables.
92
93
94* How to use local atomic operations 71* How to use local atomic operations
95 72
96#include <linux/percpu.h> 73#include <linux/percpu.h>
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt
index 4f7da5a2bf4f..ea72d2e66ca8 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -61,7 +61,10 @@ Transmit path guidelines:
612) Do not forget to update netdev->trans_start to jiffies after 612) Do not forget to update netdev->trans_start to jiffies after
62 each new tx packet is given to the hardware. 62 each new tx packet is given to the hardware.
63 63
643) Do not forget that once you return 0 from your hard_start_xmit 643) A hard_start_xmit method must not modify the shared parts of a
65 cloned SKB.
66
674) Do not forget that once you return 0 from your hard_start_xmit
65 method, it is your driver's responsibility to free up the SKB 68 method, it is your driver's responsibility to free up the SKB
66 and in some finite amount of time. 69 and in some finite amount of time.
67 70
diff --git a/Documentation/networking/wavelan.txt b/Documentation/networking/wavelan.txt
index c1acf5eb3712..afa6e521c685 100644
--- a/Documentation/networking/wavelan.txt
+++ b/Documentation/networking/wavelan.txt
@@ -12,8 +12,8 @@ and many Linux driver to support it.
12"wavelan" driver (old ISA Wavelan) 12"wavelan" driver (old ISA Wavelan)
13---------------- 13----------------
14 o Config : Network device -> Wireless LAN -> AT&T WaveLAN 14 o Config : Network device -> Wireless LAN -> AT&T WaveLAN
15 o Location : .../drivers/net/wavelan* 15 o Location : .../drivers/net/wireless/wavelan*
16 o in-line doc : .../drivers/net/wavelan.p.h 16 o in-line doc : .../drivers/net/wireless/wavelan.p.h
17 o on-line doc : 17 o on-line doc :
18 http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html 18 http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html
19 19
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt
index bb7cb1d31ec7..4cc4ba9d7150 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.txt
@@ -42,23 +42,27 @@ like this source file: see Documentation/watchdog/src/watchdog-simple.c
42A more advanced driver could for example check that a HTTP server is 42A more advanced driver could for example check that a HTTP server is
43still responding before doing the write call to ping the watchdog. 43still responding before doing the write call to ping the watchdog.
44 44
45When the device is closed, the watchdog is disabled. This is not 45When the device is closed, the watchdog is disabled, unless the "Magic
46always such a good idea, since if there is a bug in the watchdog 46Close" feature is supported (see below). This is not always such a
47daemon and it crashes the system will not reboot. Because of this, 47good idea, since if there is a bug in the watchdog daemon and it
48some of the drivers support the configuration option "Disable watchdog 48crashes the system will not reboot. Because of this, some of the
49shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when 49drivers support the configuration option "Disable watchdog shutdown on
50compiling the kernel, there is no way of disabling the watchdog once 50close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when compiling
51it has been started. So, if the watchdog daemon crashes, the system 51the kernel, there is no way of disabling the watchdog once it has been
52will reboot after the timeout has passed. Watchdog devices also usually 52started. So, if the watchdog daemon crashes, the system will reboot
53support the nowayout module parameter so that this option can be controlled 53after the timeout has passed. Watchdog devices also usually support
54at runtime. 54the nowayout module parameter so that this option can be controlled at
55 55runtime.
56Drivers will not disable the watchdog, unless a specific magic character 'V' 56
57has been sent /dev/watchdog just before closing the file. If the userspace 57Magic Close feature:
58daemon closes the file without sending this special character, the driver 58
59will assume that the daemon (and userspace in general) died, and will stop 59If a driver supports "Magic Close", the driver will not disable the
60pinging the watchdog without disabling it first. This will then cause a 60watchdog unless a specific magic character 'V' has been sent to
61reboot if the watchdog is not re-opened in sufficient time. 61/dev/watchdog just before closing the file. If the userspace daemon
62closes the file without sending this special character, the driver
63will assume that the daemon (and userspace in general) died, and will
64stop pinging the watchdog without disabling it first. This will then
65cause a reboot if the watchdog is not re-opened in sufficient time.
62 66
63The ioctl API: 67The ioctl API:
64 68
diff --git a/Makefile b/Makefile
index 8f08a29539ea..ce641ebee25a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 24 3SUBLEVEL = 24
4EXTRAVERSION = -rc7 4EXTRAVERSION = -rc8
5NAME = Arr Matey! A Hairy Bilge Rat! 5NAME = Arr Matey! A Hairy Bilge Rat!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -12,7 +12,7 @@ NAME = Arr Matey! A Hairy Bilge Rat!
12 12
13# Do not: 13# Do not:
14# o use make's built-in rules and variables 14# o use make's built-in rules and variables
15# (this increases performance and avoid hard-to-debug behavour); 15# (this increases performance and avoids hard-to-debug behaviour);
16# o print "Entering directory ..."; 16# o print "Entering directory ...";
17MAKEFLAGS += -rR --no-print-directory 17MAKEFLAGS += -rR --no-print-directory
18 18
@@ -1329,7 +1329,7 @@ else
1329ALLINCLUDE_ARCHS := $(SRCARCH) 1329ALLINCLUDE_ARCHS := $(SRCARCH)
1330endif 1330endif
1331else 1331else
1332#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour. 1332#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
1333ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) 1333ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1334endif 1334endif
1335 1335
diff --git a/arch/.gitignore b/arch/.gitignore
new file mode 100644
index 000000000000..741468920320
--- /dev/null
+++ b/arch/.gitignore
@@ -0,0 +1,2 @@
1i386
2x86_64
diff --git a/arch/alpha/math-emu/math.c b/arch/alpha/math-emu/math.c
index ae79dd970b02..58c2669a1dd4 100644
--- a/arch/alpha/math-emu/math.c
+++ b/arch/alpha/math-emu/math.c
@@ -225,7 +225,7 @@ alpha_fp_emul (unsigned long pc)
225 FP_UNPACK_SP(SB, &vb); 225 FP_UNPACK_SP(SB, &vb);
226 DR_c = DB_c; 226 DR_c = DB_c;
227 DR_s = DB_s; 227 DR_s = DB_s;
228 DR_e = DB_e; 228 DR_e = DB_e + (1024 - 128);
229 DR_f = SB_f << (52 - 23); 229 DR_f = SB_f << (52 - 23);
230 goto pack_d; 230 goto pack_d;
231 } 231 }
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c4de2d4664d7..a04f507e7f2c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1072,11 +1072,13 @@ source "drivers/rtc/Kconfig"
1072 1072
1073source "drivers/dma/Kconfig" 1073source "drivers/dma/Kconfig"
1074 1074
1075source "drivers/dca/Kconfig"
1076
1075endmenu 1077endmenu
1076 1078
1077source "fs/Kconfig" 1079source "fs/Kconfig"
1078 1080
1079source "kernel/Kconfig.instrumentation" 1081source "arch/arm/Kconfig.instrumentation"
1080 1082
1081source "arch/arm/Kconfig.debug" 1083source "arch/arm/Kconfig.debug"
1082 1084
diff --git a/arch/arm/Kconfig.instrumentation b/arch/arm/Kconfig.instrumentation
new file mode 100644
index 000000000000..63b8c6d5606a
--- /dev/null
+++ b/arch/arm/Kconfig.instrumentation
@@ -0,0 +1,52 @@
1menuconfig INSTRUMENTATION
2 bool "Instrumentation Support"
3 default y
4 ---help---
5 Say Y here to get to see options related to performance measurement,
6 system-wide debugging, and testing. This option alone does not add any
7 kernel code.
8
9 If you say N, all options in this submenu will be skipped and
10 disabled. If you're trying to debug the kernel itself, go see the
11 Kernel Hacking menu.
12
13if INSTRUMENTATION
14
15config PROFILING
16 bool "Profiling support (EXPERIMENTAL)"
17 help
18 Say Y here to enable the extended profiling support mechanisms used
19 by profilers such as OProfile.
20
21config OPROFILE
22 tristate "OProfile system profiling (EXPERIMENTAL)"
23 depends on PROFILING && !UML
24 help
25 OProfile is a profiling system capable of profiling the
26 whole system, include the kernel, kernel modules, libraries,
27 and applications.
28
29 If unsure, say N.
30
31config OPROFILE_ARMV6
32 bool
33 depends on OPROFILE && CPU_V6 && !SMP
34 default y
35 select OPROFILE_ARM11_CORE
36
37config OPROFILE_MPCORE
38 bool
39 depends on OPROFILE && CPU_V6 && SMP
40 default y
41 select OPROFILE_ARM11_CORE
42
43config OPROFILE_ARM11_CORE
44 bool
45
46config MARKERS
47 bool "Activate markers"
48 help
49 Place an empty function call at each marker site. Can be
50 dynamically changed for a probe function.
51
52endif # INSTRUMENTATION
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index f65baa95986e..d5f6ea14fc7b 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -40,31 +40,29 @@ static int fsample_keymap[] = {
40 KEY(0,1,KEY_RIGHT), 40 KEY(0,1,KEY_RIGHT),
41 KEY(0,2,KEY_LEFT), 41 KEY(0,2,KEY_LEFT),
42 KEY(0,3,KEY_DOWN), 42 KEY(0,3,KEY_DOWN),
43 KEY(0,4,KEY_CENTER), 43 KEY(0,4,KEY_ENTER),
44 KEY(0,5,KEY_0_5), 44 KEY(1,0,KEY_F10),
45 KEY(1,0,KEY_SOFT2),
46 KEY(1,1,KEY_SEND), 45 KEY(1,1,KEY_SEND),
47 KEY(1,2,KEY_END), 46 KEY(1,2,KEY_END),
48 KEY(1,3,KEY_VOLUMEDOWN), 47 KEY(1,3,KEY_VOLUMEDOWN),
49 KEY(1,4,KEY_VOLUMEUP), 48 KEY(1,4,KEY_VOLUMEUP),
50 KEY(1,5,KEY_RECORD), 49 KEY(1,5,KEY_RECORD),
51 KEY(2,0,KEY_SOFT1), 50 KEY(2,0,KEY_F9),
52 KEY(2,1,KEY_3), 51 KEY(2,1,KEY_3),
53 KEY(2,2,KEY_6), 52 KEY(2,2,KEY_6),
54 KEY(2,3,KEY_9), 53 KEY(2,3,KEY_9),
55 KEY(2,4,KEY_SHARP), 54 KEY(2,4,KEY_KPDOT),
56 KEY(2,5,KEY_2_5),
57 KEY(3,0,KEY_BACK), 55 KEY(3,0,KEY_BACK),
58 KEY(3,1,KEY_2), 56 KEY(3,1,KEY_2),
59 KEY(3,2,KEY_5), 57 KEY(3,2,KEY_5),
60 KEY(3,3,KEY_8), 58 KEY(3,3,KEY_8),
61 KEY(3,4,KEY_0), 59 KEY(3,4,KEY_0),
62 KEY(3,5,KEY_HEADSETHOOK), 60 KEY(3,5,KEY_KPSLASH),
63 KEY(4,0,KEY_HOME), 61 KEY(4,0,KEY_HOME),
64 KEY(4,1,KEY_1), 62 KEY(4,1,KEY_1),
65 KEY(4,2,KEY_4), 63 KEY(4,2,KEY_4),
66 KEY(4,3,KEY_7), 64 KEY(4,3,KEY_7),
67 KEY(4,4,KEY_STAR), 65 KEY(4,4,KEY_KPASTERISK),
68 KEY(4,5,KEY_POWER), 66 KEY(4,5,KEY_POWER),
69 0 67 0
70}; 68};
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 22db19a53647..182a98a9df4c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -36,8 +36,6 @@
36#include <asm/arch/omapfb.h> 36#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h> 37#include <asm/arch/lcd_mipid.h>
38 38
39#include "../plat-omap/dsp/dsp_common.h"
40
41#define ADS7846_PENDOWN_GPIO 15 39#define ADS7846_PENDOWN_GPIO 15
42 40
43static void __init omap_nokia770_init_irq(void) 41static void __init omap_nokia770_init_irq(void)
@@ -318,6 +316,8 @@ static __init int omap_dsp_init(void)
318 out: 316 out:
319 return ret; 317 return ret;
320} 318}
319#else
320#define omap_dsp_init() do {} while (0)
321#endif /* CONFIG_OMAP_DSP */ 321#endif /* CONFIG_OMAP_DSP */
322 322
323static void __init omap_nokia770_init(void) 323static void __init omap_nokia770_init(void)
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 1d5c8d509722..e44437e10eef 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -39,31 +39,29 @@ static int p2_keymap[] = {
39 KEY(0,1,KEY_RIGHT), 39 KEY(0,1,KEY_RIGHT),
40 KEY(0,2,KEY_LEFT), 40 KEY(0,2,KEY_LEFT),
41 KEY(0,3,KEY_DOWN), 41 KEY(0,3,KEY_DOWN),
42 KEY(0,4,KEY_CENTER), 42 KEY(0,4,KEY_ENTER),
43 KEY(0,5,KEY_0_5), 43 KEY(1,0,KEY_F10),
44 KEY(1,0,KEY_SOFT2),
45 KEY(1,1,KEY_SEND), 44 KEY(1,1,KEY_SEND),
46 KEY(1,2,KEY_END), 45 KEY(1,2,KEY_END),
47 KEY(1,3,KEY_VOLUMEDOWN), 46 KEY(1,3,KEY_VOLUMEDOWN),
48 KEY(1,4,KEY_VOLUMEUP), 47 KEY(1,4,KEY_VOLUMEUP),
49 KEY(1,5,KEY_RECORD), 48 KEY(1,5,KEY_RECORD),
50 KEY(2,0,KEY_SOFT1), 49 KEY(2,0,KEY_F9),
51 KEY(2,1,KEY_3), 50 KEY(2,1,KEY_3),
52 KEY(2,2,KEY_6), 51 KEY(2,2,KEY_6),
53 KEY(2,3,KEY_9), 52 KEY(2,3,KEY_9),
54 KEY(2,4,KEY_SHARP), 53 KEY(2,4,KEY_KPDOT),
55 KEY(2,5,KEY_2_5),
56 KEY(3,0,KEY_BACK), 54 KEY(3,0,KEY_BACK),
57 KEY(3,1,KEY_2), 55 KEY(3,1,KEY_2),
58 KEY(3,2,KEY_5), 56 KEY(3,2,KEY_5),
59 KEY(3,3,KEY_8), 57 KEY(3,3,KEY_8),
60 KEY(3,4,KEY_0), 58 KEY(3,4,KEY_0),
61 KEY(3,5,KEY_HEADSETHOOK), 59 KEY(3,5,KEY_KPSLASH),
62 KEY(4,0,KEY_HOME), 60 KEY(4,0,KEY_HOME),
63 KEY(4,1,KEY_1), 61 KEY(4,1,KEY_1),
64 KEY(4,2,KEY_4), 62 KEY(4,2,KEY_4),
65 KEY(4,3,KEY_7), 63 KEY(4,3,KEY_7),
66 KEY(4,4,KEY_STAR), 64 KEY(4,4,KEY_KPASTERISK),
67 KEY(4,5,KEY_POWER), 65 KEY(4,5,KEY_POWER),
68 0 66 0
69}; 67};
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index aff71fec618a..d0447723b73a 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -43,11 +43,11 @@ pxa_cpu_save_cp:
43pxa_cpu_save_sp: 43pxa_cpu_save_sp:
44 @ preserve phys address of stack 44 @ preserve phys address of stack
45 mov r0, sp 45 mov r0, sp
46 mov r2, lr 46 str lr, [sp, #-4]!
47 bl sleep_phys_sp 47 bl sleep_phys_sp
48 ldr r1, =sleep_save_sp 48 ldr r1, =sleep_save_sp
49 str r0, [r1] 49 str r0, [r1]
50 mov pc, r2 50 ldr pc, [sp], #4
51 51
52/* 52/*
53 * pxa27x_cpu_suspend() 53 * pxa27x_cpu_suspend()
@@ -270,5 +270,3 @@ resume_after_mmu:
270 mar acc0, r2, r3 270 mar acc0, r2, r3
271#endif 271#endif
272 ldmfd sp!, {r4 - r12, pc} @ return to caller 272 ldmfd sp!, {r4 - r12, pc} @ return to caller
273
274
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 2a3a7ea5958c..25232ba08119 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -65,6 +65,10 @@ config GENERIC_CALIBRATE_DELAY
65 bool 65 bool
66 default y 66 default y
67 67
68config HARDWARE_PM
69 def_bool y
70 depends on OPROFILE
71
68source "init/Kconfig" 72source "init/Kconfig"
69source "kernel/Kconfig.preempt" 73source "kernel/Kconfig.preempt"
70 74
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 3a9114e89edf..f3b327d4ed9c 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -392,6 +392,7 @@ int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id
392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) || 392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) ||
393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) || 393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) ||
394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) { 394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) {
395 local_irq_restore(flags);
395 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n", 396 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n",
396 ioif); 397 ioif);
397 return -EBUSY; 398 return -EBUSY;
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S
index 9859d49d088b..97a7876ed681 100644
--- a/arch/cris/arch-v10/vmlinux.lds.S
+++ b/arch/cris/arch-v10/vmlinux.lds.S
@@ -9,7 +9,8 @@
9 */ 9 */
10 10
11#include <asm-generic/vmlinux.lds.h> 11#include <asm-generic/vmlinux.lds.h>
12 12#include <asm/page.h>
13
13jiffies = jiffies_64; 14jiffies = jiffies_64;
14SECTIONS 15SECTIONS
15{ 16{
@@ -23,7 +24,7 @@ SECTIONS
23 _stext = .; 24 _stext = .;
24 __stext = .; 25 __stext = .;
25 .text : { 26 .text : {
26 *(.text) 27 TEXT_TEXT
27 SCHED_TEXT 28 SCHED_TEXT
28 LOCK_TEXT 29 LOCK_TEXT
29 *(.fixup) 30 *(.fixup)
@@ -49,10 +50,10 @@ SECTIONS
49 __edata = . ; /* End of data section */ 50 __edata = . ; /* End of data section */
50 _edata = . ; 51 _edata = . ;
51 52
52 . = ALIGN(8192); /* init_task and stack, must be aligned */ 53 . = ALIGN(PAGE_SIZE); /* init_task and stack, must be aligned */
53 .data.init_task : { *(.data.init_task) } 54 .data.init_task : { *(.data.init_task) }
54 55
55 . = ALIGN(8192); /* Init code and data */ 56 . = ALIGN(PAGE_SIZE); /* Init code and data */
56 __init_begin = .; 57 __init_begin = .;
57 .init.text : { 58 .init.text : {
58 _sinittext = .; 59 _sinittext = .;
@@ -66,13 +67,7 @@ SECTIONS
66 __setup_end = .; 67 __setup_end = .;
67 .initcall.init : { 68 .initcall.init : {
68 __initcall_start = .; 69 __initcall_start = .;
69 *(.initcall1.init); 70 INITCALLS
70 *(.initcall2.init);
71 *(.initcall3.init);
72 *(.initcall4.init);
73 *(.initcall5.init);
74 *(.initcall6.init);
75 *(.initcall7.init);
76 __initcall_end = .; 71 __initcall_end = .;
77 } 72 }
78 73
@@ -88,16 +83,18 @@ SECTIONS
88 __initramfs_start = .; 83 __initramfs_start = .;
89 *(.init.ramfs) 84 *(.init.ramfs)
90 __initramfs_end = .; 85 __initramfs_end = .;
91 /* We fill to the next page, so we can discard all init
92 pages without needing to consider what payload might be
93 appended to the kernel image. */
94 FILL (0);
95 . = ALIGN (8192);
96 } 86 }
97#endif 87#endif
98
99 __vmlinux_end = .; /* last address of the physical file */ 88 __vmlinux_end = .; /* last address of the physical file */
100 __init_end = .; 89
90 /*
91 * We fill to the next page, so we can discard all init
92 * pages without needing to consider what payload might be
93 * appended to the kernel image.
94 */
95 . = ALIGN(PAGE_SIZE);
96
97 __init_end = .;
101 98
102 __data_end = . ; /* Move to _edata ? */ 99 __data_end = . ; /* Move to _edata ? */
103 __bss_start = .; /* BSS */ 100 __bss_start = .; /* BSS */
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 2173de9fe917..f6a1aeb742b3 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -1488,16 +1488,19 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1488 case LDFA_OP: 1488 case LDFA_OP:
1489 case LDFCCLR_OP: 1489 case LDFCCLR_OP:
1490 case LDFCNC_OP: 1490 case LDFCNC_OP:
1491 case LDF_IMM_OP:
1492 case LDFA_IMM_OP:
1493 case LDFCCLR_IMM_OP:
1494 case LDFCNC_IMM_OP:
1495 if (u.insn.x) 1491 if (u.insn.x)
1496 ret = emulate_load_floatpair(ifa, u.insn, regs); 1492 ret = emulate_load_floatpair(ifa, u.insn, regs);
1497 else 1493 else
1498 ret = emulate_load_float(ifa, u.insn, regs); 1494 ret = emulate_load_float(ifa, u.insn, regs);
1499 break; 1495 break;
1500 1496
1497 case LDF_IMM_OP:
1498 case LDFA_IMM_OP:
1499 case LDFCCLR_IMM_OP:
1500 case LDFCNC_IMM_OP:
1501 ret = emulate_load_float(ifa, u.insn, regs);
1502 break;
1503
1501 case STF_OP: 1504 case STF_OP:
1502 case STF_IMM_OP: 1505 case STF_IMM_OP:
1503 ret = emulate_store_float(ifa, u.insn, regs); 1506 ret = emulate_store_float(ifa, u.insn, regs);
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 9a2636e56243..bc43a5c2224d 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
149 /* Check PCI clock */ 149 /* Check PCI clock */
150 { 150 {
151 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int)); 151 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
152 int jmpr = (readw(jmpr_p) >> 2) & 0x07; 152 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
153 static const int pciclocks[] __initdata = { 153 static const int pciclocks[] __initdata = {
154 33, 20, 25, 30, 12, 16, 37, 10 154 33, 20, 25, 30, 12, 16, 37, 10
155 }; 155 };
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 4a8152375efe..632e5d201353 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -598,8 +598,8 @@ static int __init rbtx4938_ethaddr_init(void)
598 printk(KERN_WARNING "seeprom: bad checksum.\n"); 598 printk(KERN_WARNING "seeprom: bad checksum.\n");
599 } 599 }
600 for (i = 0; i < 2; i++) { 600 for (i = 0; i < 2; i++) {
601 unsigned int slot = TX4938_PCIC_IDSEL_AD_TO_SLOT(31 - i); 601 unsigned int id =
602 unsigned int id = (1 << 8) | PCI_DEVFN(slot, 0); /* bus 1 */ 602 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
603 struct platform_device *pdev; 603 struct platform_device *pdev;
604 if (!(tx4938_ccfgptr->pcfg & 604 if (!(tx4938_ccfgptr->pcfg &
605 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL))) 605 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h
index ad0420da8921..66e0ebb1a364 100644
--- a/arch/powerpc/boot/flatdevtree_env.h
+++ b/arch/powerpc/boot/flatdevtree_env.h
@@ -2,7 +2,7 @@
2 * This file adds the header file glue so that the shared files 2 * This file adds the header file glue so that the shared files
3 * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper. 3 * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper.
4 * 4 *
5 * strncmp & strchr copied from <file:lib/strings.c> 5 * strncmp & strchr copied from <file:lib/string.c>
6 * Copyright (C) 1991, 1992 Linus Torvalds 6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * 7 *
8 * Maintained by: Mark A. Greer <mgreer@mvista.com> 8 * Maintained by: Mark A. Greer <mgreer@mvista.com>
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 2d0c9ef555e9..79a85d656871 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
278 unsigned long flags; 278 unsigned long flags;
279 struct scatterlist *s, *outs, *segstart; 279 struct scatterlist *s, *outs, *segstart;
280 int outcount, incount, i; 280 int outcount, incount, i;
281 unsigned int align;
281 unsigned long handle; 282 unsigned long handle;
282 283
283 BUG_ON(direction == DMA_NONE); 284 BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,12 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
309 /* Allocate iommu entries for that segment */ 310 /* Allocate iommu entries for that segment */
310 vaddr = (unsigned long) sg_virt(s); 311 vaddr = (unsigned long) sg_virt(s);
311 npages = iommu_num_pages(vaddr, slen); 312 npages = iommu_num_pages(vaddr, slen);
312 entry = iommu_range_alloc(tbl, npages, &handle, mask >> IOMMU_PAGE_SHIFT, 0); 313 align = 0;
314 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
315 (vaddr & ~PAGE_MASK) == 0)
316 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
317 entry = iommu_range_alloc(tbl, npages, &handle,
318 mask >> IOMMU_PAGE_SHIFT, align);
313 319
314 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); 320 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
315 321
@@ -572,7 +578,7 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
572{ 578{
573 dma_addr_t dma_handle = DMA_ERROR_CODE; 579 dma_addr_t dma_handle = DMA_ERROR_CODE;
574 unsigned long uaddr; 580 unsigned long uaddr;
575 unsigned int npages; 581 unsigned int npages, align;
576 582
577 BUG_ON(direction == DMA_NONE); 583 BUG_ON(direction == DMA_NONE);
578 584
@@ -580,8 +586,13 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
580 npages = iommu_num_pages(uaddr, size); 586 npages = iommu_num_pages(uaddr, size);
581 587
582 if (tbl) { 588 if (tbl) {
589 align = 0;
590 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && size >= PAGE_SIZE &&
591 ((unsigned long)vaddr & ~PAGE_MASK) == 0)
592 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
593
583 dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 594 dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
584 mask >> IOMMU_PAGE_SHIFT, 0); 595 mask >> IOMMU_PAGE_SHIFT, align);
585 if (dma_handle == DMA_ERROR_CODE) { 596 if (dma_handle == DMA_ERROR_CODE) {
586 if (printk_ratelimit()) { 597 if (printk_ratelimit()) {
587 printk(KERN_INFO "iommu_alloc failed, " 598 printk(KERN_INFO "iommu_alloc failed, "
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index a282bc212e80..50d7372bc2ce 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -82,14 +82,6 @@ static inline void slb_shadow_clear(unsigned long entry)
82 get_slb_shadow()->save_area[entry].esid = 0; 82 get_slb_shadow()->save_area[entry].esid = 0;
83} 83}
84 84
85void slb_shadow_clear_all(void)
86{
87 int i;
88
89 for (i = 0; i < SLB_NUM_BOLTED; i++)
90 slb_shadow_clear(i);
91}
92
93static inline void create_shadowed_slbe(unsigned long ea, int ssize, 85static inline void create_shadowed_slbe(unsigned long ea, int ssize,
94 unsigned long flags, 86 unsigned long flags,
95 unsigned long entry) 87 unsigned long entry)
@@ -300,6 +292,8 @@ void slb_initialize(void)
300 292
301 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1); 293 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1);
302 294
295 slb_shadow_clear(2);
296
303 /* We don't bolt the stack for the time being - we're in boot, 297 /* We don't bolt the stack for the time being - we're in boot,
304 * so the stack is in the bolted segment. By the time it goes 298 * so the stack is in the bolted segment. By the time it goes
305 * elsewhere, we'll call _switch() which will bolt in the new 299 * elsewhere, we'll call _switch() which will bolt in the new
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 34317aa148a8..9a455d46379d 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -272,7 +272,6 @@ void vpa_init(int cpu)
272 */ 272 */
273 addr = __pa(&slb_shadow[cpu]); 273 addr = __pa(&slb_shadow[cpu]);
274 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 274 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
275 slb_shadow_clear_all();
276 ret = register_slb_shadow(hwcpu, addr); 275 ret = register_slb_shadow(hwcpu, addr);
277 if (ret) 276 if (ret)
278 printk(KERN_ERR 277 printk(KERN_ERR
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 45cb7c5286d7..00b393c3a4a0 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -436,7 +436,14 @@ void __init time_init(void)
436 436
437static inline unsigned long do_gettimeoffset(void) 437static inline unsigned long do_gettimeoffset(void)
438{ 438{
439 return (*master_l10_counter >> 10) & 0x1fffff; 439 unsigned long val = *master_l10_counter;
440 unsigned long usec = (val >> 10) & 0x1fffff;
441
442 /* Limit hit? */
443 if (val & 0x80000000)
444 usec += 1000000 / HZ;
445
446 return usec;
440} 447}
441 448
442/* Ok, my cute asm atomicity trick doesn't work anymore. 449/* Ok, my cute asm atomicity trick doesn't work anymore.
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc64/kernel/ktlb.S
index 964527d2ffa0..cef8defcd7a9 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc64/kernel/ktlb.S
@@ -1,6 +1,6 @@
1/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling. 1/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling.
2 * 2 *
3 * Copyright (C) 1995, 1997, 2005 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 1995, 1997, 2005, 2008 David S. Miller <davem@davemloft.net>
4 * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de) 4 * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de)
5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
6 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 6 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -226,6 +226,7 @@ kvmap_dtlb_load:
226 ba,pt %xcc, sun4v_dtlb_load 226 ba,pt %xcc, sun4v_dtlb_load
227 mov %g5, %g3 227 mov %g5, %g3
228 228
229#ifdef CONFIG_SPARSEMEM_VMEMMAP
229kvmap_vmemmap: 230kvmap_vmemmap:
230 sub %g4, %g5, %g5 231 sub %g4, %g5, %g5
231 srlx %g5, 22, %g5 232 srlx %g5, 22, %g5
@@ -234,6 +235,7 @@ kvmap_vmemmap:
234 or %g1, %lo(vmemmap_table), %g1 235 or %g1, %lo(vmemmap_table), %g1
235 ba,pt %xcc, kvmap_dtlb_load 236 ba,pt %xcc, kvmap_dtlb_load
236 ldx [%g1 + %g5], %g5 237 ldx [%g1 + %g5], %g5
238#endif
237 239
238kvmap_dtlb_nonlinear: 240kvmap_dtlb_nonlinear:
239 /* Catch kernel NULL pointer derefs. */ 241 /* Catch kernel NULL pointer derefs. */
@@ -242,12 +244,14 @@ kvmap_dtlb_nonlinear:
242 bleu,pn %xcc, kvmap_dtlb_longpath 244 bleu,pn %xcc, kvmap_dtlb_longpath
243 nop 245 nop
244 246
247#ifdef CONFIG_SPARSEMEM_VMEMMAP
245 /* Do not use the TSB for vmemmap. */ 248 /* Do not use the TSB for vmemmap. */
246 mov (VMEMMAP_BASE >> 24), %g5 249 mov (VMEMMAP_BASE >> 24), %g5
247 sllx %g5, 24, %g5 250 sllx %g5, 24, %g5
248 cmp %g4,%g5 251 cmp %g4,%g5
249 bgeu,pn %xcc, kvmap_vmemmap 252 bgeu,pn %xcc, kvmap_vmemmap
250 nop 253 nop
254#endif
251 255
252 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) 256 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load)
253 257
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc64/kernel/sun4v_tlb_miss.S
index 9871dbb1ab42..fd9430562e0b 100644
--- a/arch/sparc64/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc64/kernel/sun4v_tlb_miss.S
@@ -215,6 +215,7 @@ sun4v_itlb_error:
215 215
2161: ba,pt %xcc, etrap 2161: ba,pt %xcc, etrap
2172: or %g7, %lo(2b), %g7 2172: or %g7, %lo(2b), %g7
218 mov %l4, %o1
218 call sun4v_itlb_error_report 219 call sun4v_itlb_error_report
219 add %sp, PTREGS_OFF, %o0 220 add %sp, PTREGS_OFF, %o0
220 221
@@ -241,6 +242,7 @@ sun4v_dtlb_error:
241 242
2421: ba,pt %xcc, etrap 2431: ba,pt %xcc, etrap
2432: or %g7, %lo(2b), %g7 2442: or %g7, %lo(2b), %g7
245 mov %l4, %o1
244 call sun4v_dtlb_error_report 246 call sun4v_dtlb_error_report
245 add %sp, PTREGS_OFF, %o0 247 add %sp, PTREGS_OFF, %o0
246 248
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 04998388259f..2b6abf633343 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1950,6 +1950,8 @@ void sun4v_itlb_error_report(struct pt_regs *regs, int tl)
1950 printk(KERN_EMERG "SUN4V-ITLB: Error at TPC[%lx], tl %d\n", 1950 printk(KERN_EMERG "SUN4V-ITLB: Error at TPC[%lx], tl %d\n",
1951 regs->tpc, tl); 1951 regs->tpc, tl);
1952 print_symbol(KERN_EMERG "SUN4V-ITLB: TPC<%s>\n", regs->tpc); 1952 print_symbol(KERN_EMERG "SUN4V-ITLB: TPC<%s>\n", regs->tpc);
1953 printk(KERN_EMERG "SUN4V-ITLB: O7[%lx]\n", regs->u_regs[UREG_I7]);
1954 print_symbol(KERN_EMERG "SUN4V-ITLB: O7<%s>\n", regs->u_regs[UREG_I7]);
1953 printk(KERN_EMERG "SUN4V-ITLB: vaddr[%lx] ctx[%lx] " 1955 printk(KERN_EMERG "SUN4V-ITLB: vaddr[%lx] ctx[%lx] "
1954 "pte[%lx] error[%lx]\n", 1956 "pte[%lx] error[%lx]\n",
1955 sun4v_err_itlb_vaddr, sun4v_err_itlb_ctx, 1957 sun4v_err_itlb_vaddr, sun4v_err_itlb_ctx,
@@ -1971,6 +1973,8 @@ void sun4v_dtlb_error_report(struct pt_regs *regs, int tl)
1971 printk(KERN_EMERG "SUN4V-DTLB: Error at TPC[%lx], tl %d\n", 1973 printk(KERN_EMERG "SUN4V-DTLB: Error at TPC[%lx], tl %d\n",
1972 regs->tpc, tl); 1974 regs->tpc, tl);
1973 print_symbol(KERN_EMERG "SUN4V-DTLB: TPC<%s>\n", regs->tpc); 1975 print_symbol(KERN_EMERG "SUN4V-DTLB: TPC<%s>\n", regs->tpc);
1976 printk(KERN_EMERG "SUN4V-DTLB: O7[%lx]\n", regs->u_regs[UREG_I7]);
1977 print_symbol(KERN_EMERG "SUN4V-DTLB: O7<%s>\n", regs->u_regs[UREG_I7]);
1974 printk(KERN_EMERG "SUN4V-DTLB: vaddr[%lx] ctx[%lx] " 1978 printk(KERN_EMERG "SUN4V-DTLB: vaddr[%lx] ctx[%lx] "
1975 "pte[%lx] error[%lx]\n", 1979 "pte[%lx] error[%lx]\n",
1976 sun4v_err_dtlb_vaddr, sun4v_err_dtlb_ctx, 1980 sun4v_err_dtlb_vaddr, sun4v_err_dtlb_ctx,
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 4a86ffd67ec5..2f99ee206b95 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -657,7 +657,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
657 hpet_pie_count = 0; 657 hpet_pie_count = 0;
658 } 658 }
659 659
660 if (hpet_rtc_flags & RTC_PIE && 660 if (hpet_rtc_flags & RTC_AIE &&
661 (curr_time.tm_sec == hpet_alarm_time.tm_sec) && 661 (curr_time.tm_sec == hpet_alarm_time.tm_sec) &&
662 (curr_time.tm_min == hpet_alarm_time.tm_min) && 662 (curr_time.tm_min == hpet_alarm_time.tm_min) &&
663 (curr_time.tm_hour == hpet_alarm_time.tm_hour)) 663 (curr_time.tm_hour == hpet_alarm_time.tm_hour))
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index c3a565bba106..a6b1490e00c4 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2169,14 +2169,10 @@ static inline void __init check_timer(void)
2169{ 2169{
2170 int apic1, pin1, apic2, pin2; 2170 int apic1, pin1, apic2, pin2;
2171 int vector; 2171 int vector;
2172 unsigned int ver;
2173 unsigned long flags; 2172 unsigned long flags;
2174 2173
2175 local_irq_save(flags); 2174 local_irq_save(flags);
2176 2175
2177 ver = apic_read(APIC_LVR);
2178 ver = GET_APIC_VERSION(ver);
2179
2180 /* 2176 /*
2181 * get/set the timer IRQ vector: 2177 * get/set the timer IRQ vector:
2182 */ 2178 */
@@ -2189,15 +2185,11 @@ static inline void __init check_timer(void)
2189 * mode for the 8259A whenever interrupts are routed 2185 * mode for the 8259A whenever interrupts are routed
2190 * through I/O APICs. Also IRQ0 has to be enabled in 2186 * through I/O APICs. Also IRQ0 has to be enabled in
2191 * the 8259A which implies the virtual wire has to be 2187 * the 8259A which implies the virtual wire has to be
2192 * disabled in the local APIC. Finally timer interrupts 2188 * disabled in the local APIC.
2193 * need to be acknowledged manually in the 8259A for
2194 * timer_interrupt() and for the i82489DX when using
2195 * the NMI watchdog.
2196 */ 2189 */
2197 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2190 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2198 init_8259A(1); 2191 init_8259A(1);
2199 timer_ack = !cpu_has_tsc; 2192 timer_ack = 1;
2200 timer_ack |= (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2201 if (timer_over_8254 > 0) 2193 if (timer_over_8254 > 0)
2202 enable_8259A_irq(0); 2194 enable_8259A_irq(0);
2203 2195
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 0ab680f2d9db..3960ab7e1497 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -278,12 +278,12 @@ static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt)
278 278
279static irqreturn_t mfgpt_tick(int irq, void *dev_id) 279static irqreturn_t mfgpt_tick(int irq, void *dev_id)
280{ 280{
281 /* Turn off the clock (and clear the event) */
282 mfgpt_disable_timer(mfgpt_event_clock);
283
281 if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN) 284 if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN)
282 return IRQ_HANDLED; 285 return IRQ_HANDLED;
283 286
284 /* Turn off the clock */
285 mfgpt_disable_timer(mfgpt_event_clock);
286
287 /* Clear the counter */ 287 /* Clear the counter */
288 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); 288 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0);
289 289
@@ -319,10 +319,6 @@ static int __init mfgpt_timer_setup(void)
319 } 319 }
320 320
321 mfgpt_event_clock = timer; 321 mfgpt_event_clock = timer;
322 /* Set the clock scale and enable the event mode for CMP2 */
323 val = MFGPT_SCALE | (3 << 8);
324
325 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
326 322
327 /* Set up the IRQ on the MFGPT side */ 323 /* Set up the IRQ on the MFGPT side */
328 if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) { 324 if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) {
@@ -339,6 +335,11 @@ static int __init mfgpt_timer_setup(void)
339 goto err; 335 goto err;
340 } 336 }
341 337
338 /* Set the clock scale and enable the event mode for CMP2 */
339 val = MFGPT_SCALE | (3 << 8);
340
341 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
342
342 /* Set up the clock event */ 343 /* Set up the clock event */
343 mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32); 344 mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32);
344 mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF, 345 mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF,
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 80ca72e5ac29..852db2906921 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -25,7 +25,6 @@
25 25
26#include <asm/smp.h> 26#include <asm/smp.h>
27#include <asm/nmi.h> 27#include <asm/nmi.h>
28#include <asm/timer.h>
29 28
30#include "mach_traps.h" 29#include "mach_traps.h"
31 30
@@ -84,7 +83,7 @@ static int __init check_nmi_watchdog(void)
84 83
85 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 84 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
86 if (!prev_nmi_count) 85 if (!prev_nmi_count)
87 goto error; 86 return -1;
88 87
89 printk(KERN_INFO "Testing NMI watchdog ... "); 88 printk(KERN_INFO "Testing NMI watchdog ... ");
90 89
@@ -119,7 +118,7 @@ static int __init check_nmi_watchdog(void)
119 if (!atomic_read(&nmi_active)) { 118 if (!atomic_read(&nmi_active)) {
120 kfree(prev_nmi_count); 119 kfree(prev_nmi_count);
121 atomic_set(&nmi_active, -1); 120 atomic_set(&nmi_active, -1);
122 goto error; 121 return -1;
123 } 122 }
124 printk("OK.\n"); 123 printk("OK.\n");
125 124
@@ -130,10 +129,6 @@ static int __init check_nmi_watchdog(void)
130 129
131 kfree(prev_nmi_count); 130 kfree(prev_nmi_count);
132 return 0; 131 return 0;
133error:
134 timer_ack = !cpu_has_tsc;
135
136 return -1;
137} 132}
138/* This needs to happen later in boot so counters are working */ 133/* This needs to happen later in boot so counters are working */
139late_initcall(check_nmi_watchdog); 134late_initcall(check_nmi_watchdog);
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index c88bbffcaa03..02d1e1e58e81 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -541,6 +541,7 @@ fastcall void do_##name(struct pt_regs * regs, long error_code) \
541 info.si_errno = 0; \ 541 info.si_errno = 0; \
542 info.si_code = sicode; \ 542 info.si_code = sicode; \
543 info.si_addr = (void __user *)siaddr; \ 543 info.si_addr = (void __user *)siaddr; \
544 trace_hardirqs_fixup(); \
544 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 545 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
545 == NOTIFY_STOP) \ 546 == NOTIFY_STOP) \
546 return; \ 547 return; \
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index d11525ad81b4..cc68b92316cd 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -635,6 +635,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
635 info.si_errno = 0; \ 635 info.si_errno = 0; \
636 info.si_code = sicode; \ 636 info.si_code = sicode; \
637 info.si_addr = (void __user *)siaddr; \ 637 info.si_addr = (void __user *)siaddr; \
638 trace_hardirqs_fixup(); \
638 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 639 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
639 == NOTIFY_STOP) \ 640 == NOTIFY_STOP) \
640 return; \ 641 return; \
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c7d19471261d..3c76d194fd2c 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -321,8 +321,13 @@ extern void set_highmem_pages_init(int);
321static void __init set_highmem_pages_init(int bad_ppro) 321static void __init set_highmem_pages_init(int bad_ppro)
322{ 322{
323 int pfn; 323 int pfn;
324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) 324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) {
325 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); 325 /*
326 * Holes under sparsemem might not have no mem_map[]:
327 */
328 if (pfn_valid(pfn))
329 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
330 }
326 totalram_pages += totalhigh_pages; 331 totalram_pages += totalhigh_pages;
327} 332}
328#endif /* CONFIG_FLATMEM */ 333#endif /* CONFIG_FLATMEM */
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 2d0eeac7251f..944bbcdd2b8d 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -380,7 +380,7 @@ static int __init ppro_init(char ** cpu_type)
380 380
381 if (cpu_model == 14) 381 if (cpu_model == 14)
382 *cpu_type = "i386/core"; 382 *cpu_type = "i386/core";
383 else if (cpu_model == 15) 383 else if (cpu_model == 15 || cpu_model == 23)
384 *cpu_type = "i386/core_2"; 384 *cpu_type = "i386/core_2";
385 else if (cpu_model > 0xd) 385 else if (cpu_model > 0xd)
386 return 0; 386 return 0;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4753a1831dbc..6380726f7538 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6998,7 +6998,9 @@ int ata_host_start(struct ata_host *host)
6998 rc = ap->ops->port_start(ap); 6998 rc = ap->ops->port_start(ap);
6999 if (rc) { 6999 if (rc) {
7000 if (rc != -ENODEV) 7000 if (rc != -ENODEV)
7001 dev_printk(KERN_ERR, host->dev, "failed to start port %d (errno=%d)\n", i, rc); 7001 dev_printk(KERN_ERR, host->dev,
7002 "failed to start port %d "
7003 "(errno=%d)\n", i, rc);
7002 goto err_out; 7004 goto err_out;
7003 } 7005 }
7004 } 7006 }
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 088a41f4e656..7842cc487359 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1509,7 +1509,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1509 if (res == NULL) 1509 if (res == NULL)
1510 return -EINVAL; 1510 return -EINVAL;
1511 1511
1512 while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) { 1512 while (bfin_port_info[board_idx].udma_mask > 0 &&
1513 udma_fsclk[udma_mode] > fsclk) {
1513 udma_mode--; 1514 udma_mode--;
1514 bfin_port_info[board_idx].udma_mask >>= 1; 1515 bfin_port_info[board_idx].udma_mask >>= 1;
1515 } 1516 }
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 7bed8d806381..17159b5e1e43 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -271,14 +271,12 @@ static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsig
271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
272 272
273 if (unlikely(slop)) { 273 if (unlikely(slop)) {
274 u32 pad; 274 __le32 pad = 0;
275 if (write_data) { 275 if (write_data) {
276 memcpy(&pad, buf + buflen - slop, slop); 276 memcpy(&pad, buf + buflen - slop, slop);
277 pad = le32_to_cpu(pad); 277 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
278 iowrite32(pad, ap->ioaddr.data_addr);
279 } else { 278 } else {
280 pad = ioread32(ap->ioaddr.data_addr); 279 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
281 pad = cpu_to_le16(pad);
282 memcpy(buf + buflen - slop, &pad, slop); 280 memcpy(buf + buflen - slop, &pad, slop);
283 } 281 }
284 } 282 }
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 8f2815601791..6c9689b59b06 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -244,6 +244,24 @@ static int pdc2026x_port_start(struct ata_port *ap)
244 return ata_sff_port_start(ap); 244 return ata_sff_port_start(ap);
245} 245}
246 246
247/**
248 * pdc2026x_check_atapi_dma - Check whether ATAPI DMA can be supported for this command
249 * @qc: Metadata associated with taskfile to check
250 *
251 * Just say no - not supported on older Promise.
252 *
253 * LOCKING:
254 * None (inherited from caller).
255 *
256 * RETURNS: 0 when ATAPI DMA can be used
257 * 1 otherwise
258 */
259
260static int pdc2026x_check_atapi_dma(struct ata_queued_cmd *qc)
261{
262 return 1;
263}
264
247static struct scsi_host_template pdc202xx_sht = { 265static struct scsi_host_template pdc202xx_sht = {
248 .module = THIS_MODULE, 266 .module = THIS_MODULE,
249 .name = DRV_NAME, 267 .name = DRV_NAME,
@@ -311,6 +329,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
311 .post_internal_cmd = ata_bmdma_post_internal_cmd, 329 .post_internal_cmd = ata_bmdma_post_internal_cmd,
312 .cable_detect = pdc2026x_cable_detect, 330 .cable_detect = pdc2026x_cable_detect,
313 331
332 .check_atapi_dma= pdc2026x_check_atapi_dma,
314 .bmdma_setup = ata_bmdma_setup, 333 .bmdma_setup = ata_bmdma_setup,
315 .bmdma_start = pdc2026x_bmdma_start, 334 .bmdma_start = pdc2026x_bmdma_start,
316 .bmdma_stop = pdc2026x_bmdma_stop, 335 .bmdma_stop = pdc2026x_bmdma_stop,
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 7d4c696c4cb6..a4c0e502cb42 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -136,14 +136,12 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
137 137
138 if (unlikely(slop)) { 138 if (unlikely(slop)) {
139 u32 pad; 139 __le32 pad = 0;
140 if (write_data) { 140 if (write_data) {
141 memcpy(&pad, buf + buflen - slop, slop); 141 memcpy(&pad, buf + buflen - slop, slop);
142 pad = le32_to_cpu(pad); 142 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
143 iowrite32(pad, ap->ioaddr.data_addr);
144 } else { 143 } else {
145 pad = ioread32(ap->ioaddr.data_addr); 144 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
146 pad = cpu_to_le32(pad);
147 memcpy(buf + buflen - slop, &pad, slop); 145 memcpy(buf + buflen - slop, &pad, slop);
148 } 146 }
149 } 147 }
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 311cdb3a5566..7116a9e7a8b2 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -104,14 +104,12 @@ static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsig
104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
105 105
106 if (unlikely(slop)) { 106 if (unlikely(slop)) {
107 u32 pad; 107 __le32 pad = 0;
108 if (write_data) { 108 if (write_data) {
109 memcpy(&pad, buf + buflen - slop, slop); 109 memcpy(&pad, buf + buflen - slop, slop);
110 pad = le32_to_cpu(pad); 110 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
111 iowrite32(pad, ap->ioaddr.data_addr);
112 } else { 111 } else {
113 pad = ioread32(ap->ioaddr.data_addr); 112 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
114 pad = cpu_to_le16(pad);
115 memcpy(buf + buflen - slop, &pad, slop); 113 memcpy(buf + buflen - slop, &pad, slop);
116 } 114 }
117 } 115 }
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 0bd657f5dd2a..84672dc57f7a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -357,7 +357,7 @@ static const struct atmphy_ops idt77105_ops = {
357}; 357};
358 358
359 359
360int __devinit idt77105_init(struct atm_dev *dev) 360int idt77105_init(struct atm_dev *dev)
361{ 361{
362 dev->phy = &idt77105_ops; 362 dev->phy = &idt77105_ops;
363 return 0; 363 return 0;
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index f04f39c00833..b1d063cc4fbe 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops = {
289}; 289};
290 290
291 291
292int __devinit suni_init(struct atm_dev *dev) 292int suni_init(struct atm_dev *dev)
293{ 293{
294 unsigned char mri; 294 unsigned char mri;
295 295
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 8c3e62a17b4a..b91d45a41b2f 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -204,6 +204,19 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
204 spin_lock_irqsave(&ll->hcill_lock, flags); 204 spin_lock_irqsave(&ll->hcill_lock, flags);
205 205
206 switch (ll->hcill_state) { 206 switch (ll->hcill_state) {
207 case HCILL_ASLEEP_TO_AWAKE:
208 /*
209 * This state means that both the host and the BRF chip
210 * have simultaneously sent a wake-up-indication packet.
211 * Traditionaly, in this case, receiving a wake-up-indication
212 * was enough and an additional wake-up-ack wasn't needed.
213 * This has changed with the BRF6350, which does require an
214 * explicit wake-up-ack. Other BRF versions, which do not
215 * require an explicit ack here, do accept it, thus it is
216 * perfectly safe to always send one.
217 */
218 BT_DBG("dual wake-up-indication");
219 /* deliberate fall-through - do not add break */
207 case HCILL_ASLEEP: 220 case HCILL_ASLEEP:
208 /* acknowledge device wake up */ 221 /* acknowledge device wake up */
209 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) { 222 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
@@ -211,16 +224,8 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
211 goto out; 224 goto out;
212 } 225 }
213 break; 226 break;
214 case HCILL_ASLEEP_TO_AWAKE:
215 /*
216 * this state means that a wake-up-indication
217 * is already on its way to the device,
218 * and will serve as the required wake-up-ack
219 */
220 BT_DBG("dual wake-up-indication");
221 break;
222 default: 227 default:
223 /* any other state are illegal */ 228 /* any other state is illegal */
224 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state); 229 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
225 break; 230 break;
226 } 231 }
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index ef1ed5d70125..2e3a0d4bc4c2 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -137,7 +137,7 @@ config CYCLADES
137 your Linux box, for instance in order to become a dial-in server. 137 your Linux box, for instance in order to become a dial-in server.
138 138
139 For information about the Cyclades-Z card, read 139 For information about the Cyclades-Z card, read
140 <file:drivers/char/README.cycladesZ>. 140 <file:Documentation/README.cycladesZ>.
141 141
142 To compile this driver as a module, choose M here: the 142 To compile this driver as a module, choose M here: the
143 module will be called cyclades. 143 module will be called cyclades.
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 1bba99747f5b..5d3a04ba6ad2 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -603,5 +603,9 @@ MODULE_DESCRIPTION ("'cpufreq_conservative' - A dynamic cpufreq governor for "
603 "optimised for use in a battery environment"); 603 "optimised for use in a battery environment");
604MODULE_LICENSE ("GPL"); 604MODULE_LICENSE ("GPL");
605 605
606#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
607fs_initcall(cpufreq_gov_dbs_init);
608#else
606module_init(cpufreq_gov_dbs_init); 609module_init(cpufreq_gov_dbs_init);
610#endif
607module_exit(cpufreq_gov_dbs_exit); 611module_exit(cpufreq_gov_dbs_exit);
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 369f44595150..d2af20dda382 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -610,6 +610,9 @@ MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "
610 "Low Latency Frequency Transition capable processors"); 610 "Low Latency Frequency Transition capable processors");
611MODULE_LICENSE("GPL"); 611MODULE_LICENSE("GPL");
612 612
613#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
614fs_initcall(cpufreq_gov_dbs_init);
615#else
613module_init(cpufreq_gov_dbs_init); 616module_init(cpufreq_gov_dbs_init);
617#endif
614module_exit(cpufreq_gov_dbs_exit); 618module_exit(cpufreq_gov_dbs_exit);
615
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 51bedab6c808..f8cdde4bf6cd 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -231,5 +231,9 @@ MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>, Russell King <rmk@arm.linux.
231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'"); 231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'");
232MODULE_LICENSE ("GPL"); 232MODULE_LICENSE ("GPL");
233 233
234#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE
234fs_initcall(cpufreq_gov_userspace_init); 235fs_initcall(cpufreq_gov_userspace_init);
236#else
237module_init(cpufreq_gov_userspace_init);
238#endif
235module_exit(cpufreq_gov_userspace_exit); 239module_exit(cpufreq_gov_userspace_exit);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6a182e14cf58..ad6c8a319903 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2,6 +2,14 @@
2 it87.c - Part of lm_sensors, Linux kernel modules for hardware 2 it87.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring. 3 monitoring.
4 4
5 The IT8705F is an LPC-based Super I/O part that contains UARTs, a
6 parallel port, an IR port, a MIDI port, a floppy controller, etc., in
7 addition to an Environment Controller (Enhanced Hardware Monitor and
8 Fan Controller)
9
10 This driver supports only the Environment Controller in the IT8705F and
11 similar parts. The other devices are supported by different drivers.
12
5 Supports: IT8705F Super I/O chip w/LPC interface 13 Supports: IT8705F Super I/O chip w/LPC interface
6 IT8712F Super I/O chip w/LPC interface 14 IT8712F Super I/O chip w/LPC interface
7 IT8716F Super I/O chip w/LPC interface 15 IT8716F Super I/O chip w/LPC interface
@@ -118,9 +126,15 @@ static int fix_pwm_polarity;
118/* Length of ISA address segment */ 126/* Length of ISA address segment */
119#define IT87_EXTENT 8 127#define IT87_EXTENT 8
120 128
121/* Where are the ISA address/data registers relative to the base address */ 129/* Length of ISA address segment for Environmental Controller */
122#define IT87_ADDR_REG_OFFSET 5 130#define IT87_EC_EXTENT 2
123#define IT87_DATA_REG_OFFSET 6 131
132/* Offset of EC registers from ISA base address */
133#define IT87_EC_OFFSET 5
134
135/* Where are the ISA address/data registers relative to the EC base address */
136#define IT87_ADDR_REG_OFFSET 0
137#define IT87_DATA_REG_OFFSET 1
124 138
125/*----- The IT87 registers -----*/ 139/*----- The IT87 registers -----*/
126 140
@@ -968,10 +982,10 @@ static int __devinit it87_probe(struct platform_device *pdev)
968 }; 982 };
969 983
970 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 984 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
971 if (!request_region(res->start, IT87_EXTENT, DRVNAME)) { 985 if (!request_region(res->start, IT87_EC_EXTENT, DRVNAME)) {
972 dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", 986 dev_err(dev, "Failed to request region 0x%lx-0x%lx\n",
973 (unsigned long)res->start, 987 (unsigned long)res->start,
974 (unsigned long)(res->start + IT87_EXTENT - 1)); 988 (unsigned long)(res->start + IT87_EC_EXTENT - 1));
975 err = -EBUSY; 989 err = -EBUSY;
976 goto ERROR0; 990 goto ERROR0;
977 } 991 }
@@ -1124,7 +1138,7 @@ ERROR2:
1124 platform_set_drvdata(pdev, NULL); 1138 platform_set_drvdata(pdev, NULL);
1125 kfree(data); 1139 kfree(data);
1126ERROR1: 1140ERROR1:
1127 release_region(res->start, IT87_EXTENT); 1141 release_region(res->start, IT87_EC_EXTENT);
1128ERROR0: 1142ERROR0:
1129 return err; 1143 return err;
1130} 1144}
@@ -1137,7 +1151,7 @@ static int __devexit it87_remove(struct platform_device *pdev)
1137 sysfs_remove_group(&pdev->dev.kobj, &it87_group); 1151 sysfs_remove_group(&pdev->dev.kobj, &it87_group);
1138 sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt); 1152 sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt);
1139 1153
1140 release_region(data->addr, IT87_EXTENT); 1154 release_region(data->addr, IT87_EC_EXTENT);
1141 platform_set_drvdata(pdev, NULL); 1155 platform_set_drvdata(pdev, NULL);
1142 kfree(data); 1156 kfree(data);
1143 1157
@@ -1402,8 +1416,8 @@ static int __init it87_device_add(unsigned short address,
1402 const struct it87_sio_data *sio_data) 1416 const struct it87_sio_data *sio_data)
1403{ 1417{
1404 struct resource res = { 1418 struct resource res = {
1405 .start = address , 1419 .start = address + IT87_EC_OFFSET,
1406 .end = address + IT87_EXTENT - 1, 1420 .end = address + IT87_EC_OFFSET + IT87_EC_EXTENT - 1,
1407 .name = DRVNAME, 1421 .name = DRVNAME,
1408 .flags = IORESOURCE_IO, 1422 .flags = IORESOURCE_IO,
1409 }; 1423 };
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 16a2a938b520..b3df6f3c705e 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -455,6 +455,28 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
455 } 455 }
456 } 456 }
457 457
458 /*
459 * The opcode is in the low byte when its in network order
460 * (top byte when in host order).
461 */
462 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
463 if (qp->ibqp.qp_num > 1 &&
464 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
465 if (header_in_data) {
466 wc.imm_data = *(__be32 *) data;
467 data += sizeof(__be32);
468 } else
469 wc.imm_data = ohdr->u.ud.imm_data;
470 wc.wc_flags = IB_WC_WITH_IMM;
471 hdrsize += sizeof(u32);
472 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
473 wc.imm_data = 0;
474 wc.wc_flags = 0;
475 } else {
476 dev->n_pkt_drops++;
477 goto bail;
478 }
479
458 /* Get the number of bytes the message was padded by. */ 480 /* Get the number of bytes the message was padded by. */
459 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; 481 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
460 if (unlikely(tlen < (hdrsize + pad + 4))) { 482 if (unlikely(tlen < (hdrsize + pad + 4))) {
@@ -482,28 +504,6 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
482 wc.byte_len = tlen + sizeof(struct ib_grh); 504 wc.byte_len = tlen + sizeof(struct ib_grh);
483 505
484 /* 506 /*
485 * The opcode is in the low byte when its in network order
486 * (top byte when in host order).
487 */
488 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
489 if (qp->ibqp.qp_num > 1 &&
490 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
491 if (header_in_data) {
492 wc.imm_data = *(__be32 *) data;
493 data += sizeof(__be32);
494 } else
495 wc.imm_data = ohdr->u.ud.imm_data;
496 wc.wc_flags = IB_WC_WITH_IMM;
497 hdrsize += sizeof(u32);
498 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
499 wc.imm_data = 0;
500 wc.wc_flags = 0;
501 } else {
502 dev->n_pkt_drops++;
503 goto bail;
504 }
505
506 /*
507 * Get the next work request entry to find where to put the data. 507 * Get the next work request entry to find where to put the data.
508 */ 508 */
509 if (qp->r_reuse_sge) 509 if (qp->r_reuse_sge)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 2b5ed119c9a9..b346a3b418ea 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -54,7 +54,7 @@ static const struct alps_model_info alps_model_data[] = {
54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ 54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xff, ALPS_FW_BK_1 } /* Dell Vostro 1400 */ 57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */
58}; 58};
59 59
60/* 60/*
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 9ec57d80186e..df81b0aaa9f8 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -225,8 +225,13 @@ static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolu
225 225
226static void lifebook_disconnect(struct psmouse *psmouse) 226static void lifebook_disconnect(struct psmouse *psmouse)
227{ 227{
228 struct lifebook_data *priv = psmouse->private;
229
228 psmouse_reset(psmouse); 230 psmouse_reset(psmouse);
229 kfree(psmouse->private); 231 if (priv) {
232 input_unregister_device(priv->dev2);
233 kfree(priv);
234 }
230 psmouse->private = NULL; 235 psmouse->private = NULL;
231} 236}
232 237
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 21a9c0b69a1f..b8628252e10c 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
1247 err_pt_deactivate: 1247 err_pt_deactivate:
1248 if (parent && parent->pt_deactivate) 1248 if (parent && parent->pt_deactivate)
1249 parent->pt_deactivate(parent); 1249 parent->pt_deactivate(parent);
1250 input_unregister_device(psmouse->dev);
1251 input_dev = NULL; /* so we don't try to free it below */
1250 err_protocol_disconnect: 1252 err_protocol_disconnect:
1251 if (psmouse->disconnect) 1253 if (psmouse->disconnect)
1252 psmouse->disconnect(psmouse); 1254 psmouse->disconnect(psmouse);
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 78c3ea75da2a..be83516c776c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -1029,6 +1029,15 @@ static const struct input_device_id mousedev_ids[] = {
1029 BIT_MASK(ABS_PRESSURE) | 1029 BIT_MASK(ABS_PRESSURE) |
1030 BIT_MASK(ABS_TOOL_WIDTH) }, 1030 BIT_MASK(ABS_TOOL_WIDTH) },
1031 }, /* A touchpad */ 1031 }, /* A touchpad */
1032 {
1033 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1034 INPUT_DEVICE_ID_MATCH_KEYBIT |
1035 INPUT_DEVICE_ID_MATCH_ABSBIT,
1036 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) },
1037 .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) },
1038 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
1039 }, /* Mouse-like device with absolute X and Y but ordinary
1040 clicks, like hp ILO2 High Performance mouse */
1032 1041
1033 { }, /* Terminating entry */ 1042 { }, /* Terminating entry */
1034}; 1043};
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 19055e7381f8..63f9664a066f 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -11,6 +11,7 @@
11 * - DMC TSC-10/25 11 * - DMC TSC-10/25
12 * - IRTOUCHSYSTEMS/UNITOP 12 * - IRTOUCHSYSTEMS/UNITOP
13 * - IdealTEK URTC1000 13 * - IdealTEK URTC1000
14 * - General Touch
14 * - GoTop Super_Q2/GogoPen/PenPower tablets 15 * - GoTop Super_Q2/GogoPen/PenPower tablets
15 * 16 *
16 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 17 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
@@ -50,7 +51,7 @@
50#include <linux/usb/input.h> 51#include <linux/usb/input.h>
51 52
52 53
53#define DRIVER_VERSION "v0.5" 54#define DRIVER_VERSION "v0.6"
54#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 55#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
55#define DRIVER_DESC "USB Touchscreen Driver" 56#define DRIVER_DESC "USB Touchscreen Driver"
56 57
@@ -65,17 +66,21 @@ struct usbtouch_device_info {
65 int min_yc, max_yc; 66 int min_yc, max_yc;
66 int min_press, max_press; 67 int min_press, max_press;
67 int rept_size; 68 int rept_size;
68 int flags;
69 69
70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
71
72 /*
73 * used to get the packet len. possible return values:
74 * > 0: packet len
75 * = 0: skip one byte
76 * < 0: -return value more bytes needed
77 */
71 int (*get_pkt_len) (unsigned char *pkt, int len); 78 int (*get_pkt_len) (unsigned char *pkt, int len);
79
72 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); 80 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
73 int (*init) (struct usbtouch_usb *usbtouch); 81 int (*init) (struct usbtouch_usb *usbtouch);
74}; 82};
75 83
76#define USBTOUCH_FLG_BUFFER 0x01
77
78
79/* a usbtouch device */ 84/* a usbtouch device */
80struct usbtouch_usb { 85struct usbtouch_usb {
81 unsigned char *data; 86 unsigned char *data;
@@ -94,15 +99,6 @@ struct usbtouch_usb {
94}; 99};
95 100
96 101
97#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK)
98#define MULTI_PACKET
99#endif
100
101#ifdef MULTI_PACKET
102static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
103 unsigned char *pkt, int len);
104#endif
105
106/* device types */ 102/* device types */
107enum { 103enum {
108 DEVTPYE_DUMMY = -1, 104 DEVTPYE_DUMMY = -1,
@@ -186,6 +182,10 @@ static struct usb_device_id usbtouch_devices[] = {
186 182
187#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 183#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
188 184
185#ifndef MULTI_PACKET
186#define MULTI_PACKET
187#endif
188
189#define EGALAX_PKT_TYPE_MASK 0xFE 189#define EGALAX_PKT_TYPE_MASK 0xFE
190#define EGALAX_PKT_TYPE_REPT 0x80 190#define EGALAX_PKT_TYPE_REPT 0x80
191#define EGALAX_PKT_TYPE_DIAG 0x0A 191#define EGALAX_PKT_TYPE_DIAG 0x0A
@@ -323,6 +323,9 @@ static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
323 * eTurboTouch part 323 * eTurboTouch part
324 */ 324 */
325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO 325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
326#ifndef MULTI_PACKET
327#define MULTI_PACKET
328#endif
326static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 329static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
327{ 330{
328 unsigned int shift; 331 unsigned int shift;
@@ -461,6 +464,9 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
461 * IdealTEK URTC1000 Part 464 * IdealTEK URTC1000 Part
462 */ 465 */
463#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK 466#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
467#ifndef MULTI_PACKET
468#define MULTI_PACKET
469#endif
464static int idealtek_get_pkt_len(unsigned char *buf, int len) 470static int idealtek_get_pkt_len(unsigned char *buf, int len)
465{ 471{
466 if (buf[0] & 0x80) 472 if (buf[0] & 0x80)
@@ -525,6 +531,11 @@ static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
525/***************************************************************************** 531/*****************************************************************************
526 * the different device descriptors 532 * the different device descriptors
527 */ 533 */
534#ifdef MULTI_PACKET
535static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
536 unsigned char *pkt, int len);
537#endif
538
528static struct usbtouch_device_info usbtouch_dev_info[] = { 539static struct usbtouch_device_info usbtouch_dev_info[] = {
529#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 540#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
530 [DEVTYPE_EGALAX] = { 541 [DEVTYPE_EGALAX] = {
@@ -533,7 +544,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
533 .min_yc = 0x0, 544 .min_yc = 0x0,
534 .max_yc = 0x07ff, 545 .max_yc = 0x07ff,
535 .rept_size = 16, 546 .rept_size = 16,
536 .flags = USBTOUCH_FLG_BUFFER,
537 .process_pkt = usbtouch_process_multi, 547 .process_pkt = usbtouch_process_multi,
538 .get_pkt_len = egalax_get_pkt_len, 548 .get_pkt_len = egalax_get_pkt_len,
539 .read_data = egalax_read_data, 549 .read_data = egalax_read_data,
@@ -582,7 +592,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
582 .min_yc = 0x0, 592 .min_yc = 0x0,
583 .max_yc = 0x07ff, 593 .max_yc = 0x07ff,
584 .rept_size = 8, 594 .rept_size = 8,
585 .flags = USBTOUCH_FLG_BUFFER,
586 .process_pkt = usbtouch_process_multi, 595 .process_pkt = usbtouch_process_multi,
587 .get_pkt_len = eturbo_get_pkt_len, 596 .get_pkt_len = eturbo_get_pkt_len,
588 .read_data = eturbo_read_data, 597 .read_data = eturbo_read_data,
@@ -630,7 +639,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
630 .min_yc = 0x0, 639 .min_yc = 0x0,
631 .max_yc = 0x0fff, 640 .max_yc = 0x0fff,
632 .rept_size = 8, 641 .rept_size = 8,
633 .flags = USBTOUCH_FLG_BUFFER,
634 .process_pkt = usbtouch_process_multi, 642 .process_pkt = usbtouch_process_multi,
635 .get_pkt_len = idealtek_get_pkt_len, 643 .get_pkt_len = idealtek_get_pkt_len,
636 .read_data = idealtek_read_data, 644 .read_data = idealtek_read_data,
@@ -738,11 +746,14 @@ static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
738 pos = 0; 746 pos = 0;
739 while (pos < buf_len) { 747 while (pos < buf_len) {
740 /* get packet len */ 748 /* get packet len */
741 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, len); 749 pkt_len = usbtouch->type->get_pkt_len(buffer + pos,
750 buf_len - pos);
742 751
743 /* unknown packet: drop everything */ 752 /* unknown packet: skip one byte */
744 if (unlikely(!pkt_len)) 753 if (unlikely(!pkt_len)) {
745 goto out_flush_buf; 754 pos++;
755 continue;
756 }
746 757
747 /* full packet: process */ 758 /* full packet: process */
748 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) { 759 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) {
@@ -857,7 +868,7 @@ static int usbtouch_probe(struct usb_interface *intf,
857 if (!usbtouch->data) 868 if (!usbtouch->data)
858 goto out_free; 869 goto out_free;
859 870
860 if (type->flags & USBTOUCH_FLG_BUFFER) { 871 if (type->get_pkt_len) {
861 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); 872 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
862 if (!usbtouch->buffer) 873 if (!usbtouch->buffer)
863 goto out_free_buffers; 874 goto out_free_buffers;
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 7eb9ecff8f4a..6b8dbb9ba73b 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -10,10 +10,3 @@ config LGUEST
10 not "rustyvisor". See Documentation/lguest/lguest.txt. 10 not "rustyvisor". See Documentation/lguest/lguest.txt.
11 11
12 If unsure, say N. If curious, say M. If masochistic, say Y. 12 If unsure, say N. If curious, say M. If masochistic, say Y.
13
14config LGUEST_GUEST
15 bool
16 help
17 The guest needs code built-in, even if the host has lguest
18 support as a module. The drivers are tiny, so we build them
19 in too.
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 4fd187ac9d70..4f0a9157ecb1 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1202,9 +1202,8 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
1202 1202
1203static int saa7134_resume(struct pci_dev *pci_dev) 1203static int saa7134_resume(struct pci_dev *pci_dev)
1204{ 1204{
1205
1206 struct saa7134_dev *dev = pci_get_drvdata(pci_dev); 1205 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1207 unsigned int flags; 1206 unsigned long flags;
1208 1207
1209 pci_restore_state(pci_dev); 1208 pci_restore_state(pci_dev);
1210 pci_set_power_state(pci_dev, PCI_D0); 1209 pci_set_power_state(pci_dev, PCI_D0);
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 275e7510ebaf..684bab781015 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -243,14 +243,16 @@ enum eeprom_offset {
243enum Window3 { /* Window 3: MAC/config bits. */ 243enum Window3 { /* Window 3: MAC/config bits. */
244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8, 244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8,
245}; 245};
246union wn3_config { 246enum wn3_config {
247 int i; 247 Ram_size = 7,
248 struct w3_config_fields { 248 Ram_width = 8,
249 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 249 Ram_speed = 0x30,
250 int pad8:8; 250 Rom_size = 0xc0,
251 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 251 Ram_split_shift = 16,
252 int pad24:7; 252 Ram_split = 3 << Ram_split_shift,
253 } u; 253 Xcvr_shift = 20,
254 Xcvr = 7 << Xcvr_shift,
255 Autoselect = 0x1000000,
254}; 256};
255 257
256enum Window4 { 258enum Window4 {
@@ -614,7 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
614 /* Read the station address from the EEPROM. */ 616 /* Read the station address from the EEPROM. */
615 EL3WINDOW(0); 617 EL3WINDOW(0);
616 for (i = 0; i < 0x18; i++) { 618 for (i = 0; i < 0x18; i++) {
617 short *phys_addr = (short *) dev->dev_addr; 619 __be16 *phys_addr = (__be16 *) dev->dev_addr;
618 int timer; 620 int timer;
619 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd); 621 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd);
620 /* Pause for at least 162 us. for the read to take place. */ 622 /* Pause for at least 162 us. for the read to take place. */
@@ -646,22 +648,22 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
646 648
647 { 649 {
648 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; 650 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
649 union wn3_config config; 651 __u32 config;
650 EL3WINDOW(3); 652 EL3WINDOW(3);
651 vp->available_media = inw(ioaddr + Wn3_Options); 653 vp->available_media = inw(ioaddr + Wn3_Options);
652 config.i = inl(ioaddr + Wn3_Config); 654 config = inl(ioaddr + Wn3_Config);
653 if (corkscrew_debug > 1) 655 if (corkscrew_debug > 1)
654 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n", 656 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n",
655 config.i, inw(ioaddr + Wn3_Options)); 657 config, inw(ioaddr + Wn3_Options));
656 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", 658 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n",
657 8 << config.u.ram_size, 659 8 << config & Ram_size,
658 config.u.ram_width ? "word" : "byte", 660 config & Ram_width ? "word" : "byte",
659 ram_split[config.u.ram_split], 661 ram_split[(config & Ram_split) >> Ram_split_shift],
660 config.u.autoselect ? "autoselect/" : "", 662 config & Autoselect ? "autoselect/" : "",
661 media_tbl[config.u.xcvr].name); 663 media_tbl[(config & Xcvr) >> Xcvr_shift].name);
662 dev->if_port = config.u.xcvr; 664 vp->default_media = (config & Xcvr) >> Xcvr_shift;
663 vp->default_media = config.u.xcvr; 665 vp->autoselect = config & Autoselect ? 1 : 0;
664 vp->autoselect = config.u.autoselect; 666 dev->if_port = vp->default_media;
665 } 667 }
666 if (vp->media_override != 7) { 668 if (vp->media_override != 7) {
667 printk(KERN_INFO " Media override to transceiver type %d (%s).\n", 669 printk(KERN_INFO " Media override to transceiver type %d (%s).\n",
@@ -694,14 +696,14 @@ static int corkscrew_open(struct net_device *dev)
694{ 696{
695 int ioaddr = dev->base_addr; 697 int ioaddr = dev->base_addr;
696 struct corkscrew_private *vp = netdev_priv(dev); 698 struct corkscrew_private *vp = netdev_priv(dev);
697 union wn3_config config; 699 __u32 config;
698 int i; 700 int i;
699 701
700 /* Before initializing select the active media port. */ 702 /* Before initializing select the active media port. */
701 EL3WINDOW(3); 703 EL3WINDOW(3);
702 if (vp->full_duplex) 704 if (vp->full_duplex)
703 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */ 705 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */
704 config.i = inl(ioaddr + Wn3_Config); 706 config = inl(ioaddr + Wn3_Config);
705 707
706 if (vp->media_override != 7) { 708 if (vp->media_override != 7) {
707 if (corkscrew_debug > 1) 709 if (corkscrew_debug > 1)
@@ -727,12 +729,12 @@ static int corkscrew_open(struct net_device *dev)
727 } else 729 } else
728 dev->if_port = vp->default_media; 730 dev->if_port = vp->default_media;
729 731
730 config.u.xcvr = dev->if_port; 732 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
731 outl(config.i, ioaddr + Wn3_Config); 733 outl(config, ioaddr + Wn3_Config);
732 734
733 if (corkscrew_debug > 1) { 735 if (corkscrew_debug > 1) {
734 printk("%s: corkscrew_open() InternalConfig %8.8x.\n", 736 printk("%s: corkscrew_open() InternalConfig %8.8x.\n",
735 dev->name, config.i); 737 dev->name, config);
736 } 738 }
737 739
738 outw(TxReset, ioaddr + EL3_CMD); 740 outw(TxReset, ioaddr + EL3_CMD);
@@ -901,7 +903,7 @@ static void corkscrew_timer(unsigned long data)
901 ok = 1; 903 ok = 1;
902 } 904 }
903 if (!ok) { 905 if (!ok) {
904 union wn3_config config; 906 __u32 config;
905 907
906 do { 908 do {
907 dev->if_port = 909 dev->if_port =
@@ -928,9 +930,9 @@ static void corkscrew_timer(unsigned long data)
928 ioaddr + Wn4_Media); 930 ioaddr + Wn4_Media);
929 931
930 EL3WINDOW(3); 932 EL3WINDOW(3);
931 config.i = inl(ioaddr + Wn3_Config); 933 config = inl(ioaddr + Wn3_Config);
932 config.u.xcvr = dev->if_port; 934 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
933 outl(config.i, ioaddr + Wn3_Config); 935 outl(config, ioaddr + Wn3_Config);
934 936
935 outw(dev->if_port == 3 ? StartCoax : StopCoax, 937 outw(dev->if_port == 3 ? StartCoax : StopCoax,
936 ioaddr + EL3_CMD); 938 ioaddr + EL3_CMD);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 114771a2a133..9af05a2f4af3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1976,9 +1976,6 @@ config E1000E
1976 1976
1977 <http://support.intel.com> 1977 <http://support.intel.com>
1978 1978
1979 More specific information on configuring the driver is in
1980 <file:Documentation/networking/e1000e.txt>.
1981
1982 To compile this driver as a module, choose M here. The module 1979 To compile this driver as a module, choose M here. The module
1983 will be called e1000e. 1980 will be called e1000e.
1984 1981
@@ -2468,9 +2465,6 @@ config IXGBE
2468 2465
2469 <http://support.intel.com> 2466 <http://support.intel.com>
2470 2467
2471 More specific information on configuring the driver is in
2472 <file:Documentation/networking/ixgbe.txt>.
2473
2474 To compile this driver as a module, choose M here. The module 2468 To compile this driver as a module, choose M here. The module
2475 will be called ixgbe. 2469 will be called ixgbe.
2476 2470
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7dd4ef4..9200ee59d854 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -120,7 +120,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
120 struct atl1_hw *hw = &adapter->hw; 120 struct atl1_hw *hw = &adapter->hw;
121 struct net_device *netdev = adapter->netdev; 121 struct net_device *netdev = adapter->netdev;
122 122
123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
125 125
126 adapter->wol = 0; 126 adapter->wol = 0;
@@ -688,7 +688,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
688{ 688{
689 struct atl1_adapter *adapter = netdev_priv(netdev); 689 struct atl1_adapter *adapter = netdev_priv(netdev);
690 int old_mtu = netdev->mtu; 690 int old_mtu = netdev->mtu;
691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
692 692
693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
694 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 694 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
@@ -853,8 +853,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
853 /* set Interrupt Clear Timer */ 853 /* set Interrupt Clear Timer */
854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER); 854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER);
855 855
856 /* set MTU, 4 : VLAN */ 856 /* set max frame size hw will accept */
857 iowrite32(hw->max_frame_size + 4, hw->hw_addr + REG_MTU); 857 iowrite32(hw->max_frame_size, hw->hw_addr + REG_MTU);
858 858
859 /* jumbo size & rrd retirement timer */ 859 /* jumbo size & rrd retirement timer */
860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK) 860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 25b8dbf6cfd7..b57bc9467dbe 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
979/* 979/*
980 * Send learning packets after MAC address swap. 980 * Send learning packets after MAC address swap.
981 * 981 *
982 * Called with RTNL and bond->lock held for read. 982 * Called with RTNL and no other locks
983 */ 983 */
984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, 984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
985 struct slave *slave2) 985 struct slave *slave2)
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); 987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
988 struct slave *disabled_slave = NULL; 988 struct slave *disabled_slave = NULL;
989 989
990 ASSERT_RTNL();
991
990 /* fasten the change in the switch */ 992 /* fasten the change in the switch */
991 if (SLAVE_IS_OK(slave1)) { 993 if (SLAVE_IS_OK(slave1)) {
992 alb_send_learning_packets(slave1, slave1->dev->dev_addr); 994 alb_send_learning_packets(slave1, slave1->dev->dev_addr);
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
1031 * a slave that has @slave's permanet address as its current address. 1033 * a slave that has @slave's permanet address as its current address.
1032 * We'll make sure that that slave no longer uses @slave's permanent address. 1034 * We'll make sure that that slave no longer uses @slave's permanent address.
1033 * 1035 *
1034 * Caller must hold bond lock 1036 * Caller must hold RTNL and no other locks
1035 */ 1037 */
1036static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) 1038static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
1037{ 1039{
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1542 return 0; 1544 return 0;
1543} 1545}
1544 1546
1545/* Caller must hold bond lock for write */ 1547/*
1548 * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1549 * if necessary.
1550 *
1551 * Caller must hold RTNL and no other locks
1552 */
1546void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) 1553void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
1547{ 1554{
1548 if (bond->slave_cnt > 1) { 1555 if (bond->slave_cnt > 1) {
@@ -1601,9 +1608,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1601 struct slave *swap_slave; 1608 struct slave *swap_slave;
1602 int i; 1609 int i;
1603 1610
1604 if (new_slave)
1605 ASSERT_RTNL();
1606
1607 if (bond->curr_active_slave == new_slave) { 1611 if (bond->curr_active_slave == new_slave) {
1608 return; 1612 return;
1609 } 1613 }
@@ -1649,6 +1653,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1649 write_unlock_bh(&bond->curr_slave_lock); 1653 write_unlock_bh(&bond->curr_slave_lock);
1650 read_unlock(&bond->lock); 1654 read_unlock(&bond->lock);
1651 1655
1656 ASSERT_RTNL();
1657
1652 /* curr_active_slave must be set before calling alb_swap_mac_addr */ 1658 /* curr_active_slave must be set before calling alb_swap_mac_addr */
1653 if (swap_slave) { 1659 if (swap_slave) {
1654 /* swap mac address */ 1660 /* swap mac address */
@@ -1659,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1659 bond->alb_info.rlb_enabled); 1665 bond->alb_info.rlb_enabled);
1660 } 1666 }
1661 1667
1662 read_lock(&bond->lock);
1663
1664 if (swap_slave) { 1668 if (swap_slave) {
1665 alb_fasten_mac_swap(bond, swap_slave, new_slave); 1669 alb_fasten_mac_swap(bond, swap_slave, new_slave);
1670 read_lock(&bond->lock);
1666 } else { 1671 } else {
1667 /* fasten bond mac on new current slave */ 1672 read_lock(&bond->lock);
1668 alb_send_learning_packets(new_slave, bond->dev->dev_addr); 1673 alb_send_learning_packets(new_slave, bond->dev->dev_addr);
1669 } 1674 }
1670 1675
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b0b26036266b..49a198206e3d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1746,7 +1746,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1746 * has been cleared (if our_slave == old_current), 1746 * has been cleared (if our_slave == old_current),
1747 * but before a new active slave is selected. 1747 * but before a new active slave is selected.
1748 */ 1748 */
1749 write_unlock_bh(&bond->lock);
1749 bond_alb_deinit_slave(bond, slave); 1750 bond_alb_deinit_slave(bond, slave);
1751 write_lock_bh(&bond->lock);
1750 } 1752 }
1751 1753
1752 if (oldcurrent == slave) { 1754 if (oldcurrent == slave) {
@@ -1905,6 +1907,12 @@ static int bond_release_all(struct net_device *bond_dev)
1905 slave_dev = slave->dev; 1907 slave_dev = slave->dev;
1906 bond_detach_slave(bond, slave); 1908 bond_detach_slave(bond, slave);
1907 1909
1910 /* now that the slave is detached, unlock and perform
1911 * all the undo steps that should not be called from
1912 * within a lock.
1913 */
1914 write_unlock_bh(&bond->lock);
1915
1908 if ((bond->params.mode == BOND_MODE_TLB) || 1916 if ((bond->params.mode == BOND_MODE_TLB) ||
1909 (bond->params.mode == BOND_MODE_ALB)) { 1917 (bond->params.mode == BOND_MODE_ALB)) {
1910 /* must be called only after the slave 1918 /* must be called only after the slave
@@ -1915,12 +1923,6 @@ static int bond_release_all(struct net_device *bond_dev)
1915 1923
1916 bond_compute_features(bond); 1924 bond_compute_features(bond);
1917 1925
1918 /* now that the slave is detached, unlock and perform
1919 * all the undo steps that should not be called from
1920 * within a lock.
1921 */
1922 write_unlock_bh(&bond->lock);
1923
1924 bond_destroy_slave_symlinks(bond_dev, slave_dev); 1926 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1925 bond_del_vlans_from_slave(bond, slave_dev); 1927 bond_del_vlans_from_slave(bond, slave_dev);
1926 1928
@@ -2384,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work)
2384 rtnl_lock(); 2386 rtnl_lock();
2385 read_lock(&bond->lock); 2387 read_lock(&bond->lock);
2386 __bond_mii_monitor(bond, 1); 2388 __bond_mii_monitor(bond, 1);
2387 rtnl_unlock(); 2389 read_unlock(&bond->lock);
2390 rtnl_unlock(); /* might sleep, hold no other locks */
2391 read_lock(&bond->lock);
2388 } 2392 }
2389 2393
2390 delay = ((bond->params.miimon * HZ) / 1000) ? : 1; 2394 delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
@@ -3399,9 +3403,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond
3399 case NETDEV_CHANGENAME: 3403 case NETDEV_CHANGENAME:
3400 return bond_event_changename(event_bond); 3404 return bond_event_changename(event_bond);
3401 case NETDEV_UNREGISTER: 3405 case NETDEV_UNREGISTER:
3402 /* 3406 bond_release_all(event_bond->dev);
3403 * TODO: remove a bond from the list?
3404 */
3405 break; 3407 break;
3406 default: 3408 default:
3407 break; 3409 break;
@@ -4540,18 +4542,27 @@ static void bond_free_all(void)
4540 4542
4541/* 4543/*
4542 * Convert string input module parms. Accept either the 4544 * Convert string input module parms. Accept either the
4543 * number of the mode or its string name. 4545 * number of the mode or its string name. A bit complicated because
4546 * some mode names are substrings of other names, and calls from sysfs
4547 * may have whitespace in the name (trailing newlines, for example).
4544 */ 4548 */
4545int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) 4549int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
4546{ 4550{
4547 int i; 4551 int mode = -1, i, rv;
4552 char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
4553
4554 rv = sscanf(buf, "%d", &mode);
4555 if (!rv) {
4556 rv = sscanf(buf, "%20s", modestr);
4557 if (!rv)
4558 return -1;
4559 }
4548 4560
4549 for (i = 0; tbl[i].modename; i++) { 4561 for (i = 0; tbl[i].modename; i++) {
4550 if ((isdigit(*mode_arg) && 4562 if (mode == tbl[i].mode)
4551 tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || 4563 return tbl[i].mode;
4552 (strcmp(mode_arg, tbl[i].modename) == 0)) { 4564 if (strcmp(modestr, tbl[i].modename) == 0)
4553 return tbl[i].mode; 4565 return tbl[i].mode;
4554 }
4555 } 4566 }
4556 4567
4557 return -1; 4568 return -1;
@@ -4865,9 +4876,22 @@ static struct lock_class_key bonding_netdev_xmit_lock_key;
4865int bond_create(char *name, struct bond_params *params, struct bonding **newbond) 4876int bond_create(char *name, struct bond_params *params, struct bonding **newbond)
4866{ 4877{
4867 struct net_device *bond_dev; 4878 struct net_device *bond_dev;
4879 struct bonding *bond, *nxt;
4868 int res; 4880 int res;
4869 4881
4870 rtnl_lock(); 4882 rtnl_lock();
4883 down_write(&bonding_rwsem);
4884
4885 /* Check to see if the bond already exists. */
4886 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
4887 if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
4888 printk(KERN_ERR DRV_NAME
4889 ": cannot add bond %s; it already exists\n",
4890 name);
4891 res = -EPERM;
4892 goto out_rtnl;
4893 }
4894
4871 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", 4895 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
4872 ether_setup); 4896 ether_setup);
4873 if (!bond_dev) { 4897 if (!bond_dev) {
@@ -4906,10 +4930,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4906 4930
4907 netif_carrier_off(bond_dev); 4931 netif_carrier_off(bond_dev);
4908 4932
4933 up_write(&bonding_rwsem);
4909 rtnl_unlock(); /* allows sysfs registration of net device */ 4934 rtnl_unlock(); /* allows sysfs registration of net device */
4910 res = bond_create_sysfs_entry(bond_dev->priv); 4935 res = bond_create_sysfs_entry(bond_dev->priv);
4911 if (res < 0) { 4936 if (res < 0) {
4912 rtnl_lock(); 4937 rtnl_lock();
4938 down_write(&bonding_rwsem);
4913 goto out_bond; 4939 goto out_bond;
4914 } 4940 }
4915 4941
@@ -4920,6 +4946,7 @@ out_bond:
4920out_netdev: 4946out_netdev:
4921 free_netdev(bond_dev); 4947 free_netdev(bond_dev);
4922out_rtnl: 4948out_rtnl:
4949 up_write(&bonding_rwsem);
4923 rtnl_unlock(); 4950 rtnl_unlock();
4924 return res; 4951 return res;
4925} 4952}
@@ -4940,6 +4967,9 @@ static int __init bonding_init(void)
4940#ifdef CONFIG_PROC_FS 4967#ifdef CONFIG_PROC_FS
4941 bond_create_proc_dir(); 4968 bond_create_proc_dir();
4942#endif 4969#endif
4970
4971 init_rwsem(&bonding_rwsem);
4972
4943 for (i = 0; i < max_bonds; i++) { 4973 for (i = 0; i < max_bonds; i++) {
4944 res = bond_create(NULL, &bonding_defaults, NULL); 4974 res = bond_create(NULL, &bonding_defaults, NULL);
4945 if (res) 4975 if (res)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b352415..90a1f31e8e63 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -109,11 +109,10 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
109{ 109{
110 char command[IFNAMSIZ + 1] = {0, }; 110 char command[IFNAMSIZ + 1] = {0, };
111 char *ifname; 111 char *ifname;
112 int res = count; 112 int rv, res = count;
113 struct bonding *bond; 113 struct bonding *bond;
114 struct bonding *nxt; 114 struct bonding *nxt;
115 115
116 down_write(&(bonding_rwsem));
117 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 116 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
118 ifname = command + 1; 117 ifname = command + 1;
119 if ((strlen(command) <= 1) || 118 if ((strlen(command) <= 1) ||
@@ -121,39 +120,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
121 goto err_no_cmd; 120 goto err_no_cmd;
122 121
123 if (command[0] == '+') { 122 if (command[0] == '+') {
124
125 /* Check to see if the bond already exists. */
126 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
127 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
128 printk(KERN_ERR DRV_NAME
129 ": cannot add bond %s; it already exists\n",
130 ifname);
131 res = -EPERM;
132 goto out;
133 }
134
135 printk(KERN_INFO DRV_NAME 123 printk(KERN_INFO DRV_NAME
136 ": %s is being created...\n", ifname); 124 ": %s is being created...\n", ifname);
137 if (bond_create(ifname, &bonding_defaults, &bond)) { 125 rv = bond_create(ifname, &bonding_defaults, &bond);
138 printk(KERN_INFO DRV_NAME 126 if (rv) {
139 ": %s interface already exists. Bond creation failed.\n", 127 printk(KERN_INFO DRV_NAME ": Bond creation failed.\n");
140 ifname); 128 res = rv;
141 res = -EPERM;
142 } 129 }
143 goto out; 130 goto out;
144 } 131 }
145 132
146 if (command[0] == '-') { 133 if (command[0] == '-') {
134 rtnl_lock();
135 down_write(&bonding_rwsem);
136
147 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) 137 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
148 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { 138 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
149 rtnl_lock();
150 /* check the ref count on the bond's kobject. 139 /* check the ref count on the bond's kobject.
151 * If it's > expected, then there's a file open, 140 * If it's > expected, then there's a file open,
152 * and we have to fail. 141 * and we have to fail.
153 */ 142 */
154 if (atomic_read(&bond->dev->dev.kobj.kref.refcount) 143 if (atomic_read(&bond->dev->dev.kobj.kref.refcount)
155 > expected_refcount){ 144 > expected_refcount){
156 rtnl_unlock();
157 printk(KERN_INFO DRV_NAME 145 printk(KERN_INFO DRV_NAME
158 ": Unable remove bond %s due to open references.\n", 146 ": Unable remove bond %s due to open references.\n",
159 ifname); 147 ifname);
@@ -164,6 +152,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
164 ": %s is being deleted...\n", 152 ": %s is being deleted...\n",
165 bond->dev->name); 153 bond->dev->name);
166 bond_destroy(bond); 154 bond_destroy(bond);
155 up_write(&bonding_rwsem);
167 rtnl_unlock(); 156 rtnl_unlock();
168 goto out; 157 goto out;
169 } 158 }
@@ -171,6 +160,8 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
171 printk(KERN_ERR DRV_NAME 160 printk(KERN_ERR DRV_NAME
172 ": unable to delete non-existent bond %s\n", ifname); 161 ": unable to delete non-existent bond %s\n", ifname);
173 res = -ENODEV; 162 res = -ENODEV;
163 up_write(&bonding_rwsem);
164 rtnl_unlock();
174 goto out; 165 goto out;
175 } 166 }
176 167
@@ -183,7 +174,6 @@ err_no_cmd:
183 * get called forever, which is bad. 174 * get called forever, which is bad.
184 */ 175 */
185out: 176out:
186 up_write(&(bonding_rwsem));
187 return res; 177 return res;
188} 178}
189/* class attribute for bond_masters file. This ends up in /sys/class/net */ 179/* class attribute for bond_masters file. This ends up in /sys/class/net */
@@ -271,6 +261,9 @@ static ssize_t bonding_store_slaves(struct device *d,
271 261
272 /* Note: We can't hold bond->lock here, as bond_create grabs it. */ 262 /* Note: We can't hold bond->lock here, as bond_create grabs it. */
273 263
264 rtnl_lock();
265 down_write(&(bonding_rwsem));
266
274 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 267 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
275 ifname = command + 1; 268 ifname = command + 1;
276 if ((strlen(command) <= 1) || 269 if ((strlen(command) <= 1) ||
@@ -336,12 +329,10 @@ static ssize_t bonding_store_slaves(struct device *d,
336 dev->mtu = bond->dev->mtu; 329 dev->mtu = bond->dev->mtu;
337 } 330 }
338 } 331 }
339 rtnl_lock();
340 res = bond_enslave(bond->dev, dev); 332 res = bond_enslave(bond->dev, dev);
341 bond_for_each_slave(bond, slave, i) 333 bond_for_each_slave(bond, slave, i)
342 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) 334 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
343 slave->original_mtu = original_mtu; 335 slave->original_mtu = original_mtu;
344 rtnl_unlock();
345 if (res) { 336 if (res) {
346 ret = res; 337 ret = res;
347 } 338 }
@@ -359,12 +350,10 @@ static ssize_t bonding_store_slaves(struct device *d,
359 if (dev) { 350 if (dev) {
360 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", 351 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
361 bond->dev->name, dev->name); 352 bond->dev->name, dev->name);
362 rtnl_lock();
363 if (bond->setup_by_slave) 353 if (bond->setup_by_slave)
364 res = bond_release_and_destroy(bond->dev, dev); 354 res = bond_release_and_destroy(bond->dev, dev);
365 else 355 else
366 res = bond_release(bond->dev, dev); 356 res = bond_release(bond->dev, dev);
367 rtnl_unlock();
368 if (res) { 357 if (res) {
369 ret = res; 358 ret = res;
370 goto out; 359 goto out;
@@ -389,6 +378,8 @@ err_no_cmd:
389 ret = -EPERM; 378 ret = -EPERM;
390 379
391out: 380out:
381 up_write(&(bonding_rwsem));
382 rtnl_unlock();
392 return ret; 383 return ret;
393} 384}
394 385
@@ -423,7 +414,7 @@ static ssize_t bonding_store_mode(struct device *d,
423 goto out; 414 goto out;
424 } 415 }
425 416
426 new_value = bond_parse_parm((char *)buf, bond_mode_tbl); 417 new_value = bond_parse_parm(buf, bond_mode_tbl);
427 if (new_value < 0) { 418 if (new_value < 0) {
428 printk(KERN_ERR DRV_NAME 419 printk(KERN_ERR DRV_NAME
429 ": %s: Ignoring invalid mode value %.*s.\n", 420 ": %s: Ignoring invalid mode value %.*s.\n",
@@ -478,7 +469,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
478 goto out; 469 goto out;
479 } 470 }
480 471
481 new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); 472 new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
482 if (new_value < 0) { 473 if (new_value < 0) {
483 printk(KERN_ERR DRV_NAME 474 printk(KERN_ERR DRV_NAME
484 ": %s: Ignoring invalid xmit hash policy value %.*s.\n", 475 ": %s: Ignoring invalid xmit hash policy value %.*s.\n",
@@ -518,7 +509,7 @@ static ssize_t bonding_store_arp_validate(struct device *d,
518 int new_value; 509 int new_value;
519 struct bonding *bond = to_bond(d); 510 struct bonding *bond = to_bond(d);
520 511
521 new_value = bond_parse_parm((char *)buf, arp_validate_tbl); 512 new_value = bond_parse_parm(buf, arp_validate_tbl);
522 if (new_value < 0) { 513 if (new_value < 0) {
523 printk(KERN_ERR DRV_NAME 514 printk(KERN_ERR DRV_NAME
524 ": %s: Ignoring invalid arp_validate value %s\n", 515 ": %s: Ignoring invalid arp_validate value %s\n",
@@ -941,7 +932,7 @@ static ssize_t bonding_store_lacp(struct device *d,
941 goto out; 932 goto out;
942 } 933 }
943 934
944 new_value = bond_parse_parm((char *)buf, bond_lacp_tbl); 935 new_value = bond_parse_parm(buf, bond_lacp_tbl);
945 936
946 if ((new_value == 1) || (new_value == 0)) { 937 if ((new_value == 1) || (new_value == 0)) {
947 bond->params.lacp_fast = new_value; 938 bond->params.lacp_fast = new_value;
@@ -1075,7 +1066,10 @@ static ssize_t bonding_store_primary(struct device *d,
1075 struct slave *slave; 1066 struct slave *slave;
1076 struct bonding *bond = to_bond(d); 1067 struct bonding *bond = to_bond(d);
1077 1068
1078 write_lock_bh(&bond->lock); 1069 rtnl_lock();
1070 read_lock(&bond->lock);
1071 write_lock_bh(&bond->curr_slave_lock);
1072
1079 if (!USES_PRIMARY(bond->params.mode)) { 1073 if (!USES_PRIMARY(bond->params.mode)) {
1080 printk(KERN_INFO DRV_NAME 1074 printk(KERN_INFO DRV_NAME
1081 ": %s: Unable to set primary slave; %s is in mode %d\n", 1075 ": %s: Unable to set primary slave; %s is in mode %d\n",
@@ -1109,8 +1103,8 @@ static ssize_t bonding_store_primary(struct device *d,
1109 } 1103 }
1110 } 1104 }
1111out: 1105out:
1112 write_unlock_bh(&bond->lock); 1106 write_unlock_bh(&bond->curr_slave_lock);
1113 1107 read_unlock(&bond->lock);
1114 rtnl_unlock(); 1108 rtnl_unlock();
1115 1109
1116 return count; 1110 return count;
@@ -1190,7 +1184,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1190 struct bonding *bond = to_bond(d); 1184 struct bonding *bond = to_bond(d);
1191 1185
1192 rtnl_lock(); 1186 rtnl_lock();
1193 write_lock_bh(&bond->lock); 1187 read_lock(&bond->lock);
1188 write_lock_bh(&bond->curr_slave_lock);
1194 1189
1195 if (!USES_PRIMARY(bond->params.mode)) { 1190 if (!USES_PRIMARY(bond->params.mode)) {
1196 printk(KERN_INFO DRV_NAME 1191 printk(KERN_INFO DRV_NAME
@@ -1247,7 +1242,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1247 } 1242 }
1248 } 1243 }
1249out: 1244out:
1250 write_unlock_bh(&bond->lock); 1245 write_unlock_bh(&bond->curr_slave_lock);
1246 read_unlock(&bond->lock);
1251 rtnl_unlock(); 1247 rtnl_unlock();
1252 1248
1253 return count; 1249 return count;
@@ -1418,8 +1414,6 @@ int bond_create_sysfs(void)
1418 int ret = 0; 1414 int ret = 0;
1419 struct bonding *firstbond; 1415 struct bonding *firstbond;
1420 1416
1421 init_rwsem(&bonding_rwsem);
1422
1423 /* get the netdev class pointer */ 1417 /* get the netdev class pointer */
1424 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); 1418 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list);
1425 if (!firstbond) 1419 if (!firstbond)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index e1e4734e23ce..6d83be49899a 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -141,6 +141,8 @@ struct bond_parm_tbl {
141 int mode; 141 int mode;
142}; 142};
143 143
144#define BOND_MAX_MODENAME_LEN 20
145
144struct vlan_entry { 146struct vlan_entry {
145 struct list_head vlan_list; 147 struct list_head vlan_list;
146 __be32 vlan_ip; 148 __be32 vlan_ip;
@@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *);
314void bond_loadbalance_arp_mon(struct work_struct *); 316void bond_loadbalance_arp_mon(struct work_struct *);
315void bond_activebackup_arp_mon(struct work_struct *); 317void bond_activebackup_arp_mon(struct work_struct *);
316void bond_set_mode_ops(struct bonding *bond, int mode); 318void bond_set_mode_ops(struct bonding *bond, int mode);
317int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); 319int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
318void bond_select_active_slave(struct bonding *bond); 320void bond_select_active_slave(struct bonding *bond);
319void bond_change_active_slave(struct bonding *bond, struct slave *new_active); 321void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
320void bond_register_arp(struct bonding *); 322void bond_register_arp(struct bonding *);
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 6fd95a2c8cec..6e12d48351b8 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -459,7 +459,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
459 return NETDEV_TX_OK; 459 return NETDEV_TX_OK;
460 460
461 len = max(skb->len, ETH_ZLEN); 461 len = max(skb->len, ETH_ZLEN);
462 queue = skb->queue_mapping; 462 queue = skb_get_queue_mapping(skb);
463#ifdef CONFIG_NETDEVICES_MULTIQUEUE 463#ifdef CONFIG_NETDEVICES_MULTIQUEUE
464 netif_stop_subqueue(dev, queue); 464 netif_stop_subqueue(dev, queue);
465#else 465#else
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 47cce9cad30f..e233d04a2132 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1316,9 +1316,10 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1316 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", 1316 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x",
1317 i, 1317 i,
1318 (u32) (np->tx_ring_dma + i * sizeof (*desc)), 1318 (u32) (np->tx_ring_dma + i * sizeof (*desc)),
1319 (u32) desc->next_desc, 1319 (u32)le64_to_cpu(desc->next_desc),
1320 (u32) desc->status, (u32) (desc->fraginfo >> 32), 1320 (u32)le64_to_cpu(desc->status),
1321 (u32) desc->fraginfo); 1321 (u32)(le64_to_cpu(desc->fraginfo) >> 32),
1322 (u32)le64_to_cpu(desc->fraginfo));
1322 printk ("\n"); 1323 printk ("\n");
1323 } 1324 }
1324 printk ("\n"); 1325 printk ("\n");
@@ -1435,7 +1436,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data)
1435static int 1436static int
1436mii_wait_link (struct net_device *dev, int wait) 1437mii_wait_link (struct net_device *dev, int wait)
1437{ 1438{
1438 BMSR_t bmsr; 1439 __u16 bmsr;
1439 int phy_addr; 1440 int phy_addr;
1440 struct netdev_private *np; 1441 struct netdev_private *np;
1441 1442
@@ -1443,8 +1444,8 @@ mii_wait_link (struct net_device *dev, int wait)
1443 phy_addr = np->phy_addr; 1444 phy_addr = np->phy_addr;
1444 1445
1445 do { 1446 do {
1446 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1447 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1447 if (bmsr.bits.link_status) 1448 if (bmsr & MII_BMSR_LINK_STATUS)
1448 return 0; 1449 return 0;
1449 mdelay (1); 1450 mdelay (1);
1450 } while (--wait > 0); 1451 } while (--wait > 0);
@@ -1453,70 +1454,72 @@ mii_wait_link (struct net_device *dev, int wait)
1453static int 1454static int
1454mii_get_media (struct net_device *dev) 1455mii_get_media (struct net_device *dev)
1455{ 1456{
1456 ANAR_t negotiate; 1457 __u16 negotiate;
1457 BMSR_t bmsr; 1458 __u16 bmsr;
1458 BMCR_t bmcr; 1459 __u16 mscr;
1459 MSCR_t mscr; 1460 __u16 mssr;
1460 MSSR_t mssr;
1461 int phy_addr; 1461 int phy_addr;
1462 struct netdev_private *np; 1462 struct netdev_private *np;
1463 1463
1464 np = netdev_priv(dev); 1464 np = netdev_priv(dev);
1465 phy_addr = np->phy_addr; 1465 phy_addr = np->phy_addr;
1466 1466
1467 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1467 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1468 if (np->an_enable) { 1468 if (np->an_enable) {
1469 if (!bmsr.bits.an_complete) { 1469 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1470 /* Auto-Negotiation not completed */ 1470 /* Auto-Negotiation not completed */
1471 return -1; 1471 return -1;
1472 } 1472 }
1473 negotiate.image = mii_read (dev, phy_addr, MII_ANAR) & 1473 negotiate = mii_read (dev, phy_addr, MII_ANAR) &
1474 mii_read (dev, phy_addr, MII_ANLPAR); 1474 mii_read (dev, phy_addr, MII_ANLPAR);
1475 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1475 mscr = mii_read (dev, phy_addr, MII_MSCR);
1476 mssr.image = mii_read (dev, phy_addr, MII_MSSR); 1476 mssr = mii_read (dev, phy_addr, MII_MSSR);
1477 if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) { 1477 if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) {
1478 np->speed = 1000; 1478 np->speed = 1000;
1479 np->full_duplex = 1; 1479 np->full_duplex = 1;
1480 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1480 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1481 } else if (mscr.bits.media_1000BT_HD & mssr.bits.lp_1000BT_HD) { 1481 } else if (mscr & MII_MSCR_1000BT_HD && mssr & MII_MSSR_LP_1000BT_HD) {
1482 np->speed = 1000; 1482 np->speed = 1000;
1483 np->full_duplex = 0; 1483 np->full_duplex = 0;
1484 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); 1484 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n");
1485 } else if (negotiate.bits.media_100BX_FD) { 1485 } else if (negotiate & MII_ANAR_100BX_FD) {
1486 np->speed = 100; 1486 np->speed = 100;
1487 np->full_duplex = 1; 1487 np->full_duplex = 1;
1488 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); 1488 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n");
1489 } else if (negotiate.bits.media_100BX_HD) { 1489 } else if (negotiate & MII_ANAR_100BX_HD) {
1490 np->speed = 100; 1490 np->speed = 100;
1491 np->full_duplex = 0; 1491 np->full_duplex = 0;
1492 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); 1492 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n");
1493 } else if (negotiate.bits.media_10BT_FD) { 1493 } else if (negotiate & MII_ANAR_10BT_FD) {
1494 np->speed = 10; 1494 np->speed = 10;
1495 np->full_duplex = 1; 1495 np->full_duplex = 1;
1496 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); 1496 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n");
1497 } else if (negotiate.bits.media_10BT_HD) { 1497 } else if (negotiate & MII_ANAR_10BT_HD) {
1498 np->speed = 10; 1498 np->speed = 10;
1499 np->full_duplex = 0; 1499 np->full_duplex = 0;
1500 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); 1500 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n");
1501 } 1501 }
1502 if (negotiate.bits.pause) { 1502 if (negotiate & MII_ANAR_PAUSE) {
1503 np->tx_flow &= 1; 1503 np->tx_flow &= 1;
1504 np->rx_flow &= 1; 1504 np->rx_flow &= 1;
1505 } else if (negotiate.bits.asymmetric) { 1505 } else if (negotiate & MII_ANAR_ASYMMETRIC) {
1506 np->tx_flow = 0; 1506 np->tx_flow = 0;
1507 np->rx_flow &= 1; 1507 np->rx_flow &= 1;
1508 } 1508 }
1509 /* else tx_flow, rx_flow = user select */ 1509 /* else tx_flow, rx_flow = user select */
1510 } else { 1510 } else {
1511 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1511 __u16 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1512 if (bmcr.bits.speed100 == 1 && bmcr.bits.speed1000 == 0) { 1512 switch (bmcr & (MII_BMCR_SPEED_100 | MII_BMCR_SPEED_1000)) {
1513 case MII_BMCR_SPEED_1000:
1514 printk (KERN_INFO "Operating at 1000 Mbps, ");
1515 break;
1516 case MII_BMCR_SPEED_100:
1513 printk (KERN_INFO "Operating at 100 Mbps, "); 1517 printk (KERN_INFO "Operating at 100 Mbps, ");
1514 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 0) { 1518 break;
1519 case 0:
1515 printk (KERN_INFO "Operating at 10 Mbps, "); 1520 printk (KERN_INFO "Operating at 10 Mbps, ");
1516 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 1) {
1517 printk (KERN_INFO "Operating at 1000 Mbps, ");
1518 } 1521 }
1519 if (bmcr.bits.duplex_mode) { 1522 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1520 printk ("Full duplex\n"); 1523 printk ("Full duplex\n");
1521 } else { 1524 } else {
1522 printk ("Half duplex\n"); 1525 printk ("Half duplex\n");
@@ -1537,10 +1540,10 @@ mii_get_media (struct net_device *dev)
1537static int 1540static int
1538mii_set_media (struct net_device *dev) 1541mii_set_media (struct net_device *dev)
1539{ 1542{
1540 PHY_SCR_t pscr; 1543 __u16 pscr;
1541 BMCR_t bmcr; 1544 __u16 bmcr;
1542 BMSR_t bmsr; 1545 __u16 bmsr;
1543 ANAR_t anar; 1546 __u16 anar;
1544 int phy_addr; 1547 int phy_addr;
1545 struct netdev_private *np; 1548 struct netdev_private *np;
1546 np = netdev_priv(dev); 1549 np = netdev_priv(dev);
@@ -1549,76 +1552,77 @@ mii_set_media (struct net_device *dev)
1549 /* Does user set speed? */ 1552 /* Does user set speed? */
1550 if (np->an_enable) { 1553 if (np->an_enable) {
1551 /* Advertise capabilities */ 1554 /* Advertise capabilities */
1552 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1555 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1553 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1556 anar = mii_read (dev, phy_addr, MII_ANAR) &
1554 anar.bits.media_100BX_FD = bmsr.bits.media_100BX_FD; 1557 ~MII_ANAR_100BX_FD &
1555 anar.bits.media_100BX_HD = bmsr.bits.media_100BX_HD; 1558 ~MII_ANAR_100BX_HD &
1556 anar.bits.media_100BT4 = bmsr.bits.media_100BT4; 1559 ~MII_ANAR_100BT4 &
1557 anar.bits.media_10BT_FD = bmsr.bits.media_10BT_FD; 1560 ~MII_ANAR_10BT_FD &
1558 anar.bits.media_10BT_HD = bmsr.bits.media_10BT_HD; 1561 ~MII_ANAR_10BT_HD;
1559 anar.bits.pause = 1; 1562 if (bmsr & MII_BMSR_100BX_FD)
1560 anar.bits.asymmetric = 1; 1563 anar |= MII_ANAR_100BX_FD;
1561 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1564 if (bmsr & MII_BMSR_100BX_HD)
1565 anar |= MII_ANAR_100BX_HD;
1566 if (bmsr & MII_BMSR_100BT4)
1567 anar |= MII_ANAR_100BT4;
1568 if (bmsr & MII_BMSR_10BT_FD)
1569 anar |= MII_ANAR_10BT_FD;
1570 if (bmsr & MII_BMSR_10BT_HD)
1571 anar |= MII_ANAR_10BT_HD;
1572 anar |= MII_ANAR_PAUSE | MII_ANAR_ASYMMETRIC;
1573 mii_write (dev, phy_addr, MII_ANAR, anar);
1562 1574
1563 /* Enable Auto crossover */ 1575 /* Enable Auto crossover */
1564 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1576 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1565 pscr.bits.mdi_crossover_mode = 3; /* 11'b */ 1577 pscr |= 3 << 5; /* 11'b */
1566 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1578 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1567 1579
1568 /* Soft reset PHY */ 1580 /* Soft reset PHY */
1569 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1581 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1570 bmcr.image = 0; 1582 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | MII_BMCR_RESET;
1571 bmcr.bits.an_enable = 1; 1583 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1572 bmcr.bits.restart_an = 1;
1573 bmcr.bits.reset = 1;
1574 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1575 mdelay(1); 1584 mdelay(1);
1576 } else { 1585 } else {
1577 /* Force speed setting */ 1586 /* Force speed setting */
1578 /* 1) Disable Auto crossover */ 1587 /* 1) Disable Auto crossover */
1579 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1588 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1580 pscr.bits.mdi_crossover_mode = 0; 1589 pscr &= ~(3 << 5);
1581 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1590 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1582 1591
1583 /* 2) PHY Reset */ 1592 /* 2) PHY Reset */
1584 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1593 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1585 bmcr.bits.reset = 1; 1594 bmcr |= MII_BMCR_RESET;
1586 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1595 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1587 1596
1588 /* 3) Power Down */ 1597 /* 3) Power Down */
1589 bmcr.image = 0x1940; /* must be 0x1940 */ 1598 bmcr = 0x1940; /* must be 0x1940 */
1590 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1599 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1591 mdelay (100); /* wait a certain time */ 1600 mdelay (100); /* wait a certain time */
1592 1601
1593 /* 4) Advertise nothing */ 1602 /* 4) Advertise nothing */
1594 mii_write (dev, phy_addr, MII_ANAR, 0); 1603 mii_write (dev, phy_addr, MII_ANAR, 0);
1595 1604
1596 /* 5) Set media and Power Up */ 1605 /* 5) Set media and Power Up */
1597 bmcr.image = 0; 1606 bmcr = MII_BMCR_POWER_DOWN;
1598 bmcr.bits.power_down = 1;
1599 if (np->speed == 100) { 1607 if (np->speed == 100) {
1600 bmcr.bits.speed100 = 1; 1608 bmcr |= MII_BMCR_SPEED_100;
1601 bmcr.bits.speed1000 = 0;
1602 printk (KERN_INFO "Manual 100 Mbps, "); 1609 printk (KERN_INFO "Manual 100 Mbps, ");
1603 } else if (np->speed == 10) { 1610 } else if (np->speed == 10) {
1604 bmcr.bits.speed100 = 0;
1605 bmcr.bits.speed1000 = 0;
1606 printk (KERN_INFO "Manual 10 Mbps, "); 1611 printk (KERN_INFO "Manual 10 Mbps, ");
1607 } 1612 }
1608 if (np->full_duplex) { 1613 if (np->full_duplex) {
1609 bmcr.bits.duplex_mode = 1; 1614 bmcr |= MII_BMCR_DUPLEX_MODE;
1610 printk ("Full duplex\n"); 1615 printk ("Full duplex\n");
1611 } else { 1616 } else {
1612 bmcr.bits.duplex_mode = 0;
1613 printk ("Half duplex\n"); 1617 printk ("Half duplex\n");
1614 } 1618 }
1615#if 0 1619#if 0
1616 /* Set 1000BaseT Master/Slave setting */ 1620 /* Set 1000BaseT Master/Slave setting */
1617 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1621 mscr = mii_read (dev, phy_addr, MII_MSCR);
1618 mscr.bits.cfg_enable = 1; 1622 mscr |= MII_MSCR_CFG_ENABLE;
1619 mscr.bits.cfg_value = 0; 1623 mscr &= ~MII_MSCR_CFG_VALUE = 0;
1620#endif 1624#endif
1621 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1625 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1622 mdelay(10); 1626 mdelay(10);
1623 } 1627 }
1624 return 0; 1628 return 0;
@@ -1627,43 +1631,42 @@ mii_set_media (struct net_device *dev)
1627static int 1631static int
1628mii_get_media_pcs (struct net_device *dev) 1632mii_get_media_pcs (struct net_device *dev)
1629{ 1633{
1630 ANAR_PCS_t negotiate; 1634 __u16 negotiate;
1631 BMSR_t bmsr; 1635 __u16 bmsr;
1632 BMCR_t bmcr;
1633 int phy_addr; 1636 int phy_addr;
1634 struct netdev_private *np; 1637 struct netdev_private *np;
1635 1638
1636 np = netdev_priv(dev); 1639 np = netdev_priv(dev);
1637 phy_addr = np->phy_addr; 1640 phy_addr = np->phy_addr;
1638 1641
1639 bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); 1642 bmsr = mii_read (dev, phy_addr, PCS_BMSR);
1640 if (np->an_enable) { 1643 if (np->an_enable) {
1641 if (!bmsr.bits.an_complete) { 1644 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1642 /* Auto-Negotiation not completed */ 1645 /* Auto-Negotiation not completed */
1643 return -1; 1646 return -1;
1644 } 1647 }
1645 negotiate.image = mii_read (dev, phy_addr, PCS_ANAR) & 1648 negotiate = mii_read (dev, phy_addr, PCS_ANAR) &
1646 mii_read (dev, phy_addr, PCS_ANLPAR); 1649 mii_read (dev, phy_addr, PCS_ANLPAR);
1647 np->speed = 1000; 1650 np->speed = 1000;
1648 if (negotiate.bits.full_duplex) { 1651 if (negotiate & PCS_ANAR_FULL_DUPLEX) {
1649 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1652 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1650 np->full_duplex = 1; 1653 np->full_duplex = 1;
1651 } else { 1654 } else {
1652 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); 1655 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n");
1653 np->full_duplex = 0; 1656 np->full_duplex = 0;
1654 } 1657 }
1655 if (negotiate.bits.pause) { 1658 if (negotiate & PCS_ANAR_PAUSE) {
1656 np->tx_flow &= 1; 1659 np->tx_flow &= 1;
1657 np->rx_flow &= 1; 1660 np->rx_flow &= 1;
1658 } else if (negotiate.bits.asymmetric) { 1661 } else if (negotiate & PCS_ANAR_ASYMMETRIC) {
1659 np->tx_flow = 0; 1662 np->tx_flow = 0;
1660 np->rx_flow &= 1; 1663 np->rx_flow &= 1;
1661 } 1664 }
1662 /* else tx_flow, rx_flow = user select */ 1665 /* else tx_flow, rx_flow = user select */
1663 } else { 1666 } else {
1664 bmcr.image = mii_read (dev, phy_addr, PCS_BMCR); 1667 __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR);
1665 printk (KERN_INFO "Operating at 1000 Mbps, "); 1668 printk (KERN_INFO "Operating at 1000 Mbps, ");
1666 if (bmcr.bits.duplex_mode) { 1669 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1667 printk ("Full duplex\n"); 1670 printk ("Full duplex\n");
1668 } else { 1671 } else {
1669 printk ("Half duplex\n"); 1672 printk ("Half duplex\n");
@@ -1684,9 +1687,9 @@ mii_get_media_pcs (struct net_device *dev)
1684static int 1687static int
1685mii_set_media_pcs (struct net_device *dev) 1688mii_set_media_pcs (struct net_device *dev)
1686{ 1689{
1687 BMCR_t bmcr; 1690 __u16 bmcr;
1688 ESR_t esr; 1691 __u16 esr;
1689 ANAR_PCS_t anar; 1692 __u16 anar;
1690 int phy_addr; 1693 int phy_addr;
1691 struct netdev_private *np; 1694 struct netdev_private *np;
1692 np = netdev_priv(dev); 1695 np = netdev_priv(dev);
@@ -1695,41 +1698,37 @@ mii_set_media_pcs (struct net_device *dev)
1695 /* Auto-Negotiation? */ 1698 /* Auto-Negotiation? */
1696 if (np->an_enable) { 1699 if (np->an_enable) {
1697 /* Advertise capabilities */ 1700 /* Advertise capabilities */
1698 esr.image = mii_read (dev, phy_addr, PCS_ESR); 1701 esr = mii_read (dev, phy_addr, PCS_ESR);
1699 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1702 anar = mii_read (dev, phy_addr, MII_ANAR) &
1700 anar.bits.half_duplex = 1703 ~PCS_ANAR_HALF_DUPLEX &
1701 esr.bits.media_1000BT_HD | esr.bits.media_1000BX_HD; 1704 ~PCS_ANAR_FULL_DUPLEX;
1702 anar.bits.full_duplex = 1705 if (esr & (MII_ESR_1000BT_HD | MII_ESR_1000BX_HD))
1703 esr.bits.media_1000BT_FD | esr.bits.media_1000BX_FD; 1706 anar |= PCS_ANAR_HALF_DUPLEX;
1704 anar.bits.pause = 1; 1707 if (esr & (MII_ESR_1000BT_FD | MII_ESR_1000BX_FD))
1705 anar.bits.asymmetric = 1; 1708 anar |= PCS_ANAR_FULL_DUPLEX;
1706 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1709 anar |= PCS_ANAR_PAUSE | PCS_ANAR_ASYMMETRIC;
1710 mii_write (dev, phy_addr, MII_ANAR, anar);
1707 1711
1708 /* Soft reset PHY */ 1712 /* Soft reset PHY */
1709 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1713 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1710 bmcr.image = 0; 1714 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN |
1711 bmcr.bits.an_enable = 1; 1715 MII_BMCR_RESET;
1712 bmcr.bits.restart_an = 1; 1716 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1713 bmcr.bits.reset = 1;
1714 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1715 mdelay(1); 1717 mdelay(1);
1716 } else { 1718 } else {
1717 /* Force speed setting */ 1719 /* Force speed setting */
1718 /* PHY Reset */ 1720 /* PHY Reset */
1719 bmcr.image = 0; 1721 bmcr = MII_BMCR_RESET;
1720 bmcr.bits.reset = 1; 1722 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1721 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1722 mdelay(10); 1723 mdelay(10);
1723 bmcr.image = 0;
1724 bmcr.bits.an_enable = 0;
1725 if (np->full_duplex) { 1724 if (np->full_duplex) {
1726 bmcr.bits.duplex_mode = 1; 1725 bmcr = MII_BMCR_DUPLEX_MODE;
1727 printk (KERN_INFO "Manual full duplex\n"); 1726 printk (KERN_INFO "Manual full duplex\n");
1728 } else { 1727 } else {
1729 bmcr.bits.duplex_mode = 0; 1728 bmcr = 0;
1730 printk (KERN_INFO "Manual half duplex\n"); 1729 printk (KERN_INFO "Manual half duplex\n");
1731 } 1730 }
1732 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1731 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1733 mdelay(10); 1732 mdelay(10);
1734 1733
1735 /* Advertise nothing */ 1734 /* Advertise nothing */
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 014b77ce96df..d66c605b4075 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -298,23 +298,6 @@ enum _pcs_reg {
298}; 298};
299 299
300/* Basic Mode Control Register */ 300/* Basic Mode Control Register */
301typedef union t_MII_BMCR {
302 u16 image;
303 struct {
304 u16 _bit_5_0:6; // bit 5:0
305 u16 speed1000:1; // bit 6
306 u16 col_test_enable:1; // bit 7
307 u16 duplex_mode:1; // bit 8
308 u16 restart_an:1; // bit 9
309 u16 isolate:1; // bit 10
310 u16 power_down:1; // bit 11
311 u16 an_enable:1; // bit 12
312 u16 speed100:1; // bit 13
313 u16 loopback:1; // bit 14
314 u16 reset:1; // bit 15
315 } bits;
316} BMCR_t, *PBMCR_t;
317
318enum _mii_bmcr { 301enum _mii_bmcr {
319 MII_BMCR_RESET = 0x8000, 302 MII_BMCR_RESET = 0x8000,
320 MII_BMCR_LOOP_BACK = 0x4000, 303 MII_BMCR_LOOP_BACK = 0x4000,
@@ -333,28 +316,6 @@ enum _mii_bmcr {
333}; 316};
334 317
335/* Basic Mode Status Register */ 318/* Basic Mode Status Register */
336typedef union t_MII_BMSR {
337 u16 image;
338 struct {
339 u16 ext_capability:1; // bit 0
340 u16 japper_detect:1; // bit 1
341 u16 link_status:1; // bit 2
342 u16 an_ability:1; // bit 3
343 u16 remote_fault:1; // bit 4
344 u16 an_complete:1; // bit 5
345 u16 preamble_supp:1; // bit 6
346 u16 _bit_7:1; // bit 7
347 u16 ext_status:1; // bit 8
348 u16 media_100BT2_HD:1; // bit 9
349 u16 media_100BT2_FD:1; // bit 10
350 u16 media_10BT_HD:1; // bit 11
351 u16 media_10BT_FD:1; // bit 12
352 u16 media_100BX_HD:1; // bit 13
353 u16 media_100BX_FD:1; // bit 14
354 u16 media_100BT4:1; // bit 15
355 } bits;
356} BMSR_t, *PBMSR_t;
357
358enum _mii_bmsr { 319enum _mii_bmsr {
359 MII_BMSR_100BT4 = 0x8000, 320 MII_BMSR_100BT4 = 0x8000,
360 MII_BMSR_100BX_FD = 0x4000, 321 MII_BMSR_100BX_FD = 0x4000,
@@ -374,24 +335,6 @@ enum _mii_bmsr {
374}; 335};
375 336
376/* ANAR */ 337/* ANAR */
377typedef union t_MII_ANAR {
378 u16 image;
379 struct {
380 u16 selector:5; // bit 4:0
381 u16 media_10BT_HD:1; // bit 5
382 u16 media_10BT_FD:1; // bit 6
383 u16 media_100BX_HD:1; // bit 7
384 u16 media_100BX_FD:1; // bit 8
385 u16 media_100BT4:1; // bit 9
386 u16 pause:1; // bit 10
387 u16 asymmetric:1; // bit 11
388 u16 _bit12:1; // bit 12
389 u16 remote_fault:1; // bit 13
390 u16 _bit14:1; // bit 14
391 u16 next_page:1; // bit 15
392 } bits;
393} ANAR_t, *PANAR_t;
394
395enum _mii_anar { 338enum _mii_anar {
396 MII_ANAR_NEXT_PAGE = 0x8000, 339 MII_ANAR_NEXT_PAGE = 0x8000,
397 MII_ANAR_REMOTE_FAULT = 0x4000, 340 MII_ANAR_REMOTE_FAULT = 0x4000,
@@ -407,24 +350,6 @@ enum _mii_anar {
407}; 350};
408 351
409/* ANLPAR */ 352/* ANLPAR */
410typedef union t_MII_ANLPAR {
411 u16 image;
412 struct {
413 u16 selector:5; // bit 4:0
414 u16 media_10BT_HD:1; // bit 5
415 u16 media_10BT_FD:1; // bit 6
416 u16 media_100BX_HD:1; // bit 7
417 u16 media_100BX_FD:1; // bit 8
418 u16 media_100BT4:1; // bit 9
419 u16 pause:1; // bit 10
420 u16 asymmetric:1; // bit 11
421 u16 _bit12:1; // bit 12
422 u16 remote_fault:1; // bit 13
423 u16 _bit14:1; // bit 14
424 u16 next_page:1; // bit 15
425 } bits;
426} ANLPAR_t, *PANLPAR_t;
427
428enum _mii_anlpar { 353enum _mii_anlpar {
429 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE, 354 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE,
430 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT, 355 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT,
@@ -439,18 +364,6 @@ enum _mii_anlpar {
439}; 364};
440 365
441/* Auto-Negotiation Expansion Register */ 366/* Auto-Negotiation Expansion Register */
442typedef union t_MII_ANER {
443 u16 image;
444 struct {
445 u16 lp_negotiable:1; // bit 0
446 u16 page_received:1; // bit 1
447 u16 nextpagable:1; // bit 2
448 u16 lp_nextpagable:1; // bit 3
449 u16 pdetect_fault:1; // bit 4
450 u16 _bit15_5:11; // bit 15:5
451 } bits;
452} ANER_t, *PANER_t;
453
454enum _mii_aner { 367enum _mii_aner {
455 MII_ANER_PAR_DETECT_FAULT = 0x0010, 368 MII_ANER_PAR_DETECT_FAULT = 0x0010,
456 MII_ANER_LP_NEXTPAGABLE = 0x0008, 369 MII_ANER_LP_NEXTPAGABLE = 0x0008,
@@ -460,19 +373,6 @@ enum _mii_aner {
460}; 373};
461 374
462/* MASTER-SLAVE Control Register */ 375/* MASTER-SLAVE Control Register */
463typedef union t_MII_MSCR {
464 u16 image;
465 struct {
466 u16 _bit_7_0:8; // bit 7:0
467 u16 media_1000BT_HD:1; // bit 8
468 u16 media_1000BT_FD:1; // bit 9
469 u16 port_type:1; // bit 10
470 u16 cfg_value:1; // bit 11
471 u16 cfg_enable:1; // bit 12
472 u16 test_mode:3; // bit 15:13
473 } bits;
474} MSCR_t, *PMSCR_t;
475
476enum _mii_mscr { 376enum _mii_mscr {
477 MII_MSCR_TEST_MODE = 0xe000, 377 MII_MSCR_TEST_MODE = 0xe000,
478 MII_MSCR_CFG_ENABLE = 0x1000, 378 MII_MSCR_CFG_ENABLE = 0x1000,
@@ -483,20 +383,6 @@ enum _mii_mscr {
483}; 383};
484 384
485/* MASTER-SLAVE Status Register */ 385/* MASTER-SLAVE Status Register */
486typedef union t_MII_MSSR {
487 u16 image;
488 struct {
489 u16 idle_err_count:8; // bit 7:0
490 u16 _bit_9_8:2; // bit 9:8
491 u16 lp_1000BT_HD:1; // bit 10
492 u16 lp_1000BT_FD:1; // bit 11
493 u16 remote_rcv_status:1; // bit 12
494 u16 local_rcv_status:1; // bit 13
495 u16 cfg_resolution:1; // bit 14
496 u16 cfg_fault:1; // bit 15
497 } bits;
498} MSSR_t, *PMSSR_t;
499
500enum _mii_mssr { 386enum _mii_mssr {
501 MII_MSSR_CFG_FAULT = 0x8000, 387 MII_MSSR_CFG_FAULT = 0x8000,
502 MII_MSSR_CFG_RES = 0x4000, 388 MII_MSSR_CFG_RES = 0x4000,
@@ -508,17 +394,6 @@ enum _mii_mssr {
508}; 394};
509 395
510/* IEEE Extened Status Register */ 396/* IEEE Extened Status Register */
511typedef union t_MII_ESR {
512 u16 image;
513 struct {
514 u16 _bit_11_0:12; // bit 11:0
515 u16 media_1000BT_HD:2; // bit 12
516 u16 media_1000BT_FD:1; // bit 13
517 u16 media_1000BX_HD:1; // bit 14
518 u16 media_1000BX_FD:1; // bit 15
519 } bits;
520} ESR_t, *PESR_t;
521
522enum _mii_esr { 397enum _mii_esr {
523 MII_ESR_1000BX_FD = 0x8000, 398 MII_ESR_1000BX_FD = 0x8000,
524 MII_ESR_1000BX_HD = 0x4000, 399 MII_ESR_1000BX_HD = 0x4000,
@@ -526,6 +401,7 @@ enum _mii_esr {
526 MII_ESR_1000BT_HD = 0x1000, 401 MII_ESR_1000BT_HD = 0x1000,
527}; 402};
528/* PHY Specific Control Register */ 403/* PHY Specific Control Register */
404#if 0
529typedef union t_MII_PHY_SCR { 405typedef union t_MII_PHY_SCR {
530 u16 image; 406 u16 image;
531 struct { 407 struct {
@@ -543,6 +419,7 @@ typedef union t_MII_PHY_SCR {
543 u16 xmit_fifo_depth:2; // bit 15:14 419 u16 xmit_fifo_depth:2; // bit 15:14
544 } bits; 420 } bits;
545} PHY_SCR_t, *PPHY_SCR_t; 421} PHY_SCR_t, *PPHY_SCR_t;
422#endif
546 423
547typedef enum t_MII_ADMIN_STATUS { 424typedef enum t_MII_ADMIN_STATUS {
548 adm_reset, 425 adm_reset,
@@ -556,21 +433,6 @@ typedef enum t_MII_ADMIN_STATUS {
556/* PCS control and status registers bitmap as the same as MII */ 433/* PCS control and status registers bitmap as the same as MII */
557/* PCS Extended Status register bitmap as the same as MII */ 434/* PCS Extended Status register bitmap as the same as MII */
558/* PCS ANAR */ 435/* PCS ANAR */
559typedef union t_PCS_ANAR {
560 u16 image;
561 struct {
562 u16 _bit_4_0:5; // bit 4:0
563 u16 full_duplex:1; // bit 5
564 u16 half_duplex:1; // bit 6
565 u16 asymmetric:1; // bit 7
566 u16 pause:1; // bit 8
567 u16 _bit_11_9:3; // bit 11:9
568 u16 remote_fault:2; // bit 13:12
569 u16 _bit_14:1; // bit 14
570 u16 next_page:1; // bit 15
571 } bits;
572} ANAR_PCS_t, *PANAR_PCS_t;
573
574enum _pcs_anar { 436enum _pcs_anar {
575 PCS_ANAR_NEXT_PAGE = 0x8000, 437 PCS_ANAR_NEXT_PAGE = 0x8000,
576 PCS_ANAR_REMOTE_FAULT = 0x3000, 438 PCS_ANAR_REMOTE_FAULT = 0x3000,
@@ -580,21 +442,6 @@ enum _pcs_anar {
580 PCS_ANAR_FULL_DUPLEX = 0x0020, 442 PCS_ANAR_FULL_DUPLEX = 0x0020,
581}; 443};
582/* PCS ANLPAR */ 444/* PCS ANLPAR */
583typedef union t_PCS_ANLPAR {
584 u16 image;
585 struct {
586 u16 _bit_4_0:5; // bit 4:0
587 u16 full_duplex:1; // bit 5
588 u16 half_duplex:1; // bit 6
589 u16 asymmetric:1; // bit 7
590 u16 pause:1; // bit 8
591 u16 _bit_11_9:3; // bit 11:9
592 u16 remote_fault:2; // bit 13:12
593 u16 _bit_14:1; // bit 14
594 u16 next_page:1; // bit 15
595 } bits;
596} ANLPAR_PCS_t, *PANLPAR_PCS_t;
597
598enum _pcs_anlpar { 445enum _pcs_anlpar {
599 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE, 446 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE,
600 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT, 447 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT,
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 13d57b0a88fa..76c0fa690cc6 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -632,6 +632,7 @@ e1000_down(struct e1000_adapter *adapter)
632 632
633#ifdef CONFIG_E1000_NAPI 633#ifdef CONFIG_E1000_NAPI
634 napi_disable(&adapter->napi); 634 napi_disable(&adapter->napi);
635 atomic_set(&adapter->irq_sem, 0);
635#endif 636#endif
636 e1000_irq_disable(adapter); 637 e1000_irq_disable(adapter);
637 638
@@ -3919,7 +3920,7 @@ e1000_clean(struct napi_struct *napi, int budget)
3919{ 3920{
3920 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); 3921 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
3921 struct net_device *poll_dev = adapter->netdev; 3922 struct net_device *poll_dev = adapter->netdev;
3922 int work_done = 0; 3923 int tx_cleaned = 0, work_done = 0;
3923 3924
3924 /* Must NOT use netdev_priv macro here. */ 3925 /* Must NOT use netdev_priv macro here. */
3925 adapter = poll_dev->priv; 3926 adapter = poll_dev->priv;
@@ -3929,14 +3930,17 @@ e1000_clean(struct napi_struct *napi, int budget)
3929 * simultaneously. A failure obtaining the lock means 3930 * simultaneously. A failure obtaining the lock means
3930 * tx_ring[0] is currently being cleaned anyway. */ 3931 * tx_ring[0] is currently being cleaned anyway. */
3931 if (spin_trylock(&adapter->tx_queue_lock)) { 3932 if (spin_trylock(&adapter->tx_queue_lock)) {
3932 e1000_clean_tx_irq(adapter, 3933 tx_cleaned = e1000_clean_tx_irq(adapter,
3933 &adapter->tx_ring[0]); 3934 &adapter->tx_ring[0]);
3934 spin_unlock(&adapter->tx_queue_lock); 3935 spin_unlock(&adapter->tx_queue_lock);
3935 } 3936 }
3936 3937
3937 adapter->clean_rx(adapter, &adapter->rx_ring[0], 3938 adapter->clean_rx(adapter, &adapter->rx_ring[0],
3938 &work_done, budget); 3939 &work_done, budget);
3939 3940
3941 if (tx_cleaned)
3942 work_done = budget;
3943
3940 /* If budget not fully consumed, exit the polling mode */ 3944 /* If budget not fully consumed, exit the polling mode */
3941 if (work_done < budget) { 3945 if (work_done < budget) {
3942 if (likely(adapter->itr_setting & 3)) 3946 if (likely(adapter->itr_setting & 3))
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4a6fc7453776..9cc5a6b01bc1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1384,7 +1384,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1384{ 1384{
1385 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); 1385 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
1386 struct net_device *poll_dev = adapter->netdev; 1386 struct net_device *poll_dev = adapter->netdev;
1387 int work_done = 0; 1387 int tx_cleaned = 0, work_done = 0;
1388 1388
1389 /* Must NOT use netdev_priv macro here. */ 1389 /* Must NOT use netdev_priv macro here. */
1390 adapter = poll_dev->priv; 1390 adapter = poll_dev->priv;
@@ -1394,12 +1394,15 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1394 * simultaneously. A failure obtaining the lock means 1394 * simultaneously. A failure obtaining the lock means
1395 * tx_ring is currently being cleaned anyway. */ 1395 * tx_ring is currently being cleaned anyway. */
1396 if (spin_trylock(&adapter->tx_queue_lock)) { 1396 if (spin_trylock(&adapter->tx_queue_lock)) {
1397 e1000_clean_tx_irq(adapter); 1397 tx_cleaned = e1000_clean_tx_irq(adapter);
1398 spin_unlock(&adapter->tx_queue_lock); 1398 spin_unlock(&adapter->tx_queue_lock);
1399 } 1399 }
1400 1400
1401 adapter->clean_rx(adapter, &work_done, budget); 1401 adapter->clean_rx(adapter, &work_done, budget);
1402 1402
1403 if (tx_cleaned)
1404 work_done = budget;
1405
1403 /* If budget not fully consumed, exit the polling mode */ 1406 /* If budget not fully consumed, exit the polling mode */
1404 if (work_done < budget) { 1407 if (work_done < budget) {
1405 if (adapter->itr_setting & 3) 1408 if (adapter->itr_setting & 3)
@@ -2180,6 +2183,7 @@ void e1000e_down(struct e1000_adapter *adapter)
2180 msleep(10); 2183 msleep(10);
2181 2184
2182 napi_disable(&adapter->napi); 2185 napi_disable(&adapter->napi);
2186 atomic_set(&adapter->irq_sem, 0);
2183 e1000_irq_disable(adapter); 2187 e1000_irq_disable(adapter);
2184 2188
2185 del_timer_sync(&adapter->watchdog_timer); 2189 del_timer_sync(&adapter->watchdog_timer);
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb65d1e..50f0c17451b1 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
857static void ipg_nic_txfree(struct net_device *dev) 857static void ipg_nic_txfree(struct net_device *dev)
858{ 858{
859 struct ipg_nic_private *sp = netdev_priv(dev); 859 struct ipg_nic_private *sp = netdev_priv(dev);
860 void __iomem *ioaddr = sp->ioaddr; 860 unsigned int released, pending, dirty;
861 unsigned int curr;
862 u64 txd_map;
863 unsigned int released, pending;
864
865 txd_map = (u64)sp->txd_map;
866 curr = ipg_r32(TFD_LIST_PTR_0) -
867 do_div(txd_map, sizeof(struct ipg_tx)) - 1;
868 861
869 IPG_DEBUG_MSG("_nic_txfree\n"); 862 IPG_DEBUG_MSG("_nic_txfree\n");
870 863
871 pending = sp->tx_current - sp->tx_dirty; 864 pending = sp->tx_current - sp->tx_dirty;
865 dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
872 866
873 for (released = 0; released < pending; released++) { 867 for (released = 0; released < pending; released++) {
874 unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
875 struct sk_buff *skb = sp->TxBuff[dirty]; 868 struct sk_buff *skb = sp->TxBuff[dirty];
876 struct ipg_tx *txfd = sp->txd + dirty; 869 struct ipg_tx *txfd = sp->txd + dirty;
877 870
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
882 * If the TFDDone bit is set, free the associated 875 * If the TFDDone bit is set, free the associated
883 * buffer. 876 * buffer.
884 */ 877 */
885 if (dirty == curr) 878 if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
886 break; 879 break;
887
888 /* Setup TFDDONE for compatible issue. */
889 txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
890 880
891 /* Free the transmit buffer. */ 881 /* Free the transmit buffer. */
892 if (skb) { 882 if (skb) {
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
898 888
899 sp->TxBuff[dirty] = NULL; 889 sp->TxBuff[dirty] = NULL;
900 } 890 }
891 dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
901 } 892 }
902 893
903 sp->tx_dirty += released; 894 sp->tx_dirty += released;
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1630#ifdef JUMBO_FRAME 1621#ifdef JUMBO_FRAME
1631 ipg_nic_rxrestore(dev); 1622 ipg_nic_rxrestore(dev);
1632#endif 1623#endif
1624 spin_lock(&sp->lock);
1625
1633 /* Get interrupt source information, and acknowledge 1626 /* Get interrupt source information, and acknowledge
1634 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, 1627 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
1635 * IntRequested, MacControlFrame, LinkEvent) interrupts 1628 * IntRequested, MacControlFrame, LinkEvent) interrupts
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1647 handled = 1; 1640 handled = 1;
1648 1641
1649 if (unlikely(!netif_running(dev))) 1642 if (unlikely(!netif_running(dev)))
1650 goto out; 1643 goto out_unlock;
1651
1652 spin_lock(&sp->lock);
1653 1644
1654 /* If RFDListEnd interrupt, restore all used RFDs. */ 1645 /* If RFDListEnd interrupt, restore all used RFDs. */
1655 if (status & IPG_IS_RFD_LIST_END) { 1646 if (status & IPG_IS_RFD_LIST_END) {
@@ -1733,9 +1724,9 @@ out_enable:
1733 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | 1724 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
1734 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | 1725 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
1735 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); 1726 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
1736 1727out_unlock:
1737 spin_unlock(&sp->lock); 1728 spin_unlock(&sp->lock);
1738out: 1729
1739 return IRQ_RETVAL(handled); 1730 return IRQ_RETVAL(handled);
1740} 1731}
1741 1732
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1943 */ 1934 */
1944 if (sp->tenmbpsmode) 1935 if (sp->tenmbpsmode)
1945 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); 1936 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
1946 else if (!((sp->tx_current - sp->tx_dirty + 1) > 1937 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1947 IPG_FRAMESBETWEENTXDMACOMPLETES)) {
1948 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1949 }
1950 /* Based on compilation option, determine if FCS is to be 1938 /* Based on compilation option, determine if FCS is to be
1951 * appended to transmit frame by IPG. 1939 * appended to transmit frame by IPG.
1952 */ 1940 */
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2003 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); 1991 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
2004 1992
2005 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) 1993 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
2006 netif_wake_queue(dev); 1994 netif_stop_queue(dev);
2007 1995
2008 spin_unlock_irqrestore(&sp->lock, flags); 1996 spin_unlock_irqrestore(&sp->lock, flags);
2009 1997
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d2fb88d5cda2..4f63839051b0 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -296,6 +296,11 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
296{ 296{
297 struct net_device *netdev = adapter->netdev; 297 struct net_device *netdev = adapter->netdev;
298 298
299#ifdef CONFIG_IXGB_NAPI
300 napi_disable(&adapter->napi);
301 atomic_set(&adapter->irq_sem, 0);
302#endif
303
299 ixgb_irq_disable(adapter); 304 ixgb_irq_disable(adapter);
300 free_irq(adapter->pdev->irq, netdev); 305 free_irq(adapter->pdev->irq, netdev);
301 306
@@ -304,9 +309,7 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
304 309
305 if(kill_watchdog) 310 if(kill_watchdog)
306 del_timer_sync(&adapter->watchdog_timer); 311 del_timer_sync(&adapter->watchdog_timer);
307#ifdef CONFIG_IXGB_NAPI 312
308 napi_disable(&adapter->napi);
309#endif
310 adapter->link_speed = 0; 313 adapter->link_speed = 0;
311 adapter->link_duplex = 0; 314 adapter->link_duplex = 0;
312 netif_carrier_off(netdev); 315 netif_carrier_off(netdev);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a56491617661..a4265bc1cebb 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1409,9 +1409,11 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
1409 IXGBE_WRITE_FLUSH(&adapter->hw); 1409 IXGBE_WRITE_FLUSH(&adapter->hw);
1410 msleep(10); 1410 msleep(10);
1411 1411
1412 napi_disable(&adapter->napi);
1413 atomic_set(&adapter->irq_sem, 0);
1414
1412 ixgbe_irq_disable(adapter); 1415 ixgbe_irq_disable(adapter);
1413 1416
1414 napi_disable(&adapter->napi);
1415 del_timer_sync(&adapter->watchdog_timer); 1417 del_timer_sync(&adapter->watchdog_timer);
1416 1418
1417 netif_carrier_off(netdev); 1419 netif_carrier_off(netdev);
@@ -1468,13 +1470,16 @@ static int ixgbe_clean(struct napi_struct *napi, int budget)
1468 struct ixgbe_adapter *adapter = container_of(napi, 1470 struct ixgbe_adapter *adapter = container_of(napi,
1469 struct ixgbe_adapter, napi); 1471 struct ixgbe_adapter, napi);
1470 struct net_device *netdev = adapter->netdev; 1472 struct net_device *netdev = adapter->netdev;
1471 int work_done = 0; 1473 int tx_cleaned = 0, work_done = 0;
1472 1474
1473 /* In non-MSIX case, there is no multi-Tx/Rx queue */ 1475 /* In non-MSIX case, there is no multi-Tx/Rx queue */
1474 ixgbe_clean_tx_irq(adapter, adapter->tx_ring); 1476 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
1475 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, 1477 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
1476 budget); 1478 budget);
1477 1479
1480 if (tx_cleaned)
1481 work_done = budget;
1482
1478 /* If budget not fully consumed, exit the polling mode */ 1483 /* If budget not fully consumed, exit the polling mode */
1479 if (work_done < budget) { 1484 if (work_done < budget) {
1480 netif_rx_complete(netdev, napi); 1485 netif_rx_complete(netdev, napi);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5654c4..e8dc2f44fec9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
384 if (lowerdev == NULL) 384 if (lowerdev == NULL)
385 return -ENODEV; 385 return -ENODEV;
386 386
387 /* Don't allow macvlans on top of other macvlans - its not really
388 * wrong, but lockdep can't handle it and its not useful for anything
389 * you couldn't do directly on top of the real device.
390 */
391 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
392 return -ENODEV;
393
387 if (!tb[IFLA_MTU]) 394 if (!tb[IFLA_MTU])
388 dev->mtu = lowerdev->mtu; 395 dev->mtu = lowerdev->mtu;
389 else if (dev->mtu > lowerdev->mtu) 396 else if (dev->mtu > lowerdev->mtu)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 9a0c6d3adfe9..5f6beabf2d17 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -801,22 +801,90 @@ static int bcm8704_init_user_dev3(struct niu *np)
801 return 0; 801 return 0;
802} 802}
803 803
804static int xcvr_init_10g(struct niu *np) 804static int mrvl88x2011_act_led(struct niu *np, int val)
805{
806 int err;
807
808 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
809 MRVL88X2011_LED_8_TO_11_CTL);
810 if (err < 0)
811 return err;
812
813 err &= ~MRVL88X2011_LED(MRVL88X2011_LED_ACT,MRVL88X2011_LED_CTL_MASK);
814 err |= MRVL88X2011_LED(MRVL88X2011_LED_ACT,val);
815
816 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
817 MRVL88X2011_LED_8_TO_11_CTL, err);
818}
819
820static int mrvl88x2011_led_blink_rate(struct niu *np, int rate)
821{
822 int err;
823
824 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
825 MRVL88X2011_LED_BLINK_CTL);
826 if (err >= 0) {
827 err &= ~MRVL88X2011_LED_BLKRATE_MASK;
828 err |= (rate << 4);
829
830 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
831 MRVL88X2011_LED_BLINK_CTL, err);
832 }
833
834 return err;
835}
836
837static int xcvr_init_10g_mrvl88x2011(struct niu *np)
838{
839 int err;
840
841 /* Set LED functions */
842 err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS);
843 if (err)
844 return err;
845
846 /* led activity */
847 err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF);
848 if (err)
849 return err;
850
851 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
852 MRVL88X2011_GENERAL_CTL);
853 if (err < 0)
854 return err;
855
856 err |= MRVL88X2011_ENA_XFPREFCLK;
857
858 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
859 MRVL88X2011_GENERAL_CTL, err);
860 if (err < 0)
861 return err;
862
863 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
864 MRVL88X2011_PMA_PMD_CTL_1);
865 if (err < 0)
866 return err;
867
868 if (np->link_config.loopback_mode == LOOPBACK_MAC)
869 err |= MRVL88X2011_LOOPBACK;
870 else
871 err &= ~MRVL88X2011_LOOPBACK;
872
873 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
874 MRVL88X2011_PMA_PMD_CTL_1, err);
875 if (err < 0)
876 return err;
877
878 /* Enable PMD */
879 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
880 MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX);
881}
882
883static int xcvr_init_10g_bcm8704(struct niu *np)
805{ 884{
806 struct niu_link_config *lp = &np->link_config; 885 struct niu_link_config *lp = &np->link_config;
807 u16 analog_stat0, tx_alarm_status; 886 u16 analog_stat0, tx_alarm_status;
808 int err; 887 int err;
809 u64 val;
810
811 val = nr64_mac(XMAC_CONFIG);
812 val &= ~XMAC_CONFIG_LED_POLARITY;
813 val |= XMAC_CONFIG_FORCE_LED_ON;
814 nw64_mac(XMAC_CONFIG, val);
815
816 /* XXX shared resource, lock parent XXX */
817 val = nr64(MIF_CONFIG);
818 val |= MIF_CONFIG_INDIRECT_MODE;
819 nw64(MIF_CONFIG, val);
820 888
821 err = bcm8704_reset(np); 889 err = bcm8704_reset(np);
822 if (err) 890 if (err)
@@ -896,6 +964,38 @@ static int xcvr_init_10g(struct niu *np)
896 return 0; 964 return 0;
897} 965}
898 966
967static int xcvr_init_10g(struct niu *np)
968{
969 int phy_id, err;
970 u64 val;
971
972 val = nr64_mac(XMAC_CONFIG);
973 val &= ~XMAC_CONFIG_LED_POLARITY;
974 val |= XMAC_CONFIG_FORCE_LED_ON;
975 nw64_mac(XMAC_CONFIG, val);
976
977 /* XXX shared resource, lock parent XXX */
978 val = nr64(MIF_CONFIG);
979 val |= MIF_CONFIG_INDIRECT_MODE;
980 nw64(MIF_CONFIG, val);
981
982 phy_id = phy_decode(np->parent->port_phy, np->port);
983 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
984
985 /* handle different phy types */
986 switch (phy_id & NIU_PHY_ID_MASK) {
987 case NIU_PHY_ID_MRVL88X2011:
988 err = xcvr_init_10g_mrvl88x2011(np);
989 break;
990
991 default: /* bcom 8704 */
992 err = xcvr_init_10g_bcm8704(np);
993 break;
994 }
995
996 return 0;
997}
998
899static int mii_reset(struct niu *np) 999static int mii_reset(struct niu *np)
900{ 1000{
901 int limit, err; 1001 int limit, err;
@@ -1082,19 +1182,68 @@ static int niu_link_status_common(struct niu *np, int link_up)
1082 return 0; 1182 return 0;
1083} 1183}
1084 1184
1085static int link_status_10g(struct niu *np, int *link_up_p) 1185static int link_status_10g_mrvl(struct niu *np, int *link_up_p)
1086{ 1186{
1087 unsigned long flags; 1187 int err, link_up, pma_status, pcs_status;
1088 int err, link_up;
1089 1188
1090 link_up = 0; 1189 link_up = 0;
1091 1190
1092 spin_lock_irqsave(&np->lock, flags); 1191 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1192 MRVL88X2011_10G_PMD_STATUS_2);
1193 if (err < 0)
1194 goto out;
1093 1195
1094 err = -EINVAL; 1196 /* Check PMA/PMD Register: 1.0001.2 == 1 */
1095 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) 1197 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1198 MRVL88X2011_PMA_PMD_STATUS_1);
1199 if (err < 0)
1200 goto out;
1201
1202 pma_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1203
1204 /* Check PMC Register : 3.0001.2 == 1: read twice */
1205 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1206 MRVL88X2011_PMA_PMD_STATUS_1);
1207 if (err < 0)
1208 goto out;
1209
1210 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1211 MRVL88X2011_PMA_PMD_STATUS_1);
1212 if (err < 0)
1213 goto out;
1214
1215 pcs_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1216
1217 /* Check XGXS Register : 4.0018.[0-3,12] */
1218 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR,
1219 MRVL88X2011_10G_XGXS_LANE_STAT);
1220 if (err < 0)
1096 goto out; 1221 goto out;
1097 1222
1223 if (err == (PHYXS_XGXS_LANE_STAT_ALINGED | PHYXS_XGXS_LANE_STAT_LANE3 |
1224 PHYXS_XGXS_LANE_STAT_LANE2 | PHYXS_XGXS_LANE_STAT_LANE1 |
1225 PHYXS_XGXS_LANE_STAT_LANE0 | PHYXS_XGXS_LANE_STAT_MAGIC |
1226 0x800))
1227 link_up = (pma_status && pcs_status) ? 1 : 0;
1228
1229 np->link_config.active_speed = SPEED_10000;
1230 np->link_config.active_duplex = DUPLEX_FULL;
1231 err = 0;
1232out:
1233 mrvl88x2011_act_led(np, (link_up ?
1234 MRVL88X2011_LED_CTL_PCS_ACT :
1235 MRVL88X2011_LED_CTL_OFF));
1236
1237 *link_up_p = link_up;
1238 return err;
1239}
1240
1241static int link_status_10g_bcom(struct niu *np, int *link_up_p)
1242{
1243 int err, link_up;
1244
1245 link_up = 0;
1246
1098 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, 1247 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR,
1099 BCM8704_PMD_RCV_SIGDET); 1248 BCM8704_PMD_RCV_SIGDET);
1100 if (err < 0) 1249 if (err < 0)
@@ -1134,14 +1283,43 @@ static int link_status_10g(struct niu *np, int *link_up_p)
1134 err = 0; 1283 err = 0;
1135 1284
1136out: 1285out:
1286 *link_up_p = link_up;
1287 return err;
1288}
1289
1290static int link_status_10g(struct niu *np, int *link_up_p)
1291{
1292 unsigned long flags;
1293 int err = -EINVAL;
1294
1295 spin_lock_irqsave(&np->lock, flags);
1296
1297 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) {
1298 int phy_id;
1299
1300 phy_id = phy_decode(np->parent->port_phy, np->port);
1301 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
1302
1303 /* handle different phy types */
1304 switch (phy_id & NIU_PHY_ID_MASK) {
1305 case NIU_PHY_ID_MRVL88X2011:
1306 err = link_status_10g_mrvl(np, link_up_p);
1307 break;
1308
1309 default: /* bcom 8704 */
1310 err = link_status_10g_bcom(np, link_up_p);
1311 break;
1312 }
1313 }
1314
1137 spin_unlock_irqrestore(&np->lock, flags); 1315 spin_unlock_irqrestore(&np->lock, flags);
1138 1316
1139 *link_up_p = link_up;
1140 return err; 1317 return err;
1141} 1318}
1142 1319
1143static int link_status_1g(struct niu *np, int *link_up_p) 1320static int link_status_1g(struct niu *np, int *link_up_p)
1144{ 1321{
1322 struct niu_link_config *lp = &np->link_config;
1145 u16 current_speed, bmsr; 1323 u16 current_speed, bmsr;
1146 unsigned long flags; 1324 unsigned long flags;
1147 u8 current_duplex; 1325 u8 current_duplex;
@@ -1209,6 +1387,8 @@ static int link_status_1g(struct niu *np, int *link_up_p)
1209 link_up = 0; 1387 link_up = 0;
1210 } 1388 }
1211 } 1389 }
1390 lp->active_speed = current_speed;
1391 lp->active_duplex = current_duplex;
1212 err = 0; 1392 err = 0;
1213 1393
1214out: 1394out:
@@ -6297,7 +6477,8 @@ static int __devinit phy_record(struct niu_parent *parent,
6297 if (dev_id_1 < 0 || dev_id_2 < 0) 6477 if (dev_id_1 < 0 || dev_id_2 < 0)
6298 return 0; 6478 return 0;
6299 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { 6479 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) {
6300 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) 6480 if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) &&
6481 ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011))
6301 return 0; 6482 return 0;
6302 } else { 6483 } else {
6303 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) 6484 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R)
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 10e3f111b6d5..0e8626adc573 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2538,6 +2538,39 @@ struct fcram_hash_ipv6 {
2538#define NIU_PHY_ID_MASK 0xfffff0f0 2538#define NIU_PHY_ID_MASK 0xfffff0f0
2539#define NIU_PHY_ID_BCM8704 0x00206030 2539#define NIU_PHY_ID_BCM8704 0x00206030
2540#define NIU_PHY_ID_BCM5464R 0x002060b0 2540#define NIU_PHY_ID_BCM5464R 0x002060b0
2541#define NIU_PHY_ID_MRVL88X2011 0x01410020
2542
2543/* MRVL88X2011 register addresses */
2544#define MRVL88X2011_USER_DEV1_ADDR 1
2545#define MRVL88X2011_USER_DEV2_ADDR 2
2546#define MRVL88X2011_USER_DEV3_ADDR 3
2547#define MRVL88X2011_USER_DEV4_ADDR 4
2548#define MRVL88X2011_PMA_PMD_CTL_1 0x0000
2549#define MRVL88X2011_PMA_PMD_STATUS_1 0x0001
2550#define MRVL88X2011_10G_PMD_STATUS_2 0x0008
2551#define MRVL88X2011_10G_PMD_TX_DIS 0x0009
2552#define MRVL88X2011_10G_XGXS_LANE_STAT 0x0018
2553#define MRVL88X2011_GENERAL_CTL 0x8300
2554#define MRVL88X2011_LED_BLINK_CTL 0x8303
2555#define MRVL88X2011_LED_8_TO_11_CTL 0x8306
2556
2557/* MRVL88X2011 register control */
2558#define MRVL88X2011_ENA_XFPREFCLK 0x0001
2559#define MRVL88X2011_ENA_PMDTX 0x0000
2560#define MRVL88X2011_LOOPBACK 0x1
2561#define MRVL88X2011_LED_ACT 0x1
2562#define MRVL88X2011_LNK_STATUS_OK 0x4
2563#define MRVL88X2011_LED_BLKRATE_MASK 0x70
2564#define MRVL88X2011_LED_BLKRATE_034MS 0x0
2565#define MRVL88X2011_LED_BLKRATE_067MS 0x1
2566#define MRVL88X2011_LED_BLKRATE_134MS 0x2
2567#define MRVL88X2011_LED_BLKRATE_269MS 0x3
2568#define MRVL88X2011_LED_BLKRATE_538MS 0x4
2569#define MRVL88X2011_LED_CTL_OFF 0x0
2570#define MRVL88X2011_LED_CTL_PCS_ACT 0x5
2571#define MRVL88X2011_LED_CTL_MASK 0x7
2572#define MRVL88X2011_LED(n,v) ((v)<<((n)*4))
2573#define MRVL88X2011_LED_STAT(n,v) ((v)>>((n)*4))
2541 2574
2542#define BCM8704_PMA_PMD_DEV_ADDR 1 2575#define BCM8704_PMA_PMD_DEV_ADDR 1
2543#define BCM8704_PCS_DEV_ADDR 2 2576#define BCM8704_PCS_DEV_ADDR 2
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 288177716a49..36a7ba3134ce 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -187,14 +187,16 @@ enum Window1 {
187enum Window3 { /* Window 3: MAC/config bits. */ 187enum Window3 { /* Window 3: MAC/config bits. */
188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8, 188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
189}; 189};
190union wn3_config { 190enum wn3_config {
191 int i; 191 Ram_size = 7,
192 struct w3_config_fields { 192 Ram_width = 8,
193 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 193 Ram_speed = 0x30,
194 int pad8:8; 194 Rom_size = 0xc0,
195 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 195 Ram_split_shift = 16,
196 int pad24:7; 196 Ram_split = 3 << Ram_split_shift,
197 } u; 197 Xcvr_shift = 20,
198 Xcvr = 7 << Xcvr_shift,
199 Autoselect = 0x1000000,
198}; 200};
199 201
200enum Window4 { /* Window 4: Xcvr/media bits. */ 202enum Window4 { /* Window 4: Xcvr/media bits. */
@@ -342,7 +344,7 @@ static int tc574_config(struct pcmcia_device *link)
342 kio_addr_t ioaddr; 344 kio_addr_t ioaddr;
343 __be16 *phys_addr; 345 __be16 *phys_addr;
344 char *cardname; 346 char *cardname;
345 union wn3_config config; 347 __u32 config;
346 DECLARE_MAC_BUF(mac); 348 DECLARE_MAC_BUF(mac);
347 349
348 phys_addr = (__be16 *)dev->dev_addr; 350 phys_addr = (__be16 *)dev->dev_addr;
@@ -401,9 +403,9 @@ static int tc574_config(struct pcmcia_device *link)
401 outw(0<<11, ioaddr + RunnerRdCtrl); 403 outw(0<<11, ioaddr + RunnerRdCtrl);
402 printk(KERN_INFO " ASIC rev %d,", mcr>>3); 404 printk(KERN_INFO " ASIC rev %d,", mcr>>3);
403 EL3WINDOW(3); 405 EL3WINDOW(3);
404 config.i = inl(ioaddr + Wn3_Config); 406 config = inl(ioaddr + Wn3_Config);
405 lp->default_media = config.u.xcvr; 407 lp->default_media = (config & Xcvr) >> Xcvr_shift;
406 lp->autoselect = config.u.autoselect; 408 lp->autoselect = config & Autoselect ? 1 : 0;
407 } 409 }
408 410
409 init_timer(&lp->media); 411 init_timer(&lp->media);
@@ -464,8 +466,9 @@ static int tc574_config(struct pcmcia_device *link)
464 dev->name, cardname, dev->base_addr, dev->irq, 466 dev->name, cardname, dev->base_addr, dev->irq,
465 print_mac(mac, dev->dev_addr)); 467 print_mac(mac, dev->dev_addr));
466 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", 468 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n",
467 8 << config.u.ram_size, ram_split[config.u.ram_split], 469 8 << config & Ram_size,
468 config.u.autoselect ? "autoselect " : ""); 470 ram_split[(config & Ram_split) >> Ram_split_shift],
471 config & Autoselect ? "autoselect " : "");
469 472
470 return 0; 473 return 0;
471 474
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index fa57c49c0c51..f2ba944e035e 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -84,7 +84,7 @@
84#include "s2io.h" 84#include "s2io.h"
85#include "s2io-regs.h" 85#include "s2io-regs.h"
86 86
87#define DRV_VERSION "2.0.26.10" 87#define DRV_VERSION "2.0.26.17"
88 88
89/* S2io Driver name & version. */ 89/* S2io Driver name & version. */
90static char s2io_driver_name[] = "Neterion"; 90static char s2io_driver_name[] = "Neterion";
@@ -3848,8 +3848,6 @@ static int s2io_open(struct net_device *dev)
3848 netif_carrier_off(dev); 3848 netif_carrier_off(dev);
3849 sp->last_link_state = 0; 3849 sp->last_link_state = 0;
3850 3850
3851 napi_enable(&sp->napi);
3852
3853 if (sp->config.intr_type == MSI_X) { 3851 if (sp->config.intr_type == MSI_X) {
3854 int ret = s2io_enable_msi_x(sp); 3852 int ret = s2io_enable_msi_x(sp);
3855 3853
@@ -3892,7 +3890,6 @@ static int s2io_open(struct net_device *dev)
3892 return 0; 3890 return 0;
3893 3891
3894hw_init_failed: 3892hw_init_failed:
3895 napi_disable(&sp->napi);
3896 if (sp->config.intr_type == MSI_X) { 3893 if (sp->config.intr_type == MSI_X) {
3897 if (sp->entries) { 3894 if (sp->entries) {
3898 kfree(sp->entries); 3895 kfree(sp->entries);
@@ -3932,7 +3929,6 @@ static int s2io_close(struct net_device *dev)
3932 return 0; 3929 return 0;
3933 3930
3934 netif_stop_queue(dev); 3931 netif_stop_queue(dev);
3935 napi_disable(&sp->napi);
3936 /* Reset card, kill tasklet and free Tx and Rx buffers. */ 3932 /* Reset card, kill tasklet and free Tx and Rx buffers. */
3937 s2io_card_down(sp); 3933 s2io_card_down(sp);
3938 3934
@@ -6796,6 +6792,8 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6796 struct XENA_dev_config __iomem *bar0 = sp->bar0; 6792 struct XENA_dev_config __iomem *bar0 = sp->bar0;
6797 unsigned long flags; 6793 unsigned long flags;
6798 register u64 val64 = 0; 6794 register u64 val64 = 0;
6795 struct config_param *config;
6796 config = &sp->config;
6799 6797
6800 if (!is_s2io_card_up(sp)) 6798 if (!is_s2io_card_up(sp))
6801 return; 6799 return;
@@ -6807,6 +6805,10 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6807 } 6805 }
6808 clear_bit(__S2IO_STATE_CARD_UP, &sp->state); 6806 clear_bit(__S2IO_STATE_CARD_UP, &sp->state);
6809 6807
6808 /* Disable napi */
6809 if (config->napi)
6810 napi_disable(&sp->napi);
6811
6810 /* disable Tx and Rx traffic on the NIC */ 6812 /* disable Tx and Rx traffic on the NIC */
6811 if (do_io) 6813 if (do_io)
6812 stop_nic(sp); 6814 stop_nic(sp);
@@ -6900,6 +6902,11 @@ static int s2io_card_up(struct s2io_nic * sp)
6900 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, 6902 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i,
6901 atomic_read(&sp->rx_bufs_left[i])); 6903 atomic_read(&sp->rx_bufs_left[i]));
6902 } 6904 }
6905
6906 /* Initialise napi */
6907 if (config->napi)
6908 napi_enable(&sp->napi);
6909
6903 /* Maintain the state prior to the open */ 6910 /* Maintain the state prior to the open */
6904 if (sp->promisc_flg) 6911 if (sp->promisc_flg)
6905 sp->promisc_flg = 0; 6912 sp->promisc_flg = 0;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 7023bbe545ee..bc15940ce1bc 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3949,7 +3949,7 @@ static __exit void sky2_debug_cleanup(void)
3949/* Initialize network device */ 3949/* Initialize network device */
3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, 3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3951 unsigned port, 3951 unsigned port,
3952 int highmem) 3952 int highmem, int wol)
3953{ 3953{
3954 struct sky2_port *sky2; 3954 struct sky2_port *sky2;
3955 struct net_device *dev = alloc_etherdev(sizeof(*sky2)); 3955 struct net_device *dev = alloc_etherdev(sizeof(*sky2));
@@ -3989,7 +3989,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3989 sky2->speed = -1; 3989 sky2->speed = -1;
3990 sky2->advertising = sky2_supported_modes(hw); 3990 sky2->advertising = sky2_supported_modes(hw);
3991 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); 3991 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
3992 sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC; 3992 sky2->wol = wol;
3993 3993
3994 spin_lock_init(&sky2->phy_lock); 3994 spin_lock_init(&sky2->phy_lock);
3995 sky2->tx_pending = TX_DEF_PENDING; 3995 sky2->tx_pending = TX_DEF_PENDING;
@@ -4086,12 +4086,24 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
4086 return err; 4086 return err;
4087} 4087}
4088 4088
4089static int __devinit pci_wake_enabled(struct pci_dev *dev)
4090{
4091 int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
4092 u16 value;
4093
4094 if (!pm)
4095 return 0;
4096 if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
4097 return 0;
4098 return value & PCI_PM_CTRL_PME_ENABLE;
4099}
4100
4089static int __devinit sky2_probe(struct pci_dev *pdev, 4101static int __devinit sky2_probe(struct pci_dev *pdev,
4090 const struct pci_device_id *ent) 4102 const struct pci_device_id *ent)
4091{ 4103{
4092 struct net_device *dev; 4104 struct net_device *dev;
4093 struct sky2_hw *hw; 4105 struct sky2_hw *hw;
4094 int err, using_dac = 0; 4106 int err, using_dac = 0, wol_default;
4095 4107
4096 err = pci_enable_device(pdev); 4108 err = pci_enable_device(pdev);
4097 if (err) { 4109 if (err) {
@@ -4124,6 +4136,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4124 } 4136 }
4125 } 4137 }
4126 4138
4139 wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
4140
4127 err = -ENOMEM; 4141 err = -ENOMEM;
4128 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 4142 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
4129 if (!hw) { 4143 if (!hw) {
@@ -4167,7 +4181,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4167 4181
4168 sky2_reset(hw); 4182 sky2_reset(hw);
4169 4183
4170 dev = sky2_init_netdev(hw, 0, using_dac); 4184 dev = sky2_init_netdev(hw, 0, using_dac, wol_default);
4171 if (!dev) { 4185 if (!dev) {
4172 err = -ENOMEM; 4186 err = -ENOMEM;
4173 goto err_out_free_pci; 4187 goto err_out_free_pci;
@@ -4204,7 +4218,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4204 if (hw->ports > 1) { 4218 if (hw->ports > 1) {
4205 struct net_device *dev1; 4219 struct net_device *dev1;
4206 4220
4207 dev1 = sky2_init_netdev(hw, 1, using_dac); 4221 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default);
4208 if (!dev1) 4222 if (!dev1)
4209 dev_warn(&pdev->dev, "allocation for second device failed\n"); 4223 dev_warn(&pdev->dev, "allocation for second device failed\n");
4210 else if ((err = register_netdev(dev1))) { 4224 else if ((err = register_netdev(dev1))) {
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05588d5..370d329d15d9 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -611,7 +611,7 @@ static int __devinit tc35815_mac_match(struct device *dev, void *data)
611{ 611{
612 struct platform_device *plat_dev = to_platform_device(dev); 612 struct platform_device *plat_dev = to_platform_device(dev);
613 struct pci_dev *pci_dev = data; 613 struct pci_dev *pci_dev = data;
614 unsigned int id = (pci_dev->bus->number << 8) | pci_dev->devfn; 614 unsigned int id = pci_dev->irq;
615 return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; 615 return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id;
616} 616}
617 617
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 43af9e9b2652..3f67a29593bc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -459,19 +459,7 @@ static __init int veth_init(void)
459 459
460static __exit void veth_exit(void) 460static __exit void veth_exit(void)
461{ 461{
462 struct veth_priv *priv, *next; 462 rtnl_link_unregister(&veth_link_ops);
463
464 rtnl_lock();
465 /*
466 * cannot trust __rtnl_link_unregister() to unregister all
467 * devices, as each ->dellink call will remove two devices
468 * from the list at once.
469 */
470 list_for_each_entry_safe(priv, next, &veth_list, list)
471 veth_dellink(priv->dev);
472
473 __rtnl_link_unregister(&veth_link_ops);
474 rtnl_unlock();
475} 463}
476 464
477module_init(veth_init); 465module_init(veth_init);
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 33dc713b5301..c6f26e28e376 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -139,19 +139,21 @@ struct thingie {
139}; 139};
140 140
141struct TxFD { 141struct TxFD {
142 u32 state; 142 __le32 state;
143 u32 next; 143 __le32 next;
144 u32 data; 144 __le32 data;
145 u32 complete; 145 __le32 complete;
146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */ 146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */
147 /* FWIW, datasheet calls that "dummy" and says that card
148 * never looks at it; neither does the driver */
147}; 149};
148 150
149struct RxFD { 151struct RxFD {
150 u32 state1; 152 __le32 state1;
151 u32 next; 153 __le32 next;
152 u32 data; 154 __le32 data;
153 u32 state2; 155 __le32 state2;
154 u32 end; 156 __le32 end;
155}; 157};
156 158
157#define DUMMY_SKB_SIZE 64 159#define DUMMY_SKB_SIZE 64
@@ -181,7 +183,7 @@ struct RxFD {
181#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET) 183#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET)
182 184
183struct dscc4_pci_priv { 185struct dscc4_pci_priv {
184 u32 *iqcfg; 186 __le32 *iqcfg;
185 int cfg_cur; 187 int cfg_cur;
186 spinlock_t lock; 188 spinlock_t lock;
187 struct pci_dev *pdev; 189 struct pci_dev *pdev;
@@ -197,8 +199,8 @@ struct dscc4_dev_priv {
197 199
198 struct RxFD *rx_fd; 200 struct RxFD *rx_fd;
199 struct TxFD *tx_fd; 201 struct TxFD *tx_fd;
200 u32 *iqrx; 202 __le32 *iqrx;
201 u32 *iqtx; 203 __le32 *iqtx;
202 204
203 /* FIXME: check all the volatile are required */ 205 /* FIXME: check all the volatile are required */
204 volatile u32 tx_current; 206 volatile u32 tx_current;
@@ -298,7 +300,7 @@ struct dscc4_dev_priv {
298#define BrrExpMask 0x00000f00 300#define BrrExpMask 0x00000f00
299#define BrrMultMask 0x0000003f 301#define BrrMultMask 0x0000003f
300#define EncodingMask 0x00700000 302#define EncodingMask 0x00700000
301#define Hold 0x40000000 303#define Hold cpu_to_le32(0x40000000)
302#define SccBusy 0x10000000 304#define SccBusy 0x10000000
303#define PowerUp 0x80000000 305#define PowerUp 0x80000000
304#define Vis 0x00001000 306#define Vis 0x00001000
@@ -307,14 +309,14 @@ struct dscc4_dev_priv {
307#define FrameRdo 0x40 309#define FrameRdo 0x40
308#define FrameCrc 0x20 310#define FrameCrc 0x20
309#define FrameRab 0x10 311#define FrameRab 0x10
310#define FrameAborted 0x00000200 312#define FrameAborted cpu_to_le32(0x00000200)
311#define FrameEnd 0x80000000 313#define FrameEnd cpu_to_le32(0x80000000)
312#define DataComplete 0x40000000 314#define DataComplete cpu_to_le32(0x40000000)
313#define LengthCheck 0x00008000 315#define LengthCheck 0x00008000
314#define SccEvt 0x02000000 316#define SccEvt 0x02000000
315#define NoAck 0x00000200 317#define NoAck 0x00000200
316#define Action 0x00000001 318#define Action 0x00000001
317#define HiDesc 0x20000000 319#define HiDesc cpu_to_le32(0x20000000)
318 320
319/* SCC events */ 321/* SCC events */
320#define RxEvt 0xf0000000 322#define RxEvt 0xf0000000
@@ -489,8 +491,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
489 skbuff = dpriv->tx_skbuff; 491 skbuff = dpriv->tx_skbuff;
490 for (i = 0; i < TX_RING_SIZE; i++) { 492 for (i = 0; i < TX_RING_SIZE; i++) {
491 if (*skbuff) { 493 if (*skbuff) {
492 pci_unmap_single(pdev, tx_fd->data, (*skbuff)->len, 494 pci_unmap_single(pdev, le32_to_cpu(tx_fd->data),
493 PCI_DMA_TODEVICE); 495 (*skbuff)->len, PCI_DMA_TODEVICE);
494 dev_kfree_skb(*skbuff); 496 dev_kfree_skb(*skbuff);
495 } 497 }
496 skbuff++; 498 skbuff++;
@@ -500,7 +502,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
500 skbuff = dpriv->rx_skbuff; 502 skbuff = dpriv->rx_skbuff;
501 for (i = 0; i < RX_RING_SIZE; i++) { 503 for (i = 0; i < RX_RING_SIZE; i++) {
502 if (*skbuff) { 504 if (*skbuff) {
503 pci_unmap_single(pdev, rx_fd->data, 505 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
504 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 506 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
505 dev_kfree_skb(*skbuff); 507 dev_kfree_skb(*skbuff);
506 } 508 }
@@ -522,10 +524,10 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
522 dpriv->rx_skbuff[dirty] = skb; 524 dpriv->rx_skbuff[dirty] = skb;
523 if (skb) { 525 if (skb) {
524 skb->protocol = hdlc_type_trans(skb, dev); 526 skb->protocol = hdlc_type_trans(skb, dev);
525 rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 527 rx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
526 len, PCI_DMA_FROMDEVICE); 528 skb->data, len, PCI_DMA_FROMDEVICE));
527 } else { 529 } else {
528 rx_fd->data = (u32) NULL; 530 rx_fd->data = 0;
529 ret = -1; 531 ret = -1;
530 } 532 }
531 return ret; 533 return ret;
@@ -587,7 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv)
587 589
588 do { 590 do {
589 if (!(dpriv->flags & (NeedIDR | NeedIDT)) || 591 if (!(dpriv->flags & (NeedIDR | NeedIDT)) ||
590 (dpriv->iqtx[cur] & Xpr)) 592 (dpriv->iqtx[cur] & cpu_to_le32(Xpr)))
591 break; 593 break;
592 smp_rmb(); 594 smp_rmb();
593 schedule_timeout_uninterruptible(10); 595 schedule_timeout_uninterruptible(10);
@@ -650,8 +652,9 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
650 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__); 652 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__);
651 goto refill; 653 goto refill;
652 } 654 }
653 pkt_len = TO_SIZE(rx_fd->state2); 655 pkt_len = TO_SIZE(le32_to_cpu(rx_fd->state2));
654 pci_unmap_single(pdev, rx_fd->data, RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 656 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
657 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
655 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { 658 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) {
656 stats->rx_packets++; 659 stats->rx_packets++;
657 stats->rx_bytes += pkt_len; 660 stats->rx_bytes += pkt_len;
@@ -679,7 +682,7 @@ refill:
679 } 682 }
680 dscc4_rx_update(dpriv, dev); 683 dscc4_rx_update(dpriv, dev);
681 rx_fd->state2 = 0x00000000; 684 rx_fd->state2 = 0x00000000;
682 rx_fd->end = 0xbabeface; 685 rx_fd->end = cpu_to_le32(0xbabeface);
683} 686}
684 687
685static void dscc4_free1(struct pci_dev *pdev) 688static void dscc4_free1(struct pci_dev *pdev)
@@ -772,8 +775,8 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
772 } 775 }
773 /* Global interrupt queue */ 776 /* Global interrupt queue */
774 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); 777 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1);
775 priv->iqcfg = (u32 *) pci_alloc_consistent(pdev, 778 priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev,
776 IRQ_RING_SIZE*sizeof(u32), &priv->iqcfg_dma); 779 IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma);
777 if (!priv->iqcfg) 780 if (!priv->iqcfg)
778 goto err_free_irq_5; 781 goto err_free_irq_5;
779 writel(priv->iqcfg_dma, ioaddr + IQCFG); 782 writel(priv->iqcfg_dma, ioaddr + IQCFG);
@@ -786,7 +789,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
786 */ 789 */
787 for (i = 0; i < dev_per_card; i++) { 790 for (i = 0; i < dev_per_card; i++) {
788 dpriv = priv->root + i; 791 dpriv = priv->root + i;
789 dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, 792 dpriv->iqtx = (__le32 *) pci_alloc_consistent(pdev,
790 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); 793 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma);
791 if (!dpriv->iqtx) 794 if (!dpriv->iqtx)
792 goto err_free_iqtx_6; 795 goto err_free_iqtx_6;
@@ -794,7 +797,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
794 } 797 }
795 for (i = 0; i < dev_per_card; i++) { 798 for (i = 0; i < dev_per_card; i++) {
796 dpriv = priv->root + i; 799 dpriv = priv->root + i;
797 dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, 800 dpriv->iqrx = (__le32 *) pci_alloc_consistent(pdev,
798 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); 801 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma);
799 if (!dpriv->iqrx) 802 if (!dpriv->iqrx)
800 goto err_free_iqrx_7; 803 goto err_free_iqrx_7;
@@ -1156,8 +1159,8 @@ static int dscc4_start_xmit(struct sk_buff *skb, struct net_device *dev)
1156 dpriv->tx_skbuff[next] = skb; 1159 dpriv->tx_skbuff[next] = skb;
1157 tx_fd = dpriv->tx_fd + next; 1160 tx_fd = dpriv->tx_fd + next;
1158 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len); 1161 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len);
1159 tx_fd->data = pci_map_single(ppriv->pdev, skb->data, skb->len, 1162 tx_fd->data = cpu_to_le32(pci_map_single(ppriv->pdev, skb->data, skb->len,
1160 PCI_DMA_TODEVICE); 1163 PCI_DMA_TODEVICE));
1161 tx_fd->complete = 0x00000000; 1164 tx_fd->complete = 0x00000000;
1162 tx_fd->jiffies = jiffies; 1165 tx_fd->jiffies = jiffies;
1163 mb(); 1166 mb();
@@ -1508,7 +1511,7 @@ static irqreturn_t dscc4_irq(int irq, void *token)
1508 if (state & Cfg) { 1511 if (state & Cfg) {
1509 if (debug > 0) 1512 if (debug > 0)
1510 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); 1513 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME);
1511 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & Arf) 1514 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & cpu_to_le32(Arf))
1512 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); 1515 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG");
1513 if (!(state &= ~Cfg)) 1516 if (!(state &= ~Cfg))
1514 goto out; 1517 goto out;
@@ -1541,7 +1544,7 @@ static void dscc4_tx_irq(struct dscc4_pci_priv *ppriv,
1541 1544
1542try: 1545try:
1543 cur = dpriv->iqtx_current%IRQ_RING_SIZE; 1546 cur = dpriv->iqtx_current%IRQ_RING_SIZE;
1544 state = dpriv->iqtx[cur]; 1547 state = le32_to_cpu(dpriv->iqtx[cur]);
1545 if (!state) { 1548 if (!state) {
1546 if (debug > 4) 1549 if (debug > 4)
1547 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name, 1550 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name,
@@ -1580,7 +1583,7 @@ try:
1580 tx_fd = dpriv->tx_fd + cur; 1583 tx_fd = dpriv->tx_fd + cur;
1581 skb = dpriv->tx_skbuff[cur]; 1584 skb = dpriv->tx_skbuff[cur];
1582 if (skb) { 1585 if (skb) {
1583 pci_unmap_single(ppriv->pdev, tx_fd->data, 1586 pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data),
1584 skb->len, PCI_DMA_TODEVICE); 1587 skb->len, PCI_DMA_TODEVICE);
1585 if (tx_fd->state & FrameEnd) { 1588 if (tx_fd->state & FrameEnd) {
1586 stats->tx_packets++; 1589 stats->tx_packets++;
@@ -1711,7 +1714,7 @@ static void dscc4_rx_irq(struct dscc4_pci_priv *priv,
1711 1714
1712try: 1715try:
1713 cur = dpriv->iqrx_current%IRQ_RING_SIZE; 1716 cur = dpriv->iqrx_current%IRQ_RING_SIZE;
1714 state = dpriv->iqrx[cur]; 1717 state = le32_to_cpu(dpriv->iqrx[cur]);
1715 if (!state) 1718 if (!state)
1716 return; 1719 return;
1717 dpriv->iqrx[cur] = 0; 1720 dpriv->iqrx[cur] = 0;
@@ -1755,7 +1758,7 @@ try:
1755 goto try; 1758 goto try;
1756 rx_fd->state1 &= ~Hold; 1759 rx_fd->state1 &= ~Hold;
1757 rx_fd->state2 = 0x00000000; 1760 rx_fd->state2 = 0x00000000;
1758 rx_fd->end = 0xbabeface; 1761 rx_fd->end = cpu_to_le32(0xbabeface);
1759 //} 1762 //}
1760 goto try; 1763 goto try;
1761 } 1764 }
@@ -1834,7 +1837,7 @@ try:
1834 hdlc_stats(dev)->rx_over_errors++; 1837 hdlc_stats(dev)->rx_over_errors++;
1835 rx_fd->state1 |= Hold; 1838 rx_fd->state1 |= Hold;
1836 rx_fd->state2 = 0x00000000; 1839 rx_fd->state2 = 0x00000000;
1837 rx_fd->end = 0xbabeface; 1840 rx_fd->end = cpu_to_le32(0xbabeface);
1838 } else 1841 } else
1839 dscc4_rx_skb(dpriv, dev); 1842 dscc4_rx_skb(dpriv, dev);
1840 } while (1); 1843 } while (1);
@@ -1904,8 +1907,9 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv)
1904 skb_copy_to_linear_data(skb, version, 1907 skb_copy_to_linear_data(skb, version,
1905 strlen(version) % DUMMY_SKB_SIZE); 1908 strlen(version) % DUMMY_SKB_SIZE);
1906 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); 1909 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE);
1907 tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 1910 tx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
1908 DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); 1911 skb->data, DUMMY_SKB_SIZE,
1912 PCI_DMA_TODEVICE));
1909 dpriv->tx_skbuff[last] = skb; 1913 dpriv->tx_skbuff[last] = skb;
1910 } 1914 }
1911 return skb; 1915 return skb;
@@ -1937,8 +1941,8 @@ static int dscc4_init_ring(struct net_device *dev)
1937 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE); 1941 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE);
1938 tx_fd->complete = 0x00000000; 1942 tx_fd->complete = 0x00000000;
1939 /* FIXME: NULL should be ok - to be tried */ 1943 /* FIXME: NULL should be ok - to be tried */
1940 tx_fd->data = dpriv->tx_fd_dma; 1944 tx_fd->data = cpu_to_le32(dpriv->tx_fd_dma);
1941 (tx_fd++)->next = (u32)(dpriv->tx_fd_dma + 1945 (tx_fd++)->next = cpu_to_le32(dpriv->tx_fd_dma +
1942 (++i%TX_RING_SIZE)*sizeof(*tx_fd)); 1946 (++i%TX_RING_SIZE)*sizeof(*tx_fd));
1943 } while (i < TX_RING_SIZE); 1947 } while (i < TX_RING_SIZE);
1944 1948
@@ -1951,12 +1955,12 @@ static int dscc4_init_ring(struct net_device *dev)
1951 /* size set by the host. Multiple of 4 bytes please */ 1955 /* size set by the host. Multiple of 4 bytes please */
1952 rx_fd->state1 = HiDesc; 1956 rx_fd->state1 = HiDesc;
1953 rx_fd->state2 = 0x00000000; 1957 rx_fd->state2 = 0x00000000;
1954 rx_fd->end = 0xbabeface; 1958 rx_fd->end = cpu_to_le32(0xbabeface);
1955 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU); 1959 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU);
1956 // FIXME: return value verifiee mais traitement suspect 1960 // FIXME: return value verifiee mais traitement suspect
1957 if (try_get_rx_skb(dpriv, dev) >= 0) 1961 if (try_get_rx_skb(dpriv, dev) >= 0)
1958 dpriv->rx_dirty++; 1962 dpriv->rx_dirty++;
1959 (rx_fd++)->next = (u32)(dpriv->rx_fd_dma + 1963 (rx_fd++)->next = cpu_to_le32(dpriv->rx_fd_dma +
1960 (++i%RX_RING_SIZE)*sizeof(*rx_fd)); 1964 (++i%RX_RING_SIZE)*sizeof(*rx_fd));
1961 } while (i < RX_RING_SIZE); 1965 } while (i < RX_RING_SIZE);
1962 1966
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c
index 574737b55f39..c9c878cd5c72 100644
--- a/drivers/net/wan/lmc/lmc_media.c
+++ b/drivers/net/wan/lmc/lmc_media.c
@@ -890,16 +890,8 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v,
890static void 890static void
891lmc_ssi_watchdog (lmc_softc_t * const sc) 891lmc_ssi_watchdog (lmc_softc_t * const sc)
892{ 892{
893 u_int16_t mii17; 893 u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17);
894 struct ssicsr2 894 if (((mii17 >> 3) & 7) == 7)
895 {
896 unsigned short dtr:1, dsr:1, rts:1, cable:3, crc:1, led0:1, led1:1,
897 led2:1, led3:1, fifo:1, ll:1, rl:1, tm:1, loop:1;
898 };
899 struct ssicsr2 *ssicsr;
900 mii17 = lmc_mii_readreg (sc, 0, 17);
901 ssicsr = (struct ssicsr2 *) &mii17;
902 if (ssicsr->cable == 7)
903 { 895 {
904 lmc_led_off (sc, LMC_MII16_LED2); 896 lmc_led_off (sc, LMC_MII16_LED2);
905 } 897 }
diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h
index 27715e70f28b..84264510a8ed 100644
--- a/drivers/net/wan/sbni.h
+++ b/drivers/net/wan/sbni.h
@@ -44,9 +44,15 @@ enum {
44#define PR_RES 0x80 44#define PR_RES 0x80
45 45
46struct sbni_csr1 { 46struct sbni_csr1 {
47 unsigned rxl : 5; 47#ifdef __LITTLE_ENDIAN_BITFIELD
48 unsigned rate : 2; 48 u8 rxl : 5;
49 unsigned : 1; 49 u8 rate : 2;
50 u8 : 1;
51#else
52 u8 : 1;
53 u8 rate : 2;
54 u8 rxl : 5;
55#endif
50}; 56};
51 57
52/* fields in frame header */ 58/* fields in frame header */
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index c98fc62a3e61..2c08c0a5a0df 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -68,7 +68,7 @@ config WAVELAN
68 <http://www.tldp.org/docs.html#howto>. Some more specific 68 <http://www.tldp.org/docs.html#howto>. Some more specific
69 information is contained in 69 information is contained in
70 <file:Documentation/networking/wavelan.txt> and in the source code 70 <file:Documentation/networking/wavelan.txt> and in the source code
71 <file:drivers/net/wavelan.p.h>. 71 <file:drivers/net/wireless/wavelan.p.h>.
72 72
73 You will also need the wireless tools package available from 73 You will also need the wireless tools package available from
74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. 74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 98cf70c5fd47..11f53cb1139e 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -138,8 +138,11 @@ void b43_rfkill_init(struct b43_wldev *dev)
138 rfk->rfkill->user_claim_unsupported = 1; 138 rfk->rfkill->user_claim_unsupported = 1;
139 139
140 rfk->poll_dev = input_allocate_polled_device(); 140 rfk->poll_dev = input_allocate_polled_device();
141 if (!rfk->poll_dev) 141 if (!rfk->poll_dev) {
142 goto err_free_rfk; 142 rfkill_free(rfk->rfkill);
143 goto err_freed_rfk;
144 }
145
143 rfk->poll_dev->private = dev; 146 rfk->poll_dev->private = dev;
144 rfk->poll_dev->poll = b43_rfkill_poll; 147 rfk->poll_dev->poll = b43_rfkill_poll;
145 rfk->poll_dev->poll_interval = 1000; /* msecs */ 148 rfk->poll_dev->poll_interval = 1000; /* msecs */
@@ -175,8 +178,7 @@ err_unreg_rfk:
175err_free_polldev: 178err_free_polldev:
176 input_free_polled_device(rfk->poll_dev); 179 input_free_polled_device(rfk->poll_dev);
177 rfk->poll_dev = NULL; 180 rfk->poll_dev = NULL;
178err_free_rfk: 181err_freed_rfk:
179 rfkill_free(rfk->rfkill);
180 rfk->rfkill = NULL; 182 rfk->rfkill = NULL;
181out_error: 183out_error:
182 rfk->registered = 0; 184 rfk->registered = 0;
@@ -195,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev)
195 rfkill_unregister(rfk->rfkill); 197 rfkill_unregister(rfk->rfkill);
196 input_free_polled_device(rfk->poll_dev); 198 input_free_polled_device(rfk->poll_dev);
197 rfk->poll_dev = NULL; 199 rfk->poll_dev = NULL;
198 rfkill_free(rfk->rfkill);
199 rfk->rfkill = NULL; 200 rfk->rfkill = NULL;
200} 201}
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 040dc3e36410..cbf15d703201 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -608,7 +608,7 @@ static void prism2_plx_remove(struct pci_dev *pdev)
608 608
609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); 609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table);
610 610
611static struct pci_driver prism2_plx_drv_id = { 611static struct pci_driver prism2_plx_driver = {
612 .name = "hostap_plx", 612 .name = "hostap_plx",
613 .id_table = prism2_plx_id_table, 613 .id_table = prism2_plx_id_table,
614 .probe = prism2_plx_probe, 614 .probe = prism2_plx_probe,
@@ -618,13 +618,13 @@ static struct pci_driver prism2_plx_drv_id = {
618 618
619static int __init init_prism2_plx(void) 619static int __init init_prism2_plx(void)
620{ 620{
621 return pci_register_driver(&prism2_plx_drv_id); 621 return pci_register_driver(&prism2_plx_driver);
622} 622}
623 623
624 624
625static void __exit exit_prism2_plx(void) 625static void __exit exit_prism2_plx(void)
626{ 626{
627 pci_unregister_driver(&prism2_plx_drv_id); 627 pci_unregister_driver(&prism2_plx_driver);
628} 628}
629 629
630 630
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 88062c1318a8..003f73f89efa 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4935,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv)
4935/** 4935/**
4936 * Reclaim Tx queue entries no more used by NIC. 4936 * Reclaim Tx queue entries no more used by NIC.
4937 * 4937 *
4938 * When FW adwances 'R' index, all entries between old and 4938 * When FW advances 'R' index, all entries between old and
4939 * new 'R' index need to be reclaimed. As result, some free space 4939 * new 'R' index need to be reclaimed. As result, some free space
4940 * forms. If there is enough free space (> low mark), wake Tx queue. 4940 * forms. If there is enough free space (> low mark), wake Tx queue.
4941 * 4941 *
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b24425f74883..4f1efb108c28 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -871,6 +871,10 @@ static int if_sdio_probe(struct sdio_func *func,
871 if (sscanf(func->card->info[i], 871 if (sscanf(func->card->info[i],
872 "ID: %x", &model) == 1) 872 "ID: %x", &model) == 1)
873 break; 873 break;
874 if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) {
875 model = 4;
876 break;
877 }
874 } 878 }
875 879
876 if (i == func->card->num_info) { 880 if (i == func->card->num_info) {
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 6d5d9aba0b73..04663eb31950 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -149,7 +149,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
149 * The data behind the ieee80211 header must be 149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary. 150 * aligned on a 4 byte boundary.
151 */ 151 */
152 align = NET_IP_ALIGN + (2 * (header_size % 4 == 0)); 152 align = header_size % 4;
153 153
154 /* 154 /*
155 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index ab4797ed94c9..568d73847dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -245,13 +245,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
245 * Allocate a new sk buffer to replace the current one. 245 * Allocate a new sk buffer to replace the current one.
246 * If allocation fails, we should drop the current frame 246 * If allocation fails, we should drop the current frame
247 * so we can recycle the existing sk buffer for the new frame. 247 * so we can recycle the existing sk buffer for the new frame.
248 * As alignment we use 2 and not NET_IP_ALIGN because we need
249 * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN
250 * can be 0 on some hardware). We use these 2 bytes for frame
251 * alignment later, we assume that the chance that
252 * header_size % 4 == 2 is bigger then header_size % 2 == 0
253 * and thus optimize alignment by reserving the 2 bytes in
254 * advance.
248 */ 255 */
249 frame_size = entry->ring->data_size + entry->ring->desc_size; 256 frame_size = entry->ring->data_size + entry->ring->desc_size;
250 skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); 257 skb = dev_alloc_skb(frame_size + 2);
251 if (!skb) 258 if (!skb)
252 goto skip_entry; 259 goto skip_entry;
253 260
254 skb_reserve(skb, NET_IP_ALIGN); 261 skb_reserve(skb, 2);
255 skb_put(skb, frame_size); 262 skb_put(skb, frame_size);
256 263
257 /* 264 /*
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index f7b8648acbfa..6b9840cce0f4 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -215,6 +215,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
215 } else if (!warned) { 215 } else if (!warned) {
216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO " 216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
217 "resources: %d \n", PNP_MAX_PORT); 217 "resources: %d \n", PNP_MAX_PORT);
218 warned = 1;
218 } 219 }
219} 220}
220 221
@@ -242,6 +243,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
242 } else if (!warned) { 243 } else if (!warned) {
243 printk(KERN_ERR "pnpacpi: exceeded the max number of mem " 244 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
244 "resources: %d\n", PNP_MAX_MEM); 245 "resources: %d\n", PNP_MAX_MEM);
246 warned = 1;
245 } 247 }
246} 248}
247 249
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a6676be87843..184c7ae78519 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -732,7 +732,7 @@ config SCSI_GDTH
732 This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) 732 This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI)
733 manufactured by Intel Corporation/ICP vortex GmbH. It is documented 733 manufactured by Intel Corporation/ICP vortex GmbH. It is documented
734 in the kernel source in <file:drivers/scsi/gdth.c> and 734 in the kernel source in <file:drivers/scsi/gdth.c> and
735 <file:drivers/scsi/gdth.h.> 735 <file:drivers/scsi/gdth.h>.
736 736
737 To compile this driver as a module, choose M here: the 737 To compile this driver as a module, choose M here: the
738 module will be called gdth. 738 module will be called gdth.
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index feba9679ace8..7c069a02c1dd 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -447,7 +447,7 @@ static void usa26_indat_callback(struct urb *urb)
447 447
448 port = (struct usb_serial_port *) urb->context; 448 port = (struct usb_serial_port *) urb->context;
449 tty = port->tty; 449 tty = port->tty;
450 if (urb->actual_length) { 450 if (tty && urb->actual_length) {
451 /* 0x80 bit is error flag */ 451 /* 0x80 bit is error flag */
452 if ((data[0] & 0x80) == 0) { 452 if ((data[0] & 0x80) == 0) {
453 /* no errors on individual bytes, only possible overrun err*/ 453 /* no errors on individual bytes, only possible overrun err*/
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 8d81ef019c6c..08d072552233 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -259,6 +259,10 @@ static const struct fb_videomode modedb[] = {
259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */ 259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */
260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5, 260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5,
261 0, FB_VMODE_NONINTERLACED 261 0, FB_VMODE_NONINTERLACED
262 }, {
263 /* 1280x800, 60 Hz, 47.403 kHz hsync, WXGA 16:10 aspect ratio */
264 NULL, 60, 1280, 800, 12048, 200, 64, 24, 1, 136, 3,
265 0, FB_VMODE_NONINTERLACED
262 }, 266 },
263}; 267};
264 268
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index ad35033f1a48..b3c31d9dc591 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -488,7 +488,7 @@ static int s3c2410fb_set_par(struct fb_info *info)
488 break; 488 break;
489 } 489 }
490 490
491 info->fix.line_length = (var->width * var->bits_per_pixel) / 8; 491 info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8;
492 492
493 /* activate this new configuration */ 493 /* activate this new configuration */
494 494
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 4318935678c5..112f4ec59035 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -112,7 +112,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
112 112
113static inline int w1_DS18B20_convert_temp(u8 rom[9]) 113static inline int w1_DS18B20_convert_temp(u8 rom[9])
114{ 114{
115 int t = (rom[1] << 8) | rom[0]; 115 s16 t = (rom[1] << 8) | rom[0];
116 t /= 16; 116 t /= 16;
117 return t; 117 return t;
118} 118}
@@ -204,7 +204,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj,
204 204
205 crc = w1_calc_crc8(rom, 8); 205 crc = w1_calc_crc8(rom, 8);
206 206
207 if (rom[8] == crc && rom[0]) 207 if (rom[8] == crc)
208 verdict = 1; 208 verdict = 1;
209 } 209 }
210 } 210 }
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 6ea125eabeaa..c622a0e6c9ae 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -382,10 +382,8 @@ wdt_init(void)
382 /* we will autodetect the W83697HF/HG watchdog */ 382 /* we will autodetect the W83697HF/HG watchdog */
383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) { 383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {
384 wdt_io = w83697hf_ioports[i]; 384 wdt_io = w83697hf_ioports[i];
385 if (!w83697hf_check_wdt()) { 385 if (!w83697hf_check_wdt())
386 found++; 386 found++;
387 break;
388 }
389 } 387 }
390 } else { 388 } else {
391 if (!w83697hf_check_wdt()) 389 if (!w83697hf_check_wdt())
diff --git a/fs/Kconfig b/fs/Kconfig
index 487236c65837..781b47d2f9f2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1112,8 +1112,8 @@ config HFS_FS
1112 help 1112 help
1113 If you say Y here, you will be able to mount Macintosh-formatted 1113 If you say Y here, you will be able to mount Macintosh-formatted
1114 floppy disks and hard drive partitions with full read-write access. 1114 floppy disks and hard drive partitions with full read-write access.
1115 Please read <file:fs/hfs/HFS.txt> to learn about the available mount 1115 Please read <file:Documentation/filesystems/hfs.txt> to learn about
1116 options. 1116 the available mount options.
1117 1117
1118 To compile this file system support as a module, choose M here: the 1118 To compile this file system support as a module, choose M here: the
1119 module will be called hfs. 1119 module will be called hfs.
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 31284c77bba8..110dd3515dc8 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
61 mapping = tree->inode->i_mapping; 61 mapping = tree->inode->i_mapping;
62 page = read_mapping_page(mapping, 0, NULL); 62 page = read_mapping_page(mapping, 0, NULL);
63 if (IS_ERR(page)) 63 if (IS_ERR(page))
64 goto free_tree; 64 goto free_inode;
65 65
66 /* Load the header */ 66 /* Load the header */
67 head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc)); 67 head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc));
@@ -99,11 +99,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
99 page_cache_release(page); 99 page_cache_release(page);
100 return tree; 100 return tree;
101 101
102 fail_page: 102fail_page:
103 page_cache_release(page); 103 page_cache_release(page);
104 free_tree: 104free_inode:
105 tree->inode->i_mapping->a_ops = &hfs_aops; 105 tree->inode->i_mapping->a_ops = &hfs_aops;
106 iput(tree->inode); 106 iput(tree->inode);
107free_tree:
107 kfree(tree); 108 kfree(tree);
108 return NULL; 109 return NULL;
109} 110}
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 08ff6c7028cc..038ed7436199 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -288,10 +288,12 @@ handle_t *journal_start(journal_t *journal, int nblocks)
288 jbd_free_handle(handle); 288 jbd_free_handle(handle);
289 current->journal_info = NULL; 289 current->journal_info = NULL;
290 handle = ERR_PTR(err); 290 handle = ERR_PTR(err);
291 goto out;
291 } 292 }
292 293
293 lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_); 294 lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
294 295
296out:
295 return handle; 297 return handle;
296} 298}
297 299
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 337162935d21..f281cc6584b0 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -678,8 +678,10 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
678 sd = sysfs_find_dirent(parent_sd, dentry->d_name.name); 678 sd = sysfs_find_dirent(parent_sd, dentry->d_name.name);
679 679
680 /* no such entry */ 680 /* no such entry */
681 if (!sd) 681 if (!sd) {
682 ret = ERR_PTR(-ENOENT);
682 goto out_unlock; 683 goto out_unlock;
684 }
683 685
684 /* attach dentry and inode */ 686 /* attach dentry and inode */
685 inode = sysfs_get_inode(sd); 687 inode = sysfs_get_inode(sd);
@@ -781,6 +783,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
781 old_dentry = sysfs_get_dentry(sd); 783 old_dentry = sysfs_get_dentry(sd);
782 if (IS_ERR(old_dentry)) { 784 if (IS_ERR(old_dentry)) {
783 error = PTR_ERR(old_dentry); 785 error = PTR_ERR(old_dentry);
786 old_dentry = NULL;
784 goto out; 787 goto out;
785 } 788 }
786 789
@@ -848,6 +851,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
848 old_dentry = sysfs_get_dentry(sd); 851 old_dentry = sysfs_get_dentry(sd);
849 if (IS_ERR(old_dentry)) { 852 if (IS_ERR(old_dentry)) {
850 error = PTR_ERR(old_dentry); 853 error = PTR_ERR(old_dentry);
854 old_dentry = NULL;
851 goto out; 855 goto out;
852 } 856 }
853 old_parent = old_dentry->d_parent; 857 old_parent = old_dentry->d_parent;
@@ -855,6 +859,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
855 new_parent = sysfs_get_dentry(new_parent_sd); 859 new_parent = sysfs_get_dentry(new_parent_sd);
856 if (IS_ERR(new_parent)) { 860 if (IS_ERR(new_parent)) {
857 error = PTR_ERR(new_parent); 861 error = PTR_ERR(new_parent);
862 new_parent = NULL;
858 goto out; 863 goto out;
859 } 864 }
860 865
@@ -878,7 +883,6 @@ again:
878 error = 0; 883 error = 0;
879 d_add(new_dentry, NULL); 884 d_add(new_dentry, NULL);
880 d_move(old_dentry, new_dentry); 885 d_move(old_dentry, new_dentry);
881 dput(new_dentry);
882 886
883 /* Remove from old parent's list and insert into new parent's list. */ 887 /* Remove from old parent's list and insert into new parent's list. */
884 sysfs_unlink_sibling(sd); 888 sysfs_unlink_sibling(sd);
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index 0648e3153f81..b84353ef6998 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -4,14 +4,11 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/arch/page.h> 6#include <asm/arch/page.h>
7#include <linux/const.h>
7 8
8/* PAGE_SHIFT determines the page size */ 9/* PAGE_SHIFT determines the page size */
9#define PAGE_SHIFT 13 10#define PAGE_SHIFT 13
10#ifndef __ASSEMBLY__ 11#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
11#define PAGE_SIZE (1UL << PAGE_SHIFT)
12#else
13#define PAGE_SIZE (1 << PAGE_SHIFT)
14#endif
15#define PAGE_MASK (~(PAGE_SIZE-1)) 12#define PAGE_MASK (~(PAGE_SIZE-1))
16 13
17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 14#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
index e09131a6127d..8ce517574340 100644
--- a/include/asm-mips/smtc_ipi.h
+++ b/include/asm-mips/smtc_ipi.h
@@ -49,7 +49,7 @@ struct smtc_ipi_q {
49 49
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p) 50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51{ 51{
52 long flags; 52 unsigned long flags;
53 53
54 spin_lock_irqsave(&q->lock, flags); 54 spin_lock_irqsave(&q->lock, flags);
55 if (q->head == NULL) 55 if (q->head == NULL)
@@ -98,7 +98,7 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
98 98
99static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p) 99static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
100{ 100{
101 long flags; 101 unsigned long flags;
102 102
103 spin_lock_irqsave(&q->lock, flags); 103 spin_lock_irqsave(&q->lock, flags);
104 if (q->head == NULL) { 104 if (q->head == NULL) {
@@ -114,7 +114,7 @@ static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
114 114
115static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q) 115static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
116{ 116{
117 long flags; 117 unsigned long flags;
118 int retval; 118 int retval;
119 119
120 spin_lock_irqsave(&q->lock, flags); 120 spin_lock_irqsave(&q->lock, flags);
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 951e2487aa69..82328dec2b52 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -286,7 +286,6 @@ extern void hpte_init_iSeries(void);
286extern void hpte_init_beat(void); 286extern void hpte_init_beat(void);
287extern void hpte_init_beat_v3(void); 287extern void hpte_init_beat_v3(void);
288 288
289extern void slb_shadow_clear_all(void);
290extern void stabs_alloc(void); 289extern void stabs_alloc(void);
291extern void slb_initialize(void); 290extern void slb_initialize(void);
292extern void slb_flush_and_rebolt(void); 291extern void slb_flush_and_rebolt(void);
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 664a2fa7adc9..80b027081b3c 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -3,6 +3,10 @@
3 3
4#include <asm/msr-index.h> 4#include <asm/msr-index.h>
5 5
6#ifndef __ASSEMBLY__
7# include <linux/types.h>
8#endif
9
6#ifdef __i386__ 10#ifdef __i386__
7 11
8#ifdef __KERNEL__ 12#ifdef __KERNEL__
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 72ab80801ef6..e672e80202a8 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -554,8 +554,6 @@ static inline int ata_drive_40wire(const u16 *dev_id)
554 554
555static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 555static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
556{ 556{
557 if (ata_id_is_sata(dev_id))
558 return 0; /* SATA */
559 if ((dev_id[93] & 0x2000) == 0x2000) 557 if ((dev_id[93] & 0x2000) == 0x2000)
560 return 0; /* 80 wire */ 558 return 0; /* 80 wire */
561 return 1; 559 return 1;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 7daafdc2514b..7f28c32d9aca 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -149,19 +149,27 @@ struct execute_work {
149 149
150extern struct workqueue_struct * 150extern struct workqueue_struct *
151__create_workqueue_key(const char *name, int singlethread, 151__create_workqueue_key(const char *name, int singlethread,
152 int freezeable, struct lock_class_key *key); 152 int freezeable, struct lock_class_key *key,
153 const char *lock_name);
153 154
154#ifdef CONFIG_LOCKDEP 155#ifdef CONFIG_LOCKDEP
155#define __create_workqueue(name, singlethread, freezeable) \ 156#define __create_workqueue(name, singlethread, freezeable) \
156({ \ 157({ \
157 static struct lock_class_key __key; \ 158 static struct lock_class_key __key; \
159 const char *__lock_name; \
160 \
161 if (__builtin_constant_p(name)) \
162 __lock_name = (name); \
163 else \
164 __lock_name = #name; \
158 \ 165 \
159 __create_workqueue_key((name), (singlethread), \ 166 __create_workqueue_key((name), (singlethread), \
160 (freezeable), &__key); \ 167 (freezeable), &__key, \
168 __lock_name); \
161}) 169})
162#else 170#else
163#define __create_workqueue(name, singlethread, freezeable) \ 171#define __create_workqueue(name, singlethread, freezeable) \
164 __create_workqueue_key((name), (singlethread), (freezeable), NULL) 172 __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL)
165#endif 173#endif
166 174
167#define create_workqueue(name) __create_workqueue((name), 0, 0) 175#define create_workqueue(name) __create_workqueue((name), 0, 0)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index e65dd0b47cdc..f994bb8065e6 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1378,7 +1378,7 @@ sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
1378/* 1378/*
1379 * Functions related to boot-time initialization: 1379 * Functions related to boot-time initialization:
1380 */ 1380 */
1381static void __devinit init_hrtimers_cpu(int cpu) 1381static void __cpuinit init_hrtimers_cpu(int cpu)
1382{ 1382{
1383 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 1383 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
1384 int i; 1384 int i;
diff --git a/kernel/kmod.c b/kernel/kmod.c
index c6a4f8aebeba..bb7df2a28bd7 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -451,13 +451,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
451 enum umh_wait wait) 451 enum umh_wait wait)
452{ 452{
453 DECLARE_COMPLETION_ONSTACK(done); 453 DECLARE_COMPLETION_ONSTACK(done);
454 int retval; 454 int retval = 0;
455 455
456 helper_lock(); 456 helper_lock();
457 if (sub_info->path[0] == '\0') { 457 if (sub_info->path[0] == '\0')
458 retval = 0;
459 goto out; 458 goto out;
460 }
461 459
462 if (!khelper_wq || usermodehelper_disabled) { 460 if (!khelper_wq || usermodehelper_disabled) {
463 retval = -EBUSY; 461 retval = -EBUSY;
@@ -468,13 +466,14 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
468 sub_info->wait = wait; 466 sub_info->wait = wait;
469 467
470 queue_work(khelper_wq, &sub_info->work); 468 queue_work(khelper_wq, &sub_info->work);
471 if (wait == UMH_NO_WAIT) /* task has freed sub_info */ 469 if (wait == UMH_NO_WAIT) /* task has freed sub_info */
472 return 0; 470 goto unlock;
473 wait_for_completion(&done); 471 wait_for_completion(&done);
474 retval = sub_info->retval; 472 retval = sub_info->retval;
475 473
476 out: 474out:
477 call_usermodehelper_freeinfo(sub_info); 475 call_usermodehelper_freeinfo(sub_info);
476unlock:
478 helper_unlock(); 477 helper_unlock();
479 return retval; 478 return retval;
480} 479}
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 723bd9f92556..4335f12a27c6 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2943,9 +2943,10 @@ void lockdep_free_key_range(void *start, unsigned long size)
2943 struct list_head *head; 2943 struct list_head *head;
2944 unsigned long flags; 2944 unsigned long flags;
2945 int i; 2945 int i;
2946 int locked;
2946 2947
2947 raw_local_irq_save(flags); 2948 raw_local_irq_save(flags);
2948 graph_lock(); 2949 locked = graph_lock();
2949 2950
2950 /* 2951 /*
2951 * Unhash all classes that were created by this module: 2952 * Unhash all classes that were created by this module:
@@ -2959,7 +2960,8 @@ void lockdep_free_key_range(void *start, unsigned long size)
2959 zap_class(class); 2960 zap_class(class);
2960 } 2961 }
2961 2962
2962 graph_unlock(); 2963 if (locked)
2964 graph_unlock();
2963 raw_local_irq_restore(flags); 2965 raw_local_irq_restore(flags);
2964} 2966}
2965 2967
@@ -2969,6 +2971,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
2969 struct list_head *head; 2971 struct list_head *head;
2970 unsigned long flags; 2972 unsigned long flags;
2971 int i, j; 2973 int i, j;
2974 int locked;
2972 2975
2973 raw_local_irq_save(flags); 2976 raw_local_irq_save(flags);
2974 2977
@@ -2987,7 +2990,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
2987 * Debug check: in the end all mapped classes should 2990 * Debug check: in the end all mapped classes should
2988 * be gone. 2991 * be gone.
2989 */ 2992 */
2990 graph_lock(); 2993 locked = graph_lock();
2991 for (i = 0; i < CLASSHASH_SIZE; i++) { 2994 for (i = 0; i < CLASSHASH_SIZE; i++) {
2992 head = classhash_table + i; 2995 head = classhash_table + i;
2993 if (list_empty(head)) 2996 if (list_empty(head))
@@ -3000,7 +3003,8 @@ void lockdep_reset_lock(struct lockdep_map *lock)
3000 } 3003 }
3001 } 3004 }
3002 } 3005 }
3003 graph_unlock(); 3006 if (locked)
3007 graph_unlock();
3004 3008
3005out_restore: 3009out_restore:
3006 raw_local_irq_restore(flags); 3010 raw_local_irq_restore(flags);
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index a66d4d1615f7..f2c1a04e9b18 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -549,7 +549,7 @@ static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
549 rdp->blimit = blimit; 549 rdp->blimit = blimit;
550} 550}
551 551
552static void __devinit rcu_online_cpu(int cpu) 552static void __cpuinit rcu_online_cpu(int cpu)
553{ 553{
554 struct rcu_data *rdp = &per_cpu(rcu_data, cpu); 554 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
555 struct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu); 555 struct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu);
diff --git a/kernel/sched.c b/kernel/sched.c
index 37cf07aa4164..e76b11ca6df3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7153,6 +7153,14 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
7153{ 7153{
7154 int i; 7154 int i;
7155 7155
7156 /*
7157 * A weight of 0 or 1 can cause arithmetics problems.
7158 * (The default weight is 1024 - so there's no practical
7159 * limitation from this.)
7160 */
7161 if (shares < 2)
7162 shares = 2;
7163
7156 spin_lock(&tg->lock); 7164 spin_lock(&tg->lock);
7157 if (tg->shares == shares) 7165 if (tg->shares == shares)
7158 goto done; 7166 goto done;
diff --git a/kernel/timer.c b/kernel/timer.c
index 26671f4db07f..2a00c22203f3 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1289,7 +1289,7 @@ static void migrate_timer_list(tvec_base_t *new_base, struct list_head *head)
1289 } 1289 }
1290} 1290}
1291 1291
1292static void __devinit migrate_timers(int cpu) 1292static void __cpuinit migrate_timers(int cpu)
1293{ 1293{
1294 tvec_base_t *old_base; 1294 tvec_base_t *old_base;
1295 tvec_base_t *new_base; 1295 tvec_base_t *new_base;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 52d5e7c9a8e6..8db0b597509e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -722,7 +722,8 @@ static void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
722struct workqueue_struct *__create_workqueue_key(const char *name, 722struct workqueue_struct *__create_workqueue_key(const char *name,
723 int singlethread, 723 int singlethread,
724 int freezeable, 724 int freezeable,
725 struct lock_class_key *key) 725 struct lock_class_key *key,
726 const char *lock_name)
726{ 727{
727 struct workqueue_struct *wq; 728 struct workqueue_struct *wq;
728 struct cpu_workqueue_struct *cwq; 729 struct cpu_workqueue_struct *cwq;
@@ -739,7 +740,7 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
739 } 740 }
740 741
741 wq->name = name; 742 wq->name = name;
742 lockdep_init_map(&wq->lockdep_map, name, key, 0); 743 lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
743 wq->singlethread = singlethread; 744 wq->singlethread = singlethread;
744 wq->freezeable = freezeable; 745 wq->freezeable = freezeable;
745 INIT_LIST_HEAD(&wq->list); 746 INIT_LIST_HEAD(&wq->list);
diff --git a/mm/memory.c b/mm/memory.c
index 4bf0b6d0eb2a..6dd1cd88bfb6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -392,6 +392,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
392 return NULL; 392 return NULL;
393 } 393 }
394 394
395#ifdef CONFIG_DEBUG_VM
395 /* 396 /*
396 * Add some anal sanity checks for now. Eventually, 397 * Add some anal sanity checks for now. Eventually,
397 * we should just do "return pfn_to_page(pfn)", but 398 * we should just do "return pfn_to_page(pfn)", but
@@ -402,6 +403,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
402 print_bad_pte(vma, pte, addr); 403 print_bad_pte(vma, pte, addr);
403 return NULL; 404 return NULL;
404 } 405 }
406#endif
405 407
406 /* 408 /*
407 * NOTE! We still have PageReserved() pages in the page 409 * NOTE! We still have PageReserved() pages in the page
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e1028fae3ebb..b2838c24e582 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2566,7 +2566,7 @@ static void __meminit zone_init_free_lists(struct pglist_data *pgdat,
2566 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) 2566 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
2567#endif 2567#endif
2568 2568
2569static int __devinit zone_batchsize(struct zone *zone) 2569static int zone_batchsize(struct zone *zone)
2570{ 2570{
2571 int batch; 2571 int batch;
2572 2572
diff --git a/net/802/tr.c b/net/802/tr.c
index a2bd0f2e3af8..1e115e5beab6 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -642,7 +642,7 @@ struct net_device *alloc_trdev(int sizeof_priv)
642static int __init rif_init(void) 642static int __init rif_init(void)
643{ 643{
644 init_timer(&rif_timer); 644 init_timer(&rif_timer);
645 rif_timer.expires = sysctl_tr_rif_timeout; 645 rif_timer.expires = jiffies + sysctl_tr_rif_timeout;
646 rif_timer.data = 0L; 646 rif_timer.data = 0L;
647 rif_timer.function = rif_check_expire; 647 rif_timer.function = rif_check_expire;
648 add_timer(&rif_timer); 648 add_timer(&rif_timer);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4add9bd4bc8d..032bf44eca5e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -323,6 +323,7 @@ static const struct header_ops vlan_header_ops = {
323static int vlan_dev_init(struct net_device *dev) 323static int vlan_dev_init(struct net_device *dev)
324{ 324{
325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; 325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
326 int subclass = 0;
326 327
327 /* IFF_BROADCAST|IFF_MULTICAST; ??? */ 328 /* IFF_BROADCAST|IFF_MULTICAST; ??? */
328 dev->flags = real_dev->flags & ~IFF_UP; 329 dev->flags = real_dev->flags & ~IFF_UP;
@@ -349,7 +350,11 @@ static int vlan_dev_init(struct net_device *dev)
349 dev->hard_start_xmit = vlan_dev_hard_start_xmit; 350 dev->hard_start_xmit = vlan_dev_hard_start_xmit;
350 } 351 }
351 352
352 lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); 353 if (real_dev->priv_flags & IFF_802_1Q_VLAN)
354 subclass = 1;
355
356 lockdep_set_class_and_subclass(&dev->_xmit_lock,
357 &vlan_netdev_xmit_lock_key, subclass);
353 return 0; 358 return 0;
354} 359}
355 360
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8378afd54b30..b4725ff317c0 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -87,10 +87,22 @@ static void ax25_kill_by_device(struct net_device *dev)
87 return; 87 return;
88 88
89 spin_lock_bh(&ax25_list_lock); 89 spin_lock_bh(&ax25_list_lock);
90again:
90 ax25_for_each(s, node, &ax25_list) { 91 ax25_for_each(s, node, &ax25_list) {
91 if (s->ax25_dev == ax25_dev) { 92 if (s->ax25_dev == ax25_dev) {
92 s->ax25_dev = NULL; 93 s->ax25_dev = NULL;
94 spin_unlock_bh(&ax25_list_lock);
93 ax25_disconnect(s, ENETUNREACH); 95 ax25_disconnect(s, ENETUNREACH);
96 spin_lock_bh(&ax25_list_lock);
97
98 /* The entry could have been deleted from the
99 * list meanwhile and thus the next pointer is
100 * no longer valid. Play it safe and restart
101 * the scan. Forward progress is ensured
102 * because we set s->ax25_dev to NULL and we
103 * are never passed a NULL 'dev' argument.
104 */
105 goto again;
94 } 106 }
95 } 107 }
96 spin_unlock_bh(&ax25_list_lock); 108 spin_unlock_bh(&ax25_list_lock);
@@ -1109,21 +1121,19 @@ static int __must_check ax25_connect(struct socket *sock,
1109 * some sanity checks. code further down depends on this 1121 * some sanity checks. code further down depends on this
1110 */ 1122 */
1111 1123
1112 if (addr_len == sizeof(struct sockaddr_ax25)) { 1124 if (addr_len == sizeof(struct sockaddr_ax25))
1113 /* support for this will go away in early 2.5.x */ 1125 /* support for this will go away in early 2.5.x
1114 printk(KERN_WARNING "ax25_connect(): %s uses obsolete socket structure\n", 1126 * ax25_connect(): uses obsolete socket structure
1115 current->comm); 1127 */
1116 } 1128 ;
1117 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1129 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1118 /* support for old structure may go away some time */ 1130 /* support for old structure may go away some time
1131 * ax25_connect(): uses old (6 digipeater) socket structure.
1132 */
1119 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1133 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1120 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1134 (addr_len > sizeof(struct full_sockaddr_ax25)))
1121 return -EINVAL; 1135 return -EINVAL;
1122 }
1123 1136
1124 printk(KERN_WARNING "ax25_connect(): %s uses old (6 digipeater) socket structure.\n",
1125 current->comm);
1126 }
1127 1137
1128 if (fsa->fsa_ax25.sax25_family != AF_AX25) 1138 if (fsa->fsa_ax25.sax25_family != AF_AX25)
1129 return -EINVAL; 1139 return -EINVAL;
@@ -1467,21 +1477,20 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1467 goto out; 1477 goto out;
1468 } 1478 }
1469 1479
1470 if (addr_len == sizeof(struct sockaddr_ax25)) { 1480 if (addr_len == sizeof(struct sockaddr_ax25))
1471 printk(KERN_WARNING "ax25_sendmsg(): %s uses obsolete socket structure\n", 1481 /* ax25_sendmsg(): uses obsolete socket structure */
1472 current->comm); 1482 ;
1473 } 1483 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1474 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1484 /* support for old structure may go away some time
1475 /* support for old structure may go away some time */ 1485 * ax25_sendmsg(): uses old (6 digipeater)
1486 * socket structure.
1487 */
1476 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1488 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1477 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1489 (addr_len > sizeof(struct full_sockaddr_ax25))) {
1478 err = -EINVAL; 1490 err = -EINVAL;
1479 goto out; 1491 goto out;
1480 } 1492 }
1481 1493
1482 printk(KERN_WARNING "ax25_sendmsg(): %s uses old (6 digipeater) socket structure.\n",
1483 current->comm);
1484 }
1485 1494
1486 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) { 1495 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) {
1487 int ct = 0; 1496 int ct = 0;
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index e447651a2dbe..a6a758dd1f7d 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -95,9 +95,10 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
95 95
96 BT_DBG("dev %p dlc %p", dev, dlc); 96 BT_DBG("dev %p dlc %p", dev, dlc);
97 97
98 write_lock_bh(&rfcomm_dev_lock); 98 /* Refcount should only hit zero when called from rfcomm_dev_del()
99 list_del_init(&dev->list); 99 which will have taken us off the list. Everything else are
100 write_unlock_bh(&rfcomm_dev_lock); 100 refcounting bugs. */
101 BUG_ON(!list_empty(&dev->list));
101 102
102 rfcomm_dlc_lock(dlc); 103 rfcomm_dlc_lock(dlc);
103 /* Detach DLC if it's owned by this dev */ 104 /* Detach DLC if it's owned by this dev */
@@ -109,11 +110,6 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
109 110
110 tty_unregister_device(rfcomm_tty_driver, dev->id); 111 tty_unregister_device(rfcomm_tty_driver, dev->id);
111 112
112 /* Refcount should only hit zero when called from rfcomm_dev_del()
113 which will have taken us off the list. Everything else are
114 refcounting bugs. */
115 BUG_ON(!list_empty(&dev->list));
116
117 kfree(dev); 113 kfree(dev);
118 114
119 /* It's safe to call module_put() here because socket still 115 /* It's safe to call module_put() here because socket still
@@ -313,7 +309,15 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
313{ 309{
314 BT_DBG("dev %p", dev); 310 BT_DBG("dev %p", dev);
315 311
316 set_bit(RFCOMM_TTY_RELEASED, &dev->flags); 312 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
313 BUG_ON(1);
314 else
315 set_bit(RFCOMM_TTY_RELEASED, &dev->flags);
316
317 write_lock_bh(&rfcomm_dev_lock);
318 list_del_init(&dev->list);
319 write_unlock_bh(&rfcomm_dev_lock);
320
317 rfcomm_dev_put(dev); 321 rfcomm_dev_put(dev);
318} 322}
319 323
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index c1757c79dfbb..9f78a69d6b8b 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -142,6 +142,23 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
142 return skb->nf_bridge; 142 return skb->nf_bridge;
143} 143}
144 144
145static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)
146{
147 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
148
149 if (atomic_read(&nf_bridge->use) > 1) {
150 struct nf_bridge_info *tmp = nf_bridge_alloc(skb);
151
152 if (tmp) {
153 memcpy(tmp, nf_bridge, sizeof(struct nf_bridge_info));
154 atomic_set(&tmp->use, 1);
155 nf_bridge_put(nf_bridge);
156 }
157 nf_bridge = tmp;
158 }
159 return nf_bridge;
160}
161
145static inline void nf_bridge_push_encap_header(struct sk_buff *skb) 162static inline void nf_bridge_push_encap_header(struct sk_buff *skb)
146{ 163{
147 unsigned int len = nf_bridge_encap_header_len(skb); 164 unsigned int len = nf_bridge_encap_header_len(skb);
@@ -247,8 +264,9 @@ static void __br_dnat_complain(void)
247 * Let us first consider the case that ip_route_input() succeeds: 264 * Let us first consider the case that ip_route_input() succeeds:
248 * 265 *
249 * If skb->dst->dev equals the logical bridge device the packet 266 * If skb->dst->dev equals the logical bridge device the packet
250 * came in on, we can consider this bridging. We then call 267 * came in on, we can consider this bridging. The packet is passed
251 * skb->dst->output() which will make the packet enter br_nf_local_out() 268 * through the neighbour output function to build a new destination
269 * MAC address, which will make the packet enter br_nf_local_out()
252 * not much later. In that function it is assured that the iptables 270 * not much later. In that function it is assured that the iptables
253 * FORWARD chain is traversed for the packet. 271 * FORWARD chain is traversed for the packet.
254 * 272 *
@@ -285,12 +303,17 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
285 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 303 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
286 304
287 skb->dev = bridge_parent(skb->dev); 305 skb->dev = bridge_parent(skb->dev);
288 if (!skb->dev) 306 if (skb->dev) {
289 kfree_skb(skb); 307 struct dst_entry *dst = skb->dst;
290 else { 308
291 nf_bridge_pull_encap_header(skb); 309 nf_bridge_pull_encap_header(skb);
292 skb->dst->output(skb); 310
311 if (dst->hh)
312 return neigh_hh_output(dst->hh, skb);
313 else if (dst->neighbour)
314 return dst->neighbour->output(skb);
293 } 315 }
316 kfree_skb(skb);
294 return 0; 317 return 0;
295} 318}
296 319
@@ -631,6 +654,11 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
631 if (!skb->nf_bridge) 654 if (!skb->nf_bridge)
632 return NF_ACCEPT; 655 return NF_ACCEPT;
633 656
657 /* Need exclusive nf_bridge_info since we might have multiple
658 * different physoutdevs. */
659 if (!nf_bridge_unshare(skb))
660 return NF_DROP;
661
634 parent = bridge_parent(out); 662 parent = bridge_parent(out);
635 if (!parent) 663 if (!parent)
636 return NF_DROP; 664 return NF_DROP;
@@ -712,6 +740,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff *skb,
712 if (!skb->nf_bridge) 740 if (!skb->nf_bridge)
713 return NF_ACCEPT; 741 return NF_ACCEPT;
714 742
743 /* Need exclusive nf_bridge_info since we might have multiple
744 * different physoutdevs. */
745 if (!nf_bridge_unshare(skb))
746 return NF_DROP;
747
715 nf_bridge = skb->nf_bridge; 748 nf_bridge = skb->nf_bridge;
716 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT)) 749 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT))
717 return NF_ACCEPT; 750 return NF_ACCEPT;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1ba26fb4bf2..fed95a323b28 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -308,9 +308,12 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
308 struct net *net; 308 struct net *net;
309 309
310 for_each_net(net) { 310 for_each_net(net) {
311restart:
311 for_each_netdev_safe(net, dev, n) { 312 for_each_netdev_safe(net, dev, n) {
312 if (dev->rtnl_link_ops == ops) 313 if (dev->rtnl_link_ops == ops) {
313 ops->dellink(dev); 314 ops->dellink(dev);
315 goto restart;
316 }
314 } 317 }
315 } 318 }
316 list_del(&ops->list); 319 list_del(&ops->list);
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 66663e5d7acd..0e10ff21e292 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1665,12 +1665,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
1665 break; 1665 break;
1666 rcu_read_unlock_bh(); 1666 rcu_read_unlock_bh();
1667 } 1667 }
1668 return rt; 1668 return rcu_dereference(rt);
1669} 1669}
1670 1670
1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) 1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
1672{ 1672{
1673 struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); 1673 struct dn_rt_cache_iter_state *s = seq->private;
1674 1674
1675 rt = rt->u.dst.dn_next; 1675 rt = rt->u.dst.dn_next;
1676 while(!rt) { 1676 while(!rt) {
@@ -1680,7 +1680,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
1680 rcu_read_lock_bh(); 1680 rcu_read_lock_bh();
1681 rt = dn_rt_hash_table[s->bucket].chain; 1681 rt = dn_rt_hash_table[s->bucket].chain;
1682 } 1682 }
1683 return rt; 1683 return rcu_dereference(rt);
1684} 1684}
1685 1685
1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) 1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 527a6e0af5b6..0dfee27cfbcd 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -444,6 +444,9 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
444 struct fib_info *fi_drop; 444 struct fib_info *fi_drop;
445 u8 state; 445 u8 state;
446 446
447 if (fi->fib_treeref > 1)
448 goto out;
449
447 write_lock_bh(&fib_hash_lock); 450 write_lock_bh(&fib_hash_lock);
448 fi_drop = fa->fa_info; 451 fi_drop = fa->fa_info;
449 fa->fa_info = fi; 452 fa->fa_info = fi;
@@ -718,19 +721,18 @@ fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb,
718{ 721{
719 int h, s_h; 722 int h, s_h;
720 723
724 if (fz->fz_hash == NULL)
725 return skb->len;
721 s_h = cb->args[3]; 726 s_h = cb->args[3];
722 for (h=0; h < fz->fz_divisor; h++) { 727 for (h = s_h; h < fz->fz_divisor; h++) {
723 if (h < s_h) continue; 728 if (hlist_empty(&fz->fz_hash[h]))
724 if (h > s_h)
725 memset(&cb->args[4], 0,
726 sizeof(cb->args) - 4*sizeof(cb->args[0]));
727 if (fz->fz_hash == NULL ||
728 hlist_empty(&fz->fz_hash[h]))
729 continue; 729 continue;
730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { 730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h]) < 0) {
731 cb->args[3] = h; 731 cb->args[3] = h;
732 return -1; 732 return -1;
733 } 733 }
734 memset(&cb->args[4], 0,
735 sizeof(cb->args) - 4*sizeof(cb->args[0]));
734 } 736 }
735 cb->args[3] = h; 737 cb->args[3] = h;
736 return skb->len; 738 return skb->len;
@@ -746,14 +748,13 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin
746 read_lock(&fib_hash_lock); 748 read_lock(&fib_hash_lock);
747 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { 749 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) {
748 if (m < s_m) continue; 750 if (m < s_m) continue;
749 if (m > s_m)
750 memset(&cb->args[3], 0,
751 sizeof(cb->args) - 3*sizeof(cb->args[0]));
752 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { 751 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) {
753 cb->args[2] = m; 752 cb->args[2] = m;
754 read_unlock(&fib_hash_lock); 753 read_unlock(&fib_hash_lock);
755 return -1; 754 return -1;
756 } 755 }
756 memset(&cb->args[3], 0,
757 sizeof(cb->args) - 3*sizeof(cb->args[0]));
757 } 758 }
758 read_unlock(&fib_hash_lock); 759 read_unlock(&fib_hash_lock);
759 cb->args[2] = m; 760 cb->args[2] = m;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 8d8c2915e064..1010b469d7d3 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1214,6 +1214,9 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1214 struct fib_info *fi_drop; 1214 struct fib_info *fi_drop;
1215 u8 state; 1215 u8 state;
1216 1216
1217 if (fi->fib_treeref > 1)
1218 goto out;
1219
1217 err = -ENOBUFS; 1220 err = -ENOBUFS;
1218 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL); 1221 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL);
1219 if (new_fa == NULL) 1222 if (new_fa == NULL)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 233de0634298..82baea026484 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -540,7 +540,6 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
540 icmp_param.data.icmph.checksum = 0; 540 icmp_param.data.icmph.checksum = 0;
541 icmp_param.skb = skb_in; 541 icmp_param.skb = skb_in;
542 icmp_param.offset = skb_network_offset(skb_in); 542 icmp_param.offset = skb_network_offset(skb_in);
543 icmp_out_count(icmp_param.data.icmph.type);
544 inet_sk(icmp_socket->sk)->tos = tos; 543 inet_sk(icmp_socket->sk)->tos = tos;
545 ipc.addr = iph->saddr; 544 ipc.addr = iph->saddr;
546 ipc.opt = &icmp_param.replyopts; 545 ipc.opt = &icmp_param.replyopts;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d3377069ce05..28484f396b04 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
283 break; 283 break;
284 rcu_read_unlock_bh(); 284 rcu_read_unlock_bh();
285 } 285 }
286 return r; 286 return rcu_dereference(r);
287} 287}
288 288
289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
290{ 290{
291 struct rt_cache_iter_state *st = rcu_dereference(seq->private); 291 struct rt_cache_iter_state *st = seq->private;
292 292
293 r = r->u.dst.rt_next; 293 r = r->u.dst.rt_next;
294 while (!r) { 294 while (!r) {
@@ -298,7 +298,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
298 rcu_read_lock_bh(); 298 rcu_read_lock_bh();
299 r = rt_hash_table[st->bucket].chain; 299 r = rt_hash_table[st->bucket].chain;
300 } 300 }
301 return r; 301 return rcu_dereference(r);
302} 302}
303 303
304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) 304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9bb031fa1c2f..f1240688dc58 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -458,8 +458,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
458 } 458 }
459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); 459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
460 460
461 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
462
463out_put: 461out_put:
464 if (likely(idev != NULL)) 462 if (likely(idev != NULL))
465 in6_dev_put(idev); 463 in6_dev_put(idev);
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index adc73adadfae..0765d8bd380f 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -193,7 +193,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
193 sk2->sk_family == PF_INET6 && 193 sk2->sk_family == PF_INET6 &&
194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && 194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && 195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
196 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { 196 (!sk2->sk_bound_dev_if || sk2->sk_bound_dev_if == dif)) {
197 if (twsk_unique(sk, sk2, twp)) 197 if (twsk_unique(sk, sk2, twp))
198 goto unique; 198 goto unique;
199 else 199 else
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c
index 34ba150bfe5d..41df9a578c7a 100644
--- a/net/ipv6/netfilter/ip6t_eui64.c
+++ b/net/ipv6/netfilter/ip6t_eui64.c
@@ -47,7 +47,7 @@ match(const struct sk_buff *skb,
47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); 47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
48 eui64[3] = 0xff; 48 eui64[3] = 0xff;
49 eui64[4] = 0xfe; 49 eui64[4] = 0xfe;
50 eui64[0] |= 0x02; 50 eui64[0] ^= 0x02;
51 51
52 i = 0; 52 i = 0;
53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i] 53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i]
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 8631ed7fe8a9..44937616057e 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -88,7 +88,7 @@ static char *icmp6type2name[256] = {
88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs", 88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs",
89 [ICMPV6_TIME_EXCEED] = "TimeExcds", 89 [ICMPV6_TIME_EXCEED] = "TimeExcds",
90 [ICMPV6_PARAMPROB] = "ParmProblems", 90 [ICMPV6_PARAMPROB] = "ParmProblems",
91 [ICMPV6_ECHO_REQUEST] = "EchoRequest", 91 [ICMPV6_ECHO_REQUEST] = "Echos",
92 [ICMPV6_ECHO_REPLY] = "EchoReplies", 92 [ICMPV6_ECHO_REPLY] = "EchoReplies",
93 [ICMPV6_MGM_QUERY] = "GroupMembQueries", 93 [ICMPV6_MGM_QUERY] = "GroupMembQueries",
94 [ICMPV6_MGM_REPORT] = "GroupMembResponses", 94 [ICMPV6_MGM_REPORT] = "GroupMembResponses",
@@ -98,7 +98,7 @@ static char *icmp6type2name[256] = {
98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits", 98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits",
99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements", 99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements",
100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits", 100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits",
101 [NDISC_REDIRECT] = "NeighborRedirects", 101 [NDISC_REDIRECT] = "Redirects",
102}; 102};
103 103
104 104
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6ecb5e6fae2e..20083e0d3995 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -329,7 +329,7 @@ static inline int rt6_check_dev(struct rt6_info *rt, int oif)
329static inline int rt6_check_neigh(struct rt6_info *rt) 329static inline int rt6_check_neigh(struct rt6_info *rt)
330{ 330{
331 struct neighbour *neigh = rt->rt6i_nexthop; 331 struct neighbour *neigh = rt->rt6i_nexthop;
332 int m = 0; 332 int m;
333 if (rt->rt6i_flags & RTF_NONEXTHOP || 333 if (rt->rt6i_flags & RTF_NONEXTHOP ||
334 !(rt->rt6i_flags & RTF_GATEWAY)) 334 !(rt->rt6i_flags & RTF_GATEWAY))
335 m = 1; 335 m = 1;
@@ -337,10 +337,15 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
337 read_lock_bh(&neigh->lock); 337 read_lock_bh(&neigh->lock);
338 if (neigh->nud_state & NUD_VALID) 338 if (neigh->nud_state & NUD_VALID)
339 m = 2; 339 m = 2;
340 else if (!(neigh->nud_state & NUD_FAILED)) 340#ifdef CONFIG_IPV6_ROUTER_PREF
341 else if (neigh->nud_state & NUD_FAILED)
342 m = 0;
343#endif
344 else
341 m = 1; 345 m = 1;
342 read_unlock_bh(&neigh->lock); 346 read_unlock_bh(&neigh->lock);
343 } 347 } else
348 m = 0;
344 return m; 349 return m;
345} 350}
346 351
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index d5e4dd75200b..07dfa7fdd2a0 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -802,12 +802,18 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
802 } 802 }
803#endif /* CONFIG_IRDA_ULTRA */ 803#endif /* CONFIG_IRDA_ULTRA */
804 804
805 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
806 if (self->ias_obj == NULL)
807 return -ENOMEM;
808
805 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); 809 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name);
806 if (err < 0) 810 if (err < 0) {
811 kfree(self->ias_obj->name);
812 kfree(self->ias_obj);
807 return err; 813 return err;
814 }
808 815
809 /* Register with LM-IAS */ 816 /* Register with LM-IAS */
810 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
811 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel", 817 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
812 self->stsap_sel, IAS_KERNEL_ATTR); 818 self->stsap_sel, IAS_KERNEL_ATTR);
813 irias_insert_object(self->ias_obj); 819 irias_insert_object(self->ias_obj);
@@ -1825,7 +1831,7 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1825 struct irda_ias_set *ias_opt; 1831 struct irda_ias_set *ias_opt;
1826 struct ias_object *ias_obj; 1832 struct ias_object *ias_obj;
1827 struct ias_attrib * ias_attr; /* Attribute in IAS object */ 1833 struct ias_attrib * ias_attr; /* Attribute in IAS object */
1828 int opt; 1834 int opt, free_ias = 0;
1829 1835
1830 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 1836 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
1831 1837
@@ -1881,11 +1887,20 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1881 /* Create a new object */ 1887 /* Create a new object */
1882 ias_obj = irias_new_object(ias_opt->irda_class_name, 1888 ias_obj = irias_new_object(ias_opt->irda_class_name,
1883 jiffies); 1889 jiffies);
1890 if (ias_obj == NULL) {
1891 kfree(ias_opt);
1892 return -ENOMEM;
1893 }
1894 free_ias = 1;
1884 } 1895 }
1885 1896
1886 /* Do we have the attribute already ? */ 1897 /* Do we have the attribute already ? */
1887 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) { 1898 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) {
1888 kfree(ias_opt); 1899 kfree(ias_opt);
1900 if (free_ias) {
1901 kfree(ias_obj->name);
1902 kfree(ias_obj);
1903 }
1889 return -EINVAL; 1904 return -EINVAL;
1890 } 1905 }
1891 1906
@@ -1904,6 +1919,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1904 if(ias_opt->attribute.irda_attrib_octet_seq.len > 1919 if(ias_opt->attribute.irda_attrib_octet_seq.len >
1905 IAS_MAX_OCTET_STRING) { 1920 IAS_MAX_OCTET_STRING) {
1906 kfree(ias_opt); 1921 kfree(ias_opt);
1922 if (free_ias) {
1923 kfree(ias_obj->name);
1924 kfree(ias_obj);
1925 }
1926
1907 return -EINVAL; 1927 return -EINVAL;
1908 } 1928 }
1909 /* Add an octet sequence attribute */ 1929 /* Add an octet sequence attribute */
@@ -1932,6 +1952,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1932 break; 1952 break;
1933 default : 1953 default :
1934 kfree(ias_opt); 1954 kfree(ias_opt);
1955 if (free_ias) {
1956 kfree(ias_obj->name);
1957 kfree(ias_obj);
1958 }
1935 return -EINVAL; 1959 return -EINVAL;
1936 } 1960 }
1937 irias_insert_object(ias_obj); 1961 irias_insert_object(ias_obj);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 26d5e63c4cc5..76dcd882f87b 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3593,27 +3593,29 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
3593 /* old ipsecrequest */ 3593 /* old ipsecrequest */
3594 int mode = pfkey_mode_from_xfrm(mp->mode); 3594 int mode = pfkey_mode_from_xfrm(mp->mode);
3595 if (mode < 0) 3595 if (mode < 0)
3596 return -EINVAL; 3596 goto err;
3597 if (set_ipsecrequest(skb, mp->proto, mode, 3597 if (set_ipsecrequest(skb, mp->proto, mode,
3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3599 mp->reqid, mp->old_family, 3599 mp->reqid, mp->old_family,
3600 &mp->old_saddr, &mp->old_daddr) < 0) { 3600 &mp->old_saddr, &mp->old_daddr) < 0)
3601 return -EINVAL; 3601 goto err;
3602 }
3603 3602
3604 /* new ipsecrequest */ 3603 /* new ipsecrequest */
3605 if (set_ipsecrequest(skb, mp->proto, mode, 3604 if (set_ipsecrequest(skb, mp->proto, mode,
3606 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3605 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3607 mp->reqid, mp->new_family, 3606 mp->reqid, mp->new_family,
3608 &mp->new_saddr, &mp->new_daddr) < 0) { 3607 &mp->new_saddr, &mp->new_daddr) < 0)
3609 return -EINVAL; 3608 goto err;
3610 }
3611 } 3609 }
3612 3610
3613 /* broadcast migrate message to sockets */ 3611 /* broadcast migrate message to sockets */
3614 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL); 3612 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
3615 3613
3616 return 0; 3614 return 0;
3615
3616err:
3617 kfree_skb(skb);
3618 return -EINVAL;
3617} 3619}
3618#else 3620#else
3619static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 3621static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 0a1f4c6bcdef..d842c4a6d63f 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -56,8 +56,8 @@ match(const struct sk_buff *skb,
56 if (info->name[0] == '\0') 56 if (info->name[0] == '\0')
57 ret = !ret; 57 ret = !ret;
58 else 58 else
59 ret ^= !strncmp(master_help->helper->name, info->name, 59 ret ^= !strncmp(helper->name, info->name,
60 strlen(master_help->helper->name)); 60 strlen(helper->name));
61 return ret; 61 return ret;
62} 62}
63 63
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 4469a7be006c..d06d338812e9 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -392,11 +392,14 @@ int rfkill_register(struct rfkill *rfkill)
392 rfkill_led_trigger_register(rfkill); 392 rfkill_led_trigger_register(rfkill);
393 393
394 error = rfkill_add_switch(rfkill); 394 error = rfkill_add_switch(rfkill);
395 if (error) 395 if (error) {
396 rfkill_led_trigger_unregister(rfkill);
396 return error; 397 return error;
398 }
397 399
398 error = device_add(dev); 400 error = device_add(dev);
399 if (error) { 401 if (error) {
402 rfkill_led_trigger_unregister(rfkill);
400 rfkill_remove_switch(rfkill); 403 rfkill_remove_switch(rfkill);
401 return error; 404 return error;
402 } 405 }
diff --git a/security/commoncap.c b/security/commoncap.c
index 5bc1895f3f9c..ea61bc73f6d3 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -59,6 +59,12 @@ int cap_netlink_recv(struct sk_buff *skb, int cap)
59 59
60EXPORT_SYMBOL(cap_netlink_recv); 60EXPORT_SYMBOL(cap_netlink_recv);
61 61
62/*
63 * NOTE WELL: cap_capable() cannot be used like the kernel's capable()
64 * function. That is, it has the reverse semantics: cap_capable()
65 * returns 0 when a task has a capability, but the kernel's capable()
66 * returns 1 for this case.
67 */
62int cap_capable (struct task_struct *tsk, int cap) 68int cap_capable (struct task_struct *tsk, int cap)
63{ 69{
64 /* Derived from include/linux/sched.h:capable. */ 70 /* Derived from include/linux/sched.h:capable. */
@@ -107,10 +113,11 @@ static inline int cap_block_setpcap(struct task_struct *target)
107static inline int cap_inh_is_capped(void) 113static inline int cap_inh_is_capped(void)
108{ 114{
109 /* 115 /*
110 * return 1 if changes to the inheritable set are limited 116 * Return 1 if changes to the inheritable set are limited
111 * to the old permitted set. 117 * to the old permitted set. That is, if the current task
118 * does *not* possess the CAP_SETPCAP capability.
112 */ 119 */
113 return !cap_capable(current, CAP_SETPCAP); 120 return (cap_capable(current, CAP_SETPCAP) != 0);
114} 121}
115 122
116#else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */ 123#else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index d243ddc723a5..66e013d6f6f6 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
@@ -53,10 +53,11 @@ static int selinux_netlbl_sock_setsid(struct sock *sk, u32 sid)
53 struct sk_security_struct *sksec = sk->sk_security; 53 struct sk_security_struct *sksec = sk->sk_security;
54 struct netlbl_lsm_secattr secattr; 54 struct netlbl_lsm_secattr secattr;
55 55
56 netlbl_secattr_init(&secattr);
57
56 rc = security_netlbl_sid_to_secattr(sid, &secattr); 58 rc = security_netlbl_sid_to_secattr(sid, &secattr);
57 if (rc != 0) 59 if (rc != 0)
58 return rc; 60 goto sock_setsid_return;
59
60 rc = netlbl_sock_setattr(sk, &secattr); 61 rc = netlbl_sock_setattr(sk, &secattr);
61 if (rc == 0) { 62 if (rc == 0) {
62 spin_lock_bh(&sksec->nlbl_lock); 63 spin_lock_bh(&sksec->nlbl_lock);
@@ -64,6 +65,8 @@ static int selinux_netlbl_sock_setsid(struct sock *sk, u32 sid)
64 spin_unlock_bh(&sksec->nlbl_lock); 65 spin_unlock_bh(&sksec->nlbl_lock);
65 } 66 }
66 67
68sock_setsid_return:
69 netlbl_secattr_destroy(&secattr);
67 return rc; 70 return rc;
68} 71}
69 72
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d572dc908f31..f83b19daed16 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2606,8 +2606,6 @@ int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
2606 int rc = -ENOENT; 2606 int rc = -ENOENT;
2607 struct context *ctx; 2607 struct context *ctx;
2608 2608
2609 netlbl_secattr_init(secattr);
2610
2611 if (!ss_initialized) 2609 if (!ss_initialized)
2612 return 0; 2610 return 0;
2613 2611
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index af37cd09bddd..857008bb7167 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -75,7 +75,7 @@ config SOUND_TRIDENT
75 75
76 76
77 This driver differs slightly from OSS/Free, so PLEASE READ the 77 This driver differs slightly from OSS/Free, so PLEASE READ the
78 comments at the top of <file:drivers/sound/trident.c>. 78 comments at the top of <file:sound/oss/trident.c>.
79 79
80config SOUND_MSNDCLAS 80config SOUND_MSNDCLAS
81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey" 81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
@@ -564,7 +564,7 @@ config SOUND_AEDSP16
564 questions. 564 questions.
565 565
566 Read the <file:Documentation/sound/oss/README.OSS> file and the head of 566 Read the <file:Documentation/sound/oss/README.OSS> file and the head of
567 <file:drivers/sound/aedsp16.c> as well as 567 <file:sound/oss/aedsp16.c> as well as
568 <file:Documentation/sound/oss/AudioExcelDSP16> to get more information 568 <file:Documentation/sound/oss/AudioExcelDSP16> to get more information
569 about this driver and its configuration. 569 about this driver and its configuration.
570 570