aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/driver-model/platform.txt6
-rw-r--r--Documentation/ja_JP/stable_kernel_rules.txt79
-rw-r--r--MAINTAINERS25
-rw-r--r--arch/Kconfig31
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/arm/Kconfig21
-rw-r--r--arch/arm/Kconfig.instrumentation62
-rw-r--r--arch/avr32/Kconfig7
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/m32r/Kconfig3
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68knommu/Kconfig2
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/parisc/Kconfig3
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/ppc/Kconfig4
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/sh/Kconfig3
-rw-r--r--arch/sparc/Kconfig3
-rw-r--r--arch/sparc64/Kconfig4
-rw-r--r--arch/um/Kconfig2
-rw-r--r--arch/v850/Kconfig2
-rw-r--r--arch/x86/Kconfig8
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--drivers/base/core.c40
-rw-r--r--drivers/base/driver.c9
-rw-r--r--drivers/base/power/main.c1
-rw-r--r--drivers/base/power/power.h1
-rw-r--r--drivers/char/drm/drm_vm.c2
-rw-r--r--drivers/char/mspec.c2
-rw-r--r--drivers/char/nozomi.c172
-rw-r--r--drivers/macintosh/adb.c1
-rw-r--r--drivers/net/Kconfig11
-rw-r--r--drivers/net/arm/at91_ether.c2
-rw-r--r--drivers/net/ax88796.c40
-rw-r--r--drivers/net/bfin_mac.c107
-rw-r--r--drivers/net/bfin_mac.h31
-rw-r--r--drivers/net/bonding/bond_main.c106
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cxgb3/mc5.c2
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/cxgb3/t3_hw.c22
-rw-r--r--drivers/net/e100.c18
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/e1000e/defines.h1
-rw-r--r--drivers/net/e1000e/ethtool.c17
-rw-r--r--drivers/net/e1000e/netdev.c12
-rw-r--r--drivers/net/ehea/ehea.h3
-rw-r--r--drivers/net/ehea/ehea_ethtool.c4
-rw-r--r--drivers/net/ehea/ehea_hw.h8
-rw-r--r--drivers/net/ehea/ehea_main.c124
-rw-r--r--drivers/net/ehea/ehea_phyp.c158
-rw-r--r--drivers/net/ehea/ehea_phyp.h22
-rw-r--r--drivers/net/ehea/ehea_qmr.c32
-rw-r--r--drivers/net/ehea/ehea_qmr.h16
-rw-r--r--drivers/net/forcedeth.c61
-rw-r--r--drivers/net/ibmlana.c4
-rw-r--r--drivers/net/igb/igb_main.c1
-rw-r--r--drivers/net/macb.c9
-rw-r--r--drivers/net/mipsnet.c203
-rw-r--r--drivers/net/mipsnet.h112
-rw-r--r--drivers/net/natsemi.c18
-rw-r--r--drivers/net/pasemi_mac.c259
-rw-r--r--drivers/net/pasemi_mac.h16
-rw-r--r--drivers/net/pci-skeleton.c49
-rw-r--r--drivers/net/phy/Kconfig5
-rw-r--r--drivers/net/phy/Makefile1
-rw-r--r--drivers/net/phy/broadcom.c20
-rw-r--r--drivers/net/phy/mdio_bus.c2
-rw-r--r--drivers/net/phy/phy.c68
-rw-r--r--drivers/net/phy/phy_device.c11
-rw-r--r--drivers/net/phy/realtek.c80
-rw-r--r--drivers/net/s2io.c20
-rw-r--r--drivers/net/s2io.h2
-rw-r--r--drivers/net/sis190.c2
-rw-r--r--drivers/net/sky2.c14
-rw-r--r--drivers/net/sunbmac.c2
-rw-r--r--drivers/net/sunqe.c6
-rw-r--r--drivers/net/sunvnet.c2
-rw-r--r--drivers/net/tokenring/olympic.c2
-rw-r--r--drivers/net/ucc_geth.c37
-rw-r--r--drivers/net/usb/rtl8150.c1
-rw-r--r--drivers/net/via-rhine.c2
-rw-r--r--drivers/net/via-velocity.c70
-rw-r--r--drivers/net/via-velocity.h224
-rw-r--r--drivers/net/wireless/ath5k/base.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c10
-rw-r--r--drivers/pci/Makefile3
-rw-r--r--drivers/pci/hotplug-pci.c20
-rw-r--r--drivers/pci/pci-sysfs.c5
-rw-r--r--drivers/pci/pci.c4
-rw-r--r--drivers/pci/pcie/Kconfig20
-rw-r--r--drivers/pci/pcie/Makefile3
-rw-r--r--drivers/pci/pcie/aspm.c802
-rw-r--r--drivers/pci/probe.c24
-rw-r--r--drivers/pci/remove.c4
-rw-r--r--drivers/pci/setup-bus.c4
-rw-r--r--drivers/scsi/aic7xxx/Makefile9
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--fs/locks.c125
-rw-r--r--fs/ncpfs/mmap.c4
-rw-r--r--include/linux/aspm.h44
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/device.h6
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/ieee80211.h6
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_regs.h8
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/net/if_inet6.h6
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_connection_sock.h8
-rw-r--r--include/net/inet_hashtables.h51
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/sock.h3
-rw-r--r--init/Kconfig14
-rw-r--r--kernel/Kconfig.instrumentation49
-rw-r--r--kernel/Makefile3
-rw-r--r--kernel/relay.c1
-rw-r--r--lib/Kconfig.debug14
-rw-r--r--lib/kobject.c2
-rw-r--r--mm/mmap.c2
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/ipv4.c18
-rw-r--r--net/dccp/ipv6.c20
-rw-r--r--net/dccp/proto.c18
-rw-r--r--net/ipv4/inet_connection_sock.c8
-rw-r--r--net/ipv4/inet_hashtables.c58
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_ipv4.c31
-rw-r--r--net/ipv6/inet6_hashtables.c4
-rw-r--r--net/ipv6/tcp_ipv6.c19
-rw-r--r--net/mac80211/Kconfig12
-rw-r--r--net/mac80211/ieee80211.c14
-rw-r--r--net/mac80211/rc80211_pid_algo.c2
-rw-r--r--net/mac80211/rc80211_simple.c2
-rw-r--r--net/mac80211/rx.c7
-rw-r--r--scripts/kconfig/mconf.c1
-rw-r--r--scripts/kconfig/menu.c9
-rw-r--r--scripts/mod/modpost.c17
-rwxr-xr-x[-rw-r--r--]scripts/setlocalversion16
-rw-r--r--sound/oss/via82cxxx_audio.c14
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c2
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c2
153 files changed, 1690 insertions, 2484 deletions
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt
index 2a97320ee17f..83009fdcbbc8 100644
--- a/Documentation/driver-model/platform.txt
+++ b/Documentation/driver-model/platform.txt
@@ -122,15 +122,15 @@ None the less, there are some APIs to support such legacy drivers. Avoid
122using these calls except with such hotplug-deficient drivers. 122using these calls except with such hotplug-deficient drivers.
123 123
124 struct platform_device *platform_device_alloc( 124 struct platform_device *platform_device_alloc(
125 char *name, unsigned id); 125 const char *name, int id);
126 126
127You can use platform_device_alloc() to dynamically allocate a device, which 127You can use platform_device_alloc() to dynamically allocate a device, which
128you will then initialize with resources and platform_device_register(). 128you will then initialize with resources and platform_device_register().
129A better solution is usually: 129A better solution is usually:
130 130
131 struct platform_device *platform_device_register_simple( 131 struct platform_device *platform_device_register_simple(
132 char *name, unsigned id, 132 const char *name, int id,
133 struct resource *res, unsigned nres); 133 struct resource *res, unsigned int nres);
134 134
135You can use platform_device_register_simple() as a one-step call to allocate 135You can use platform_device_register_simple() as a one-step call to allocate
136and register a device. 136and register a device.
diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt
new file mode 100644
index 000000000000..17d87519e468
--- /dev/null
+++ b/Documentation/ja_JP/stable_kernel_rules.txt
@@ -0,0 +1,79 @@
1NOTE:
2This is Japanese translated version of "Documentation/stable_kernel_rules.txt".
3This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com>
4and JF Project team <www.linux.or.jp/JF>.
5If you find difference with original file or problem in translation,
6please contact maintainer of this file or JF project.
7
8Please also note that purpose of this file is easier to read for non
9English natives and do no intended to fork. So, if you have any
10comment or update of this file, please try to update Original(English)
11file at first.
12
13==================================
14これは、
15linux-2.6.24/Documentation/stable_kernel_rules.txt
16の和訳です。
17
18翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
19翻訳日: 2007/12/30
20翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
21校正者: 武井伸光さん、<takei at webmasters dot gr dot jp>
22 かねこさん (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp>
23 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
24 野口さん (Kenji Noguchi) <tokyo246 at gmail dot com>
25 神宮信太郎さん <jin at libjingu dot jp>
26==================================
27
28ずっと知りたかった Linux 2.6 -stable リリースの全て
29
30"-stable" ツリーにどのような種類のパッチが受け入れられるか、どのような
31ものが受け入れられないか、についての規則-
32
33 - 明らかに正しく、テストされているものでなければならない。
34 - 文脈(変更行の前後)を含めて 100 行より大きくてはいけない。
35 - ただ一個のことだけを修正しているべき。
36 - 皆を悩ませている本物のバグを修正しなければならない。("これはバグで
37 あるかもしれないが..." のようなものではない)
38 - ビルドエラー(CONFIG_BROKENになっているものを除く), oops, ハング、デー
39 タ破壊、現実のセキュリティ問題、その他 "ああ、これはダメだね"という
40 ようなものを修正しなければならない。短く言えば、重大な問題。
41 - どのように競合状態が発生するかの説明も一緒に書かれていない限り、
42 "理論的には競合状態になる"ようなものは不可。
43 - いかなる些細な修正も含めることはできない。(スペルの修正、空白のクリー
44 ンアップなど)
45 - 対応するサブシステムメンテナが受け入れたものでなければならない。
46 - Documentation/SubmittingPatches の規則に従ったものでなければならない。
47
48-stable ツリーにパッチを送付する手続き-
49
50 - 上記の規則に従っているかを確認した後に、stable@kernel.org にパッチ
51 を送る。
52 - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合
53 には NAK を受け取る。この反応は開発者たちのスケジュールによって、数
54 日かかる場合がある。
55 - もし受け取られたら、パッチは他の開発者たちのレビューのために
56 -stable キューに追加される。
57 - セキュリティパッチはこのエイリアス (stable@kernel.org) に送られるべ
58 きではなく、代わりに security@kernel.org のアドレスに送られる。
59
60レビューサイクル-
61
62 - -stable メンテナがレビューサイクルを決めるとき、パッチはレビュー委
63 員会とパッチが影響する領域のメンテナ(提供者がその領域のメンテナで無
64 い限り)に送られ、linux-kernel メーリングリストにCCされる。
65 - レビュー委員会は 48時間の間に ACK か NAK を出す。
66 - もしパッチが委員会のメンバから却下れるか、メンテナ達やメンバが気付
67 かなかった問題が持ちあがり、linux-kernel メンバがパッチに異議を唱え
68 た場合には、パッチはキューから削除される。
69 - レビューサイクルの最後に、ACK を受けたパッチは最新の -stable リリー
70 スに追加され、その後に新しい -stable リリースが行われる。
71 - セキュリティパッチは、通常のレビューサイクルを通らず、セキュリティ
72 カーネルチームから直接 -stable ツリーに受け付けられる。
73 この手続きの詳細については kernel security チームに問い合わせること。
74
75レビュー委員会-
76
77 - この委員会は、このタスクについて活動する多くのボランティアと、少数の
78 非ボランティアのカーネル開発者達で構成されている。
79
diff --git a/MAINTAINERS b/MAINTAINERS
index 16abd89f8e23..da30a72a839c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -84,13 +84,6 @@ S: Status, one of the following:
84 it has been replaced by a better system and you 84 it has been replaced by a better system and you
85 should be using that. 85 should be using that.
86 86
873C359 NETWORK DRIVER
88P: Mike Phillips
89M: mikep@linuxtr.net
90L: netdev@vger.kernel.org
91W: http://www.linuxtr.net
92S: Maintained
93
943C505 NETWORK DRIVER 873C505 NETWORK DRIVER
95P: Philip Blundell 88P: Philip Blundell
96M: philb@gnu.org 89M: philb@gnu.org
@@ -939,8 +932,6 @@ M: maxk@qualcomm.com
939S: Maintained 932S: Maintained
940 933
941BONDING DRIVER 934BONDING DRIVER
942P: Chad Tindel
943M: ctindel@users.sourceforge.net
944P: Jay Vosburgh 935P: Jay Vosburgh
945M: fubar@us.ibm.com 936M: fubar@us.ibm.com
946L: bonding-devel@lists.sourceforge.net 937L: bonding-devel@lists.sourceforge.net
@@ -2864,15 +2855,6 @@ L: ocfs2-devel@oss.oracle.com
2864W: http://oss.oracle.com/projects/ocfs2/ 2855W: http://oss.oracle.com/projects/ocfs2/
2865S: Supported 2856S: Supported
2866 2857
2867OLYMPIC NETWORK DRIVER
2868P: Peter De Shrijver
2869M: p2@ace.ulyssis.student.kuleuven.ac.be
2870P: Mike Phillips
2871M: mikep@linuxtr.net
2872L: netdev@vger.kernel.org
2873W: http://www.linuxtr.net
2874S: Maintained
2875
2876OMNIKEY CARDMAN 4000 DRIVER 2858OMNIKEY CARDMAN 4000 DRIVER
2877P: Harald Welte 2859P: Harald Welte
2878M: laforge@gnumonks.org 2860M: laforge@gnumonks.org
@@ -3788,13 +3770,6 @@ L: tlan-devel@lists.sourceforge.net (subscribers-only)
3788W: http://sourceforge.net/projects/tlan/ 3770W: http://sourceforge.net/projects/tlan/
3789S: Maintained 3771S: Maintained
3790 3772
3791TOKEN-RING NETWORK DRIVER
3792P: Mike Phillips
3793M: mikep@linuxtr.net
3794L: netdev@vger.kernel.org
3795W: http://www.linuxtr.net
3796S: Maintained
3797
3798TOSHIBA ACPI EXTRAS DRIVER 3773TOSHIBA ACPI EXTRAS DRIVER
3799P: John Belmonte 3774P: John Belmonte
3800M: toshiba_acpi@memebeam.org 3775M: toshiba_acpi@memebeam.org
diff --git a/arch/Kconfig b/arch/Kconfig
new file mode 100644
index 000000000000..3d72dc3fc8f5
--- /dev/null
+++ b/arch/Kconfig
@@ -0,0 +1,31 @@
1#
2# General architecture dependent options
3#
4
5config OPROFILE
6 tristate "OProfile system profiling (EXPERIMENTAL)"
7 depends on PROFILING
8 depends on HAVE_OPROFILE
9 help
10 OProfile is a profiling system capable of profiling the
11 whole system, include the kernel, kernel modules, libraries,
12 and applications.
13
14 If unsure, say N.
15
16config HAVE_OPROFILE
17 def_bool n
18
19config KPROBES
20 bool "Kprobes"
21 depends on KALLSYMS && MODULES
22 depends on HAVE_KPROBES
23 help
24 Kprobes allows you to trap at almost any kernel address and
25 execute a callback function. register_kprobe() establishes
26 a probepoint and specifies the callback. Kprobes is useful
27 for kernel debugging, non-intrusive instrumentation and testing.
28 If in doubt, say "N".
29
30config HAVE_KPROBES
31 def_bool n
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 1a99bdd3b67d..01b10ab588a6 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -5,6 +5,7 @@
5config ALPHA 5config ALPHA
6 bool 6 bool
7 default y 7 default y
8 select HAVE_OPROFILE
8 help 9 help
9 The Alpha is a 64-bit general-purpose processor designed and 10 The Alpha is a 64-bit general-purpose processor designed and
10 marketed by the Digital Equipment Corporation of blessed memory, 11 marketed by the Digital Equipment Corporation of blessed memory,
@@ -649,8 +650,6 @@ source "drivers/Kconfig"
649 650
650source "fs/Kconfig" 651source "fs/Kconfig"
651 652
652source "kernel/Kconfig.instrumentation"
653
654source "arch/alpha/Kconfig.debug" 653source "arch/alpha/Kconfig.debug"
655 654
656# DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig 655# DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 11606434011a..471637002e8b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,6 +10,8 @@ config ARM
10 default y 10 default y
11 select RTC_LIB 11 select RTC_LIB
12 select SYS_SUPPORTS_APM_EMULATION 12 select SYS_SUPPORTS_APM_EMULATION
13 select HAVE_OPROFILE
14 select HAVE_KPROBES if (!XIP_KERNEL)
13 help 15 help
14 The ARM series is a line of low-power-consumption RISC chip designs 16 The ARM series is a line of low-power-consumption RISC chip designs
15 licensed by ARM Ltd and targeted at embedded applications and 17 licensed by ARM Ltd and targeted at embedded applications and
@@ -135,6 +137,23 @@ config FIQ
135config ARCH_MTD_XIP 137config ARCH_MTD_XIP
136 bool 138 bool
137 139
140if OPROFILE
141
142config OPROFILE_ARMV6
143 def_bool y
144 depends on CPU_V6 && !SMP
145 select OPROFILE_ARM11_CORE
146
147config OPROFILE_MPCORE
148 def_bool y
149 depends on CPU_V6 && SMP
150 select OPROFILE_ARM11_CORE
151
152config OPROFILE_ARM11_CORE
153 bool
154
155endif
156
138config VECTORS_BASE 157config VECTORS_BASE
139 hex 158 hex
140 default 0xffff0000 if MMU || CPU_HIGH_VECTOR 159 default 0xffff0000 if MMU || CPU_HIGH_VECTOR
@@ -1127,8 +1146,6 @@ endmenu
1127 1146
1128source "fs/Kconfig" 1147source "fs/Kconfig"
1129 1148
1130source "arch/arm/Kconfig.instrumentation"
1131
1132source "arch/arm/Kconfig.debug" 1149source "arch/arm/Kconfig.debug"
1133 1150
1134source "security/Kconfig" 1151source "security/Kconfig"
diff --git a/arch/arm/Kconfig.instrumentation b/arch/arm/Kconfig.instrumentation
deleted file mode 100644
index 453ad8e15d69..000000000000
--- a/arch/arm/Kconfig.instrumentation
+++ /dev/null
@@ -1,62 +0,0 @@
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 KPROBES
47 bool "Kprobes"
48 depends on KALLSYMS && MODULES && !UML && !XIP_KERNEL
49 help
50 Kprobes allows you to trap at almost any kernel address and
51 execute a callback function. register_kprobe() establishes
52 a probepoint and specifies the callback. Kprobes is useful
53 for kernel debugging, non-intrusive instrumentation and testing.
54 If in doubt, say "N".
55
56config MARKERS
57 bool "Activate markers"
58 help
59 Place an empty function call at each marker site. Can be
60 dynamically changed for a probe function.
61
62endif # INSTRUMENTATION
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index e34e2c9c94cb..c816f29154c9 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -10,6 +10,8 @@ config AVR32
10 # With EMBEDDED=n, we get lots of stuff automatically selected 10 # With EMBEDDED=n, we get lots of stuff automatically selected
11 # that we usually don't need on AVR32. 11 # that we usually don't need on AVR32.
12 select EMBEDDED 12 select EMBEDDED
13 select HAVE_OPROFILE
14 select HAVE_KPROBES
13 help 15 help
14 AVR32 is a high-performance 32-bit RISC microprocessor core, 16 AVR32 is a high-performance 32-bit RISC microprocessor core,
15 designed for cost-sensitive embedded applications, with particular 17 designed for cost-sensitive embedded applications, with particular
@@ -54,9 +56,6 @@ config ARCH_HAS_ILOG2_U32
54config ARCH_HAS_ILOG2_U64 56config ARCH_HAS_ILOG2_U64
55 def_bool n 57 def_bool n
56 58
57config ARCH_SUPPORTS_OPROFILE
58 def_bool y
59
60config GENERIC_HWEIGHT 59config GENERIC_HWEIGHT
61 def_bool y 60 def_bool y
62 61
@@ -236,8 +235,6 @@ source "drivers/Kconfig"
236 235
237source "fs/Kconfig" 236source "fs/Kconfig"
238 237
239source "kernel/Kconfig.instrumentation"
240
241source "arch/avr32/Kconfig.debug" 238source "arch/avr32/Kconfig.debug"
242 239
243source "security/Kconfig" 240source "security/Kconfig"
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 4802eb767dc9..ba21e33b8b1f 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -24,6 +24,7 @@ config RWSEM_XCHGADD_ALGORITHM
24config BLACKFIN 24config BLACKFIN
25 bool 25 bool
26 default y 26 default y
27 select HAVE_OPROFILE
27 28
28config ZONE_DMA 29config ZONE_DMA
29 bool 30 bool
@@ -973,8 +974,6 @@ source "drivers/Kconfig"
973 974
974source "fs/Kconfig" 975source "fs/Kconfig"
975 976
976source "kernel/Kconfig.instrumentation"
977
978source "arch/blackfin/Kconfig.debug" 977source "arch/blackfin/Kconfig.debug"
979 978
980source "security/Kconfig" 979source "security/Kconfig"
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 222da1501f47..7f0be4cd5e9a 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -213,8 +213,6 @@ source "drivers/pci/Kconfig"
213 213
214source "drivers/usb/Kconfig" 214source "drivers/usb/Kconfig"
215 215
216source "kernel/Kconfig.instrumentation"
217
218source "arch/cris/Kconfig.debug" 216source "arch/cris/Kconfig.debug"
219 217
220source "security/Kconfig" 218source "security/Kconfig"
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 88f5ceab0d32..bf0468cbe713 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -375,8 +375,6 @@ source "drivers/Kconfig"
375 375
376source "fs/Kconfig" 376source "fs/Kconfig"
377 377
378source "kernel/Kconfig.instrumentation"
379
380source "arch/frv/Kconfig.debug" 378source "arch/frv/Kconfig.debug"
381 379
382source "security/Kconfig" 380source "security/Kconfig"
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index ff6a8712bd6d..dc61222e1120 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -223,8 +223,6 @@ endmenu
223 223
224source "fs/Kconfig" 224source "fs/Kconfig"
225 225
226source "kernel/Kconfig.instrumentation"
227
228source "arch/h8300/Kconfig.debug" 226source "arch/h8300/Kconfig.debug"
229 227
230source "security/Kconfig" 228source "security/Kconfig"
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 495e88fb91c5..b0de1132dfc0 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -15,6 +15,8 @@ config IA64
15 select ACPI if (!IA64_HP_SIM) 15 select ACPI if (!IA64_HP_SIM)
16 select PM if (!IA64_HP_SIM) 16 select PM if (!IA64_HP_SIM)
17 select ARCH_SUPPORTS_MSI 17 select ARCH_SUPPORTS_MSI
18 select HAVE_OPROFILE
19 select HAVE_KPROBES
18 default y 20 default y
19 help 21 help
20 The Itanium Processor Family is Intel's 64-bit successor to 22 The Itanium Processor Family is Intel's 64-bit successor to
@@ -600,8 +602,6 @@ config IRQ_PER_CPU
600 602
601source "arch/ia64/hp/sim/Kconfig" 603source "arch/ia64/hp/sim/Kconfig"
602 604
603source "kernel/Kconfig.instrumentation"
604
605source "arch/ia64/Kconfig.debug" 605source "arch/ia64/Kconfig.debug"
606 606
607source "security/Kconfig" 607source "security/Kconfig"
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index e0118c4bc082..795180b8fd8e 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux/M32R Kernel Configuration"
8config M32R 8config M32R
9 bool 9 bool
10 default y 10 default y
11 select HAVE_OPROFILE
11 12
12config SBUS 13config SBUS
13 bool 14 bool
@@ -425,8 +426,6 @@ source "drivers/Kconfig"
425 426
426source "fs/Kconfig" 427source "fs/Kconfig"
427 428
428source "kernel/Kconfig.instrumentation"
429
430source "arch/m32r/Kconfig.debug" 429source "arch/m32r/Kconfig.debug"
431 430
432source "security/Kconfig" 431source "security/Kconfig"
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 24e6bc09e7a7..8236e42ef711 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -678,8 +678,6 @@ endmenu
678 678
679source "fs/Kconfig" 679source "fs/Kconfig"
680 680
681source "kernel/Kconfig.instrumentation"
682
683source "arch/m68k/Kconfig.debug" 681source "arch/m68k/Kconfig.debug"
684 682
685source "security/Kconfig" 683source "security/Kconfig"
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index bd9213749ac2..6abbbb8aac5e 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -711,8 +711,6 @@ source "drivers/Kconfig"
711 711
712source "fs/Kconfig" 712source "fs/Kconfig"
713 713
714source "kernel/Kconfig.instrumentation"
715
716source "arch/m68knommu/Kconfig.debug" 714source "arch/m68knommu/Kconfig.debug"
717 715
718source "security/Kconfig" 716source "security/Kconfig"
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 223eb1550fdc..ec78a5762e9e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1,6 +1,7 @@
1config MIPS 1config MIPS
2 bool 2 bool
3 default y 3 default y
4 select HAVE_OPROFILE
4 # Horrible source of confusion. Die, die, die ... 5 # Horrible source of confusion. Die, die, die ...
5 select EMBEDDED 6 select EMBEDDED
6 select RTC_LIB 7 select RTC_LIB
@@ -2095,8 +2096,6 @@ source "drivers/Kconfig"
2095 2096
2096source "fs/Kconfig" 2097source "fs/Kconfig"
2097 2098
2098source "kernel/Kconfig.instrumentation"
2099
2100source "arch/mips/Kconfig.debug" 2099source "arch/mips/Kconfig.debug"
2101 2100
2102source "security/Kconfig" 2101source "security/Kconfig"
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 808c060231e8..028d8a0fdbfd 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -7,6 +7,7 @@ mainmenu "Linux/PA-RISC Kernel Configuration"
7 7
8config PARISC 8config PARISC
9 def_bool y 9 def_bool y
10 select HAVE_OPROFILE
10 help 11 help
11 The PA-RISC microprocessor is designed by Hewlett-Packard and used 12 The PA-RISC microprocessor is designed by Hewlett-Packard and used
12 in many of their workstations & servers (HP9000 700 and 800 series, 13 in many of their workstations & servers (HP9000 700 and 800 series,
@@ -271,8 +272,6 @@ source "drivers/Kconfig"
271 272
272source "fs/Kconfig" 273source "fs/Kconfig"
273 274
274source "kernel/Kconfig.instrumentation"
275
276source "arch/parisc/Kconfig.debug" 275source "arch/parisc/Kconfig.debug"
277 276
278source "security/Kconfig" 277source "security/Kconfig"
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 4a22c9928618..b94d4502a477 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -87,6 +87,8 @@ config ARCH_NO_VIRT_TO_BUS
87config PPC 87config PPC
88 bool 88 bool
89 default y 89 default y
90 select HAVE_OPROFILE
91 select HAVE_KPROBES
90 92
91config EARLY_PRINTK 93config EARLY_PRINTK
92 bool 94 bool
@@ -713,8 +715,6 @@ source "arch/powerpc/sysdev/qe_lib/Kconfig"
713 715
714source "lib/Kconfig" 716source "lib/Kconfig"
715 717
716source "kernel/Kconfig.instrumentation"
717
718source "arch/powerpc/Kconfig.debug" 718source "arch/powerpc/Kconfig.debug"
719 719
720source "security/Kconfig" 720source "security/Kconfig"
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index db5934cdafb3..531156f8919c 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -42,6 +42,8 @@ config GENERIC_CALIBRATE_DELAY
42config PPC 42config PPC
43 bool 43 bool
44 default y 44 default y
45 select HAVE_OPROFILE
46 select HAVE_KPROBES
45 47
46config PPC32 48config PPC32
47 bool 49 bool
@@ -1256,8 +1258,6 @@ endmenu
1256 1258
1257source "lib/Kconfig" 1259source "lib/Kconfig"
1258 1260
1259source "kernel/Kconfig.instrumentation"
1260
1261source "arch/ppc/Kconfig.debug" 1261source "arch/ppc/Kconfig.debug"
1262 1262
1263source "security/Kconfig" 1263source "security/Kconfig"
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 39177ba0ec8a..82cbffd03654 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -51,6 +51,8 @@ mainmenu "Linux Kernel Configuration"
51 51
52config S390 52config S390
53 def_bool y 53 def_bool y
54 select HAVE_OPROFILE
55 select HAVE_KPROBES
54 56
55source "init/Kconfig" 57source "init/Kconfig"
56 58
@@ -526,8 +528,6 @@ source "drivers/Kconfig"
526 528
527source "fs/Kconfig" 529source "fs/Kconfig"
528 530
529source "kernel/Kconfig.instrumentation"
530
531source "arch/s390/Kconfig.debug" 531source "arch/s390/Kconfig.debug"
532 532
533source "security/Kconfig" 533source "security/Kconfig"
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index ad3bee70a5b5..1c3a90835c7e 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux/SuperH Kernel Configuration"
8config SUPERH 8config SUPERH
9 def_bool y 9 def_bool y
10 select EMBEDDED 10 select EMBEDDED
11 select HAVE_OPROFILE
11 help 12 help
12 The SuperH is a RISC processor targeted for use in embedded systems 13 The SuperH is a RISC processor targeted for use in embedded systems
13 and consumer electronics; it was also used in the Sega Dreamcast 14 and consumer electronics; it was also used in the Sega Dreamcast
@@ -895,8 +896,6 @@ source "drivers/Kconfig"
895 896
896source "fs/Kconfig" 897source "fs/Kconfig"
897 898
898source "kernel/Kconfig.instrumentation"
899
900source "arch/sh/Kconfig.debug" 899source "arch/sh/Kconfig.debug"
901 900
902source "security/Kconfig" 901source "security/Kconfig"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 556f79a873b9..99f8971716d2 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -62,6 +62,7 @@ config NR_CPUS
62config SPARC 62config SPARC
63 bool 63 bool
64 default y 64 default y
65 select HAVE_OPROFILE
65 66
66# Identify this as a Sparc32 build 67# Identify this as a Sparc32 build
67config SPARC32 68config SPARC32
@@ -319,8 +320,6 @@ endmenu
319 320
320source "fs/Kconfig" 321source "fs/Kconfig"
321 322
322source "kernel/Kconfig.instrumentation"
323
324source "arch/sparc/Kconfig.debug" 323source "arch/sparc/Kconfig.debug"
325 324
326source "security/Kconfig" 325source "security/Kconfig"
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 7392ea9c2301..a8c6366f05a1 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -8,6 +8,8 @@ mainmenu "Linux/UltraSPARC Kernel Configuration"
8config SPARC 8config SPARC
9 bool 9 bool
10 default y 10 default y
11 select HAVE_OPROFILE
12 select HAVE_KPROBES
11 13
12config SPARC64 14config SPARC64
13 bool 15 bool
@@ -464,8 +466,6 @@ source "drivers/sbus/char/Kconfig"
464 466
465source "fs/Kconfig" 467source "fs/Kconfig"
466 468
467source "kernel/Kconfig.instrumentation"
468
469source "arch/sparc64/Kconfig.debug" 469source "arch/sparc64/Kconfig.debug"
470 470
471source "security/Kconfig" 471source "security/Kconfig"
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index dd1689b814cb..55945db1313c 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -289,6 +289,4 @@ config INPUT
289 bool 289 bool
290 default n 290 default n
291 291
292source "kernel/Kconfig.instrumentation"
293
294source "arch/um/Kconfig.debug" 292source "arch/um/Kconfig.debug"
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index b6a50b8b38de..ace479ab273f 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -331,8 +331,6 @@ source "sound/Kconfig"
331 331
332source "drivers/usb/Kconfig" 332source "drivers/usb/Kconfig"
333 333
334source "kernel/Kconfig.instrumentation"
335
336source "arch/v850/Kconfig.debug" 334source "arch/v850/Kconfig.debug"
337 335
338source "security/Kconfig" 336source "security/Kconfig"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 56e7e91a1a01..99af1272ab1d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -18,6 +18,8 @@ config X86_64
18### Arch settings 18### Arch settings
19config X86 19config X86
20 def_bool y 20 def_bool y
21 select HAVE_OPROFILE
22 select HAVE_KPROBES
21 23
22config GENERIC_LOCKBREAK 24config GENERIC_LOCKBREAK
23 def_bool n 25 def_bool n
@@ -106,10 +108,6 @@ config GENERIC_TIME_VSYSCALL
106config HAVE_SETUP_PER_CPU_AREA 108config HAVE_SETUP_PER_CPU_AREA
107 def_bool X86_64 109 def_bool X86_64
108 110
109config ARCH_SUPPORTS_OPROFILE
110 bool
111 default y
112
113select HAVE_KVM 111select HAVE_KVM
114 112
115config ARCH_HIBERNATION_POSSIBLE 113config ARCH_HIBERNATION_POSSIBLE
@@ -1596,8 +1594,6 @@ source "drivers/firmware/Kconfig"
1596 1594
1597source "fs/Kconfig" 1595source "fs/Kconfig"
1598 1596
1599source "kernel/Kconfig.instrumentation"
1600
1601source "arch/x86/Kconfig.debug" 1597source "arch/x86/Kconfig.debug"
1602 1598
1603source "security/Kconfig" 1599source "security/Kconfig"
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 844721e8e3dd..5d5546ce88fe 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -246,8 +246,6 @@ config EMBEDDED_RAMDISK_IMAGE
246 provide one yourself. 246 provide one yourself.
247endmenu 247endmenu
248 248
249source "kernel/Kconfig.instrumentation"
250
251source "arch/xtensa/Kconfig.debug" 249source "arch/xtensa/Kconfig.debug"
252 250
253source "security/Kconfig" 251source "security/Kconfig"
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b1727876182c..9c0070b5bd3e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -423,10 +423,8 @@ struct kset *devices_kset;
423int device_create_file(struct device *dev, struct device_attribute *attr) 423int device_create_file(struct device *dev, struct device_attribute *attr)
424{ 424{
425 int error = 0; 425 int error = 0;
426 if (get_device(dev)) { 426 if (dev)
427 error = sysfs_create_file(&dev->kobj, &attr->attr); 427 error = sysfs_create_file(&dev->kobj, &attr->attr);
428 put_device(dev);
429 }
430 return error; 428 return error;
431} 429}
432 430
@@ -437,10 +435,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr)
437 */ 435 */
438void device_remove_file(struct device *dev, struct device_attribute *attr) 436void device_remove_file(struct device *dev, struct device_attribute *attr)
439{ 437{
440 if (get_device(dev)) { 438 if (dev)
441 sysfs_remove_file(&dev->kobj, &attr->attr); 439 sysfs_remove_file(&dev->kobj, &attr->attr);
442 put_device(dev);
443 }
444} 440}
445 441
446/** 442/**
@@ -1144,25 +1140,11 @@ error:
1144} 1140}
1145EXPORT_SYMBOL_GPL(device_create); 1141EXPORT_SYMBOL_GPL(device_create);
1146 1142
1147/** 1143static int __match_devt(struct device *dev, void *data)
1148 * find_device - finds a device that was created with device_create()
1149 * @class: pointer to the struct class that this device was registered with
1150 * @devt: the dev_t of the device that was previously registered
1151 */
1152static struct device *find_device(struct class *class, dev_t devt)
1153{ 1144{
1154 struct device *dev = NULL; 1145 dev_t *devt = data;
1155 struct device *dev_tmp;
1156 1146
1157 down(&class->sem); 1147 return dev->devt == *devt;
1158 list_for_each_entry(dev_tmp, &class->devices, node) {
1159 if (dev_tmp->devt == devt) {
1160 dev = dev_tmp;
1161 break;
1162 }
1163 }
1164 up(&class->sem);
1165 return dev;
1166} 1148}
1167 1149
1168/** 1150/**
@@ -1177,9 +1159,11 @@ void device_destroy(struct class *class, dev_t devt)
1177{ 1159{
1178 struct device *dev; 1160 struct device *dev;
1179 1161
1180 dev = find_device(class, devt); 1162 dev = class_find_device(class, &devt, __match_devt);
1181 if (dev) 1163 if (dev) {
1164 put_device(dev);
1182 device_unregister(dev); 1165 device_unregister(dev);
1166 }
1183} 1167}
1184EXPORT_SYMBOL_GPL(device_destroy); 1168EXPORT_SYMBOL_GPL(device_destroy);
1185 1169
@@ -1203,9 +1187,11 @@ void destroy_suspended_device(struct class *class, dev_t devt)
1203{ 1187{
1204 struct device *dev; 1188 struct device *dev;
1205 1189
1206 dev = find_device(class, devt); 1190 dev = class_find_device(class, &devt, __match_devt);
1207 if (dev) 1191 if (dev) {
1208 device_pm_schedule_removal(dev); 1192 device_pm_schedule_removal(dev);
1193 put_device(dev);
1194 }
1209} 1195}
1210EXPORT_SYMBOL_GPL(destroy_suspended_device); 1196EXPORT_SYMBOL_GPL(destroy_suspended_device);
1211#endif /* CONFIG_PM_SLEEP */ 1197#endif /* CONFIG_PM_SLEEP */
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index a35f04121a00..ba75184c653c 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -97,10 +97,9 @@ int driver_create_file(struct device_driver *drv,
97 struct driver_attribute *attr) 97 struct driver_attribute *attr)
98{ 98{
99 int error; 99 int error;
100 if (get_driver(drv)) { 100 if (drv)
101 error = sysfs_create_file(&drv->p->kobj, &attr->attr); 101 error = sysfs_create_file(&drv->p->kobj, &attr->attr);
102 put_driver(drv); 102 else
103 } else
104 error = -EINVAL; 103 error = -EINVAL;
105 return error; 104 return error;
106} 105}
@@ -114,10 +113,8 @@ EXPORT_SYMBOL_GPL(driver_create_file);
114void driver_remove_file(struct device_driver *drv, 113void driver_remove_file(struct device_driver *drv,
115 struct driver_attribute *attr) 114 struct driver_attribute *attr)
116{ 115{
117 if (get_driver(drv)) { 116 if (drv)
118 sysfs_remove_file(&drv->p->kobj, &attr->attr); 117 sysfs_remove_file(&drv->p->kobj, &attr->attr);
119 put_driver(drv);
120 }
121} 118}
122EXPORT_SYMBOL_GPL(driver_remove_file); 119EXPORT_SYMBOL_GPL(driver_remove_file);
123 120
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 200ed5fafd50..bdc03f7e8424 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -129,6 +129,7 @@ void device_pm_schedule_removal(struct device *dev)
129 list_move_tail(&dev->power.entry, &dpm_destroy); 129 list_move_tail(&dev->power.entry, &dpm_destroy);
130 mutex_unlock(&dpm_list_mtx); 130 mutex_unlock(&dpm_list_mtx);
131} 131}
132EXPORT_SYMBOL_GPL(device_pm_schedule_removal);
132 133
133/** 134/**
134 * pm_sleep_lock - mutual exclusion for registration and suspend 135 * pm_sleep_lock - mutual exclusion for registration and suspend
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 6f0dfca8ebdd..e32d3bdb92c1 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -13,7 +13,6 @@ static inline struct device *to_device(struct list_head *entry)
13 13
14extern void device_pm_add(struct device *); 14extern void device_pm_add(struct device *);
15extern void device_pm_remove(struct device *); 15extern void device_pm_remove(struct device *);
16extern void device_pm_schedule_removal(struct device *);
17extern int pm_sleep_lock(void); 16extern int pm_sleep_lock(void);
18extern void pm_sleep_unlock(void); 17extern void pm_sleep_unlock(void);
19 18
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index e8d50af58201..ef5e6b130c48 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -506,6 +506,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
506 vma->vm_ops = &drm_vm_dma_ops; 506 vma->vm_ops = &drm_vm_dma_ops;
507 507
508 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 508 vma->vm_flags |= VM_RESERVED; /* Don't swap */
509 vma->vm_flags |= VM_DONTEXPAND;
509 510
510 vma->vm_file = filp; /* Needed for drm_vm_open() */ 511 vma->vm_file = filp; /* Needed for drm_vm_open() */
511 drm_vm_open_locked(vma); 512 drm_vm_open_locked(vma);
@@ -655,6 +656,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
655 return -EINVAL; /* This should never happen. */ 656 return -EINVAL; /* This should never happen. */
656 } 657 }
657 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 658 vma->vm_flags |= VM_RESERVED; /* Don't swap */
659 vma->vm_flags |= VM_DONTEXPAND;
658 660
659 vma->vm_file = filp; /* Needed for drm_vm_open() */ 661 vma->vm_file = filp; /* Needed for drm_vm_open() */
660 drm_vm_open_locked(vma); 662 drm_vm_open_locked(vma);
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 82f2e27dca7d..ff146c2b08fd 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -283,7 +283,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
283 vdata->refcnt = ATOMIC_INIT(1); 283 vdata->refcnt = ATOMIC_INIT(1);
284 vma->vm_private_data = vdata; 284 vma->vm_private_data = vdata;
285 285
286 vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP); 286 vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND);
287 if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED) 287 if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED)
288 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 288 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
289 vma->vm_ops = &mspec_vm_ops; 289 vma->vm_ops = &mspec_vm_ops;
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 6076e662886a..dfaab2322de3 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -2,7 +2,7 @@
2 * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter 2 * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter
3 * 3 *
4 * Written by: Ulf Jakobsson, 4 * Written by: Ulf Jakobsson,
5 * Jan erfeldt, 5 * Jan Åkerfeldt,
6 * Stefan Thomasson, 6 * Stefan Thomasson,
7 * 7 *
8 * Maintained by: Paul Hardwick (p.hardwick@option.com) 8 * Maintained by: Paul Hardwick (p.hardwick@option.com)
@@ -38,60 +38,6 @@
38 * -------------------------------------------------------------------------- 38 * --------------------------------------------------------------------------
39 */ 39 */
40 40
41/*
42 * CHANGELOG
43 * Version 2.1d
44 * 11-November-2007 Jiri Slaby, Frank Seidel
45 * - Big rework of multicard support by Jiri
46 * - Major cleanups (semaphore to mutex, endianess, no major reservation)
47 * - Optimizations
48 *
49 * Version 2.1c
50 * 30-October-2007 Frank Seidel
51 * - Completed multicard support
52 * - Minor cleanups
53 *
54 * Version 2.1b
55 * 07-August-2007 Frank Seidel
56 * - Minor cleanups
57 * - theoretical multicard support
58 *
59 * Version 2.1
60 * 03-July-2006 Paul Hardwick
61 *
62 * - Stability Improvements. Incorporated spinlock wraps patch.
63 * - Updated for newer 2.6.14+ kernels (tty_buffer_request_room)
64 * - using __devexit macro for tty
65 *
66 *
67 * Version 2.0
68 * 08-feb-2006 15:34:10:Ulf
69 *
70 * -Fixed issue when not waking up line disipine layer, could probably result
71 * in better uplink performance for 2.4.
72 *
73 * -Fixed issue with big endian during initalization, now proper toggle flags
74 * are handled between preloader and maincode.
75 *
76 * -Fixed flow control issue.
77 *
78 * -Added support for setting DTR.
79 *
80 * -For 2.4 kernels, removing temporary buffer that's not needed.
81 *
82 * -Reading CTS only for modem port (only port that supports it).
83 *
84 * -Return 0 in write_room instead of netative value, it's not handled in
85 * upper layer.
86 *
87 * --------------------------------------------------------------------------
88 * Version 1.0
89 *
90 * First version of driver, only tested with card of type F32_2.
91 * Works fine with 2.4 and 2.6 kernels.
92 * Driver also support big endian architecture.
93 */
94
95/* Enable this to have a lot of debug printouts */ 41/* Enable this to have a lot of debug printouts */
96#define DEBUG 42#define DEBUG
97 43
@@ -143,8 +89,9 @@ do { \
143/* Do we need this settable at runtime? */ 89/* Do we need this settable at runtime? */
144static int debug = NOZOMI_DEBUG_LEVEL; 90static int debug = NOZOMI_DEBUG_LEVEL;
145 91
146#define D(lvl, args...) do {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \ 92#define D(lvl, args...) do \
147 while (0) 93 {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
94 while (0)
148#define D_(lvl, args...) D(lvl, ##args) 95#define D_(lvl, args...) D(lvl, ##args)
149 96
150/* These printouts are always printed */ 97/* These printouts are always printed */
@@ -273,13 +220,13 @@ enum port_type {
273/* Big endian */ 220/* Big endian */
274 221
275struct toggles { 222struct toggles {
276 unsigned enabled:5; /* 223 unsigned int enabled:5; /*
277 * Toggle fields are valid if enabled is 0, 224 * Toggle fields are valid if enabled is 0,
278 * else A-channels must always be used. 225 * else A-channels must always be used.
279 */ 226 */
280 unsigned diag_dl:1; 227 unsigned int diag_dl:1;
281 unsigned mdm_dl:1; 228 unsigned int mdm_dl:1;
282 unsigned mdm_ul:1; 229 unsigned int mdm_ul:1;
283} __attribute__ ((packed)); 230} __attribute__ ((packed));
284 231
285/* Configuration table to read at startup of card */ 232/* Configuration table to read at startup of card */
@@ -320,19 +267,19 @@ struct config_table {
320/* This stores all control downlink flags */ 267/* This stores all control downlink flags */
321struct ctrl_dl { 268struct ctrl_dl {
322 u8 port; 269 u8 port;
323 unsigned reserved:4; 270 unsigned int reserved:4;
324 unsigned CTS:1; 271 unsigned int CTS:1;
325 unsigned RI:1; 272 unsigned int RI:1;
326 unsigned DCD:1; 273 unsigned int DCD:1;
327 unsigned DSR:1; 274 unsigned int DSR:1;
328} __attribute__ ((packed)); 275} __attribute__ ((packed));
329 276
330/* This stores all control uplink flags */ 277/* This stores all control uplink flags */
331struct ctrl_ul { 278struct ctrl_ul {
332 u8 port; 279 u8 port;
333 unsigned reserved:6; 280 unsigned int reserved:6;
334 unsigned RTS:1; 281 unsigned int RTS:1;
335 unsigned DTR:1; 282 unsigned int DTR:1;
336} __attribute__ ((packed)); 283} __attribute__ ((packed));
337 284
338#else 285#else
@@ -340,10 +287,10 @@ struct ctrl_ul {
340 287
341/* This represents the toggle information */ 288/* This represents the toggle information */
342struct toggles { 289struct toggles {
343 unsigned mdm_ul:1; 290 unsigned int mdm_ul:1;
344 unsigned mdm_dl:1; 291 unsigned int mdm_dl:1;
345 unsigned diag_dl:1; 292 unsigned int diag_dl:1;
346 unsigned enabled:5; /* 293 unsigned int enabled:5; /*
347 * Toggle fields are valid if enabled is 0, 294 * Toggle fields are valid if enabled is 0,
348 * else A-channels must always be used. 295 * else A-channels must always be used.
349 */ 296 */
@@ -379,19 +326,19 @@ struct config_table {
379 326
380/* This stores all control downlink flags */ 327/* This stores all control downlink flags */
381struct ctrl_dl { 328struct ctrl_dl {
382 unsigned DSR:1; 329 unsigned int DSR:1;
383 unsigned DCD:1; 330 unsigned int DCD:1;
384 unsigned RI:1; 331 unsigned int RI:1;
385 unsigned CTS:1; 332 unsigned int CTS:1;
386 unsigned reserverd:4; 333 unsigned int reserverd:4;
387 u8 port; 334 u8 port;
388} __attribute__ ((packed)); 335} __attribute__ ((packed));
389 336
390/* This stores all control uplink flags */ 337/* This stores all control uplink flags */
391struct ctrl_ul { 338struct ctrl_ul {
392 unsigned DTR:1; 339 unsigned int DTR:1;
393 unsigned RTS:1; 340 unsigned int RTS:1;
394 unsigned reserved:6; 341 unsigned int reserved:6;
395 u8 port; 342 u8 port;
396} __attribute__ ((packed)); 343} __attribute__ ((packed));
397#endif 344#endif
@@ -448,7 +395,7 @@ struct buffer {
448} __attribute__ ((packed)); 395} __attribute__ ((packed));
449 396
450/* Global variables */ 397/* Global variables */
451static struct pci_device_id nozomi_pci_tbl[] = { 398static const struct pci_device_id nozomi_pci_tbl[] __devinitconst = {
452 {PCI_DEVICE(VENDOR1, DEVICE1)}, 399 {PCI_DEVICE(VENDOR1, DEVICE1)},
453 {}, 400 {},
454}; 401};
@@ -524,12 +471,12 @@ out:
524 * -Optimize 471 * -Optimize
525 * -Rewrite cleaner 472 * -Rewrite cleaner
526 */ 473 */
527static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, 474static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf,
528 u32 size_bytes) 475 u32 size_bytes)
529{ 476{
530 u32 i = 0; 477 u32 i = 0;
531 u32 *ptr = (__force u32 *) mem_addr_start; 478 u32 *ptr = (__force u32 *) mem_addr_start;
532 u16 *buf16; 479 const u16 *buf16;
533 480
534 if (unlikely(!ptr || !buf)) 481 if (unlikely(!ptr || !buf))
535 return 0; 482 return 0;
@@ -537,7 +484,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf,
537 /* shortcut for extremely often used cases */ 484 /* shortcut for extremely often used cases */
538 switch (size_bytes) { 485 switch (size_bytes) {
539 case 2: /* 2 bytes */ 486 case 2: /* 2 bytes */
540 buf16 = (u16 *) buf; 487 buf16 = (const u16 *)buf;
541 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 488 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr);
542 return 2; 489 return 2;
543 break; 490 break;
@@ -554,7 +501,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf,
554 while (i < size_bytes) { 501 while (i < size_bytes) {
555 if (size_bytes - i == 2) { 502 if (size_bytes - i == 2) {
556 /* 2 bytes */ 503 /* 2 bytes */
557 buf16 = (u16 *) buf; 504 buf16 = (const u16 *)buf;
558 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 505 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr);
559 i += 2; 506 i += 2;
560 } else { 507 } else {
@@ -694,7 +641,7 @@ static void dump_table(const struct nozomi *dc)
694 dc->config_table.ul_ctrl_len); 641 dc->config_table.ul_ctrl_len);
695} 642}
696#else 643#else
697static __inline__ void dump_table(const struct nozomi *dc) { } 644static inline void dump_table(const struct nozomi *dc) { }
698#endif 645#endif
699 646
700/* 647/*
@@ -776,8 +723,7 @@ static int nozomi_read_config_table(struct nozomi *dc)
776/* Enable uplink interrupts */ 723/* Enable uplink interrupts */
777static void enable_transmit_ul(enum port_type port, struct nozomi *dc) 724static void enable_transmit_ul(enum port_type port, struct nozomi *dc)
778{ 725{
779 u16 mask[NOZOMI_MAX_PORTS] = \ 726 static const u16 mask[] = {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL};
780 {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL};
781 727
782 if (port < NOZOMI_MAX_PORTS) { 728 if (port < NOZOMI_MAX_PORTS) {
783 dc->last_ier |= mask[port]; 729 dc->last_ier |= mask[port];
@@ -790,8 +736,8 @@ static void enable_transmit_ul(enum port_type port, struct nozomi *dc)
790/* Disable uplink interrupts */ 736/* Disable uplink interrupts */
791static void disable_transmit_ul(enum port_type port, struct nozomi *dc) 737static void disable_transmit_ul(enum port_type port, struct nozomi *dc)
792{ 738{
793 u16 mask[NOZOMI_MAX_PORTS] = \ 739 static const u16 mask[] =
794 {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; 740 {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL};
795 741
796 if (port < NOZOMI_MAX_PORTS) { 742 if (port < NOZOMI_MAX_PORTS) {
797 dc->last_ier &= mask[port]; 743 dc->last_ier &= mask[port];
@@ -804,8 +750,7 @@ static void disable_transmit_ul(enum port_type port, struct nozomi *dc)
804/* Enable downlink interrupts */ 750/* Enable downlink interrupts */
805static void enable_transmit_dl(enum port_type port, struct nozomi *dc) 751static void enable_transmit_dl(enum port_type port, struct nozomi *dc)
806{ 752{
807 u16 mask[NOZOMI_MAX_PORTS] = \ 753 static const u16 mask[] = {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL};
808 {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL};
809 754
810 if (port < NOZOMI_MAX_PORTS) { 755 if (port < NOZOMI_MAX_PORTS) {
811 dc->last_ier |= mask[port]; 756 dc->last_ier |= mask[port];
@@ -818,8 +763,8 @@ static void enable_transmit_dl(enum port_type port, struct nozomi *dc)
818/* Disable downlink interrupts */ 763/* Disable downlink interrupts */
819static void disable_transmit_dl(enum port_type port, struct nozomi *dc) 764static void disable_transmit_dl(enum port_type port, struct nozomi *dc)
820{ 765{
821 u16 mask[NOZOMI_MAX_PORTS] = \ 766 static const u16 mask[] =
822 {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; 767 {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL};
823 768
824 if (port < NOZOMI_MAX_PORTS) { 769 if (port < NOZOMI_MAX_PORTS) {
825 dc->last_ier &= mask[port]; 770 dc->last_ier &= mask[port];
@@ -833,13 +778,13 @@ static void disable_transmit_dl(enum port_type port, struct nozomi *dc)
833 * Return 1 - send buffer to card and ack. 778 * Return 1 - send buffer to card and ack.
834 * Return 0 - don't ack, don't send buffer to card. 779 * Return 0 - don't ack, don't send buffer to card.
835 */ 780 */
836static int send_data(enum port_type index, struct nozomi *dc) 781static int send_data(enum port_type index, const struct nozomi *dc)
837{ 782{
838 u32 size = 0; 783 u32 size = 0;
839 struct port *port = &dc->port[index]; 784 const struct port *port = &dc->port[index];
840 u8 toggle = port->toggle_ul; 785 const u8 toggle = port->toggle_ul;
841 void __iomem *addr = port->ul_addr[toggle]; 786 void __iomem *addr = port->ul_addr[toggle];
842 u32 ul_size = port->ul_size[toggle]; 787 const u32 ul_size = port->ul_size[toggle];
843 struct tty_struct *tty = port->tty; 788 struct tty_struct *tty = port->tty;
844 789
845 /* Get data from tty and place in buf for now */ 790 /* Get data from tty and place in buf for now */
@@ -1102,7 +1047,7 @@ static int send_flow_control(struct nozomi *dc)
1102} 1047}
1103 1048
1104/* 1049/*
1105 * Handle donlink data, ports that are handled are modem and diagnostics 1050 * Handle downlink data, ports that are handled are modem and diagnostics
1106 * Return 1 - ok 1051 * Return 1 - ok
1107 * Return 0 - toggle fields are out of sync 1052 * Return 0 - toggle fields are out of sync
1108 */ 1053 */
@@ -1359,20 +1304,20 @@ static void nozomi_setup_private_data(struct nozomi *dc)
1359static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, 1304static ssize_t card_type_show(struct device *dev, struct device_attribute *attr,
1360 char *buf) 1305 char *buf)
1361{ 1306{
1362 struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1307 const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev));
1363 1308
1364 return sprintf(buf, "%d\n", dc->card_type); 1309 return sprintf(buf, "%d\n", dc->card_type);
1365} 1310}
1366static DEVICE_ATTR(card_type, 0444, card_type_show, NULL); 1311static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
1367 1312
1368static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, 1313static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
1369 char *buf) 1314 char *buf)
1370{ 1315{
1371 struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1316 const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev));
1372 1317
1373 return sprintf(buf, "%u\n", dc->open_ttys); 1318 return sprintf(buf, "%u\n", dc->open_ttys);
1374} 1319}
1375static DEVICE_ATTR(open_ttys, 0444, open_ttys_show, NULL); 1320static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL);
1376 1321
1377static void make_sysfs_files(struct nozomi *dc) 1322static void make_sysfs_files(struct nozomi *dc)
1378{ 1323{
@@ -1735,7 +1680,7 @@ static int ntty_write_room(struct tty_struct *tty)
1735{ 1680{
1736 struct port *port = tty->driver_data; 1681 struct port *port = tty->driver_data;
1737 int room = 0; 1682 int room = 0;
1738 struct nozomi *dc = get_dc_by_tty(tty); 1683 const struct nozomi *dc = get_dc_by_tty(tty);
1739 1684
1740 if (!dc || !port) 1685 if (!dc || !port)
1741 return 0; 1686 return 0;
@@ -1755,9 +1700,9 @@ exit:
1755/* Gets io control parameters */ 1700/* Gets io control parameters */
1756static int ntty_tiocmget(struct tty_struct *tty, struct file *file) 1701static int ntty_tiocmget(struct tty_struct *tty, struct file *file)
1757{ 1702{
1758 struct port *port = tty->driver_data; 1703 const struct port *port = tty->driver_data;
1759 struct ctrl_dl *ctrl_dl = &port->ctrl_dl; 1704 const struct ctrl_dl *ctrl_dl = &port->ctrl_dl;
1760 struct ctrl_ul *ctrl_ul = &port->ctrl_ul; 1705 const struct ctrl_ul *ctrl_ul = &port->ctrl_ul;
1761 1706
1762 return (ctrl_ul->RTS ? TIOCM_RTS : 0) | 1707 return (ctrl_ul->RTS ? TIOCM_RTS : 0) |
1763 (ctrl_ul->DTR ? TIOCM_DTR : 0) | 1708 (ctrl_ul->DTR ? TIOCM_DTR : 0) |
@@ -1787,7 +1732,7 @@ static int ntty_tiocmset(struct tty_struct *tty, struct file *file,
1787static int ntty_cflags_changed(struct port *port, unsigned long flags, 1732static int ntty_cflags_changed(struct port *port, unsigned long flags,
1788 struct async_icount *cprev) 1733 struct async_icount *cprev)
1789{ 1734{
1790 struct async_icount cnow = port->tty_icount; 1735 const struct async_icount cnow = port->tty_icount;
1791 int ret; 1736 int ret;
1792 1737
1793 ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) || 1738 ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) ||
@@ -1802,7 +1747,7 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags,
1802 1747
1803static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) 1748static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp)
1804{ 1749{
1805 struct async_icount cnow = port->tty_icount; 1750 const struct async_icount cnow = port->tty_icount;
1806 struct serial_icounter_struct icount; 1751 struct serial_icounter_struct icount;
1807 1752
1808 icount.cts = cnow.cts; 1753 icount.cts = cnow.cts;
@@ -1882,7 +1827,10 @@ static void ntty_throttle(struct tty_struct *tty)
1882/* just to discard single character writes */ 1827/* just to discard single character writes */
1883static void ntty_put_char(struct tty_struct *tty, unsigned char c) 1828static void ntty_put_char(struct tty_struct *tty, unsigned char c)
1884{ 1829{
1885 /* FIXME !!! */ 1830 /*
1831 * card does not react correct when we write single chars
1832 * to the card, so we discard them
1833 */
1886 DBG2("PUT CHAR Function: %c", c); 1834 DBG2("PUT CHAR Function: %c", c);
1887} 1835}
1888 1836
@@ -1910,7 +1858,7 @@ exit_in_buffer:
1910 return rval; 1858 return rval;
1911} 1859}
1912 1860
1913static struct tty_operations tty_ops = { 1861static const struct tty_operations tty_ops = {
1914 .ioctl = ntty_ioctl, 1862 .ioctl = ntty_ioctl,
1915 .open = ntty_open, 1863 .open = ntty_open,
1916 .close = ntty_close, 1864 .close = ntty_close,
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 7ce0ea64465c..28958101061f 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -36,6 +36,7 @@
36#include <linux/completion.h> 36#include <linux/completion.h>
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/kthread.h> 38#include <linux/kthread.h>
39#include <linux/platform_device.h>
39 40
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41#include <asm/semaphore.h> 42#include <asm/semaphore.h>
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 389980f0e59e..55d224c8a0b9 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -814,8 +814,8 @@ config ULTRA32
814 will be called smc-ultra32. 814 will be called smc-ultra32.
815 815
816config BFIN_MAC 816config BFIN_MAC
817 tristate "Blackfin 536/537 on-chip mac support" 817 tristate "Blackfin 527/536/537 on-chip mac support"
818 depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H) 818 depends on NET_ETHERNET && (BF527 || BF537 || BF536) && (!BF537_PORT_H)
819 select CRC32 819 select CRC32
820 select MII 820 select MII
821 select PHYLIB 821 select PHYLIB
@@ -828,7 +828,7 @@ config BFIN_MAC
828 828
829config BFIN_MAC_USE_L1 829config BFIN_MAC_USE_L1
830 bool "Use L1 memory for rx/tx packets" 830 bool "Use L1 memory for rx/tx packets"
831 depends on BFIN_MAC && BF537 831 depends on BFIN_MAC && (BF527 || BF537)
832 default y 832 default y
833 help 833 help
834 To get maximum network performance, you should use L1 memory as rx/tx buffers. 834 To get maximum network performance, you should use L1 memory as rx/tx buffers.
@@ -855,7 +855,8 @@ config BFIN_RX_DESC_NUM
855config BFIN_MAC_RMII 855config BFIN_MAC_RMII
856 bool "RMII PHY Interface (EXPERIMENTAL)" 856 bool "RMII PHY Interface (EXPERIMENTAL)"
857 depends on BFIN_MAC && EXPERIMENTAL 857 depends on BFIN_MAC && EXPERIMENTAL
858 default n 858 default y if BFIN527_EZKIT
859 default n if BFIN537_STAMP
859 help 860 help
860 Use Reduced PHY MII Interface 861 Use Reduced PHY MII Interface
861 862
@@ -1199,7 +1200,7 @@ config NE2_MCA
1199 1200
1200config IBMLANA 1201config IBMLANA
1201 tristate "IBM LAN Adapter/A support" 1202 tristate "IBM LAN Adapter/A support"
1202 depends on MCA && MCA_LEGACY 1203 depends on MCA
1203 ---help--- 1204 ---help---
1204 This is a Micro Channel Ethernet adapter. You need to set 1205 This is a Micro Channel Ethernet adapter. You need to set
1205 CONFIG_MCA to use this driver. It is both available as an in-kernel 1206 CONFIG_MCA to use this driver. It is both available as an in-kernel
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 25b114a4e2b1..0ae0d83e5d22 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -384,7 +384,7 @@ static void reset_phy(struct net_device *dev)
384 /* Wait until PHY reset is complete */ 384 /* Wait until PHY reset is complete */
385 do { 385 do {
386 read_phy(lp->phy_address, MII_BMCR, &bmcr); 386 read_phy(lp->phy_address, MII_BMCR, &bmcr);
387 } while (!(bmcr && BMCR_RESET)); 387 } while (!(bmcr & BMCR_RESET));
388 388
389 disable_mdi(); 389 disable_mdi();
390 spin_unlock_irq(&lp->lock); 390 spin_unlock_irq(&lp->lock);
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 7495a9ee8f4b..194949afacd0 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -137,11 +137,12 @@ static int ax_initial_check(struct net_device *dev)
137static void ax_reset_8390(struct net_device *dev) 137static void ax_reset_8390(struct net_device *dev)
138{ 138{
139 struct ei_device *ei_local = netdev_priv(dev); 139 struct ei_device *ei_local = netdev_priv(dev);
140 struct ax_device *ax = to_ax_dev(dev);
140 unsigned long reset_start_time = jiffies; 141 unsigned long reset_start_time = jiffies;
141 void __iomem *addr = (void __iomem *)dev->base_addr; 142 void __iomem *addr = (void __iomem *)dev->base_addr;
142 143
143 if (ei_debug > 1) 144 if (ei_debug > 1)
144 printk(KERN_DEBUG "resetting the 8390 t=%ld...", jiffies); 145 dev_dbg(&ax->dev->dev, "resetting the 8390 t=%ld\n", jiffies);
145 146
146 ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET); 147 ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET);
147 148
@@ -151,7 +152,7 @@ static void ax_reset_8390(struct net_device *dev)
151 /* This check _should_not_ be necessary, omit eventually. */ 152 /* This check _should_not_ be necessary, omit eventually. */
152 while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) { 153 while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) {
153 if (jiffies - reset_start_time > 2*HZ/100) { 154 if (jiffies - reset_start_time > 2*HZ/100) {
154 printk(KERN_WARNING "%s: %s did not complete.\n", 155 dev_warn(&ax->dev->dev, "%s: %s did not complete.\n",
155 __FUNCTION__, dev->name); 156 __FUNCTION__, dev->name);
156 break; 157 break;
157 } 158 }
@@ -165,13 +166,15 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
165 int ring_page) 166 int ring_page)
166{ 167{
167 struct ei_device *ei_local = netdev_priv(dev); 168 struct ei_device *ei_local = netdev_priv(dev);
169 struct ax_device *ax = to_ax_dev(dev);
168 void __iomem *nic_base = ei_local->mem; 170 void __iomem *nic_base = ei_local->mem;
169 171
170 /* This *shouldn't* happen. If it does, it's the last thing you'll see */ 172 /* This *shouldn't* happen. If it does, it's the last thing you'll see */
171 if (ei_status.dmaing) { 173 if (ei_status.dmaing) {
172 printk(KERN_EMERG "%s: DMAing conflict in %s [DMAstat:%d][irqlock:%d].\n", 174 dev_err(&ax->dev->dev, "%s: DMAing conflict in %s "
175 "[DMAstat:%d][irqlock:%d].\n",
173 dev->name, __FUNCTION__, 176 dev->name, __FUNCTION__,
174 ei_status.dmaing, ei_status.irqlock); 177 ei_status.dmaing, ei_status.irqlock);
175 return; 178 return;
176 } 179 }
177 180
@@ -204,13 +207,16 @@ static void ax_block_input(struct net_device *dev, int count,
204 struct sk_buff *skb, int ring_offset) 207 struct sk_buff *skb, int ring_offset)
205{ 208{
206 struct ei_device *ei_local = netdev_priv(dev); 209 struct ei_device *ei_local = netdev_priv(dev);
210 struct ax_device *ax = to_ax_dev(dev);
207 void __iomem *nic_base = ei_local->mem; 211 void __iomem *nic_base = ei_local->mem;
208 char *buf = skb->data; 212 char *buf = skb->data;
209 213
210 if (ei_status.dmaing) { 214 if (ei_status.dmaing) {
211 printk(KERN_EMERG "%s: DMAing conflict in ax_block_input " 215 dev_err(&ax->dev->dev,
216 "%s: DMAing conflict in %s "
212 "[DMAstat:%d][irqlock:%d].\n", 217 "[DMAstat:%d][irqlock:%d].\n",
213 dev->name, ei_status.dmaing, ei_status.irqlock); 218 dev->name, __FUNCTION__,
219 ei_status.dmaing, ei_status.irqlock);
214 return; 220 return;
215 } 221 }
216 222
@@ -239,6 +245,7 @@ static void ax_block_output(struct net_device *dev, int count,
239 const unsigned char *buf, const int start_page) 245 const unsigned char *buf, const int start_page)
240{ 246{
241 struct ei_device *ei_local = netdev_priv(dev); 247 struct ei_device *ei_local = netdev_priv(dev);
248 struct ax_device *ax = to_ax_dev(dev);
242 void __iomem *nic_base = ei_local->mem; 249 void __iomem *nic_base = ei_local->mem;
243 unsigned long dma_start; 250 unsigned long dma_start;
244 251
@@ -251,7 +258,7 @@ static void ax_block_output(struct net_device *dev, int count,
251 258
252 /* This *shouldn't* happen. If it does, it's the last thing you'll see */ 259 /* This *shouldn't* happen. If it does, it's the last thing you'll see */
253 if (ei_status.dmaing) { 260 if (ei_status.dmaing) {
254 printk(KERN_EMERG "%s: DMAing conflict in %s." 261 dev_err(&ax->dev->dev, "%s: DMAing conflict in %s."
255 "[DMAstat:%d][irqlock:%d]\n", 262 "[DMAstat:%d][irqlock:%d]\n",
256 dev->name, __FUNCTION__, 263 dev->name, __FUNCTION__,
257 ei_status.dmaing, ei_status.irqlock); 264 ei_status.dmaing, ei_status.irqlock);
@@ -281,7 +288,8 @@ static void ax_block_output(struct net_device *dev, int count,
281 288
282 while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) { 289 while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) {
283 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 290 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
284 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); 291 dev_warn(&ax->dev->dev,
292 "%s: timeout waiting for Tx RDC.\n", dev->name);
285 ax_reset_8390(dev); 293 ax_reset_8390(dev);
286 ax_NS8390_init(dev,1); 294 ax_NS8390_init(dev,1);
287 break; 295 break;
@@ -424,10 +432,11 @@ static void
424ax_phy_write(struct net_device *dev, int phy_addr, int reg, int value) 432ax_phy_write(struct net_device *dev, int phy_addr, int reg, int value)
425{ 433{
426 struct ei_device *ei = (struct ei_device *) netdev_priv(dev); 434 struct ei_device *ei = (struct ei_device *) netdev_priv(dev);
435 struct ax_device *ax = to_ax_dev(dev);
427 unsigned long flags; 436 unsigned long flags;
428 437
429 printk(KERN_DEBUG "%s: %p, %04x, %04x %04x\n", 438 dev_dbg(&ax->dev->dev, "%s: %p, %04x, %04x %04x\n",
430 __FUNCTION__, dev, phy_addr, reg, value); 439 __FUNCTION__, dev, phy_addr, reg, value);
431 440
432 spin_lock_irqsave(&ei->page_lock, flags); 441 spin_lock_irqsave(&ei->page_lock, flags);
433 442
@@ -750,14 +759,11 @@ static int ax_init_dev(struct net_device *dev, int first_init)
750 ax_NS8390_init(dev, 0); 759 ax_NS8390_init(dev, 0);
751 760
752 if (first_init) { 761 if (first_init) {
753 printk("AX88796: %dbit, irq %d, %lx, MAC: ", 762 DECLARE_MAC_BUF(mac);
754 ei_status.word16 ? 16:8, dev->irq, dev->base_addr);
755
756 for (i = 0; i < ETHER_ADDR_LEN; i++)
757 printk("%2.2x%c", dev->dev_addr[i],
758 (i < (ETHER_ADDR_LEN-1) ? ':' : ' '));
759 763
760 printk("\n"); 764 dev_info(&ax->dev->dev, "%dbit, irq %d, %lx, MAC: %s\n",
765 ei_status.word16 ? 16:8, dev->irq, dev->base_addr,
766 print_mac(mac, dev->dev_addr));
761 } 767 }
762 768
763 ret = register_netdev(dev); 769 ret = register_netdev(dev);
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index eb971755a3ff..c993a32b3f50 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -1,34 +1,11 @@
1/* 1/*
2 * File: drivers/net/bfin_mac.c 2 * Blackfin On-Chip MAC Driver
3 * Based on:
4 * Maintainer:
5 * Bryan Wu <bryan.wu@analog.com>
6 * 3 *
7 * Original author: 4 * Copyright 2004-2007 Analog Devices Inc.
8 * Luke Yang <luke.yang@analog.com>
9 * 5 *
10 * Created: 6 * Enter bugs at http://blackfin.uclinux.org/
11 * Description:
12 * 7 *
13 * Modified: 8 * Licensed under the GPL-2 or later.
14 * Copyright 2004-2006 Analog Devices Inc.
15 *
16 * Bugs: Enter bugs at http://blackfin.uclinux.org/
17 *
18 * This program is free software ; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation ; either version 2, or (at your option)
21 * any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program ; see the file COPYING.
30 * If not, write to the Free Software Foundation,
31 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 */ 9 */
33 10
34#include <linux/init.h> 11#include <linux/init.h>
@@ -65,7 +42,7 @@
65#define DRV_NAME "bfin_mac" 42#define DRV_NAME "bfin_mac"
66#define DRV_VERSION "1.1" 43#define DRV_VERSION "1.1"
67#define DRV_AUTHOR "Bryan Wu, Luke Yang" 44#define DRV_AUTHOR "Bryan Wu, Luke Yang"
68#define DRV_DESC "Blackfin BF53[67] on-chip Ethernet MAC driver" 45#define DRV_DESC "Blackfin BF53[67] BF527 on-chip Ethernet MAC driver"
69 46
70MODULE_AUTHOR(DRV_AUTHOR); 47MODULE_AUTHOR(DRV_AUTHOR);
71MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
@@ -296,7 +273,7 @@ static void mdio_poll(void)
296 273
297 /* poll the STABUSY bit */ 274 /* poll the STABUSY bit */
298 while ((bfin_read_EMAC_STAADD()) & STABUSY) { 275 while ((bfin_read_EMAC_STAADD()) & STABUSY) {
299 mdelay(10); 276 udelay(1);
300 if (timeout_cnt-- < 0) { 277 if (timeout_cnt-- < 0) {
301 printk(KERN_ERR DRV_NAME 278 printk(KERN_ERR DRV_NAME
302 ": wait MDC/MDIO transaction to complete timeout\n"); 279 ": wait MDC/MDIO transaction to complete timeout\n");
@@ -412,20 +389,26 @@ static void bf537_adjust_link(struct net_device *dev)
412 spin_unlock_irqrestore(&lp->lock, flags); 389 spin_unlock_irqrestore(&lp->lock, flags);
413} 390}
414 391
392/* MDC = 2.5 MHz */
393#define MDC_CLK 2500000
394
415static int mii_probe(struct net_device *dev) 395static int mii_probe(struct net_device *dev)
416{ 396{
417 struct bf537mac_local *lp = netdev_priv(dev); 397 struct bf537mac_local *lp = netdev_priv(dev);
418 struct phy_device *phydev = NULL; 398 struct phy_device *phydev = NULL;
419 unsigned short sysctl; 399 unsigned short sysctl;
420 int i; 400 int i;
401 u32 sclk, mdc_div;
421 402
422 /* Enable PHY output early */ 403 /* Enable PHY output early */
423 if (!(bfin_read_VR_CTL() & PHYCLKOE)) 404 if (!(bfin_read_VR_CTL() & PHYCLKOE))
424 bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); 405 bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);
425 406
426 /* MDC = 2.5 MHz */ 407 sclk = get_sclk();
408 mdc_div = ((sclk / MDC_CLK) / 2) - 1;
409
427 sysctl = bfin_read_EMAC_SYSCTL(); 410 sysctl = bfin_read_EMAC_SYSCTL();
428 sysctl |= SET_MDCDIV(24); 411 sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(mdc_div);
429 bfin_write_EMAC_SYSCTL(sysctl); 412 bfin_write_EMAC_SYSCTL(sysctl);
430 413
431 /* search for connect PHY device */ 414 /* search for connect PHY device */
@@ -477,8 +460,10 @@ static int mii_probe(struct net_device *dev)
477 lp->phydev = phydev; 460 lp->phydev = phydev;
478 461
479 printk(KERN_INFO "%s: attached PHY driver [%s] " 462 printk(KERN_INFO "%s: attached PHY driver [%s] "
480 "(mii_bus:phy_addr=%s, irq=%d)\n", 463 "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
481 DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq); 464 "@sclk=%dMHz)\n",
465 DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq,
466 MDC_CLK, mdc_div, sclk/1000000);
482 467
483 return 0; 468 return 0;
484} 469}
@@ -551,7 +536,7 @@ static void adjust_tx_list(void)
551 */ 536 */
552 if (current_tx_ptr->next->next == tx_list_head) { 537 if (current_tx_ptr->next->next == tx_list_head) {
553 while (tx_list_head->status.status_word == 0) { 538 while (tx_list_head->status.status_word == 0) {
554 mdelay(10); 539 mdelay(1);
555 if (tx_list_head->status.status_word != 0 540 if (tx_list_head->status.status_word != 0
556 || !(bfin_read_DMA2_IRQ_STATUS() & 0x08)) { 541 || !(bfin_read_DMA2_IRQ_STATUS() & 0x08)) {
557 goto adjust_head; 542 goto adjust_head;
@@ -666,6 +651,12 @@ static void bf537mac_rx(struct net_device *dev)
666 current_rx_ptr->skb = new_skb; 651 current_rx_ptr->skb = new_skb;
667 current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2; 652 current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2;
668 653
654 /* Invidate the data cache of skb->data range when it is write back
655 * cache. It will prevent overwritting the new data from DMA
656 */
657 blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
658 (unsigned long)new_skb->end);
659
669 len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN); 660 len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN);
670 skb_put(skb, len); 661 skb_put(skb, len);
671 blackfin_dcache_invalidate_range((unsigned long)skb->head, 662 blackfin_dcache_invalidate_range((unsigned long)skb->head,
@@ -767,7 +758,7 @@ static void bf537mac_enable(void)
767 758
768#if defined(CONFIG_BFIN_MAC_RMII) 759#if defined(CONFIG_BFIN_MAC_RMII)
769 opmode |= RMII; /* For Now only 100MBit are supported */ 760 opmode |= RMII; /* For Now only 100MBit are supported */
770#ifdef CONFIG_BF_REV_0_2 761#if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) && CONFIG_BF_REV_0_2
771 opmode |= TE; 762 opmode |= TE;
772#endif 763#endif
773#endif 764#endif
@@ -792,6 +783,39 @@ static void bf537mac_timeout(struct net_device *dev)
792 netif_wake_queue(dev); 783 netif_wake_queue(dev);
793} 784}
794 785
786static void bf537mac_multicast_hash(struct net_device *dev)
787{
788 u32 emac_hashhi, emac_hashlo;
789 struct dev_mc_list *dmi = dev->mc_list;
790 char *addrs;
791 int i;
792 u32 crc;
793
794 emac_hashhi = emac_hashlo = 0;
795
796 for (i = 0; i < dev->mc_count; i++) {
797 addrs = dmi->dmi_addr;
798 dmi = dmi->next;
799
800 /* skip non-multicast addresses */
801 if (!(*addrs & 1))
802 continue;
803
804 crc = ether_crc(ETH_ALEN, addrs);
805 crc >>= 26;
806
807 if (crc & 0x20)
808 emac_hashhi |= 1 << (crc & 0x1f);
809 else
810 emac_hashlo |= 1 << (crc & 0x1f);
811 }
812
813 bfin_write_EMAC_HASHHI(emac_hashhi);
814 bfin_write_EMAC_HASHLO(emac_hashlo);
815
816 return;
817}
818
795/* 819/*
796 * This routine will, depending on the values passed to it, 820 * This routine will, depending on the values passed to it,
797 * either make it accept multicast packets, go into 821 * either make it accept multicast packets, go into
@@ -807,11 +831,17 @@ static void bf537mac_set_multicast_list(struct net_device *dev)
807 sysctl = bfin_read_EMAC_OPMODE(); 831 sysctl = bfin_read_EMAC_OPMODE();
808 sysctl |= RAF; 832 sysctl |= RAF;
809 bfin_write_EMAC_OPMODE(sysctl); 833 bfin_write_EMAC_OPMODE(sysctl);
810 } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { 834 } else if (dev->flags & IFF_ALLMULTI) {
811 /* accept all multicast */ 835 /* accept all multicast */
812 sysctl = bfin_read_EMAC_OPMODE(); 836 sysctl = bfin_read_EMAC_OPMODE();
813 sysctl |= PAM; 837 sysctl |= PAM;
814 bfin_write_EMAC_OPMODE(sysctl); 838 bfin_write_EMAC_OPMODE(sysctl);
839 } else if (dev->mc_count) {
840 /* set up multicast hash table */
841 sysctl = bfin_read_EMAC_OPMODE();
842 sysctl |= HM;
843 bfin_write_EMAC_OPMODE(sysctl);
844 bf537mac_multicast_hash(dev);
815 } else { 845 } else {
816 /* clear promisc or multicast mode */ 846 /* clear promisc or multicast mode */
817 sysctl = bfin_read_EMAC_OPMODE(); 847 sysctl = bfin_read_EMAC_OPMODE();
@@ -860,10 +890,10 @@ static int bf537mac_open(struct net_device *dev)
860 return retval; 890 return retval;
861 891
862 phy_start(lp->phydev); 892 phy_start(lp->phydev);
893 phy_write(lp->phydev, MII_BMCR, BMCR_RESET);
863 setup_system_regs(dev); 894 setup_system_regs(dev);
864 bf537mac_disable(); 895 bf537mac_disable();
865 bf537mac_enable(); 896 bf537mac_enable();
866
867 pr_debug("hardware init finished\n"); 897 pr_debug("hardware init finished\n");
868 netif_start_queue(dev); 898 netif_start_queue(dev);
869 netif_carrier_on(dev); 899 netif_carrier_on(dev);
@@ -886,6 +916,7 @@ static int bf537mac_close(struct net_device *dev)
886 netif_carrier_off(dev); 916 netif_carrier_off(dev);
887 917
888 phy_stop(lp->phydev); 918 phy_stop(lp->phydev);
919 phy_write(lp->phydev, MII_BMCR, BMCR_PDOWN);
889 920
890 /* clear everything */ 921 /* clear everything */
891 bf537mac_shutdown(dev); 922 bf537mac_shutdown(dev);
@@ -970,7 +1001,7 @@ static int __init bf537mac_probe(struct net_device *dev)
970 /* register irq handler */ 1001 /* register irq handler */
971 if (request_irq 1002 if (request_irq
972 (IRQ_MAC_RX, bf537mac_interrupt, IRQF_DISABLED | IRQF_SHARED, 1003 (IRQ_MAC_RX, bf537mac_interrupt, IRQF_DISABLED | IRQF_SHARED,
973 "BFIN537_MAC_RX", dev)) { 1004 "EMAC_RX", dev)) {
974 printk(KERN_WARNING DRV_NAME 1005 printk(KERN_WARNING DRV_NAME
975 ": Unable to attach BlackFin MAC RX interrupt\n"); 1006 ": Unable to attach BlackFin MAC RX interrupt\n");
976 return -EBUSY; 1007 return -EBUSY;
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h
index 5970ea7142cd..f774d5a36942 100644
--- a/drivers/net/bfin_mac.h
+++ b/drivers/net/bfin_mac.h
@@ -1,34 +1,11 @@
1/* 1/*
2 * File: drivers/net/bfin_mac.c 2 * Blackfin On-Chip MAC Driver
3 * Based on:
4 * Maintainer:
5 * Bryan Wu <bryan.wu@analog.com>
6 * 3 *
7 * Original author: 4 * Copyright 2004-2007 Analog Devices Inc.
8 * Luke Yang <luke.yang@analog.com>
9 * 5 *
10 * Created: 6 * Enter bugs at http://blackfin.uclinux.org/
11 * Description:
12 * 7 *
13 * Modified: 8 * Licensed under the GPL-2 or later.
14 * Copyright 2004-2006 Analog Devices Inc.
15 *
16 * Bugs: Enter bugs at http://blackfin.uclinux.org/
17 *
18 * This program is free software ; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation ; either version 2, or (at your option)
21 * any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program ; see the file COPYING.
30 * If not, write to the Free Software Foundation,
31 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 */ 9 */
33 10
34#define BFIN_MAC_CSUM_OFFLOAD 11#define BFIN_MAC_CSUM_OFFLOAD
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2039f7838f2d..0942d82f7cbf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1464,10 +1464,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1464 dev_set_allmulti(slave_dev, 1); 1464 dev_set_allmulti(slave_dev, 1);
1465 } 1465 }
1466 1466
1467 netif_tx_lock_bh(bond_dev);
1467 /* upload master's mc_list to new slave */ 1468 /* upload master's mc_list to new slave */
1468 for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { 1469 for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
1469 dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); 1470 dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
1470 } 1471 }
1472 netif_tx_unlock_bh(bond_dev);
1471 } 1473 }
1472 1474
1473 if (bond->params.mode == BOND_MODE_8023AD) { 1475 if (bond->params.mode == BOND_MODE_8023AD) {
@@ -1821,7 +1823,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1821 } 1823 }
1822 1824
1823 /* flush master's mc_list from slave */ 1825 /* flush master's mc_list from slave */
1826 netif_tx_lock_bh(bond_dev);
1824 bond_mc_list_flush(bond_dev, slave_dev); 1827 bond_mc_list_flush(bond_dev, slave_dev);
1828 netif_tx_unlock_bh(bond_dev);
1825 } 1829 }
1826 1830
1827 netdev_set_master(slave_dev, NULL); 1831 netdev_set_master(slave_dev, NULL);
@@ -1942,7 +1946,9 @@ static int bond_release_all(struct net_device *bond_dev)
1942 } 1946 }
1943 1947
1944 /* flush master's mc_list from slave */ 1948 /* flush master's mc_list from slave */
1949 netif_tx_lock_bh(bond_dev);
1945 bond_mc_list_flush(bond_dev, slave_dev); 1950 bond_mc_list_flush(bond_dev, slave_dev);
1951 netif_tx_unlock_bh(bond_dev);
1946 } 1952 }
1947 1953
1948 netdev_set_master(slave_dev, NULL); 1954 netdev_set_master(slave_dev, NULL);
@@ -2795,14 +2801,11 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
2795 } 2801 }
2796 2802
2797 if (do_failover) { 2803 if (do_failover) {
2798 rtnl_lock();
2799 write_lock_bh(&bond->curr_slave_lock); 2804 write_lock_bh(&bond->curr_slave_lock);
2800 2805
2801 bond_select_active_slave(bond); 2806 bond_select_active_slave(bond);
2802 2807
2803 write_unlock_bh(&bond->curr_slave_lock); 2808 write_unlock_bh(&bond->curr_slave_lock);
2804 rtnl_unlock();
2805
2806 } 2809 }
2807 2810
2808re_arm: 2811re_arm:
@@ -2859,8 +2862,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
2859 2862
2860 slave->link = BOND_LINK_UP; 2863 slave->link = BOND_LINK_UP;
2861 2864
2862 rtnl_lock();
2863
2864 write_lock_bh(&bond->curr_slave_lock); 2865 write_lock_bh(&bond->curr_slave_lock);
2865 2866
2866 if ((!bond->curr_active_slave) && 2867 if ((!bond->curr_active_slave) &&
@@ -2896,7 +2897,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
2896 } 2897 }
2897 2898
2898 write_unlock_bh(&bond->curr_slave_lock); 2899 write_unlock_bh(&bond->curr_slave_lock);
2899 rtnl_unlock();
2900 } 2900 }
2901 } else { 2901 } else {
2902 read_lock(&bond->curr_slave_lock); 2902 read_lock(&bond->curr_slave_lock);
@@ -2966,7 +2966,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
2966 bond->dev->name, 2966 bond->dev->name,
2967 slave->dev->name); 2967 slave->dev->name);
2968 2968
2969 rtnl_lock();
2970 write_lock_bh(&bond->curr_slave_lock); 2969 write_lock_bh(&bond->curr_slave_lock);
2971 2970
2972 bond_select_active_slave(bond); 2971 bond_select_active_slave(bond);
@@ -2974,8 +2973,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
2974 2973
2975 write_unlock_bh(&bond->curr_slave_lock); 2974 write_unlock_bh(&bond->curr_slave_lock);
2976 2975
2977 rtnl_unlock();
2978
2979 bond->current_arp_slave = slave; 2976 bond->current_arp_slave = slave;
2980 2977
2981 if (slave) { 2978 if (slave) {
@@ -2993,13 +2990,10 @@ void bond_activebackup_arp_mon(struct work_struct *work)
2993 bond->primary_slave->dev->name); 2990 bond->primary_slave->dev->name);
2994 2991
2995 /* primary is up so switch to it */ 2992 /* primary is up so switch to it */
2996 rtnl_lock();
2997 write_lock_bh(&bond->curr_slave_lock); 2993 write_lock_bh(&bond->curr_slave_lock);
2998 bond_change_active_slave(bond, bond->primary_slave); 2994 bond_change_active_slave(bond, bond->primary_slave);
2999 write_unlock_bh(&bond->curr_slave_lock); 2995 write_unlock_bh(&bond->curr_slave_lock);
3000 2996
3001 rtnl_unlock();
3002
3003 slave = bond->primary_slave; 2997 slave = bond->primary_slave;
3004 slave->jiffies = jiffies; 2998 slave->jiffies = jiffies;
3005 } else { 2999 } else {
@@ -3769,42 +3763,45 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
3769{ 3763{
3770 struct bonding *bond = bond_dev->priv; 3764 struct bonding *bond = bond_dev->priv;
3771 struct net_device_stats *stats = &(bond->stats), *sstats; 3765 struct net_device_stats *stats = &(bond->stats), *sstats;
3766 struct net_device_stats local_stats;
3772 struct slave *slave; 3767 struct slave *slave;
3773 int i; 3768 int i;
3774 3769
3775 memset(stats, 0, sizeof(struct net_device_stats)); 3770 memset(&local_stats, 0, sizeof(struct net_device_stats));
3776 3771
3777 read_lock_bh(&bond->lock); 3772 read_lock_bh(&bond->lock);
3778 3773
3779 bond_for_each_slave(bond, slave, i) { 3774 bond_for_each_slave(bond, slave, i) {
3780 sstats = slave->dev->get_stats(slave->dev); 3775 sstats = slave->dev->get_stats(slave->dev);
3781 stats->rx_packets += sstats->rx_packets; 3776 local_stats.rx_packets += sstats->rx_packets;
3782 stats->rx_bytes += sstats->rx_bytes; 3777 local_stats.rx_bytes += sstats->rx_bytes;
3783 stats->rx_errors += sstats->rx_errors; 3778 local_stats.rx_errors += sstats->rx_errors;
3784 stats->rx_dropped += sstats->rx_dropped; 3779 local_stats.rx_dropped += sstats->rx_dropped;
3785 3780
3786 stats->tx_packets += sstats->tx_packets; 3781 local_stats.tx_packets += sstats->tx_packets;
3787 stats->tx_bytes += sstats->tx_bytes; 3782 local_stats.tx_bytes += sstats->tx_bytes;
3788 stats->tx_errors += sstats->tx_errors; 3783 local_stats.tx_errors += sstats->tx_errors;
3789 stats->tx_dropped += sstats->tx_dropped; 3784 local_stats.tx_dropped += sstats->tx_dropped;
3790 3785
3791 stats->multicast += sstats->multicast; 3786 local_stats.multicast += sstats->multicast;
3792 stats->collisions += sstats->collisions; 3787 local_stats.collisions += sstats->collisions;
3793 3788
3794 stats->rx_length_errors += sstats->rx_length_errors; 3789 local_stats.rx_length_errors += sstats->rx_length_errors;
3795 stats->rx_over_errors += sstats->rx_over_errors; 3790 local_stats.rx_over_errors += sstats->rx_over_errors;
3796 stats->rx_crc_errors += sstats->rx_crc_errors; 3791 local_stats.rx_crc_errors += sstats->rx_crc_errors;
3797 stats->rx_frame_errors += sstats->rx_frame_errors; 3792 local_stats.rx_frame_errors += sstats->rx_frame_errors;
3798 stats->rx_fifo_errors += sstats->rx_fifo_errors; 3793 local_stats.rx_fifo_errors += sstats->rx_fifo_errors;
3799 stats->rx_missed_errors += sstats->rx_missed_errors; 3794 local_stats.rx_missed_errors += sstats->rx_missed_errors;
3800 3795
3801 stats->tx_aborted_errors += sstats->tx_aborted_errors; 3796 local_stats.tx_aborted_errors += sstats->tx_aborted_errors;
3802 stats->tx_carrier_errors += sstats->tx_carrier_errors; 3797 local_stats.tx_carrier_errors += sstats->tx_carrier_errors;
3803 stats->tx_fifo_errors += sstats->tx_fifo_errors; 3798 local_stats.tx_fifo_errors += sstats->tx_fifo_errors;
3804 stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors; 3799 local_stats.tx_heartbeat_errors += sstats->tx_heartbeat_errors;
3805 stats->tx_window_errors += sstats->tx_window_errors; 3800 local_stats.tx_window_errors += sstats->tx_window_errors;
3806 } 3801 }
3807 3802
3803 memcpy(stats, &local_stats, sizeof(struct net_device_stats));
3804
3808 read_unlock_bh(&bond->lock); 3805 read_unlock_bh(&bond->lock);
3809 3806
3810 return stats; 3807 return stats;
@@ -3937,8 +3934,6 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
3937 struct bonding *bond = bond_dev->priv; 3934 struct bonding *bond = bond_dev->priv;
3938 struct dev_mc_list *dmi; 3935 struct dev_mc_list *dmi;
3939 3936
3940 write_lock_bh(&bond->lock);
3941
3942 /* 3937 /*
3943 * Do promisc before checking multicast_mode 3938 * Do promisc before checking multicast_mode
3944 */ 3939 */
@@ -3959,6 +3954,8 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
3959 bond_set_allmulti(bond, -1); 3954 bond_set_allmulti(bond, -1);
3960 } 3955 }
3961 3956
3957 read_lock(&bond->lock);
3958
3962 bond->flags = bond_dev->flags; 3959 bond->flags = bond_dev->flags;
3963 3960
3964 /* looking for addresses to add to slaves' mc list */ 3961 /* looking for addresses to add to slaves' mc list */
@@ -3979,7 +3976,7 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
3979 bond_mc_list_destroy(bond); 3976 bond_mc_list_destroy(bond);
3980 bond_mc_list_copy(bond_dev->mc_list, bond, GFP_ATOMIC); 3977 bond_mc_list_copy(bond_dev->mc_list, bond, GFP_ATOMIC);
3981 3978
3982 write_unlock_bh(&bond->lock); 3979 read_unlock(&bond->lock);
3983} 3980}
3984 3981
3985/* 3982/*
@@ -4526,7 +4523,9 @@ static void bond_free_all(void)
4526 struct net_device *bond_dev = bond->dev; 4523 struct net_device *bond_dev = bond->dev;
4527 4524
4528 bond_work_cancel_all(bond); 4525 bond_work_cancel_all(bond);
4526 netif_tx_lock_bh(bond_dev);
4529 bond_mc_list_destroy(bond); 4527 bond_mc_list_destroy(bond);
4528 netif_tx_unlock_bh(bond_dev);
4530 /* Release the bonded slaves */ 4529 /* Release the bonded slaves */
4531 bond_release_all(bond_dev); 4530 bond_release_all(bond_dev);
4532 bond_deinit(bond_dev); 4531 bond_deinit(bond_dev);
@@ -4549,14 +4548,19 @@ static void bond_free_all(void)
4549int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) 4548int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
4550{ 4549{
4551 int mode = -1, i, rv; 4550 int mode = -1, i, rv;
4552 char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; 4551 char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
4553 4552
4554 rv = sscanf(buf, "%d", &mode); 4553 for (p = (char *)buf; *p; p++)
4555 if (!rv) { 4554 if (!(isdigit(*p) || isspace(*p)))
4555 break;
4556
4557 if (*p)
4556 rv = sscanf(buf, "%20s", modestr); 4558 rv = sscanf(buf, "%20s", modestr);
4557 if (!rv) 4559 else
4558 return -1; 4560 rv = sscanf(buf, "%d", &mode);
4559 } 4561
4562 if (!rv)
4563 return -1;
4560 4564
4561 for (i = 0; tbl[i].modename; i++) { 4565 for (i = 0; tbl[i].modename; i++) {
4562 if (mode == tbl[i].mode) 4566 if (mode == tbl[i].mode)
@@ -4883,14 +4887,16 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4883 down_write(&bonding_rwsem); 4887 down_write(&bonding_rwsem);
4884 4888
4885 /* Check to see if the bond already exists. */ 4889 /* Check to see if the bond already exists. */
4886 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) 4890 if (name) {
4887 if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { 4891 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
4888 printk(KERN_ERR DRV_NAME 4892 if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
4893 printk(KERN_ERR DRV_NAME
4889 ": cannot add bond %s; it already exists\n", 4894 ": cannot add bond %s; it already exists\n",
4890 name); 4895 name);
4891 res = -EPERM; 4896 res = -EPERM;
4892 goto out_rtnl; 4897 goto out_rtnl;
4893 } 4898 }
4899 }
4894 4900
4895 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", 4901 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
4896 ether_setup); 4902 ether_setup);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 6d83be49899a..67ccad69d445 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -22,8 +22,8 @@
22#include "bond_3ad.h" 22#include "bond_3ad.h"
23#include "bond_alb.h" 23#include "bond_alb.h"
24 24
25#define DRV_VERSION "3.2.3" 25#define DRV_VERSION "3.2.4"
26#define DRV_RELDATE "December 6, 2007" 26#define DRV_RELDATE "January 28, 2008"
27#define DRV_NAME "bonding" 27#define DRV_NAME "bonding"
28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" 28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
29 29
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c
index 84c1ffa8e2d3..4c4d6e877ea6 100644
--- a/drivers/net/cxgb3/mc5.c
+++ b/drivers/net/cxgb3/mc5.c
@@ -452,7 +452,7 @@ void t3_mc5_intr_handler(struct mc5 *mc5)
452 t3_write_reg(adap, A_MC5_DB_INT_CAUSE, cause); 452 t3_write_reg(adap, A_MC5_DB_INT_CAUSE, cause);
453} 453}
454 454
455void __devinit t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode) 455void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode)
456{ 456{
457#define K * 1024 457#define K * 1024
458 458
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index cb684d30831f..9ca8c66abd16 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2836,7 +2836,7 @@ void t3_sge_init(struct adapter *adap, struct sge_params *p)
2836 * defaults for the assorted SGE parameters, which admins can change until 2836 * defaults for the assorted SGE parameters, which admins can change until
2837 * they are used to initialize the SGE. 2837 * they are used to initialize the SGE.
2838 */ 2838 */
2839void __devinit t3_sge_prep(struct adapter *adap, struct sge_params *p) 2839void t3_sge_prep(struct adapter *adap, struct sge_params *p)
2840{ 2840{
2841 int i; 2841 int i;
2842 2842
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 7469935877bd..a99496a431c4 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -2675,7 +2675,7 @@ void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size)
2675 V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); 2675 V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size));
2676} 2676}
2677 2677
2678static void __devinit init_mtus(unsigned short mtus[]) 2678static void init_mtus(unsigned short mtus[])
2679{ 2679{
2680 /* 2680 /*
2681 * See draft-mathis-plpmtud-00.txt for the values. The min is 88 so 2681 * See draft-mathis-plpmtud-00.txt for the values. The min is 88 so
@@ -2703,7 +2703,7 @@ static void __devinit init_mtus(unsigned short mtus[])
2703/* 2703/*
2704 * Initial congestion control parameters. 2704 * Initial congestion control parameters.
2705 */ 2705 */
2706static void __devinit init_cong_ctrl(unsigned short *a, unsigned short *b) 2706static void init_cong_ctrl(unsigned short *a, unsigned short *b)
2707{ 2707{
2708 a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = 1; 2708 a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = 1;
2709 a[9] = 2; 2709 a[9] = 2;
@@ -3354,8 +3354,7 @@ out_err:
3354 * Determines a card's PCI mode and associated parameters, such as speed 3354 * Determines a card's PCI mode and associated parameters, such as speed
3355 * and width. 3355 * and width.
3356 */ 3356 */
3357static void __devinit get_pci_mode(struct adapter *adapter, 3357static void get_pci_mode(struct adapter *adapter, struct pci_params *p)
3358 struct pci_params *p)
3359{ 3358{
3360 static unsigned short speed_map[] = { 33, 66, 100, 133 }; 3359 static unsigned short speed_map[] = { 33, 66, 100, 133 };
3361 u32 pci_mode, pcie_cap; 3360 u32 pci_mode, pcie_cap;
@@ -3395,8 +3394,7 @@ static void __devinit get_pci_mode(struct adapter *adapter,
3395 * capabilities and default speed/duplex/flow-control/autonegotiation 3394 * capabilities and default speed/duplex/flow-control/autonegotiation
3396 * settings. 3395 * settings.
3397 */ 3396 */
3398static void __devinit init_link_config(struct link_config *lc, 3397static void init_link_config(struct link_config *lc, unsigned int caps)
3399 unsigned int caps)
3400{ 3398{
3401 lc->supported = caps; 3399 lc->supported = caps;
3402 lc->requested_speed = lc->speed = SPEED_INVALID; 3400 lc->requested_speed = lc->speed = SPEED_INVALID;
@@ -3419,7 +3417,7 @@ static void __devinit init_link_config(struct link_config *lc,
3419 * Calculates the size of an MC7 memory in bytes from the value of its 3417 * Calculates the size of an MC7 memory in bytes from the value of its
3420 * configuration register. 3418 * configuration register.
3421 */ 3419 */
3422static unsigned int __devinit mc7_calc_size(u32 cfg) 3420static unsigned int mc7_calc_size(u32 cfg)
3423{ 3421{
3424 unsigned int width = G_WIDTH(cfg); 3422 unsigned int width = G_WIDTH(cfg);
3425 unsigned int banks = !!(cfg & F_BKS) + 1; 3423 unsigned int banks = !!(cfg & F_BKS) + 1;
@@ -3430,8 +3428,8 @@ static unsigned int __devinit mc7_calc_size(u32 cfg)
3430 return MBs << 20; 3428 return MBs << 20;
3431} 3429}
3432 3430
3433static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7, 3431static void mc7_prep(struct adapter *adapter, struct mc7 *mc7,
3434 unsigned int base_addr, const char *name) 3432 unsigned int base_addr, const char *name)
3435{ 3433{
3436 u32 cfg; 3434 u32 cfg;
3437 3435
@@ -3517,7 +3515,7 @@ static int t3_reset_adapter(struct adapter *adapter)
3517 return 0; 3515 return 0;
3518} 3516}
3519 3517
3520static int __devinit init_parity(struct adapter *adap) 3518static int init_parity(struct adapter *adap)
3521{ 3519{
3522 int i, err, addr; 3520 int i, err, addr;
3523 3521
@@ -3552,8 +3550,8 @@ static int __devinit init_parity(struct adapter *adap)
3552 * for some adapter tunables, take PHYs out of reset, and initialize the MDIO 3550 * for some adapter tunables, take PHYs out of reset, and initialize the MDIO
3553 * interface. 3551 * interface.
3554 */ 3552 */
3555int __devinit t3_prep_adapter(struct adapter *adapter, 3553int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
3556 const struct adapter_info *ai, int reset) 3554 int reset)
3557{ 3555{
3558 int ret; 3556 int ret;
3559 unsigned int i, j = 0; 3557 unsigned int i, j = 0;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 51cf577035be..36ba6dc96acc 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -94,7 +94,7 @@
94 * enabled. 82557 pads with 7Eh, while the later controllers pad 94 * enabled. 82557 pads with 7Eh, while the later controllers pad
95 * with 00h. 95 * with 00h.
96 * 96 *
97 * IV. Recieve 97 * IV. Receive
98 * 98 *
99 * The Receive Frame Area (RFA) comprises a ring of Receive Frame 99 * The Receive Frame Area (RFA) comprises a ring of Receive Frame
100 * Descriptors (RFD) + data buffer, thus forming the simplified mode 100 * Descriptors (RFD) + data buffer, thus forming the simplified mode
@@ -120,7 +120,7 @@
120 * and Rx indication and re-allocation happen in the same context, 120 * and Rx indication and re-allocation happen in the same context,
121 * therefore no locking is required. A software-generated interrupt 121 * therefore no locking is required. A software-generated interrupt
122 * is generated from the watchdog to recover from a failed allocation 122 * is generated from the watchdog to recover from a failed allocation
123 * senario where all Rx resources have been indicated and none re- 123 * scenario where all Rx resources have been indicated and none re-
124 * placed. 124 * placed.
125 * 125 *
126 * V. Miscellaneous 126 * V. Miscellaneous
@@ -954,7 +954,7 @@ static void e100_get_defaults(struct nic *nic)
954 /* Quadwords to DMA into FIFO before starting frame transmit */ 954 /* Quadwords to DMA into FIFO before starting frame transmit */
955 nic->tx_threshold = 0xE0; 955 nic->tx_threshold = 0xE0;
956 956
957 /* no interrupt for every tx completion, delay = 256us if not 557*/ 957 /* no interrupt for every tx completion, delay = 256us if not 557 */
958 nic->tx_command = cpu_to_le16(cb_tx | cb_tx_sf | 958 nic->tx_command = cpu_to_le16(cb_tx | cb_tx_sf |
959 ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); 959 ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));
960 960
@@ -1497,7 +1497,7 @@ static void e100_update_stats(struct nic *nic)
1497 &s->complete; 1497 &s->complete;
1498 1498
1499 /* Device's stats reporting may take several microseconds to 1499 /* Device's stats reporting may take several microseconds to
1500 * complete, so where always waiting for results of the 1500 * complete, so we're always waiting for results of the
1501 * previous command. */ 1501 * previous command. */
1502 1502
1503 if(*complete == cpu_to_le32(cuc_dump_reset_complete)) { 1503 if(*complete == cpu_to_le32(cuc_dump_reset_complete)) {
@@ -1958,7 +1958,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1958 1958
1959 if(restart_required) { 1959 if(restart_required) {
1960 // ack the rnr? 1960 // ack the rnr?
1961 writeb(stat_ack_rnr, &nic->csr->scb.stat_ack); 1961 iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack);
1962 e100_start_receiver(nic, nic->rx_to_clean); 1962 e100_start_receiver(nic, nic->rx_to_clean);
1963 if(work_done) 1963 if(work_done)
1964 (*work_done)++; 1964 (*work_done)++;
@@ -2774,7 +2774,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2774 struct nic *nic = netdev_priv(netdev); 2774 struct nic *nic = netdev_priv(netdev);
2775 unregister_netdev(netdev); 2775 unregister_netdev(netdev);
2776 e100_free(nic); 2776 e100_free(nic);
2777 iounmap(nic->csr); 2777 pci_iounmap(pdev, nic->csr);
2778 free_netdev(netdev); 2778 free_netdev(netdev);
2779 pci_release_regions(pdev); 2779 pci_release_regions(pdev);
2780 pci_disable_device(pdev); 2780 pci_disable_device(pdev);
@@ -2858,17 +2858,17 @@ static void e100_shutdown(struct pci_dev *pdev)
2858/** 2858/**
2859 * e100_io_error_detected - called when PCI error is detected. 2859 * e100_io_error_detected - called when PCI error is detected.
2860 * @pdev: Pointer to PCI device 2860 * @pdev: Pointer to PCI device
2861 * @state: The current pci conneection state 2861 * @state: The current pci connection state
2862 */ 2862 */
2863static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) 2863static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
2864{ 2864{
2865 struct net_device *netdev = pci_get_drvdata(pdev); 2865 struct net_device *netdev = pci_get_drvdata(pdev);
2866 struct nic *nic = netdev_priv(netdev); 2866 struct nic *nic = netdev_priv(netdev);
2867 2867
2868 /* Similar to calling e100_down(), but avoids adpater I/O. */ 2868 /* Similar to calling e100_down(), but avoids adapter I/O. */
2869 netdev->stop(netdev); 2869 netdev->stop(netdev);
2870 2870
2871 /* Detach; put netif into state similar to hotplug unplug. */ 2871 /* Detach; put netif into a state similar to hotplug unplug. */
2872 napi_enable(&nic->napi); 2872 napi_enable(&nic->napi);
2873 netif_device_detach(netdev); 2873 netif_device_detach(netdev);
2874 pci_disable_device(pdev); 2874 pci_disable_device(pdev);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 8c87940a9ce8..7c5b05a82f0e 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -853,7 +853,7 @@ e1000_reset(struct e1000_adapter *adapter)
853/** 853/**
854 * Dump the eeprom for users having checksum issues 854 * Dump the eeprom for users having checksum issues
855 **/ 855 **/
856void e1000_dump_eeprom(struct e1000_adapter *adapter) 856static void e1000_dump_eeprom(struct e1000_adapter *adapter)
857{ 857{
858 struct net_device *netdev = adapter->netdev; 858 struct net_device *netdev = adapter->netdev;
859 struct ethtool_eeprom eeprom; 859 struct ethtool_eeprom eeprom;
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index f2175ea46b83..6232c3e96689 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -63,6 +63,7 @@
63#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 63#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
64#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ 64#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */
65#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 65#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
66#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */
66 67
67/* Extended Device Control */ 68/* Extended Device Control */
68#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ 69#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 6d9c27fd0b53..f77a7427d3a0 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -690,8 +690,8 @@ err_setup:
690 return err; 690 return err;
691} 691}
692 692
693bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data, 693static bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data,
694 int reg, int offset, u32 mask, u32 write) 694 int reg, int offset, u32 mask, u32 write)
695{ 695{
696 int i; 696 int i;
697 u32 read; 697 u32 read;
@@ -1632,7 +1632,8 @@ static void e1000_get_wol(struct net_device *netdev,
1632 return; 1632 return;
1633 1633
1634 wol->supported = WAKE_UCAST | WAKE_MCAST | 1634 wol->supported = WAKE_UCAST | WAKE_MCAST |
1635 WAKE_BCAST | WAKE_MAGIC; 1635 WAKE_BCAST | WAKE_MAGIC |
1636 WAKE_PHY | WAKE_ARP;
1636 1637
1637 /* apply any specific unsupported masks here */ 1638 /* apply any specific unsupported masks here */
1638 if (adapter->flags & FLAG_NO_WAKE_UCAST) { 1639 if (adapter->flags & FLAG_NO_WAKE_UCAST) {
@@ -1651,6 +1652,10 @@ static void e1000_get_wol(struct net_device *netdev,
1651 wol->wolopts |= WAKE_BCAST; 1652 wol->wolopts |= WAKE_BCAST;
1652 if (adapter->wol & E1000_WUFC_MAG) 1653 if (adapter->wol & E1000_WUFC_MAG)
1653 wol->wolopts |= WAKE_MAGIC; 1654 wol->wolopts |= WAKE_MAGIC;
1655 if (adapter->wol & E1000_WUFC_LNKC)
1656 wol->wolopts |= WAKE_PHY;
1657 if (adapter->wol & E1000_WUFC_ARP)
1658 wol->wolopts |= WAKE_ARP;
1654} 1659}
1655 1660
1656static int e1000_set_wol(struct net_device *netdev, 1661static int e1000_set_wol(struct net_device *netdev,
@@ -1658,7 +1663,7 @@ static int e1000_set_wol(struct net_device *netdev,
1658{ 1663{
1659 struct e1000_adapter *adapter = netdev_priv(netdev); 1664 struct e1000_adapter *adapter = netdev_priv(netdev);
1660 1665
1661 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 1666 if (wol->wolopts & WAKE_MAGICSECURE)
1662 return -EOPNOTSUPP; 1667 return -EOPNOTSUPP;
1663 1668
1664 if (!(adapter->flags & FLAG_HAS_WOL)) 1669 if (!(adapter->flags & FLAG_HAS_WOL))
@@ -1675,6 +1680,10 @@ static int e1000_set_wol(struct net_device *netdev,
1675 adapter->wol |= E1000_WUFC_BC; 1680 adapter->wol |= E1000_WUFC_BC;
1676 if (wol->wolopts & WAKE_MAGIC) 1681 if (wol->wolopts & WAKE_MAGIC)
1677 adapter->wol |= E1000_WUFC_MAG; 1682 adapter->wol |= E1000_WUFC_MAG;
1683 if (wol->wolopts & WAKE_PHY)
1684 adapter->wol |= E1000_WUFC_LNKC;
1685 if (wol->wolopts & WAKE_ARP)
1686 adapter->wol |= E1000_WUFC_ARP;
1678 1687
1679 return 0; 1688 return 0;
1680} 1689}
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 0a2cb7960c9e..f58f017ee47a 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -945,11 +945,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
945 int irq_flags = IRQF_SHARED; 945 int irq_flags = IRQF_SHARED;
946 int err; 946 int err;
947 947
948 err = pci_enable_msi(adapter->pdev); 948 if (!pci_enable_msi(adapter->pdev)) {
949 if (err) {
950 ndev_warn(netdev,
951 "Unable to allocate MSI interrupt Error: %d\n", err);
952 } else {
953 adapter->flags |= FLAG_MSI_ENABLED; 949 adapter->flags |= FLAG_MSI_ENABLED;
954 handler = e1000_intr_msi; 950 handler = e1000_intr_msi;
955 irq_flags = 0; 951 irq_flags = 0;
@@ -958,10 +954,12 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
958 err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, 954 err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
959 netdev); 955 netdev);
960 if (err) { 956 if (err) {
957 ndev_err(netdev,
958 "Unable to allocate %s interrupt (return: %d)\n",
959 adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx",
960 err);
961 if (adapter->flags & FLAG_MSI_ENABLED) 961 if (adapter->flags & FLAG_MSI_ENABLED)
962 pci_disable_msi(adapter->pdev); 962 pci_disable_msi(adapter->pdev);
963 ndev_err(netdev,
964 "Unable to allocate interrupt Error: %d\n", err);
965 } 963 }
966 964
967 return err; 965 return err;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a4647eee..88fb53eba715 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -458,4 +458,7 @@ void ehea_set_ethtool_ops(struct net_device *netdev);
458int ehea_sense_port_attr(struct ehea_port *port); 458int ehea_sense_port_attr(struct ehea_port *port);
459int ehea_set_portspeed(struct ehea_port *port, u32 port_speed); 459int ehea_set_portspeed(struct ehea_port *port, u32 port_speed);
460 460
461extern u64 ehea_driver_flags;
462extern struct work_struct ehea_rereg_mr_task;
463
461#endif /* __EHEA_H__ */ 464#endif /* __EHEA_H__ */
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 679f40ee9572..d76885223366 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -40,7 +40,7 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
40 return ret; 40 return ret;
41 41
42 if (netif_carrier_ok(dev)) { 42 if (netif_carrier_ok(dev)) {
43 switch(port->port_speed) { 43 switch (port->port_speed) {
44 case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; 44 case EHEA_SPEED_10M: cmd->speed = SPEED_10; break;
45 case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; 45 case EHEA_SPEED_100M: cmd->speed = SPEED_100; break;
46 case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; 46 case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break;
@@ -78,7 +78,7 @@ static int ehea_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
78 goto doit; 78 goto doit;
79 } 79 }
80 80
81 switch(cmd->speed) { 81 switch (cmd->speed) {
82 case SPEED_10: 82 case SPEED_10:
83 if (cmd->duplex == DUPLEX_FULL) 83 if (cmd->duplex == DUPLEX_FULL)
84 sp = H_SPEED_10M_F; 84 sp = H_SPEED_10M_F;
diff --git a/drivers/net/ehea/ehea_hw.h b/drivers/net/ehea/ehea_hw.h
index 1af7ca499ec5..567981b4b2cc 100644
--- a/drivers/net/ehea/ehea_hw.h
+++ b/drivers/net/ehea/ehea_hw.h
@@ -29,10 +29,10 @@
29#ifndef __EHEA_HW_H__ 29#ifndef __EHEA_HW_H__
30#define __EHEA_HW_H__ 30#define __EHEA_HW_H__
31 31
32#define QPX_SQA_VALUE EHEA_BMASK_IBM(48,63) 32#define QPX_SQA_VALUE EHEA_BMASK_IBM(48, 63)
33#define QPX_RQ1A_VALUE EHEA_BMASK_IBM(48,63) 33#define QPX_RQ1A_VALUE EHEA_BMASK_IBM(48, 63)
34#define QPX_RQ2A_VALUE EHEA_BMASK_IBM(48,63) 34#define QPX_RQ2A_VALUE EHEA_BMASK_IBM(48, 63)
35#define QPX_RQ3A_VALUE EHEA_BMASK_IBM(48,63) 35#define QPX_RQ3A_VALUE EHEA_BMASK_IBM(48, 63)
36 36
37#define QPTEMM_OFFSET(x) offsetof(struct ehea_qptemm, x) 37#define QPTEMM_OFFSET(x) offsetof(struct ehea_qptemm, x)
38 38
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 869e1604b16e..c051c7e09b9a 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -6,9 +6,9 @@
6 * (C) Copyright IBM Corp. 2006 6 * (C) Copyright IBM Corp. 2006
7 * 7 *
8 * Authors: 8 * Authors:
9 * Christoph Raisch <raisch@de.ibm.com> 9 * Christoph Raisch <raisch@de.ibm.com>
10 * Jan-Bernd Themann <themann@de.ibm.com> 10 * Jan-Bernd Themann <themann@de.ibm.com>
11 * Thomas Klein <tklein@de.ibm.com> 11 * Thomas Klein <tklein@de.ibm.com>
12 * 12 *
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
@@ -54,11 +54,11 @@ static int rq1_entries = EHEA_DEF_ENTRIES_RQ1;
54static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; 54static int rq2_entries = EHEA_DEF_ENTRIES_RQ2;
55static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; 55static int rq3_entries = EHEA_DEF_ENTRIES_RQ3;
56static int sq_entries = EHEA_DEF_ENTRIES_SQ; 56static int sq_entries = EHEA_DEF_ENTRIES_SQ;
57static int use_mcs = 0; 57static int use_mcs;
58static int use_lro = 0; 58static int use_lro;
59static int lro_max_aggr = EHEA_LRO_MAX_AGGR; 59static int lro_max_aggr = EHEA_LRO_MAX_AGGR;
60static int num_tx_qps = EHEA_NUM_TX_QP; 60static int num_tx_qps = EHEA_NUM_TX_QP;
61static int prop_carrier_state = 0; 61static int prop_carrier_state;
62 62
63module_param(msg_level, int, 0); 63module_param(msg_level, int, 0);
64module_param(rq1_entries, int, 0); 64module_param(rq1_entries, int, 0);
@@ -94,9 +94,9 @@ MODULE_PARM_DESC(lro_max_aggr, " LRO: Max packets to be aggregated. Default = "
94MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, " 94MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, "
95 "Default = 0"); 95 "Default = 0");
96 96
97static int port_name_cnt = 0; 97static int port_name_cnt;
98static LIST_HEAD(adapter_list); 98static LIST_HEAD(adapter_list);
99u64 ehea_driver_flags = 0; 99u64 ehea_driver_flags;
100struct work_struct ehea_rereg_mr_task; 100struct work_struct ehea_rereg_mr_task;
101 101
102struct semaphore dlpar_mem_lock; 102struct semaphore dlpar_mem_lock;
@@ -121,12 +121,13 @@ static struct of_platform_driver ehea_driver = {
121 .remove = ehea_remove, 121 .remove = ehea_remove,
122}; 122};
123 123
124void ehea_dump(void *adr, int len, char *msg) { 124void ehea_dump(void *adr, int len, char *msg)
125{
125 int x; 126 int x;
126 unsigned char *deb = adr; 127 unsigned char *deb = adr;
127 for (x = 0; x < len; x += 16) { 128 for (x = 0; x < len; x += 16) {
128 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, 129 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg,
129 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8])); 130 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
130 deb += 16; 131 deb += 16;
131 } 132 }
132} 133}
@@ -518,7 +519,8 @@ static int ehea_proc_rwqes(struct net_device *dev,
518 last_wqe_index = wqe_index; 519 last_wqe_index = wqe_index;
519 rmb(); 520 rmb();
520 if (!ehea_check_cqe(cqe, &rq)) { 521 if (!ehea_check_cqe(cqe, &rq)) {
521 if (rq == 1) { /* LL RQ1 */ 522 if (rq == 1) {
523 /* LL RQ1 */
522 skb = get_skb_by_index_ll(skb_arr_rq1, 524 skb = get_skb_by_index_ll(skb_arr_rq1,
523 skb_arr_rq1_len, 525 skb_arr_rq1_len,
524 wqe_index); 526 wqe_index);
@@ -531,10 +533,11 @@ static int ehea_proc_rwqes(struct net_device *dev,
531 if (!skb) 533 if (!skb)
532 break; 534 break;
533 } 535 }
534 skb_copy_to_linear_data(skb, ((char*)cqe) + 64, 536 skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
535 cqe->num_bytes_transfered - 4); 537 cqe->num_bytes_transfered - 4);
536 ehea_fill_skb(dev, skb, cqe); 538 ehea_fill_skb(dev, skb, cqe);
537 } else if (rq == 2) { /* RQ2 */ 539 } else if (rq == 2) {
540 /* RQ2 */
538 skb = get_skb_by_index(skb_arr_rq2, 541 skb = get_skb_by_index(skb_arr_rq2,
539 skb_arr_rq2_len, cqe); 542 skb_arr_rq2_len, cqe);
540 if (unlikely(!skb)) { 543 if (unlikely(!skb)) {
@@ -544,7 +547,8 @@ static int ehea_proc_rwqes(struct net_device *dev,
544 } 547 }
545 ehea_fill_skb(dev, skb, cqe); 548 ehea_fill_skb(dev, skb, cqe);
546 processed_rq2++; 549 processed_rq2++;
547 } else { /* RQ3 */ 550 } else {
551 /* RQ3 */
548 skb = get_skb_by_index(skb_arr_rq3, 552 skb = get_skb_by_index(skb_arr_rq3,
549 skb_arr_rq3_len, cqe); 553 skb_arr_rq3_len, cqe);
550 if (unlikely(!skb)) { 554 if (unlikely(!skb)) {
@@ -592,7 +596,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
592 unsigned long flags; 596 unsigned long flags;
593 597
594 cqe = ehea_poll_cq(send_cq); 598 cqe = ehea_poll_cq(send_cq);
595 while(cqe && (quota > 0)) { 599 while (cqe && (quota > 0)) {
596 ehea_inc_cq(send_cq); 600 ehea_inc_cq(send_cq);
597 601
598 cqe_counter++; 602 cqe_counter++;
@@ -643,7 +647,8 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
643 647
644static int ehea_poll(struct napi_struct *napi, int budget) 648static int ehea_poll(struct napi_struct *napi, int budget)
645{ 649{
646 struct ehea_port_res *pr = container_of(napi, struct ehea_port_res, napi); 650 struct ehea_port_res *pr = container_of(napi, struct ehea_port_res,
651 napi);
647 struct net_device *dev = pr->port->netdev; 652 struct net_device *dev = pr->port->netdev;
648 struct ehea_cqe *cqe; 653 struct ehea_cqe *cqe;
649 struct ehea_cqe *cqe_skb = NULL; 654 struct ehea_cqe *cqe_skb = NULL;
@@ -743,8 +748,9 @@ int ehea_sense_port_attr(struct ehea_port *port)
743 u64 hret; 748 u64 hret;
744 struct hcp_ehea_port_cb0 *cb0; 749 struct hcp_ehea_port_cb0 *cb0;
745 750
746 cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); /* May be called via */ 751 /* may be called via ehea_neq_tasklet() */
747 if (!cb0) { /* ehea_neq_tasklet() */ 752 cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
753 if (!cb0) {
748 ehea_error("no mem for cb0"); 754 ehea_error("no mem for cb0");
749 ret = -ENOMEM; 755 ret = -ENOMEM;
750 goto out; 756 goto out;
@@ -762,7 +768,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
762 /* MAC address */ 768 /* MAC address */
763 port->mac_addr = cb0->port_mac_addr << 16; 769 port->mac_addr = cb0->port_mac_addr << 16;
764 770
765 if (!is_valid_ether_addr((u8*)&port->mac_addr)) { 771 if (!is_valid_ether_addr((u8 *)&port->mac_addr)) {
766 ret = -EADDRNOTAVAIL; 772 ret = -EADDRNOTAVAIL;
767 goto out_free; 773 goto out_free;
768 } 774 }
@@ -994,7 +1000,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
994 1000
995static void ehea_neq_tasklet(unsigned long data) 1001static void ehea_neq_tasklet(unsigned long data)
996{ 1002{
997 struct ehea_adapter *adapter = (struct ehea_adapter*)data; 1003 struct ehea_adapter *adapter = (struct ehea_adapter *)data;
998 struct ehea_eqe *eqe; 1004 struct ehea_eqe *eqe;
999 u64 event_mask; 1005 u64 event_mask;
1000 1006
@@ -1204,7 +1210,7 @@ int ehea_rem_smrs(struct ehea_port_res *pr)
1204 1210
1205static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries) 1211static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries)
1206{ 1212{
1207 int arr_size = sizeof(void*) * max_q_entries; 1213 int arr_size = sizeof(void *) * max_q_entries;
1208 1214
1209 q_skba->arr = vmalloc(arr_size); 1215 q_skba->arr = vmalloc(arr_size);
1210 if (!q_skba->arr) 1216 if (!q_skba->arr)
@@ -1489,7 +1495,7 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
1489 1495
1490 nfrags = skb_shinfo(skb)->nr_frags; 1496 nfrags = skb_shinfo(skb)->nr_frags;
1491 sg1entry = &swqe->u.immdata_desc.sg_entry; 1497 sg1entry = &swqe->u.immdata_desc.sg_entry;
1492 sg_list = (struct ehea_vsgentry*)&swqe->u.immdata_desc.sg_list; 1498 sg_list = (struct ehea_vsgentry *)&swqe->u.immdata_desc.sg_list;
1493 swqe->descriptors = 0; 1499 swqe->descriptors = 0;
1494 sg1entry_contains_frag_data = 0; 1500 sg1entry_contains_frag_data = 0;
1495 1501
@@ -1542,7 +1548,7 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid)
1542 reg_type, port->mac_addr, 0, hcallid); 1548 reg_type, port->mac_addr, 0, hcallid);
1543 if (hret != H_SUCCESS) { 1549 if (hret != H_SUCCESS) {
1544 ehea_error("%sregistering bc address failed (tagged)", 1550 ehea_error("%sregistering bc address failed (tagged)",
1545 hcallid == H_REG_BCMC ? "" : "de"); 1551 hcallid == H_REG_BCMC ? "" : "de");
1546 ret = -EIO; 1552 ret = -EIO;
1547 goto out_herr; 1553 goto out_herr;
1548 } 1554 }
@@ -1732,7 +1738,7 @@ static void ehea_allmulti(struct net_device *dev, int enable)
1732 } 1738 }
1733} 1739}
1734 1740
1735static void ehea_add_multicast_entry(struct ehea_port* port, u8* mc_mac_addr) 1741static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
1736{ 1742{
1737 struct ehea_mc_list *ehea_mcl_entry; 1743 struct ehea_mc_list *ehea_mcl_entry;
1738 u64 hret; 1744 u64 hret;
@@ -1791,11 +1797,10 @@ static void ehea_set_multicast_list(struct net_device *dev)
1791 goto out; 1797 goto out;
1792 } 1798 }
1793 1799
1794 for (i = 0, k_mcl_entry = dev->mc_list; 1800 for (i = 0, k_mcl_entry = dev->mc_list; i < dev->mc_count; i++,
1795 i < dev->mc_count; 1801 k_mcl_entry = k_mcl_entry->next)
1796 i++, k_mcl_entry = k_mcl_entry->next) {
1797 ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); 1802 ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr);
1798 } 1803
1799 } 1804 }
1800out: 1805out:
1801 return; 1806 return;
@@ -1925,12 +1930,12 @@ static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps)
1925 1930
1926 if ((skb->protocol == htons(ETH_P_IP)) && 1931 if ((skb->protocol == htons(ETH_P_IP)) &&
1927 (ip_hdr(skb)->protocol == IPPROTO_TCP)) { 1932 (ip_hdr(skb)->protocol == IPPROTO_TCP)) {
1928 tcp = (struct tcphdr*)(skb_network_header(skb) + (ip_hdr(skb)->ihl * 4)); 1933 tcp = (struct tcphdr *)(skb_network_header(skb) +
1934 (ip_hdr(skb)->ihl * 4));
1929 tmp = (tcp->source + (tcp->dest << 16)) % 31; 1935 tmp = (tcp->source + (tcp->dest << 16)) % 31;
1930 tmp += ip_hdr(skb)->daddr % 31; 1936 tmp += ip_hdr(skb)->daddr % 31;
1931 return tmp % num_qps; 1937 return tmp % num_qps;
1932 } 1938 } else
1933 else
1934 return 0; 1939 return 0;
1935} 1940}
1936 1941
@@ -2122,7 +2127,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2122 u64 hret; 2127 u64 hret;
2123 u16 dummy16 = 0; 2128 u16 dummy16 = 0;
2124 u64 dummy64 = 0; 2129 u64 dummy64 = 0;
2125 struct hcp_modify_qp_cb0* cb0; 2130 struct hcp_modify_qp_cb0 *cb0;
2126 2131
2127 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2132 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
2128 if (!cb0) { 2133 if (!cb0) {
@@ -2248,7 +2253,7 @@ static int ehea_clean_all_portres(struct ehea_port *port)
2248 int ret = 0; 2253 int ret = 0;
2249 int i; 2254 int i;
2250 2255
2251 for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) 2256 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
2252 ret |= ehea_clean_portres(port, &port->port_res[i]); 2257 ret |= ehea_clean_portres(port, &port->port_res[i]);
2253 2258
2254 ret |= ehea_destroy_eq(port->qp_eq); 2259 ret |= ehea_destroy_eq(port->qp_eq);
@@ -2300,7 +2305,7 @@ static int ehea_up(struct net_device *dev)
2300 goto out_clean_pr; 2305 goto out_clean_pr;
2301 } 2306 }
2302 2307
2303 for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 2308 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2304 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); 2309 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp);
2305 if (ret) { 2310 if (ret) {
2306 ehea_error("activate_qp failed"); 2311 ehea_error("activate_qp failed");
@@ -2308,7 +2313,7 @@ static int ehea_up(struct net_device *dev)
2308 } 2313 }
2309 } 2314 }
2310 2315
2311 for(i = 0; i < port->num_def_qps; i++) { 2316 for (i = 0; i < port->num_def_qps; i++) {
2312 ret = ehea_fill_port_res(&port->port_res[i]); 2317 ret = ehea_fill_port_res(&port->port_res[i]);
2313 if (ret) { 2318 if (ret) {
2314 ehea_error("out_free_irqs"); 2319 ehea_error("out_free_irqs");
@@ -2425,7 +2430,7 @@ int ehea_stop_qps(struct net_device *dev)
2425{ 2430{
2426 struct ehea_port *port = netdev_priv(dev); 2431 struct ehea_port *port = netdev_priv(dev);
2427 struct ehea_adapter *adapter = port->adapter; 2432 struct ehea_adapter *adapter = port->adapter;
2428 struct hcp_modify_qp_cb0* cb0; 2433 struct hcp_modify_qp_cb0 *cb0;
2429 int ret = -EIO; 2434 int ret = -EIO;
2430 int dret; 2435 int dret;
2431 int i; 2436 int i;
@@ -2490,7 +2495,7 @@ out:
2490 return ret; 2495 return ret;
2491} 2496}
2492 2497
2493void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res * pr) 2498void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res *pr)
2494{ 2499{
2495 struct ehea_qp qp = *orig_qp; 2500 struct ehea_qp qp = *orig_qp;
2496 struct ehea_qp_init_attr *init_attr = &qp.init_attr; 2501 struct ehea_qp_init_attr *init_attr = &qp.init_attr;
@@ -2530,7 +2535,7 @@ int ehea_restart_qps(struct net_device *dev)
2530 int ret = 0; 2535 int ret = 0;
2531 int i; 2536 int i;
2532 2537
2533 struct hcp_modify_qp_cb0* cb0; 2538 struct hcp_modify_qp_cb0 *cb0;
2534 u64 hret; 2539 u64 hret;
2535 u64 dummy64 = 0; 2540 u64 dummy64 = 0;
2536 u16 dummy16 = 0; 2541 u16 dummy16 = 0;
@@ -2804,34 +2809,6 @@ static void __devinit logical_port_release(struct device *dev)
2804 of_node_put(port->ofdev.node); 2809 of_node_put(port->ofdev.node);
2805} 2810}
2806 2811
2807static int ehea_driver_sysfs_add(struct device *dev,
2808 struct device_driver *driver)
2809{
2810 int ret;
2811
2812 ret = sysfs_create_link(&driver->kobj, &dev->kobj,
2813 kobject_name(&dev->kobj));
2814 if (ret == 0) {
2815 ret = sysfs_create_link(&dev->kobj, &driver->kobj,
2816 "driver");
2817 if (ret)
2818 sysfs_remove_link(&driver->kobj,
2819 kobject_name(&dev->kobj));
2820 }
2821 return ret;
2822}
2823
2824static void ehea_driver_sysfs_remove(struct device *dev,
2825 struct device_driver *driver)
2826{
2827 struct device_driver *drv = driver;
2828
2829 if (drv) {
2830 sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj));
2831 sysfs_remove_link(&dev->kobj, "driver");
2832 }
2833}
2834
2835static struct device *ehea_register_port(struct ehea_port *port, 2812static struct device *ehea_register_port(struct ehea_port *port,
2836 struct device_node *dn) 2813 struct device_node *dn)
2837{ 2814{
@@ -2856,16 +2833,8 @@ static struct device *ehea_register_port(struct ehea_port *port,
2856 goto out_unreg_of_dev; 2833 goto out_unreg_of_dev;
2857 } 2834 }
2858 2835
2859 ret = ehea_driver_sysfs_add(&port->ofdev.dev, &ehea_driver.driver);
2860 if (ret) {
2861 ehea_error("failed to register sysfs driver link");
2862 goto out_rem_dev_file;
2863 }
2864
2865 return &port->ofdev.dev; 2836 return &port->ofdev.dev;
2866 2837
2867out_rem_dev_file:
2868 device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id);
2869out_unreg_of_dev: 2838out_unreg_of_dev:
2870 of_device_unregister(&port->ofdev); 2839 of_device_unregister(&port->ofdev);
2871out: 2840out:
@@ -2874,7 +2843,6 @@ out:
2874 2843
2875static void ehea_unregister_port(struct ehea_port *port) 2844static void ehea_unregister_port(struct ehea_port *port)
2876{ 2845{
2877 ehea_driver_sysfs_remove(&port->ofdev.dev, &ehea_driver.driver);
2878 device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); 2846 device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id);
2879 of_device_unregister(&port->ofdev); 2847 of_device_unregister(&port->ofdev);
2880} 2848}
@@ -3109,7 +3077,7 @@ static ssize_t ehea_probe_port(struct device *dev,
3109 of_node_put(eth_dn); 3077 of_node_put(eth_dn);
3110 3078
3111 if (port) { 3079 if (port) {
3112 for (i=0; i < EHEA_MAX_PORTS; i++) 3080 for (i = 0; i < EHEA_MAX_PORTS; i++)
3113 if (!adapter->port[i]) { 3081 if (!adapter->port[i]) {
3114 adapter->port[i] = port; 3082 adapter->port[i] = port;
3115 break; 3083 break;
@@ -3144,7 +3112,7 @@ static ssize_t ehea_remove_port(struct device *dev,
3144 3112
3145 ehea_shutdown_single_port(port); 3113 ehea_shutdown_single_port(port);
3146 3114
3147 for (i=0; i < EHEA_MAX_PORTS; i++) 3115 for (i = 0; i < EHEA_MAX_PORTS; i++)
3148 if (adapter->port[i] == port) { 3116 if (adapter->port[i] == port) {
3149 adapter->port[i] = NULL; 3117 adapter->port[i] = NULL;
3150 break; 3118 break;
@@ -3313,7 +3281,7 @@ static int ehea_reboot_notifier(struct notifier_block *nb,
3313} 3281}
3314 3282
3315static struct notifier_block ehea_reboot_nb = { 3283static struct notifier_block ehea_reboot_nb = {
3316 .notifier_call = ehea_reboot_notifier, 3284 .notifier_call = ehea_reboot_notifier,
3317}; 3285};
3318 3286
3319static int check_module_parm(void) 3287static int check_module_parm(void)
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c
index 95c4a7f9cc88..156eb6320b4e 100644
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -6,9 +6,9 @@
6 * (C) Copyright IBM Corp. 2006 6 * (C) Copyright IBM Corp. 2006
7 * 7 *
8 * Authors: 8 * Authors:
9 * Christoph Raisch <raisch@de.ibm.com> 9 * Christoph Raisch <raisch@de.ibm.com>
10 * Jan-Bernd Themann <themann@de.ibm.com> 10 * Jan-Bernd Themann <themann@de.ibm.com>
11 * Thomas Klein <tklein@de.ibm.com> 11 * Thomas Klein <tklein@de.ibm.com>
12 * 12 *
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
@@ -38,11 +38,11 @@ static inline u16 get_order_of_qentries(u16 queue_entries)
38} 38}
39 39
40/* Defines for H_CALL H_ALLOC_RESOURCE */ 40/* Defines for H_CALL H_ALLOC_RESOURCE */
41#define H_ALL_RES_TYPE_QP 1 41#define H_ALL_RES_TYPE_QP 1
42#define H_ALL_RES_TYPE_CQ 2 42#define H_ALL_RES_TYPE_CQ 2
43#define H_ALL_RES_TYPE_EQ 3 43#define H_ALL_RES_TYPE_EQ 3
44#define H_ALL_RES_TYPE_MR 5 44#define H_ALL_RES_TYPE_MR 5
45#define H_ALL_RES_TYPE_MW 6 45#define H_ALL_RES_TYPE_MW 6
46 46
47static long ehea_plpar_hcall_norets(unsigned long opcode, 47static long ehea_plpar_hcall_norets(unsigned long opcode,
48 unsigned long arg1, 48 unsigned long arg1,
@@ -137,77 +137,77 @@ u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category,
137 const u64 qp_handle, const u64 sel_mask, void *cb_addr) 137 const u64 qp_handle, const u64 sel_mask, void *cb_addr)
138{ 138{
139 return ehea_plpar_hcall_norets(H_QUERY_HEA_QP, 139 return ehea_plpar_hcall_norets(H_QUERY_HEA_QP,
140 adapter_handle, /* R4 */ 140 adapter_handle, /* R4 */
141 qp_category, /* R5 */ 141 qp_category, /* R5 */
142 qp_handle, /* R6 */ 142 qp_handle, /* R6 */
143 sel_mask, /* R7 */ 143 sel_mask, /* R7 */
144 virt_to_abs(cb_addr), /* R8 */ 144 virt_to_abs(cb_addr), /* R8 */
145 0, 0); 145 0, 0);
146} 146}
147 147
148/* input param R5 */ 148/* input param R5 */
149#define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11) 149#define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11)
150#define H_ALL_RES_QP_QPP EHEA_BMASK_IBM(12, 12) 150#define H_ALL_RES_QP_QPP EHEA_BMASK_IBM(12, 12)
151#define H_ALL_RES_QP_RQR EHEA_BMASK_IBM(13, 15) 151#define H_ALL_RES_QP_RQR EHEA_BMASK_IBM(13, 15)
152#define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16) 152#define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16)
153#define H_ALL_RES_QP_LL_QP EHEA_BMASK_IBM(17, 17) 153#define H_ALL_RES_QP_LL_QP EHEA_BMASK_IBM(17, 17)
154#define H_ALL_RES_QP_DMA128 EHEA_BMASK_IBM(19, 19) 154#define H_ALL_RES_QP_DMA128 EHEA_BMASK_IBM(19, 19)
155#define H_ALL_RES_QP_HSM EHEA_BMASK_IBM(20, 21) 155#define H_ALL_RES_QP_HSM EHEA_BMASK_IBM(20, 21)
156#define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23) 156#define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23)
157#define H_ALL_RES_QP_TENURE EHEA_BMASK_IBM(48, 55) 157#define H_ALL_RES_QP_TENURE EHEA_BMASK_IBM(48, 55)
158#define H_ALL_RES_QP_RES_TYP EHEA_BMASK_IBM(56, 63) 158#define H_ALL_RES_QP_RES_TYP EHEA_BMASK_IBM(56, 63)
159 159
160/* input param R9 */ 160/* input param R9 */
161#define H_ALL_RES_QP_TOKEN EHEA_BMASK_IBM(0, 31) 161#define H_ALL_RES_QP_TOKEN EHEA_BMASK_IBM(0, 31)
162#define H_ALL_RES_QP_PD EHEA_BMASK_IBM(32,63) 162#define H_ALL_RES_QP_PD EHEA_BMASK_IBM(32, 63)
163 163
164/* input param R10 */ 164/* input param R10 */
165#define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7) 165#define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7)
166#define H_ALL_RES_QP_MAX_R1WQE EHEA_BMASK_IBM(12, 15) 166#define H_ALL_RES_QP_MAX_R1WQE EHEA_BMASK_IBM(12, 15)
167#define H_ALL_RES_QP_MAX_R2WQE EHEA_BMASK_IBM(20, 23) 167#define H_ALL_RES_QP_MAX_R2WQE EHEA_BMASK_IBM(20, 23)
168#define H_ALL_RES_QP_MAX_R3WQE EHEA_BMASK_IBM(28, 31) 168#define H_ALL_RES_QP_MAX_R3WQE EHEA_BMASK_IBM(28, 31)
169/* Max Send Scatter Gather Elements */ 169/* Max Send Scatter Gather Elements */
170#define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39) 170#define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39)
171#define H_ALL_RES_QP_MAX_R1SGE EHEA_BMASK_IBM(45, 47) 171#define H_ALL_RES_QP_MAX_R1SGE EHEA_BMASK_IBM(45, 47)
172/* Max Receive SG Elements RQ1 */ 172/* Max Receive SG Elements RQ1 */
173#define H_ALL_RES_QP_MAX_R2SGE EHEA_BMASK_IBM(53, 55) 173#define H_ALL_RES_QP_MAX_R2SGE EHEA_BMASK_IBM(53, 55)
174#define H_ALL_RES_QP_MAX_R3SGE EHEA_BMASK_IBM(61, 63) 174#define H_ALL_RES_QP_MAX_R3SGE EHEA_BMASK_IBM(61, 63)
175 175
176/* input param R11 */ 176/* input param R11 */
177#define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7) 177#define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7)
178/* max swqe immediate data length */ 178/* max swqe immediate data length */
179#define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63) 179#define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63)
180 180
181/* input param R12 */ 181/* input param R12 */
182#define H_ALL_RES_QP_TH_RQ2 EHEA_BMASK_IBM(0, 15) 182#define H_ALL_RES_QP_TH_RQ2 EHEA_BMASK_IBM(0, 15)
183/* Threshold RQ2 */ 183/* Threshold RQ2 */
184#define H_ALL_RES_QP_TH_RQ3 EHEA_BMASK_IBM(16, 31) 184#define H_ALL_RES_QP_TH_RQ3 EHEA_BMASK_IBM(16, 31)
185/* Threshold RQ3 */ 185/* Threshold RQ3 */
186 186
187/* output param R6 */ 187/* output param R6 */
188#define H_ALL_RES_QP_ACT_SWQE EHEA_BMASK_IBM(0, 15) 188#define H_ALL_RES_QP_ACT_SWQE EHEA_BMASK_IBM(0, 15)
189#define H_ALL_RES_QP_ACT_R1WQE EHEA_BMASK_IBM(16, 31) 189#define H_ALL_RES_QP_ACT_R1WQE EHEA_BMASK_IBM(16, 31)
190#define H_ALL_RES_QP_ACT_R2WQE EHEA_BMASK_IBM(32, 47) 190#define H_ALL_RES_QP_ACT_R2WQE EHEA_BMASK_IBM(32, 47)
191#define H_ALL_RES_QP_ACT_R3WQE EHEA_BMASK_IBM(48, 63) 191#define H_ALL_RES_QP_ACT_R3WQE EHEA_BMASK_IBM(48, 63)
192 192
193/* output param, R7 */ 193/* output param, R7 */
194#define H_ALL_RES_QP_ACT_SSGE EHEA_BMASK_IBM(0, 7) 194#define H_ALL_RES_QP_ACT_SSGE EHEA_BMASK_IBM(0, 7)
195#define H_ALL_RES_QP_ACT_R1SGE EHEA_BMASK_IBM(8, 15) 195#define H_ALL_RES_QP_ACT_R1SGE EHEA_BMASK_IBM(8, 15)
196#define H_ALL_RES_QP_ACT_R2SGE EHEA_BMASK_IBM(16, 23) 196#define H_ALL_RES_QP_ACT_R2SGE EHEA_BMASK_IBM(16, 23)
197#define H_ALL_RES_QP_ACT_R3SGE EHEA_BMASK_IBM(24, 31) 197#define H_ALL_RES_QP_ACT_R3SGE EHEA_BMASK_IBM(24, 31)
198#define H_ALL_RES_QP_ACT_SWQE_IDL EHEA_BMASK_IBM(32, 39) 198#define H_ALL_RES_QP_ACT_SWQE_IDL EHEA_BMASK_IBM(32, 39)
199 199
200/* output param R8,R9 */ 200/* output param R8,R9 */
201#define H_ALL_RES_QP_SIZE_SQ EHEA_BMASK_IBM(0, 31) 201#define H_ALL_RES_QP_SIZE_SQ EHEA_BMASK_IBM(0, 31)
202#define H_ALL_RES_QP_SIZE_RQ1 EHEA_BMASK_IBM(32, 63) 202#define H_ALL_RES_QP_SIZE_RQ1 EHEA_BMASK_IBM(32, 63)
203#define H_ALL_RES_QP_SIZE_RQ2 EHEA_BMASK_IBM(0, 31) 203#define H_ALL_RES_QP_SIZE_RQ2 EHEA_BMASK_IBM(0, 31)
204#define H_ALL_RES_QP_SIZE_RQ3 EHEA_BMASK_IBM(32, 63) 204#define H_ALL_RES_QP_SIZE_RQ3 EHEA_BMASK_IBM(32, 63)
205 205
206/* output param R11,R12 */ 206/* output param R11,R12 */
207#define H_ALL_RES_QP_LIOBN_SQ EHEA_BMASK_IBM(0, 31) 207#define H_ALL_RES_QP_LIOBN_SQ EHEA_BMASK_IBM(0, 31)
208#define H_ALL_RES_QP_LIOBN_RQ1 EHEA_BMASK_IBM(32, 63) 208#define H_ALL_RES_QP_LIOBN_RQ1 EHEA_BMASK_IBM(32, 63)
209#define H_ALL_RES_QP_LIOBN_RQ2 EHEA_BMASK_IBM(0, 31) 209#define H_ALL_RES_QP_LIOBN_RQ2 EHEA_BMASK_IBM(0, 31)
210#define H_ALL_RES_QP_LIOBN_RQ3 EHEA_BMASK_IBM(32, 63) 210#define H_ALL_RES_QP_LIOBN_RQ3 EHEA_BMASK_IBM(32, 63)
211 211
212u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, 212u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
213 struct ehea_qp_init_attr *init_attr, const u32 pd, 213 struct ehea_qp_init_attr *init_attr, const u32 pd,
@@ -334,28 +334,28 @@ u64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
334} 334}
335 335
336/* Defines for H_CALL H_ALLOC_RESOURCE */ 336/* Defines for H_CALL H_ALLOC_RESOURCE */
337#define H_ALL_RES_TYPE_QP 1 337#define H_ALL_RES_TYPE_QP 1
338#define H_ALL_RES_TYPE_CQ 2 338#define H_ALL_RES_TYPE_CQ 2
339#define H_ALL_RES_TYPE_EQ 3 339#define H_ALL_RES_TYPE_EQ 3
340#define H_ALL_RES_TYPE_MR 5 340#define H_ALL_RES_TYPE_MR 5
341#define H_ALL_RES_TYPE_MW 6 341#define H_ALL_RES_TYPE_MW 6
342 342
343/* input param R5 */ 343/* input param R5 */
344#define H_ALL_RES_EQ_NEQ EHEA_BMASK_IBM(0, 0) 344#define H_ALL_RES_EQ_NEQ EHEA_BMASK_IBM(0, 0)
345#define H_ALL_RES_EQ_NON_NEQ_ISN EHEA_BMASK_IBM(6, 7) 345#define H_ALL_RES_EQ_NON_NEQ_ISN EHEA_BMASK_IBM(6, 7)
346#define H_ALL_RES_EQ_INH_EQE_GEN EHEA_BMASK_IBM(16, 16) 346#define H_ALL_RES_EQ_INH_EQE_GEN EHEA_BMASK_IBM(16, 16)
347#define H_ALL_RES_EQ_RES_TYPE EHEA_BMASK_IBM(56, 63) 347#define H_ALL_RES_EQ_RES_TYPE EHEA_BMASK_IBM(56, 63)
348/* input param R6 */ 348/* input param R6 */
349#define H_ALL_RES_EQ_MAX_EQE EHEA_BMASK_IBM(32, 63) 349#define H_ALL_RES_EQ_MAX_EQE EHEA_BMASK_IBM(32, 63)
350 350
351/* output param R6 */ 351/* output param R6 */
352#define H_ALL_RES_EQ_LIOBN EHEA_BMASK_IBM(32, 63) 352#define H_ALL_RES_EQ_LIOBN EHEA_BMASK_IBM(32, 63)
353 353
354/* output param R7 */ 354/* output param R7 */
355#define H_ALL_RES_EQ_ACT_EQE EHEA_BMASK_IBM(32, 63) 355#define H_ALL_RES_EQ_ACT_EQE EHEA_BMASK_IBM(32, 63)
356 356
357/* output param R8 */ 357/* output param R8 */
358#define H_ALL_RES_EQ_ACT_PS EHEA_BMASK_IBM(32, 63) 358#define H_ALL_RES_EQ_ACT_PS EHEA_BMASK_IBM(32, 63)
359 359
360/* output param R9 */ 360/* output param R9 */
361#define H_ALL_RES_EQ_ACT_EQ_IST_C EHEA_BMASK_IBM(30, 31) 361#define H_ALL_RES_EQ_ACT_EQ_IST_C EHEA_BMASK_IBM(30, 31)
@@ -453,12 +453,12 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
453 453
454 hret = ehea_plpar_hcall9(H_REGISTER_SMR, 454 hret = ehea_plpar_hcall9(H_REGISTER_SMR,
455 outs, 455 outs,
456 adapter_handle , /* R4 */ 456 adapter_handle , /* R4 */
457 orig_mr_handle, /* R5 */ 457 orig_mr_handle, /* R5 */
458 vaddr_in, /* R6 */ 458 vaddr_in, /* R6 */
459 (((u64)access_ctrl) << 32ULL), /* R7 */ 459 (((u64)access_ctrl) << 32ULL), /* R7 */
460 pd, /* R8 */ 460 pd, /* R8 */
461 0, 0, 0, 0); /* R9-R12 */ 461 0, 0, 0, 0); /* R9-R12 */
462 462
463 mr->handle = outs[0]; 463 mr->handle = outs[0];
464 mr->lkey = (u32)outs[2]; 464 mr->lkey = (u32)outs[2];
@@ -471,11 +471,11 @@ u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle)
471 u64 outs[PLPAR_HCALL9_BUFSIZE]; 471 u64 outs[PLPAR_HCALL9_BUFSIZE];
472 472
473 return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA, 473 return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA,
474 outs, 474 outs,
475 adapter_handle, /* R4 */ 475 adapter_handle, /* R4 */
476 H_DISABLE_GET_EHEA_WQE_P, /* R5 */ 476 H_DISABLE_GET_EHEA_WQE_P, /* R5 */
477 qp_handle, /* R6 */ 477 qp_handle, /* R6 */
478 0, 0, 0, 0, 0, 0); /* R7-R12 */ 478 0, 0, 0, 0, 0, 0); /* R7-R12 */
479} 479}
480 480
481u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle, 481u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle,
@@ -483,9 +483,9 @@ u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle,
483{ 483{
484 return ehea_plpar_hcall_norets(H_FREE_RESOURCE, 484 return ehea_plpar_hcall_norets(H_FREE_RESOURCE,
485 adapter_handle, /* R4 */ 485 adapter_handle, /* R4 */
486 res_handle, /* R5 */ 486 res_handle, /* R5 */
487 force_bit, 487 force_bit,
488 0, 0, 0, 0); /* R7-R10 */ 488 0, 0, 0, 0); /* R7-R10 */
489} 489}
490 490
491u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, 491u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
@@ -493,13 +493,13 @@ u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
493 const u32 pd, u64 *mr_handle, u32 *lkey) 493 const u32 pd, u64 *mr_handle, u32 *lkey)
494{ 494{
495 u64 hret; 495 u64 hret;
496 u64 outs[PLPAR_HCALL9_BUFSIZE]; 496 u64 outs[PLPAR_HCALL9_BUFSIZE];
497 497
498 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE, 498 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
499 outs, 499 outs,
500 adapter_handle, /* R4 */ 500 adapter_handle, /* R4 */
501 5, /* R5 */ 501 5, /* R5 */
502 vaddr, /* R6 */ 502 vaddr, /* R6 */
503 length, /* R7 */ 503 length, /* R7 */
504 (((u64) access_ctrl) << 32ULL), /* R8 */ 504 (((u64) access_ctrl) << 32ULL), /* R8 */
505 pd, /* R9 */ 505 pd, /* R9 */
@@ -619,8 +619,8 @@ u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
619 void *rblock) 619 void *rblock)
620{ 620{
621 return ehea_plpar_hcall_norets(H_ERROR_DATA, 621 return ehea_plpar_hcall_norets(H_ERROR_DATA,
622 adapter_handle, /* R4 */ 622 adapter_handle, /* R4 */
623 ressource_handle, /* R5 */ 623 ressource_handle, /* R5 */
624 virt_to_abs(rblock), /* R6 */ 624 virt_to_abs(rblock), /* R6 */
625 0, 0, 0, 0); /* R7-R12 */ 625 0, 0, 0, 0); /* R7-R12 */
626} 626}
diff --git a/drivers/net/ehea/ehea_phyp.h b/drivers/net/ehea/ehea_phyp.h
index faa191d23b86..f3628c803567 100644
--- a/drivers/net/ehea/ehea_phyp.h
+++ b/drivers/net/ehea/ehea_phyp.h
@@ -93,7 +93,7 @@ static inline void hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel,
93static inline void hcp_epas_dtor(struct h_epas *epas) 93static inline void hcp_epas_dtor(struct h_epas *epas)
94{ 94{
95 if (epas->kernel.addr) 95 if (epas->kernel.addr)
96 iounmap((void __iomem*)((u64)epas->kernel.addr & PAGE_MASK)); 96 iounmap((void __iomem *)((u64)epas->kernel.addr & PAGE_MASK));
97 97
98 epas->user.addr = 0; 98 epas->user.addr = 0;
99 epas->kernel.addr = 0; 99 epas->kernel.addr = 0;
@@ -388,23 +388,23 @@ u64 ehea_h_modify_ehea_qp(const u64 adapter_handle,
388 const u64 qp_handle, 388 const u64 qp_handle,
389 const u64 sel_mask, 389 const u64 sel_mask,
390 void *cb_addr, 390 void *cb_addr,
391 u64 * inv_attr_id, 391 u64 *inv_attr_id,
392 u64 * proc_mask, u16 * out_swr, u16 * out_rwr); 392 u64 *proc_mask, u16 *out_swr, u16 *out_rwr);
393 393
394u64 ehea_h_alloc_resource_eq(const u64 adapter_handle, 394u64 ehea_h_alloc_resource_eq(const u64 adapter_handle,
395 struct ehea_eq_attr *eq_attr, u64 * eq_handle); 395 struct ehea_eq_attr *eq_attr, u64 *eq_handle);
396 396
397u64 ehea_h_alloc_resource_cq(const u64 adapter_handle, 397u64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
398 struct ehea_cq_attr *cq_attr, 398 struct ehea_cq_attr *cq_attr,
399 u64 * cq_handle, struct h_epas *epas); 399 u64 *cq_handle, struct h_epas *epas);
400 400
401u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, 401u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
402 struct ehea_qp_init_attr *init_attr, 402 struct ehea_qp_init_attr *init_attr,
403 const u32 pd, 403 const u32 pd,
404 u64 * qp_handle, struct h_epas *h_epas); 404 u64 *qp_handle, struct h_epas *h_epas);
405 405
406#define H_REG_RPAGE_PAGE_SIZE EHEA_BMASK_IBM(48,55) 406#define H_REG_RPAGE_PAGE_SIZE EHEA_BMASK_IBM(48, 55)
407#define H_REG_RPAGE_QT EHEA_BMASK_IBM(62,63) 407#define H_REG_RPAGE_QT EHEA_BMASK_IBM(62, 63)
408 408
409u64 ehea_h_register_rpage(const u64 adapter_handle, 409u64 ehea_h_register_rpage(const u64 adapter_handle,
410 const u8 pagesize, 410 const u8 pagesize,
@@ -426,7 +426,7 @@ u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle,
426 426
427u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, 427u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
428 const u64 length, const u32 access_ctrl, 428 const u64 length, const u32 access_ctrl,
429 const u32 pd, u64 * mr_handle, u32 * lkey); 429 const u32 pd, u64 *mr_handle, u32 *lkey);
430 430
431u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle, 431u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle,
432 const u8 pagesize, const u8 queue_type, 432 const u8 pagesize, const u8 queue_type,
@@ -439,8 +439,8 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
439u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr); 439u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr);
440 440
441/* output param R5 */ 441/* output param R5 */
442#define H_MEHEAPORT_CAT EHEA_BMASK_IBM(40,47) 442#define H_MEHEAPORT_CAT EHEA_BMASK_IBM(40, 47)
443#define H_MEHEAPORT_PN EHEA_BMASK_IBM(48,63) 443#define H_MEHEAPORT_PN EHEA_BMASK_IBM(48, 63)
444 444
445u64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num, 445u64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num,
446 const u8 cb_cat, const u64 select_mask, 446 const u8 cb_cat, const u64 select_mask,
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 83b76432b41a..d522e905f460 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -33,8 +33,6 @@
33 33
34 34
35struct ehea_busmap ehea_bmap = { 0, 0, NULL }; 35struct ehea_busmap ehea_bmap = { 0, 0, NULL };
36extern u64 ehea_driver_flags;
37extern struct work_struct ehea_rereg_mr_task;
38 36
39 37
40static void *hw_qpageit_get_inc(struct hw_queue *queue) 38static void *hw_qpageit_get_inc(struct hw_queue *queue)
@@ -65,7 +63,7 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages,
65 } 63 }
66 64
67 queue->queue_length = nr_of_pages * pagesize; 65 queue->queue_length = nr_of_pages * pagesize;
68 queue->queue_pages = kmalloc(nr_of_pages * sizeof(void*), GFP_KERNEL); 66 queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL);
69 if (!queue->queue_pages) { 67 if (!queue->queue_pages) {
70 ehea_error("no mem for queue_pages"); 68 ehea_error("no mem for queue_pages");
71 return -ENOMEM; 69 return -ENOMEM;
@@ -78,11 +76,11 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages,
78 */ 76 */
79 i = 0; 77 i = 0;
80 while (i < nr_of_pages) { 78 while (i < nr_of_pages) {
81 u8 *kpage = (u8*)get_zeroed_page(GFP_KERNEL); 79 u8 *kpage = (u8 *)get_zeroed_page(GFP_KERNEL);
82 if (!kpage) 80 if (!kpage)
83 goto out_nomem; 81 goto out_nomem;
84 for (k = 0; k < pages_per_kpage && i < nr_of_pages; k++) { 82 for (k = 0; k < pages_per_kpage && i < nr_of_pages; k++) {
85 (queue->queue_pages)[i] = (struct ehea_page*)kpage; 83 (queue->queue_pages)[i] = (struct ehea_page *)kpage;
86 kpage += pagesize; 84 kpage += pagesize;
87 i++; 85 i++;
88 } 86 }
@@ -235,8 +233,8 @@ int ehea_destroy_cq(struct ehea_cq *cq)
235 return 0; 233 return 0;
236 234
237 hcp_epas_dtor(&cq->epas); 235 hcp_epas_dtor(&cq->epas);
238 236 hret = ehea_destroy_cq_res(cq, NORMAL_FREE);
239 if ((hret = ehea_destroy_cq_res(cq, NORMAL_FREE)) == H_R_STATE) { 237 if (hret == H_R_STATE) {
240 ehea_error_data(cq->adapter, cq->fw_handle); 238 ehea_error_data(cq->adapter, cq->fw_handle);
241 hret = ehea_destroy_cq_res(cq, FORCE_FREE); 239 hret = ehea_destroy_cq_res(cq, FORCE_FREE);
242 } 240 }
@@ -301,13 +299,13 @@ struct ehea_eq *ehea_create_eq(struct ehea_adapter *adapter,
301 if (i == (eq->attr.nr_pages - 1)) { 299 if (i == (eq->attr.nr_pages - 1)) {
302 /* last page */ 300 /* last page */
303 vpage = hw_qpageit_get_inc(&eq->hw_queue); 301 vpage = hw_qpageit_get_inc(&eq->hw_queue);
304 if ((hret != H_SUCCESS) || (vpage)) { 302 if ((hret != H_SUCCESS) || (vpage))
305 goto out_kill_hwq; 303 goto out_kill_hwq;
306 } 304
307 } else { 305 } else {
308 if ((hret != H_PAGE_REGISTERED) || (!vpage)) { 306 if ((hret != H_PAGE_REGISTERED) || (!vpage))
309 goto out_kill_hwq; 307 goto out_kill_hwq;
310 } 308
311 } 309 }
312 } 310 }
313 311
@@ -331,7 +329,7 @@ struct ehea_eqe *ehea_poll_eq(struct ehea_eq *eq)
331 unsigned long flags; 329 unsigned long flags;
332 330
333 spin_lock_irqsave(&eq->spinlock, flags); 331 spin_lock_irqsave(&eq->spinlock, flags);
334 eqe = (struct ehea_eqe*)hw_eqit_eq_get_inc_valid(&eq->hw_queue); 332 eqe = (struct ehea_eqe *)hw_eqit_eq_get_inc_valid(&eq->hw_queue);
335 spin_unlock_irqrestore(&eq->spinlock, flags); 333 spin_unlock_irqrestore(&eq->spinlock, flags);
336 334
337 return eqe; 335 return eqe;
@@ -364,7 +362,8 @@ int ehea_destroy_eq(struct ehea_eq *eq)
364 362
365 hcp_epas_dtor(&eq->epas); 363 hcp_epas_dtor(&eq->epas);
366 364
367 if ((hret = ehea_destroy_eq_res(eq, NORMAL_FREE)) == H_R_STATE) { 365 hret = ehea_destroy_eq_res(eq, NORMAL_FREE);
366 if (hret == H_R_STATE) {
368 ehea_error_data(eq->adapter, eq->fw_handle); 367 ehea_error_data(eq->adapter, eq->fw_handle);
369 hret = ehea_destroy_eq_res(eq, FORCE_FREE); 368 hret = ehea_destroy_eq_res(eq, FORCE_FREE);
370 } 369 }
@@ -546,7 +545,8 @@ int ehea_destroy_qp(struct ehea_qp *qp)
546 545
547 hcp_epas_dtor(&qp->epas); 546 hcp_epas_dtor(&qp->epas);
548 547
549 if ((hret = ehea_destroy_qp_res(qp, NORMAL_FREE)) == H_R_STATE) { 548 hret = ehea_destroy_qp_res(qp, NORMAL_FREE);
549 if (hret == H_R_STATE) {
550 ehea_error_data(qp->adapter, qp->fw_handle); 550 ehea_error_data(qp->adapter, qp->fw_handle);
551 hret = ehea_destroy_qp_res(qp, FORCE_FREE); 551 hret = ehea_destroy_qp_res(qp, FORCE_FREE);
552 } 552 }
@@ -559,7 +559,7 @@ int ehea_destroy_qp(struct ehea_qp *qp)
559 return 0; 559 return 0;
560} 560}
561 561
562int ehea_create_busmap( void ) 562int ehea_create_busmap(void)
563{ 563{
564 u64 vaddr = EHEA_BUSMAP_START; 564 u64 vaddr = EHEA_BUSMAP_START;
565 unsigned long high_section_index = 0; 565 unsigned long high_section_index = 0;
@@ -595,7 +595,7 @@ int ehea_create_busmap( void )
595 return 0; 595 return 0;
596} 596}
597 597
598void ehea_destroy_busmap( void ) 598void ehea_destroy_busmap(void)
599{ 599{
600 vfree(ehea_bmap.vaddr); 600 vfree(ehea_bmap.vaddr);
601} 601}
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index bc62d389c166..0bb6f92fa2f8 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -41,8 +41,8 @@
41#define EHEA_SECTSIZE (1UL << 24) 41#define EHEA_SECTSIZE (1UL << 24)
42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT) 42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT)
43 43
44#if (1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE 44#if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE)
45#error eHEA module can't work if kernel sectionsize < ehea sectionsize 45#error eHEA module cannot work if kernel sectionsize < ehea sectionsize
46#endif 46#endif
47 47
48/* Some abbreviations used here: 48/* Some abbreviations used here:
@@ -188,8 +188,8 @@ struct ehea_eqe {
188 u64 entry; 188 u64 entry;
189}; 189};
190 190
191#define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52,63) 191#define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52, 63)
192#define ERROR_DATA_TYPE EHEA_BMASK_IBM(0,7) 192#define ERROR_DATA_TYPE EHEA_BMASK_IBM(0, 7)
193 193
194static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset) 194static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset)
195{ 195{
@@ -279,7 +279,7 @@ static inline void *hw_qeit_eq_get_inc(struct hw_queue *queue)
279static inline void *hw_eqit_eq_get_inc_valid(struct hw_queue *queue) 279static inline void *hw_eqit_eq_get_inc_valid(struct hw_queue *queue)
280{ 280{
281 void *retvalue = hw_qeit_get(queue); 281 void *retvalue = hw_qeit_get(queue);
282 u32 qe = *(u8*)retvalue; 282 u32 qe = *(u8 *)retvalue;
283 if ((qe >> 7) == (queue->toggle_state & 1)) 283 if ((qe >> 7) == (queue->toggle_state & 1))
284 hw_qeit_eq_get_inc(queue); 284 hw_qeit_eq_get_inc(queue);
285 else 285 else
@@ -364,7 +364,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, int cqe,
364 364
365int ehea_destroy_cq(struct ehea_cq *cq); 365int ehea_destroy_cq(struct ehea_cq *cq);
366 366
367struct ehea_qp *ehea_create_qp(struct ehea_adapter * adapter, u32 pd, 367struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, u32 pd,
368 struct ehea_qp_init_attr *init_attr); 368 struct ehea_qp_init_attr *init_attr);
369 369
370int ehea_destroy_qp(struct ehea_qp *qp); 370int ehea_destroy_qp(struct ehea_qp *qp);
@@ -378,8 +378,8 @@ int ehea_rem_mr(struct ehea_mr *mr);
378 378
379void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle); 379void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle);
380 380
381int ehea_create_busmap( void ); 381int ehea_create_busmap(void);
382void ehea_destroy_busmap( void ); 382void ehea_destroy_busmap(void);
383u64 ehea_map_vaddr(void *caddr); 383u64 ehea_map_vaddr(void *caddr);
384 384
385#endif /* __EHEA_QMR_H__ */ 385#endif /* __EHEA_QMR_H__ */
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 7667a62ac31f..36342230a6de 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2004 Andrew de Quincey (wol support) 13 * Copyright (C) 2004 Andrew de Quincey (wol support)
14 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane 14 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane
15 * IRQ rate fixes, bigendian fixes, cleanups, verification) 15 * IRQ rate fixes, bigendian fixes, cleanups, verification)
16 * Copyright (c) 2004,5,6 NVIDIA Corporation 16 * Copyright (c) 2004,2005,2006,2007,2008 NVIDIA Corporation
17 * 17 *
18 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
@@ -226,7 +226,7 @@ enum {
226#define NVREG_MISC1_HD 0x02 226#define NVREG_MISC1_HD 0x02
227#define NVREG_MISC1_FORCE 0x3b0f3c 227#define NVREG_MISC1_FORCE 0x3b0f3c
228 228
229 NvRegMacReset = 0x3c, 229 NvRegMacReset = 0x34,
230#define NVREG_MAC_RESET_ASSERT 0x0F3 230#define NVREG_MAC_RESET_ASSERT 0x0F3
231 NvRegTransmitterControl = 0x084, 231 NvRegTransmitterControl = 0x084,
232#define NVREG_XMITCTL_START 0x01 232#define NVREG_XMITCTL_START 0x01
@@ -277,7 +277,9 @@ enum {
277#define NVREG_MCASTADDRA_FORCE 0x01 277#define NVREG_MCASTADDRA_FORCE 0x01
278 NvRegMulticastAddrB = 0xB4, 278 NvRegMulticastAddrB = 0xB4,
279 NvRegMulticastMaskA = 0xB8, 279 NvRegMulticastMaskA = 0xB8,
280#define NVREG_MCASTMASKA_NONE 0xffffffff
280 NvRegMulticastMaskB = 0xBC, 281 NvRegMulticastMaskB = 0xBC,
282#define NVREG_MCASTMASKB_NONE 0xffff
281 283
282 NvRegPhyInterface = 0xC0, 284 NvRegPhyInterface = 0xC0,
283#define PHY_RGMII 0x10000000 285#define PHY_RGMII 0x10000000
@@ -316,8 +318,8 @@ enum {
316 NvRegTxRingPhysAddrHigh = 0x148, 318 NvRegTxRingPhysAddrHigh = 0x148,
317 NvRegRxRingPhysAddrHigh = 0x14C, 319 NvRegRxRingPhysAddrHigh = 0x14C,
318 NvRegTxPauseFrame = 0x170, 320 NvRegTxPauseFrame = 0x170,
319#define NVREG_TX_PAUSEFRAME_DISABLE 0x1ff0080 321#define NVREG_TX_PAUSEFRAME_DISABLE 0x01ff0080
320#define NVREG_TX_PAUSEFRAME_ENABLE 0x0c00030 322#define NVREG_TX_PAUSEFRAME_ENABLE 0x01800010
321 NvRegMIIStatus = 0x180, 323 NvRegMIIStatus = 0x180,
322#define NVREG_MIISTAT_ERROR 0x0001 324#define NVREG_MIISTAT_ERROR 0x0001
323#define NVREG_MIISTAT_LINKCHANGE 0x0008 325#define NVREG_MIISTAT_LINKCHANGE 0x0008
@@ -471,9 +473,9 @@ union ring_type {
471#define NV_RX_AVAIL (1<<31) 473#define NV_RX_AVAIL (1<<31)
472 474
473#define NV_RX2_CHECKSUMMASK (0x1C000000) 475#define NV_RX2_CHECKSUMMASK (0x1C000000)
474#define NV_RX2_CHECKSUMOK1 (0x10000000) 476#define NV_RX2_CHECKSUM_IP (0x10000000)
475#define NV_RX2_CHECKSUMOK2 (0x14000000) 477#define NV_RX2_CHECKSUM_IP_TCP (0x14000000)
476#define NV_RX2_CHECKSUMOK3 (0x18000000) 478#define NV_RX2_CHECKSUM_IP_UDP (0x18000000)
477#define NV_RX2_DESCRIPTORVALID (1<<29) 479#define NV_RX2_DESCRIPTORVALID (1<<29)
478#define NV_RX2_SUBSTRACT1 (1<<25) 480#define NV_RX2_SUBSTRACT1 (1<<25)
479#define NV_RX2_ERROR1 (1<<18) 481#define NV_RX2_ERROR1 (1<<18)
@@ -2375,14 +2377,9 @@ static int nv_rx_process(struct net_device *dev, int limit)
2375 goto next_pkt; 2377 goto next_pkt;
2376 } 2378 }
2377 } 2379 }
2378 if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK2)/*ip and tcp */ { 2380 if (((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_TCP) || /*ip and tcp */
2381 ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_UDP)) /*ip and udp */
2379 skb->ip_summed = CHECKSUM_UNNECESSARY; 2382 skb->ip_summed = CHECKSUM_UNNECESSARY;
2380 } else {
2381 if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK1 ||
2382 (flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK3) {
2383 skb->ip_summed = CHECKSUM_UNNECESSARY;
2384 }
2385 }
2386 } else { 2383 } else {
2387 dev_kfree_skb(skb); 2384 dev_kfree_skb(skb);
2388 goto next_pkt; 2385 goto next_pkt;
@@ -2474,14 +2471,9 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2474 } 2471 }
2475 } 2472 }
2476 2473
2477 if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK2)/*ip and tcp */ { 2474 if (((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_TCP) || /*ip and tcp */
2475 ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_UDP)) /*ip and udp */
2478 skb->ip_summed = CHECKSUM_UNNECESSARY; 2476 skb->ip_summed = CHECKSUM_UNNECESSARY;
2479 } else {
2480 if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK1 ||
2481 (flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK3) {
2482 skb->ip_summed = CHECKSUM_UNNECESSARY;
2483 }
2484 }
2485 2477
2486 /* got a valid packet - forward it to the network core */ 2478 /* got a valid packet - forward it to the network core */
2487 skb_put(skb, len); 2479 skb_put(skb, len);
@@ -2703,6 +2695,9 @@ static void nv_set_multicast(struct net_device *dev)
2703 addr[1] = alwaysOn[1]; 2695 addr[1] = alwaysOn[1];
2704 mask[0] = alwaysOn[0] | alwaysOff[0]; 2696 mask[0] = alwaysOn[0] | alwaysOff[0];
2705 mask[1] = alwaysOn[1] | alwaysOff[1]; 2697 mask[1] = alwaysOn[1] | alwaysOff[1];
2698 } else {
2699 mask[0] = NVREG_MCASTMASKA_NONE;
2700 mask[1] = NVREG_MCASTMASKB_NONE;
2706 } 2701 }
2707 } 2702 }
2708 addr[0] |= NVREG_MCASTADDRA_FORCE; 2703 addr[0] |= NVREG_MCASTADDRA_FORCE;
@@ -4813,8 +4808,8 @@ static int nv_open(struct net_device *dev)
4813 nv_mac_reset(dev); 4808 nv_mac_reset(dev);
4814 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); 4809 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA);
4815 writel(0, base + NvRegMulticastAddrB); 4810 writel(0, base + NvRegMulticastAddrB);
4816 writel(0, base + NvRegMulticastMaskA); 4811 writel(NVREG_MCASTMASKA_NONE, base + NvRegMulticastMaskA);
4817 writel(0, base + NvRegMulticastMaskB); 4812 writel(NVREG_MCASTMASKB_NONE, base + NvRegMulticastMaskB);
4818 writel(0, base + NvRegPacketFilterFlags); 4813 writel(0, base + NvRegPacketFilterFlags);
4819 4814
4820 writel(0, base + NvRegTransmitterControl); 4815 writel(0, base + NvRegTransmitterControl);
@@ -4908,8 +4903,8 @@ static int nv_open(struct net_device *dev)
4908 spin_lock_irq(&np->lock); 4903 spin_lock_irq(&np->lock);
4909 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); 4904 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA);
4910 writel(0, base + NvRegMulticastAddrB); 4905 writel(0, base + NvRegMulticastAddrB);
4911 writel(0, base + NvRegMulticastMaskA); 4906 writel(NVREG_MCASTMASKA_NONE, base + NvRegMulticastMaskA);
4912 writel(0, base + NvRegMulticastMaskB); 4907 writel(NVREG_MCASTMASKB_NONE, base + NvRegMulticastMaskB);
4913 writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); 4908 writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags);
4914 /* One manual link speed update: Interrupts are enabled, future link 4909 /* One manual link speed update: Interrupts are enabled, future link
4915 * speed changes cause interrupts and are handled by nv_link_irq(). 4910 * speed changes cause interrupts and are handled by nv_link_irq().
@@ -5603,35 +5598,35 @@ static struct pci_device_id pci_tbl[] = {
5603 }, 5598 },
5604 { /* MCP77 Ethernet Controller */ 5599 { /* MCP77 Ethernet Controller */
5605 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), 5600 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32),
5606 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5601 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5607 }, 5602 },
5608 { /* MCP77 Ethernet Controller */ 5603 { /* MCP77 Ethernet Controller */
5609 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), 5604 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33),
5610 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5605 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5611 }, 5606 },
5612 { /* MCP77 Ethernet Controller */ 5607 { /* MCP77 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), 5608 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5609 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5615 }, 5610 },
5616 { /* MCP77 Ethernet Controller */ 5611 { /* MCP77 Ethernet Controller */
5617 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), 5612 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5618 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5613 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5619 }, 5614 },
5620 { /* MCP79 Ethernet Controller */ 5615 { /* MCP79 Ethernet Controller */
5621 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), 5616 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
5622 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5617 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5623 }, 5618 },
5624 { /* MCP79 Ethernet Controller */ 5619 { /* MCP79 Ethernet Controller */
5625 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), 5620 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
5626 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5621 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5627 }, 5622 },
5628 { /* MCP79 Ethernet Controller */ 5623 { /* MCP79 Ethernet Controller */
5629 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), 5624 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
5630 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5625 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5631 }, 5626 },
5632 { /* MCP79 Ethernet Controller */ 5627 { /* MCP79 Ethernet Controller */
5633 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), 5628 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
5634 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5629 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5635 }, 5630 },
5636 {0,}, 5631 {0,},
5637}; 5632};
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 46e2c52c7862..95e3464068db 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -901,12 +901,12 @@ static short ibmlana_adapter_ids[] __initdata = {
901 0x0000 901 0x0000
902}; 902};
903 903
904static char *ibmlana_adapter_names[] __initdata = { 904static char *ibmlana_adapter_names[] __devinitdata = {
905 "IBM LAN Adapter/A", 905 "IBM LAN Adapter/A",
906 NULL 906 NULL
907}; 907};
908 908
909static int ibmlana_init_one(struct device *kdev) 909static int __devinit ibmlana_init_one(struct device *kdev)
910{ 910{
911 struct mca_device *mdev = to_mca_device(kdev); 911 struct mca_device *mdev = to_mca_device(kdev);
912 struct net_device *dev; 912 struct net_device *dev;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index f3c144d5d72f..d4eb8e2d8720 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -438,7 +438,6 @@ static int igb_request_irq(struct igb_adapter *adapter)
438 if (adapter->msix_entries) { 438 if (adapter->msix_entries) {
439 err = igb_request_msix(adapter); 439 err = igb_request_msix(adapter);
440 if (!err) { 440 if (!err) {
441 struct e1000_hw *hw = &adapter->hw;
442 /* enable IAM, auto-mask, 441 /* enable IAM, auto-mask,
443 * DO NOT USE EIAME or IAME in legacy mode */ 442 * DO NOT USE EIAME or IAME in legacy mode */
444 wr32(E1000_IAM, IMS_ENABLE_MASK); 443 wr32(E1000_IAM, IMS_ENABLE_MASK);
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e10528ed9081..81bf005ff280 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1084,7 +1084,7 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1084 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 1084 return phy_mii_ioctl(phydev, if_mii(rq), cmd);
1085} 1085}
1086 1086
1087static int __devinit macb_probe(struct platform_device *pdev) 1087static int __init macb_probe(struct platform_device *pdev)
1088{ 1088{
1089 struct eth_platform_data *pdata; 1089 struct eth_platform_data *pdata;
1090 struct resource *regs; 1090 struct resource *regs;
@@ -1248,7 +1248,7 @@ err_out:
1248 return err; 1248 return err;
1249} 1249}
1250 1250
1251static int __devexit macb_remove(struct platform_device *pdev) 1251static int __exit macb_remove(struct platform_device *pdev)
1252{ 1252{
1253 struct net_device *dev; 1253 struct net_device *dev;
1254 struct macb *bp; 1254 struct macb *bp;
@@ -1276,8 +1276,7 @@ static int __devexit macb_remove(struct platform_device *pdev)
1276} 1276}
1277 1277
1278static struct platform_driver macb_driver = { 1278static struct platform_driver macb_driver = {
1279 .probe = macb_probe, 1279 .remove = __exit_p(macb_remove),
1280 .remove = __devexit_p(macb_remove),
1281 .driver = { 1280 .driver = {
1282 .name = "macb", 1281 .name = "macb",
1283 }, 1282 },
@@ -1285,7 +1284,7 @@ static struct platform_driver macb_driver = {
1285 1284
1286static int __init macb_init(void) 1285static int __init macb_init(void)
1287{ 1286{
1288 return platform_driver_register(&macb_driver); 1287 return platform_driver_probe(&macb_driver, macb_probe);
1289} 1288}
1290 1289
1291static void __exit macb_exit(void) 1290static void __exit macb_exit(void)
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index aafc3ce59cbb..6d343efb2717 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -4,8 +4,6 @@
4 * for more details. 4 * for more details.
5 */ 5 */
6 6
7#define DEBUG
8
9#include <linux/init.h> 7#include <linux/init.h>
10#include <linux/io.h> 8#include <linux/io.h>
11#include <linux/kernel.h> 9#include <linux/kernel.h>
@@ -15,11 +13,93 @@
15#include <linux/platform_device.h> 13#include <linux/platform_device.h>
16#include <asm/mips-boards/simint.h> 14#include <asm/mips-boards/simint.h>
17 15
18#include "mipsnet.h" /* actual device IO mapping */ 16#define MIPSNET_VERSION "2007-11-17"
17
18/*
19 * Net status/control block as seen by sw in the core.
20 */
21struct mipsnet_regs {
22 /*
23 * Device info for probing, reads as MIPSNET%d where %d is some
24 * form of version.
25 */
26 u64 devId; /*0x00 */
19 27
20#define MIPSNET_VERSION "2005-06-20" 28 /*
29 * read only busy flag.
30 * Set and cleared by the Net Device to indicate that an rx or a tx
31 * is in progress.
32 */
33 u32 busy; /*0x08 */
21 34
22#define mipsnet_reg_address(dev, field) (dev->base_addr + field_offset(field)) 35 /*
36 * Set by the Net Device.
37 * The device will set it once data has been received.
38 * The value is the number of bytes that should be read from
39 * rxDataBuffer. The value will decrease till 0 until all the data
40 * from rxDataBuffer has been read.
41 */
42 u32 rxDataCount; /*0x0c */
43#define MIPSNET_MAX_RXTX_DATACOUNT (1 << 16)
44
45 /*
46 * Settable from the MIPS core, cleared by the Net Device.
47 * The core should set the number of bytes it wants to send,
48 * then it should write those bytes of data to txDataBuffer.
49 * The device will clear txDataCount has been processed (not
50 * necessarily sent).
51 */
52 u32 txDataCount; /*0x10 */
53
54 /*
55 * Interrupt control
56 *
57 * Used to clear the interrupted generated by this dev.
58 * Write a 1 to clear the interrupt. (except bit31).
59 *
60 * Bit0 is set if it was a tx-done interrupt.
61 * Bit1 is set when new rx-data is available.
62 * Until this bit is cleared there will be no other RXs.
63 *
64 * Bit31 is used for testing, it clears after a read.
65 * Writing 1 to this bit will cause an interrupt to be generated.
66 * To clear the test interrupt, write 0 to this register.
67 */
68 u32 interruptControl; /*0x14 */
69#define MIPSNET_INTCTL_TXDONE (1u << 0)
70#define MIPSNET_INTCTL_RXDONE (1u << 1)
71#define MIPSNET_INTCTL_TESTBIT (1u << 31)
72
73 /*
74 * Readonly core-specific interrupt info for the device to signal
75 * the core. The meaning of the contents of this field might change.
76 */
77 /* XXX: the whole memIntf interrupt scheme is messy: the device
78 * should have no control what so ever of what VPE/register set is
79 * being used.
80 * The MemIntf should only expose interrupt lines, and something in
81 * the config should be responsible for the line<->core/vpe bindings.
82 */
83 u32 interruptInfo; /*0x18 */
84
85 /*
86 * This is where the received data is read out.
87 * There is more data to read until rxDataReady is 0.
88 * Only 1 byte at this regs offset is used.
89 */
90 u32 rxDataBuffer; /*0x1c */
91
92 /*
93 * This is where the data to transmit is written.
94 * Data should be written for the amount specified in the
95 * txDataCount register.
96 * Only 1 byte at this regs offset is used.
97 */
98 u32 txDataBuffer; /*0x20 */
99};
100
101#define regaddr(dev, field) \
102 (dev->base_addr + offsetof(struct mipsnet_regs, field))
23 103
24static char mipsnet_string[] = "mipsnet"; 104static char mipsnet_string[] = "mipsnet";
25 105
@@ -29,32 +109,27 @@ static char mipsnet_string[] = "mipsnet";
29static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata, 109static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata,
30 int len) 110 int len)
31{ 111{
32 uint32_t available_len = inl(mipsnet_reg_address(dev, rxDataCount));
33
34 if (available_len < len)
35 return -EFAULT;
36
37 for (; len > 0; len--, kdata++) 112 for (; len > 0; len--, kdata++)
38 *kdata = inb(mipsnet_reg_address(dev, rxDataBuffer)); 113 *kdata = inb(regaddr(dev, rxDataBuffer));
39 114
40 return inl(mipsnet_reg_address(dev, rxDataCount)); 115 return inl(regaddr(dev, rxDataCount));
41} 116}
42 117
43static inline ssize_t mipsnet_put_todevice(struct net_device *dev, 118static inline void mipsnet_put_todevice(struct net_device *dev,
44 struct sk_buff *skb) 119 struct sk_buff *skb)
45{ 120{
46 int count_to_go = skb->len; 121 int count_to_go = skb->len;
47 char *buf_ptr = skb->data; 122 char *buf_ptr = skb->data;
48 123
49 outl(skb->len, mipsnet_reg_address(dev, txDataCount)); 124 outl(skb->len, regaddr(dev, txDataCount));
50 125
51 for (; count_to_go; buf_ptr++, count_to_go--) 126 for (; count_to_go; buf_ptr++, count_to_go--)
52 outb(*buf_ptr, mipsnet_reg_address(dev, txDataBuffer)); 127 outb(*buf_ptr, regaddr(dev, txDataBuffer));
53 128
54 dev->stats.tx_packets++; 129 dev->stats.tx_packets++;
55 dev->stats.tx_bytes += skb->len; 130 dev->stats.tx_bytes += skb->len;
56 131
57 return skb->len; 132 dev_kfree_skb(skb);
58} 133}
59 134
60static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev) 135static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -69,18 +144,20 @@ static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev)
69 return 0; 144 return 0;
70} 145}
71 146
72static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count) 147static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t len)
73{ 148{
74 struct sk_buff *skb; 149 struct sk_buff *skb;
75 size_t len = count;
76 150
77 skb = alloc_skb(len + 2, GFP_KERNEL); 151 if (!len)
152 return len;
153
154 skb = dev_alloc_skb(len + NET_IP_ALIGN);
78 if (!skb) { 155 if (!skb) {
79 dev->stats.rx_dropped++; 156 dev->stats.rx_dropped++;
80 return -ENOMEM; 157 return -ENOMEM;
81 } 158 }
82 159
83 skb_reserve(skb, 2); 160 skb_reserve(skb, NET_IP_ALIGN);
84 if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) 161 if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len))
85 return -EFAULT; 162 return -EFAULT;
86 163
@@ -92,50 +169,42 @@ static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count)
92 dev->stats.rx_packets++; 169 dev->stats.rx_packets++;
93 dev->stats.rx_bytes += len; 170 dev->stats.rx_bytes += len;
94 171
95 return count; 172 return len;
96} 173}
97 174
98static irqreturn_t mipsnet_interrupt(int irq, void *dev_id) 175static irqreturn_t mipsnet_interrupt(int irq, void *dev_id)
99{ 176{
100 struct net_device *dev = dev_id; 177 struct net_device *dev = dev_id;
101 178 u32 int_flags;
102 irqreturn_t retval = IRQ_NONE; 179 irqreturn_t ret = IRQ_NONE;
103 uint64_t interruptFlags; 180
104 181 if (irq != dev->irq)
105 if (irq == dev->irq) { 182 goto out_badirq;
106 retval = IRQ_HANDLED; 183
107 184 /* TESTBIT is cleared on read. */
108 interruptFlags = 185 int_flags = inl(regaddr(dev, interruptControl));
109 inl(mipsnet_reg_address(dev, interruptControl)); 186 if (int_flags & MIPSNET_INTCTL_TESTBIT) {
110 187 /* TESTBIT takes effect after a write with 0. */
111 if (interruptFlags & MIPSNET_INTCTL_TXDONE) { 188 outl(0, regaddr(dev, interruptControl));
112 outl(MIPSNET_INTCTL_TXDONE, 189 ret = IRQ_HANDLED;
113 mipsnet_reg_address(dev, interruptControl)); 190 } else if (int_flags & MIPSNET_INTCTL_TXDONE) {
114 /* only one packet at a time, we are done. */ 191 /* Only one packet at a time, we are done. */
115 netif_wake_queue(dev); 192 dev->stats.tx_packets++;
116 } else if (interruptFlags & MIPSNET_INTCTL_RXDONE) { 193 netif_wake_queue(dev);
117 mipsnet_get_fromdev(dev, 194 outl(MIPSNET_INTCTL_TXDONE,
118 inl(mipsnet_reg_address(dev, rxDataCount))); 195 regaddr(dev, interruptControl));
119 outl(MIPSNET_INTCTL_RXDONE, 196 ret = IRQ_HANDLED;
120 mipsnet_reg_address(dev, interruptControl)); 197 } else if (int_flags & MIPSNET_INTCTL_RXDONE) {
121 198 mipsnet_get_fromdev(dev, inl(regaddr(dev, rxDataCount)));
122 } else if (interruptFlags & MIPSNET_INTCTL_TESTBIT) { 199 outl(MIPSNET_INTCTL_RXDONE, regaddr(dev, interruptControl));
123 /* 200 ret = IRQ_HANDLED;
124 * TESTBIT is cleared on read.
125 * And takes effect after a write with 0
126 */
127 outl(0, mipsnet_reg_address(dev, interruptControl));
128 } else {
129 /* Maybe shared IRQ, just ignore, no clearing. */
130 retval = IRQ_NONE;
131 }
132
133 } else {
134 printk(KERN_INFO "%s: %s(): irq %d for unknown device\n",
135 dev->name, __FUNCTION__, irq);
136 retval = IRQ_NONE;
137 } 201 }
138 return retval; 202 return ret;
203
204out_badirq:
205 printk(KERN_INFO "%s: %s(): irq %d for unknown device\n",
206 dev->name, __FUNCTION__, irq);
207 return ret;
139} 208}
140 209
141static int mipsnet_open(struct net_device *dev) 210static int mipsnet_open(struct net_device *dev)
@@ -144,18 +213,15 @@ static int mipsnet_open(struct net_device *dev)
144 213
145 err = request_irq(dev->irq, &mipsnet_interrupt, 214 err = request_irq(dev->irq, &mipsnet_interrupt,
146 IRQF_SHARED, dev->name, (void *) dev); 215 IRQF_SHARED, dev->name, (void *) dev);
147
148 if (err) { 216 if (err) {
149 release_region(dev->base_addr, MIPSNET_IO_EXTENT); 217 release_region(dev->base_addr, sizeof(struct mipsnet_regs));
150 return err; 218 return err;
151 } 219 }
152 220
153 netif_start_queue(dev); 221 netif_start_queue(dev);
154 222
155 /* test interrupt handler */ 223 /* test interrupt handler */
156 outl(MIPSNET_INTCTL_TESTBIT, 224 outl(MIPSNET_INTCTL_TESTBIT, regaddr(dev, interruptControl));
157 mipsnet_reg_address(dev, interruptControl));
158
159 225
160 return 0; 226 return 0;
161} 227}
@@ -163,7 +229,7 @@ static int mipsnet_open(struct net_device *dev)
163static int mipsnet_close(struct net_device *dev) 229static int mipsnet_close(struct net_device *dev)
164{ 230{
165 netif_stop_queue(dev); 231 netif_stop_queue(dev);
166 232 free_irq(dev->irq, dev);
167 return 0; 233 return 0;
168} 234}
169 235
@@ -194,10 +260,11 @@ static int __init mipsnet_probe(struct device *dev)
194 */ 260 */
195 netdev->base_addr = 0x4200; 261 netdev->base_addr = 0x4200;
196 netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 + 262 netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 +
197 inl(mipsnet_reg_address(netdev, interruptInfo)); 263 inl(regaddr(netdev, interruptInfo));
198 264
199 /* Get the io region now, get irq on open() */ 265 /* Get the io region now, get irq on open() */
200 if (!request_region(netdev->base_addr, MIPSNET_IO_EXTENT, "mipsnet")) { 266 if (!request_region(netdev->base_addr, sizeof(struct mipsnet_regs),
267 "mipsnet")) {
201 err = -EBUSY; 268 err = -EBUSY;
202 goto out_free_netdev; 269 goto out_free_netdev;
203 } 270 }
@@ -217,7 +284,7 @@ static int __init mipsnet_probe(struct device *dev)
217 return 0; 284 return 0;
218 285
219out_free_region: 286out_free_region:
220 release_region(netdev->base_addr, MIPSNET_IO_EXTENT); 287 release_region(netdev->base_addr, sizeof(struct mipsnet_regs));
221 288
222out_free_netdev: 289out_free_netdev:
223 free_netdev(netdev); 290 free_netdev(netdev);
@@ -231,7 +298,7 @@ static int __devexit mipsnet_device_remove(struct device *device)
231 struct net_device *dev = dev_get_drvdata(device); 298 struct net_device *dev = dev_get_drvdata(device);
232 299
233 unregister_netdev(dev); 300 unregister_netdev(dev);
234 release_region(dev->base_addr, MIPSNET_IO_EXTENT); 301 release_region(dev->base_addr, sizeof(struct mipsnet_regs));
235 free_netdev(dev); 302 free_netdev(dev);
236 dev_set_drvdata(device, NULL); 303 dev_set_drvdata(device, NULL);
237 304
diff --git a/drivers/net/mipsnet.h b/drivers/net/mipsnet.h
deleted file mode 100644
index 0132c6714a40..000000000000
--- a/drivers/net/mipsnet.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 */
6#ifndef __MIPSNET_H
7#define __MIPSNET_H
8
9/*
10 * Id of this Net device, as seen by the core.
11 */
12#define MIPS_NET_DEV_ID ((uint64_t) \
13 ((uint64_t) 'M' << 0)| \
14 ((uint64_t) 'I' << 8)| \
15 ((uint64_t) 'P' << 16)| \
16 ((uint64_t) 'S' << 24)| \
17 ((uint64_t) 'N' << 32)| \
18 ((uint64_t) 'E' << 40)| \
19 ((uint64_t) 'T' << 48)| \
20 ((uint64_t) '0' << 56))
21
22/*
23 * Net status/control block as seen by sw in the core.
24 * (Why not use bit fields? can't be bothered with cross-platform struct
25 * packing.)
26 */
27struct net_control_block {
28 /*
29 * dev info for probing
30 * reads as MIPSNET%d where %d is some form of version
31 */
32 uint64_t devId; /* 0x00 */
33
34 /*
35 * read only busy flag.
36 * Set and cleared by the Net Device to indicate that an rx or a tx
37 * is in progress.
38 */
39 uint32_t busy; /* 0x08 */
40
41 /*
42 * Set by the Net Device.
43 * The device will set it once data has been received.
44 * The value is the number of bytes that should be read from
45 * rxDataBuffer. The value will decrease till 0 until all the data
46 * from rxDataBuffer has been read.
47 */
48 uint32_t rxDataCount; /* 0x0c */
49#define MIPSNET_MAX_RXTX_DATACOUNT (1<<16)
50
51 /*
52 * Settable from the MIPS core, cleared by the Net Device. The core
53 * should set the number of bytes it wants to send, then it should
54 * write those bytes of data to txDataBuffer. The device will clear
55 * txDataCount has been processed (not necessarily sent).
56 */
57 uint32_t txDataCount; /* 0x10 */
58
59 /*
60 * Interrupt control
61 *
62 * Used to clear the interrupted generated by this dev.
63 * Write a 1 to clear the interrupt. (except bit31).
64 *
65 * Bit0 is set if it was a tx-done interrupt.
66 * Bit1 is set when new rx-data is available.
67 * Until this bit is cleared there will be no other RXs.
68 *
69 * Bit31 is used for testing, it clears after a read.
70 * Writing 1 to this bit will cause an interrupt to be generated.
71 * To clear the test interrupt, write 0 to this register.
72 */
73 uint32_t interruptControl; /*0x14 */
74#define MIPSNET_INTCTL_TXDONE ((uint32_t)(1 << 0))
75#define MIPSNET_INTCTL_RXDONE ((uint32_t)(1 << 1))
76#define MIPSNET_INTCTL_TESTBIT ((uint32_t)(1 << 31))
77#define MIPSNET_INTCTL_ALLSOURCES (MIPSNET_INTCTL_TXDONE | \
78 MIPSNET_INTCTL_RXDONE | \
79 MIPSNET_INTCTL_TESTBIT)
80
81 /*
82 * Readonly core-specific interrupt info for the device to signal the
83 * core. The meaning of the contents of this field might change.
84 *
85 * TODO: the whole memIntf interrupt scheme is messy: the device should
86 * have no control what so ever of what VPE/register set is being
87 * used. The MemIntf should only expose interrupt lines, and
88 * something in the config should be responsible for the
89 * line<->core/vpe bindings.
90 */
91 uint32_t interruptInfo; /* 0x18 */
92
93 /*
94 * This is where the received data is read out.
95 * There is more data to read until rxDataReady is 0.
96 * Only 1 byte at this regs offset is used.
97 */
98 uint32_t rxDataBuffer; /* 0x1c */
99
100 /*
101 * This is where the data to transmit is written. Data should be
102 * written for the amount specified in the txDataCount register. Only
103 * 1 byte at this regs offset is used.
104 */
105 uint32_t txDataBuffer; /* 0x20 */
106};
107
108#define MIPSNET_IO_EXTENT 0x40 /* being generous */
109
110#define field_offset(field) (offsetof(struct net_control_block, field))
111
112#endif /* __MIPSNET_H */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index c329a4f5840c..0a3e60418e53 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -203,22 +203,8 @@ skbuff at an offset of "+2", 16-byte aligning the IP header.
203IIId. Synchronization 203IIId. Synchronization
204 204
205Most operations are synchronized on the np->lock irq spinlock, except the 205Most operations are synchronized on the np->lock irq spinlock, except the
206performance critical codepaths: 206recieve and transmit paths which are synchronised using a combination of
207 207hardware descriptor ownership, disabling interrupts and NAPI poll scheduling.
208The rx process only runs in the interrupt handler. Access from outside
209the interrupt handler is only permitted after disable_irq().
210
211The rx process usually runs under the netif_tx_lock. If np->intr_tx_reap
212is set, then access is permitted under spin_lock_irq(&np->lock).
213
214Thus configuration functions that want to access everything must call
215 disable_irq(dev->irq);
216 netif_tx_lock_bh(dev);
217 spin_lock_irq(&np->lock);
218
219IV. Notes
220
221NatSemi PCI network controllers are very uncommon.
222 208
223IVb. References 209IVb. References
224 210
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bb88a41b7591..2e39e0285d8f 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -62,6 +62,10 @@
62 62
63#define LRO_MAX_AGGR 64 63#define LRO_MAX_AGGR 64
64 64
65#define PE_MIN_MTU 64
66#define PE_MAX_MTU 1500
67#define PE_DEF_MTU ETH_DATA_LEN
68
65#define DEFAULT_MSG_ENABLE \ 69#define DEFAULT_MSG_ENABLE \
66 (NETIF_MSG_DRV | \ 70 (NETIF_MSG_DRV | \
67 NETIF_MSG_PROBE | \ 71 NETIF_MSG_PROBE | \
@@ -82,8 +86,6 @@
82 & ((ring)->size - 1)) 86 & ((ring)->size - 1))
83#define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) 87#define RING_AVAIL(ring) ((ring->size) - RING_USED(ring))
84 88
85#define BUF_SIZE 1646 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
86
87MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
88MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); 90MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>");
89MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); 91MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver");
@@ -175,6 +177,24 @@ static int mac_to_intf(struct pasemi_mac *mac)
175 return -1; 177 return -1;
176} 178}
177 179
180static void pasemi_mac_intf_disable(struct pasemi_mac *mac)
181{
182 unsigned int flags;
183
184 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
185 flags &= ~PAS_MAC_CFG_PCFG_PE;
186 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
187}
188
189static void pasemi_mac_intf_enable(struct pasemi_mac *mac)
190{
191 unsigned int flags;
192
193 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
194 flags |= PAS_MAC_CFG_PCFG_PE;
195 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
196}
197
178static int pasemi_get_mac_addr(struct pasemi_mac *mac) 198static int pasemi_get_mac_addr(struct pasemi_mac *mac)
179{ 199{
180 struct pci_dev *pdev = mac->pdev; 200 struct pci_dev *pdev = mac->pdev;
@@ -221,6 +241,33 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
221 return 0; 241 return 0;
222} 242}
223 243
244static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
245{
246 struct pasemi_mac *mac = netdev_priv(dev);
247 struct sockaddr *addr = p;
248 unsigned int adr0, adr1;
249
250 if (!is_valid_ether_addr(addr->sa_data))
251 return -EINVAL;
252
253 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
254
255 adr0 = dev->dev_addr[2] << 24 |
256 dev->dev_addr[3] << 16 |
257 dev->dev_addr[4] << 8 |
258 dev->dev_addr[5];
259 adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1);
260 adr1 &= ~0xffff;
261 adr1 |= dev->dev_addr[0] << 8 | dev->dev_addr[1];
262
263 pasemi_mac_intf_disable(mac);
264 write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0);
265 write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1);
266 pasemi_mac_intf_enable(mac);
267
268 return 0;
269}
270
224static int get_skb_hdr(struct sk_buff *skb, void **iphdr, 271static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
225 void **tcph, u64 *hdr_flags, void *data) 272 void **tcph, u64 *hdr_flags, void *data)
226{ 273{
@@ -453,7 +500,7 @@ static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac)
453 500
454} 501}
455 502
456static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) 503static void pasemi_mac_free_rx_buffers(struct pasemi_mac *mac)
457{ 504{
458 struct pasemi_mac_rxring *rx = rx_ring(mac); 505 struct pasemi_mac_rxring *rx = rx_ring(mac);
459 unsigned int i; 506 unsigned int i;
@@ -473,7 +520,12 @@ static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac)
473 } 520 }
474 521
475 for (i = 0; i < RX_RING_SIZE; i++) 522 for (i = 0; i < RX_RING_SIZE; i++)
476 RX_DESC(rx, i) = 0; 523 RX_BUFF(rx, i) = 0;
524}
525
526static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac)
527{
528 pasemi_mac_free_rx_buffers(mac);
477 529
478 dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64), 530 dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64),
479 rx_ring(mac)->buffers, rx_ring(mac)->buf_dma); 531 rx_ring(mac)->buffers, rx_ring(mac)->buf_dma);
@@ -503,14 +555,14 @@ static void pasemi_mac_replenish_rx_ring(const struct net_device *dev,
503 /* Entry in use? */ 555 /* Entry in use? */
504 WARN_ON(*buff); 556 WARN_ON(*buff);
505 557
506 skb = dev_alloc_skb(BUF_SIZE); 558 skb = dev_alloc_skb(mac->bufsz);
507 skb_reserve(skb, LOCAL_SKB_ALIGN); 559 skb_reserve(skb, LOCAL_SKB_ALIGN);
508 560
509 if (unlikely(!skb)) 561 if (unlikely(!skb))
510 break; 562 break;
511 563
512 dma = pci_map_single(mac->dma_pdev, skb->data, 564 dma = pci_map_single(mac->dma_pdev, skb->data,
513 BUF_SIZE - LOCAL_SKB_ALIGN, 565 mac->bufsz - LOCAL_SKB_ALIGN,
514 PCI_DMA_FROMDEVICE); 566 PCI_DMA_FROMDEVICE);
515 567
516 if (unlikely(dma_mapping_error(dma))) { 568 if (unlikely(dma_mapping_error(dma))) {
@@ -520,7 +572,7 @@ static void pasemi_mac_replenish_rx_ring(const struct net_device *dev,
520 572
521 info->skb = skb; 573 info->skb = skb;
522 info->dma = dma; 574 info->dma = dma;
523 *buff = XCT_RXB_LEN(BUF_SIZE) | XCT_RXB_ADDR(dma); 575 *buff = XCT_RXB_LEN(mac->bufsz) | XCT_RXB_ADDR(dma);
524 fill++; 576 fill++;
525 } 577 }
526 578
@@ -650,7 +702,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
650 702
651 len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; 703 len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S;
652 704
653 pci_unmap_single(pdev, dma, BUF_SIZE-LOCAL_SKB_ALIGN, 705 pci_unmap_single(pdev, dma, mac->bufsz - LOCAL_SKB_ALIGN,
654 PCI_DMA_FROMDEVICE); 706 PCI_DMA_FROMDEVICE);
655 707
656 if (macrx & XCT_MACRX_CRC) { 708 if (macrx & XCT_MACRX_CRC) {
@@ -874,24 +926,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
874 return IRQ_HANDLED; 926 return IRQ_HANDLED;
875} 927}
876 928
877static void pasemi_mac_intf_disable(struct pasemi_mac *mac)
878{
879 unsigned int flags;
880
881 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
882 flags &= ~PAS_MAC_CFG_PCFG_PE;
883 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
884}
885
886static void pasemi_mac_intf_enable(struct pasemi_mac *mac)
887{
888 unsigned int flags;
889
890 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
891 flags |= PAS_MAC_CFG_PCFG_PE;
892 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
893}
894
895static void pasemi_adjust_link(struct net_device *dev) 929static void pasemi_adjust_link(struct net_device *dev)
896{ 930{
897 struct pasemi_mac *mac = netdev_priv(dev); 931 struct pasemi_mac *mac = netdev_priv(dev);
@@ -1148,11 +1182,71 @@ out_rx_resources:
1148 1182
1149#define MAX_RETRIES 5000 1183#define MAX_RETRIES 5000
1150 1184
1185static void pasemi_mac_pause_txchan(struct pasemi_mac *mac)
1186{
1187 unsigned int sta, retries;
1188 int txch = tx_ring(mac)->chan.chno;
1189
1190 write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch),
1191 PAS_DMA_TXCHAN_TCMDSTA_ST);
1192
1193 for (retries = 0; retries < MAX_RETRIES; retries++) {
1194 sta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch));
1195 if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT))
1196 break;
1197 cond_resched();
1198 }
1199
1200 if (sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)
1201 dev_err(&mac->dma_pdev->dev,
1202 "Failed to stop tx channel, tcmdsta %08x\n", sta);
1203
1204 write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), 0);
1205}
1206
1207static void pasemi_mac_pause_rxchan(struct pasemi_mac *mac)
1208{
1209 unsigned int sta, retries;
1210 int rxch = rx_ring(mac)->chan.chno;
1211
1212 write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch),
1213 PAS_DMA_RXCHAN_CCMDSTA_ST);
1214 for (retries = 0; retries < MAX_RETRIES; retries++) {
1215 sta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch));
1216 if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT))
1217 break;
1218 cond_resched();
1219 }
1220
1221 if (sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)
1222 dev_err(&mac->dma_pdev->dev,
1223 "Failed to stop rx channel, ccmdsta 08%x\n", sta);
1224 write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), 0);
1225}
1226
1227static void pasemi_mac_pause_rxint(struct pasemi_mac *mac)
1228{
1229 unsigned int sta, retries;
1230
1231 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
1232 PAS_DMA_RXINT_RCMDSTA_ST);
1233 for (retries = 0; retries < MAX_RETRIES; retries++) {
1234 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
1235 if (!(sta & PAS_DMA_RXINT_RCMDSTA_ACT))
1236 break;
1237 cond_resched();
1238 }
1239
1240 if (sta & PAS_DMA_RXINT_RCMDSTA_ACT)
1241 dev_err(&mac->dma_pdev->dev,
1242 "Failed to stop rx interface, rcmdsta %08x\n", sta);
1243 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0);
1244}
1245
1151static int pasemi_mac_close(struct net_device *dev) 1246static int pasemi_mac_close(struct net_device *dev)
1152{ 1247{
1153 struct pasemi_mac *mac = netdev_priv(dev); 1248 struct pasemi_mac *mac = netdev_priv(dev);
1154 unsigned int sta; 1249 unsigned int sta;
1155 int retries;
1156 int rxch, txch; 1250 int rxch, txch;
1157 1251
1158 rxch = rx_ring(mac)->chan.chno; 1252 rxch = rx_ring(mac)->chan.chno;
@@ -1190,51 +1284,10 @@ static int pasemi_mac_close(struct net_device *dev)
1190 pasemi_mac_clean_tx(tx_ring(mac)); 1284 pasemi_mac_clean_tx(tx_ring(mac));
1191 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); 1285 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE);
1192 1286
1193 /* Disable interface */ 1287 pasemi_mac_pause_txchan(mac);
1194 write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), 1288 pasemi_mac_pause_rxint(mac);
1195 PAS_DMA_TXCHAN_TCMDSTA_ST); 1289 pasemi_mac_pause_rxchan(mac);
1196 write_dma_reg( PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 1290 pasemi_mac_intf_disable(mac);
1197 PAS_DMA_RXINT_RCMDSTA_ST);
1198 write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch),
1199 PAS_DMA_RXCHAN_CCMDSTA_ST);
1200
1201 for (retries = 0; retries < MAX_RETRIES; retries++) {
1202 sta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(rxch));
1203 if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT))
1204 break;
1205 cond_resched();
1206 }
1207
1208 if (sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)
1209 dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
1210
1211 for (retries = 0; retries < MAX_RETRIES; retries++) {
1212 sta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch));
1213 if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT))
1214 break;
1215 cond_resched();
1216 }
1217
1218 if (sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)
1219 dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
1220
1221 for (retries = 0; retries < MAX_RETRIES; retries++) {
1222 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
1223 if (!(sta & PAS_DMA_RXINT_RCMDSTA_ACT))
1224 break;
1225 cond_resched();
1226 }
1227
1228 if (sta & PAS_DMA_RXINT_RCMDSTA_ACT)
1229 dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
1230
1231 /* Then, disable the channel. This must be done separately from
1232 * stopping, since you can't disable when active.
1233 */
1234
1235 write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), 0);
1236 write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), 0);
1237 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0);
1238 1291
1239 free_irq(mac->tx->chan.irq, mac->tx); 1292 free_irq(mac->tx->chan.irq, mac->tx);
1240 free_irq(mac->rx->chan.irq, mac->rx); 1293 free_irq(mac->rx->chan.irq, mac->rx);
@@ -1388,6 +1441,62 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
1388 return pkts; 1441 return pkts;
1389} 1442}
1390 1443
1444static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu)
1445{
1446 struct pasemi_mac *mac = netdev_priv(dev);
1447 unsigned int reg;
1448 unsigned int rcmdsta;
1449 int running;
1450
1451 if (new_mtu < PE_MIN_MTU || new_mtu > PE_MAX_MTU)
1452 return -EINVAL;
1453
1454 running = netif_running(dev);
1455
1456 if (running) {
1457 /* Need to stop the interface, clean out all already
1458 * received buffers, free all unused buffers on the RX
1459 * interface ring, then finally re-fill the rx ring with
1460 * the new-size buffers and restart.
1461 */
1462
1463 napi_disable(&mac->napi);
1464 netif_tx_disable(dev);
1465 pasemi_mac_intf_disable(mac);
1466
1467 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
1468 pasemi_mac_pause_rxint(mac);
1469 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE);
1470 pasemi_mac_free_rx_buffers(mac);
1471 }
1472
1473 /* Change maxf, i.e. what size frames are accepted.
1474 * Need room for ethernet header and CRC word
1475 */
1476 reg = read_mac_reg(mac, PAS_MAC_CFG_MACCFG);
1477 reg &= ~PAS_MAC_CFG_MACCFG_MAXF_M;
1478 reg |= PAS_MAC_CFG_MACCFG_MAXF(new_mtu + ETH_HLEN + 4);
1479 write_mac_reg(mac, PAS_MAC_CFG_MACCFG, reg);
1480
1481 dev->mtu = new_mtu;
1482 /* MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
1483 mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128;
1484
1485 if (running) {
1486 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
1487 rcmdsta | PAS_DMA_RXINT_RCMDSTA_EN);
1488
1489 rx_ring(mac)->next_to_fill = 0;
1490 pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE-1);
1491
1492 napi_enable(&mac->napi);
1493 netif_start_queue(dev);
1494 pasemi_mac_intf_enable(mac);
1495 }
1496
1497 return 0;
1498}
1499
1391static int __devinit 1500static int __devinit
1392pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1501pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1393{ 1502{
@@ -1475,6 +1584,12 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1475 dev->stop = pasemi_mac_close; 1584 dev->stop = pasemi_mac_close;
1476 dev->hard_start_xmit = pasemi_mac_start_tx; 1585 dev->hard_start_xmit = pasemi_mac_start_tx;
1477 dev->set_multicast_list = pasemi_mac_set_rx_mode; 1586 dev->set_multicast_list = pasemi_mac_set_rx_mode;
1587 dev->set_mac_address = pasemi_mac_set_mac_addr;
1588 dev->mtu = PE_DEF_MTU;
1589 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
1590 mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128;
1591
1592 dev->change_mtu = pasemi_mac_change_mtu;
1478 1593
1479 if (err) 1594 if (err)
1480 goto out; 1595 goto out;
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 8bee2a664c83..99e7b9329a6f 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -59,6 +59,7 @@ struct pasemi_mac {
59 struct phy_device *phydev; 59 struct phy_device *phydev;
60 struct napi_struct napi; 60 struct napi_struct napi;
61 61
62 int bufsz; /* RX ring buffer size */
62 u8 type; 63 u8 type;
63#define MAC_TYPE_GMAC 1 64#define MAC_TYPE_GMAC 1
64#define MAC_TYPE_XAUI 2 65#define MAC_TYPE_XAUI 2
@@ -96,6 +97,9 @@ struct pasemi_mac_buffer {
96/* MAC CFG register offsets */ 97/* MAC CFG register offsets */
97enum { 98enum {
98 PAS_MAC_CFG_PCFG = 0x80, 99 PAS_MAC_CFG_PCFG = 0x80,
100 PAS_MAC_CFG_MACCFG = 0x84,
101 PAS_MAC_CFG_ADR0 = 0x8c,
102 PAS_MAC_CFG_ADR1 = 0x90,
99 PAS_MAC_CFG_TXP = 0x98, 103 PAS_MAC_CFG_TXP = 0x98,
100 PAS_MAC_IPC_CHNL = 0x208, 104 PAS_MAC_IPC_CHNL = 0x208,
101}; 105};
@@ -130,6 +134,18 @@ enum {
130#define PAS_MAC_CFG_PCFG_SPD_100M 0x00000001 134#define PAS_MAC_CFG_PCFG_SPD_100M 0x00000001
131#define PAS_MAC_CFG_PCFG_SPD_1G 0x00000002 135#define PAS_MAC_CFG_PCFG_SPD_1G 0x00000002
132#define PAS_MAC_CFG_PCFG_SPD_10G 0x00000003 136#define PAS_MAC_CFG_PCFG_SPD_10G 0x00000003
137
138#define PAS_MAC_CFG_MACCFG_TXT_M 0x70000000
139#define PAS_MAC_CFG_MACCFG_TXT_S 28
140#define PAS_MAC_CFG_MACCFG_PRES_M 0x0f000000
141#define PAS_MAC_CFG_MACCFG_PRES_S 24
142#define PAS_MAC_CFG_MACCFG_MAXF_M 0x00ffff00
143#define PAS_MAC_CFG_MACCFG_MAXF_S 8
144#define PAS_MAC_CFG_MACCFG_MAXF(x) (((x) << PAS_MAC_CFG_MACCFG_MAXF_S) & \
145 PAS_MAC_CFG_MACCFG_MAXF_M)
146#define PAS_MAC_CFG_MACCFG_MINF_M 0x000000ff
147#define PAS_MAC_CFG_MACCFG_MINF_S 0
148
133#define PAS_MAC_CFG_TXP_FCF 0x01000000 149#define PAS_MAC_CFG_TXP_FCF 0x01000000
134#define PAS_MAC_CFG_TXP_FCE 0x00800000 150#define PAS_MAC_CFG_TXP_FCE 0x00800000
135#define PAS_MAC_CFG_TXP_FC 0x00400000 151#define PAS_MAC_CFG_TXP_FC 0x00400000
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index ed402e00e730..fffc49befe04 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -541,7 +541,7 @@ static void netdrv_hw_start (struct net_device *dev);
541#define NETDRV_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0) 541#define NETDRV_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0)
542 542
543 543
544#if MMIO_FLUSH_AUDIT_COMPLETE 544#ifdef MMIO_FLUSH_AUDIT_COMPLETE
545 545
546/* write MMIO register */ 546/* write MMIO register */
547#define NETDRV_W8(reg, val8) writeb ((val8), ioaddr + (reg)) 547#define NETDRV_W8(reg, val8) writeb ((val8), ioaddr + (reg))
@@ -603,7 +603,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
603 return -ENOMEM; 603 return -ENOMEM;
604 } 604 }
605 SET_NETDEV_DEV(dev, &pdev->dev); 605 SET_NETDEV_DEV(dev, &pdev->dev);
606 tp = dev->priv; 606 tp = netdev_priv(dev);
607 607
608 /* enable device (incl. PCI PM wakeup), and bus-mastering */ 608 /* enable device (incl. PCI PM wakeup), and bus-mastering */
609 rc = pci_enable_device (pdev); 609 rc = pci_enable_device (pdev);
@@ -759,7 +759,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
759 return i; 759 return i;
760 } 760 }
761 761
762 tp = dev->priv; 762 tp = netdev_priv(dev);
763 763
764 assert (ioaddr != NULL); 764 assert (ioaddr != NULL);
765 assert (dev != NULL); 765 assert (dev != NULL);
@@ -783,7 +783,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
783 dev->base_addr = (unsigned long) ioaddr; 783 dev->base_addr = (unsigned long) ioaddr;
784 784
785 /* dev->priv/tp zeroed and aligned in alloc_etherdev */ 785 /* dev->priv/tp zeroed and aligned in alloc_etherdev */
786 tp = dev->priv; 786 tp = netdev_priv(dev);
787 787
788 /* note: tp->chipset set in netdrv_init_board */ 788 /* note: tp->chipset set in netdrv_init_board */
789 tp->drv_flags = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 789 tp->drv_flags = PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
@@ -841,7 +841,7 @@ static void __devexit netdrv_remove_one (struct pci_dev *pdev)
841 841
842 assert (dev != NULL); 842 assert (dev != NULL);
843 843
844 np = dev->priv; 844 np = netdev_priv(dev);
845 assert (np != NULL); 845 assert (np != NULL);
846 846
847 unregister_netdev (dev); 847 unregister_netdev (dev);
@@ -974,7 +974,7 @@ static void mdio_sync (void *mdio_addr)
974 974
975static int mdio_read (struct net_device *dev, int phy_id, int location) 975static int mdio_read (struct net_device *dev, int phy_id, int location)
976{ 976{
977 struct netdrv_private *tp = dev->priv; 977 struct netdrv_private *tp = netdev_priv(dev);
978 void *mdio_addr = tp->mmio_addr + Config4; 978 void *mdio_addr = tp->mmio_addr + Config4;
979 int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; 979 int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
980 int retval = 0; 980 int retval = 0;
@@ -1017,7 +1017,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location)
1017static void mdio_write (struct net_device *dev, int phy_id, int location, 1017static void mdio_write (struct net_device *dev, int phy_id, int location,
1018 int value) 1018 int value)
1019{ 1019{
1020 struct netdrv_private *tp = dev->priv; 1020 struct netdrv_private *tp = netdev_priv(dev);
1021 void *mdio_addr = tp->mmio_addr + Config4; 1021 void *mdio_addr = tp->mmio_addr + Config4;
1022 int mii_cmd = 1022 int mii_cmd =
1023 (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; 1023 (0x5002 << 16) | (phy_id << 23) | (location << 18) | value;
@@ -1060,7 +1060,7 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
1060 1060
1061static int netdrv_open (struct net_device *dev) 1061static int netdrv_open (struct net_device *dev)
1062{ 1062{
1063 struct netdrv_private *tp = dev->priv; 1063 struct netdrv_private *tp = netdev_priv(dev);
1064 int retval; 1064 int retval;
1065#ifdef NETDRV_DEBUG 1065#ifdef NETDRV_DEBUG
1066 void *ioaddr = tp->mmio_addr; 1066 void *ioaddr = tp->mmio_addr;
@@ -1121,7 +1121,7 @@ static int netdrv_open (struct net_device *dev)
1121/* Start the hardware at open or resume. */ 1121/* Start the hardware at open or resume. */
1122static void netdrv_hw_start (struct net_device *dev) 1122static void netdrv_hw_start (struct net_device *dev)
1123{ 1123{
1124 struct netdrv_private *tp = dev->priv; 1124 struct netdrv_private *tp = netdev_priv(dev);
1125 void *ioaddr = tp->mmio_addr; 1125 void *ioaddr = tp->mmio_addr;
1126 u32 i; 1126 u32 i;
1127 1127
@@ -1191,7 +1191,7 @@ static void netdrv_hw_start (struct net_device *dev)
1191/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ 1191/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
1192static void netdrv_init_ring (struct net_device *dev) 1192static void netdrv_init_ring (struct net_device *dev)
1193{ 1193{
1194 struct netdrv_private *tp = dev->priv; 1194 struct netdrv_private *tp = netdev_priv(dev);
1195 int i; 1195 int i;
1196 1196
1197 DPRINTK ("ENTER\n"); 1197 DPRINTK ("ENTER\n");
@@ -1213,7 +1213,7 @@ static void netdrv_init_ring (struct net_device *dev)
1213static void netdrv_timer (unsigned long data) 1213static void netdrv_timer (unsigned long data)
1214{ 1214{
1215 struct net_device *dev = (struct net_device *) data; 1215 struct net_device *dev = (struct net_device *) data;
1216 struct netdrv_private *tp = dev->priv; 1216 struct netdrv_private *tp = netdev_priv(dev);
1217 void *ioaddr = tp->mmio_addr; 1217 void *ioaddr = tp->mmio_addr;
1218 int next_tick = 60 * HZ; 1218 int next_tick = 60 * HZ;
1219 int mii_lpa; 1219 int mii_lpa;
@@ -1252,9 +1252,10 @@ static void netdrv_timer (unsigned long data)
1252} 1252}
1253 1253
1254 1254
1255static void netdrv_tx_clear (struct netdrv_private *tp) 1255static void netdrv_tx_clear (struct net_device *dev)
1256{ 1256{
1257 int i; 1257 int i;
1258 struct netdrv_private *tp = netdev_priv(dev);
1258 1259
1259 atomic_set (&tp->cur_tx, 0); 1260 atomic_set (&tp->cur_tx, 0);
1260 atomic_set (&tp->dirty_tx, 0); 1261 atomic_set (&tp->dirty_tx, 0);
@@ -1278,7 +1279,7 @@ static void netdrv_tx_clear (struct netdrv_private *tp)
1278 1279
1279static void netdrv_tx_timeout (struct net_device *dev) 1280static void netdrv_tx_timeout (struct net_device *dev)
1280{ 1281{
1281 struct netdrv_private *tp = dev->priv; 1282 struct netdrv_private *tp = netdev_priv(dev);
1282 void *ioaddr = tp->mmio_addr; 1283 void *ioaddr = tp->mmio_addr;
1283 int i; 1284 int i;
1284 u8 tmp8; 1285 u8 tmp8;
@@ -1311,7 +1312,7 @@ static void netdrv_tx_timeout (struct net_device *dev)
1311 /* Stop a shared interrupt from scavenging while we are. */ 1312 /* Stop a shared interrupt from scavenging while we are. */
1312 spin_lock_irqsave (&tp->lock, flags); 1313 spin_lock_irqsave (&tp->lock, flags);
1313 1314
1314 netdrv_tx_clear (tp); 1315 netdrv_tx_clear (dev);
1315 1316
1316 spin_unlock_irqrestore (&tp->lock, flags); 1317 spin_unlock_irqrestore (&tp->lock, flags);
1317 1318
@@ -1325,7 +1326,7 @@ static void netdrv_tx_timeout (struct net_device *dev)
1325 1326
1326static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev) 1327static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev)
1327{ 1328{
1328 struct netdrv_private *tp = dev->priv; 1329 struct netdrv_private *tp = netdev_priv(dev);
1329 void *ioaddr = tp->mmio_addr; 1330 void *ioaddr = tp->mmio_addr;
1330 int entry; 1331 int entry;
1331 1332
@@ -1525,7 +1526,7 @@ static void netdrv_rx_interrupt (struct net_device *dev,
1525 DPRINTK ("%s: netdrv_rx() status %4.4x, size %4.4x," 1526 DPRINTK ("%s: netdrv_rx() status %4.4x, size %4.4x,"
1526 " cur %4.4x.\n", dev->name, rx_status, 1527 " cur %4.4x.\n", dev->name, rx_status,
1527 rx_size, cur_rx); 1528 rx_size, cur_rx);
1528#if NETDRV_DEBUG > 2 1529#if defined(NETDRV_DEBUG) && (NETDRV_DEBUG > 2)
1529 { 1530 {
1530 int i; 1531 int i;
1531 DPRINTK ("%s: Frame contents ", dev->name); 1532 DPRINTK ("%s: Frame contents ", dev->name);
@@ -1648,7 +1649,7 @@ static void netdrv_weird_interrupt (struct net_device *dev,
1648static irqreturn_t netdrv_interrupt (int irq, void *dev_instance) 1649static irqreturn_t netdrv_interrupt (int irq, void *dev_instance)
1649{ 1650{
1650 struct net_device *dev = (struct net_device *) dev_instance; 1651 struct net_device *dev = (struct net_device *) dev_instance;
1651 struct netdrv_private *tp = dev->priv; 1652 struct netdrv_private *tp = netdev_priv(dev);
1652 int boguscnt = max_interrupt_work; 1653 int boguscnt = max_interrupt_work;
1653 void *ioaddr = tp->mmio_addr; 1654 void *ioaddr = tp->mmio_addr;
1654 int status = 0, link_changed = 0; /* avoid bogus "uninit" warning */ 1655 int status = 0, link_changed = 0; /* avoid bogus "uninit" warning */
@@ -1711,7 +1712,7 @@ static irqreturn_t netdrv_interrupt (int irq, void *dev_instance)
1711 1712
1712static int netdrv_close (struct net_device *dev) 1713static int netdrv_close (struct net_device *dev)
1713{ 1714{
1714 struct netdrv_private *tp = dev->priv; 1715 struct netdrv_private *tp = netdev_priv(dev);
1715 void *ioaddr = tp->mmio_addr; 1716 void *ioaddr = tp->mmio_addr;
1716 unsigned long flags; 1717 unsigned long flags;
1717 1718
@@ -1738,10 +1739,10 @@ static int netdrv_close (struct net_device *dev)
1738 1739
1739 spin_unlock_irqrestore (&tp->lock, flags); 1740 spin_unlock_irqrestore (&tp->lock, flags);
1740 1741
1741 synchronize_irq (); 1742 synchronize_irq (dev->irq);
1742 free_irq (dev->irq, dev); 1743 free_irq (dev->irq, dev);
1743 1744
1744 netdrv_tx_clear (tp); 1745 netdrv_tx_clear (dev);
1745 1746
1746 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, 1747 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN,
1747 tp->rx_ring, tp->rx_ring_dma); 1748 tp->rx_ring, tp->rx_ring_dma);
@@ -1762,7 +1763,7 @@ static int netdrv_close (struct net_device *dev)
1762 1763
1763static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) 1764static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1764{ 1765{
1765 struct netdrv_private *tp = dev->priv; 1766 struct netdrv_private *tp = netdev_priv(dev);
1766 struct mii_ioctl_data *data = if_mii(rq); 1767 struct mii_ioctl_data *data = if_mii(rq);
1767 unsigned long flags; 1768 unsigned long flags;
1768 int rc = 0; 1769 int rc = 0;
@@ -1805,7 +1806,7 @@ static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1805 1806
1806static void netdrv_set_rx_mode (struct net_device *dev) 1807static void netdrv_set_rx_mode (struct net_device *dev)
1807{ 1808{
1808 struct netdrv_private *tp = dev->priv; 1809 struct netdrv_private *tp = netdev_priv(dev);
1809 void *ioaddr = tp->mmio_addr; 1810 void *ioaddr = tp->mmio_addr;
1810 u32 mc_filter[2]; /* Multicast hash filter */ 1811 u32 mc_filter[2]; /* Multicast hash filter */
1811 int i, rx_mode; 1812 int i, rx_mode;
@@ -1862,7 +1863,7 @@ static void netdrv_set_rx_mode (struct net_device *dev)
1862static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state) 1863static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state)
1863{ 1864{
1864 struct net_device *dev = pci_get_drvdata (pdev); 1865 struct net_device *dev = pci_get_drvdata (pdev);
1865 struct netdrv_private *tp = dev->priv; 1866 struct netdrv_private *tp = netdev_priv(dev);
1866 void *ioaddr = tp->mmio_addr; 1867 void *ioaddr = tp->mmio_addr;
1867 unsigned long flags; 1868 unsigned long flags;
1868 1869
@@ -1892,7 +1893,7 @@ static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state)
1892static int netdrv_resume (struct pci_dev *pdev) 1893static int netdrv_resume (struct pci_dev *pdev)
1893{ 1894{
1894 struct net_device *dev = pci_get_drvdata (pdev); 1895 struct net_device *dev = pci_get_drvdata (pdev);
1895 struct netdrv_private *tp = dev->priv; 1896 /*struct netdrv_private *tp = netdev_priv(dev);*/
1896 1897
1897 if (!netif_running(dev)) 1898 if (!netif_running(dev))
1898 return 0; 1899 return 0;
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 7fe03ce774b1..f4ca0591231d 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -60,6 +60,11 @@ config ICPLUS_PHY
60 ---help--- 60 ---help---
61 Currently supports the IP175C PHY. 61 Currently supports the IP175C PHY.
62 62
63config REALTEK_PHY
64 tristate "Drivers for Realtek PHYs"
65 ---help---
66 Supports the Realtek 821x PHY.
67
63config FIXED_PHY 68config FIXED_PHY
64 bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" 69 bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
65 ---help--- 70 ---help---
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 3d6cc7b67a80..5997d6ef702b 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -12,5 +12,6 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o
12obj-$(CONFIG_VITESSE_PHY) += vitesse.o 12obj-$(CONFIG_VITESSE_PHY) += vitesse.o
13obj-$(CONFIG_BROADCOM_PHY) += broadcom.o 13obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
14obj-$(CONFIG_ICPLUS_PHY) += icplus.o 14obj-$(CONFIG_ICPLUS_PHY) += icplus.o
15obj-$(CONFIG_REALTEK_PHY) += realtek.o
15obj-$(CONFIG_FIXED_PHY) += fixed.o 16obj-$(CONFIG_FIXED_PHY) += fixed.o
16obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o 17obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 29666c85ed55..5b80358af658 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -141,6 +141,20 @@ static struct phy_driver bcm5461_driver = {
141 .driver = { .owner = THIS_MODULE }, 141 .driver = { .owner = THIS_MODULE },
142}; 142};
143 143
144static struct phy_driver bcm5482_driver = {
145 .phy_id = 0x0143bcb0,
146 .phy_id_mask = 0xfffffff0,
147 .name = "Broadcom BCM5482",
148 .features = PHY_GBIT_FEATURES,
149 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
150 .config_init = bcm54xx_config_init,
151 .config_aneg = genphy_config_aneg,
152 .read_status = genphy_read_status,
153 .ack_interrupt = bcm54xx_ack_interrupt,
154 .config_intr = bcm54xx_config_intr,
155 .driver = { .owner = THIS_MODULE },
156};
157
144static int __init broadcom_init(void) 158static int __init broadcom_init(void)
145{ 159{
146 int ret; 160 int ret;
@@ -154,8 +168,13 @@ static int __init broadcom_init(void)
154 ret = phy_driver_register(&bcm5461_driver); 168 ret = phy_driver_register(&bcm5461_driver);
155 if (ret) 169 if (ret)
156 goto out_5461; 170 goto out_5461;
171 ret = phy_driver_register(&bcm5482_driver);
172 if (ret)
173 goto out_5482;
157 return ret; 174 return ret;
158 175
176out_5482:
177 phy_driver_unregister(&bcm5461_driver);
159out_5461: 178out_5461:
160 phy_driver_unregister(&bcm5421_driver); 179 phy_driver_unregister(&bcm5421_driver);
161out_5421: 180out_5421:
@@ -166,6 +185,7 @@ out_5411:
166 185
167static void __exit broadcom_exit(void) 186static void __exit broadcom_exit(void)
168{ 187{
188 phy_driver_unregister(&bcm5482_driver);
169 phy_driver_unregister(&bcm5461_driver); 189 phy_driver_unregister(&bcm5461_driver);
170 phy_driver_unregister(&bcm5421_driver); 190 phy_driver_unregister(&bcm5421_driver);
171 phy_driver_unregister(&bcm5411_driver); 191 phy_driver_unregister(&bcm5411_driver);
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index c30196d0ad16..6e9f619c491f 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,7 +49,7 @@ int mdiobus_register(struct mii_bus *bus)
49 int i; 49 int i;
50 int err = 0; 50 int err = 0;
51 51
52 spin_lock_init(&bus->mdio_lock); 52 mutex_init(&bus->mdio_lock);
53 53
54 if (NULL == bus || NULL == bus->name || 54 if (NULL == bus || NULL == bus->name ||
55 NULL == bus->read || 55 NULL == bus->read ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7c9e6e349503..12fccb1c76dc 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -26,7 +26,6 @@
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29#include <linux/spinlock.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/mii.h> 31#include <linux/mii.h>
@@ -72,9 +71,11 @@ int phy_read(struct phy_device *phydev, u16 regnum)
72 int retval; 71 int retval;
73 struct mii_bus *bus = phydev->bus; 72 struct mii_bus *bus = phydev->bus;
74 73
75 spin_lock_bh(&bus->mdio_lock); 74 BUG_ON(in_interrupt());
75
76 mutex_lock(&bus->mdio_lock);
76 retval = bus->read(bus, phydev->addr, regnum); 77 retval = bus->read(bus, phydev->addr, regnum);
77 spin_unlock_bh(&bus->mdio_lock); 78 mutex_unlock(&bus->mdio_lock);
78 79
79 return retval; 80 return retval;
80} 81}
@@ -95,9 +96,11 @@ int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
95 int err; 96 int err;
96 struct mii_bus *bus = phydev->bus; 97 struct mii_bus *bus = phydev->bus;
97 98
98 spin_lock_bh(&bus->mdio_lock); 99 BUG_ON(in_interrupt());
100
101 mutex_lock(&bus->mdio_lock);
99 err = bus->write(bus, phydev->addr, regnum, val); 102 err = bus->write(bus, phydev->addr, regnum, val);
100 spin_unlock_bh(&bus->mdio_lock); 103 mutex_unlock(&bus->mdio_lock);
101 104
102 return err; 105 return err;
103} 106}
@@ -428,7 +431,7 @@ int phy_start_aneg(struct phy_device *phydev)
428{ 431{
429 int err; 432 int err;
430 433
431 spin_lock_bh(&phydev->lock); 434 mutex_lock(&phydev->lock);
432 435
433 if (AUTONEG_DISABLE == phydev->autoneg) 436 if (AUTONEG_DISABLE == phydev->autoneg)
434 phy_sanitize_settings(phydev); 437 phy_sanitize_settings(phydev);
@@ -449,13 +452,14 @@ int phy_start_aneg(struct phy_device *phydev)
449 } 452 }
450 453
451out_unlock: 454out_unlock:
452 spin_unlock_bh(&phydev->lock); 455 mutex_unlock(&phydev->lock);
453 return err; 456 return err;
454} 457}
455EXPORT_SYMBOL(phy_start_aneg); 458EXPORT_SYMBOL(phy_start_aneg);
456 459
457 460
458static void phy_change(struct work_struct *work); 461static void phy_change(struct work_struct *work);
462static void phy_state_machine(struct work_struct *work);
459static void phy_timer(unsigned long data); 463static void phy_timer(unsigned long data);
460 464
461/** 465/**
@@ -476,6 +480,7 @@ void phy_start_machine(struct phy_device *phydev,
476{ 480{
477 phydev->adjust_state = handler; 481 phydev->adjust_state = handler;
478 482
483 INIT_WORK(&phydev->state_queue, phy_state_machine);
479 init_timer(&phydev->phy_timer); 484 init_timer(&phydev->phy_timer);
480 phydev->phy_timer.function = &phy_timer; 485 phydev->phy_timer.function = &phy_timer;
481 phydev->phy_timer.data = (unsigned long) phydev; 486 phydev->phy_timer.data = (unsigned long) phydev;
@@ -493,11 +498,12 @@ void phy_start_machine(struct phy_device *phydev,
493void phy_stop_machine(struct phy_device *phydev) 498void phy_stop_machine(struct phy_device *phydev)
494{ 499{
495 del_timer_sync(&phydev->phy_timer); 500 del_timer_sync(&phydev->phy_timer);
501 cancel_work_sync(&phydev->state_queue);
496 502
497 spin_lock_bh(&phydev->lock); 503 mutex_lock(&phydev->lock);
498 if (phydev->state > PHY_UP) 504 if (phydev->state > PHY_UP)
499 phydev->state = PHY_UP; 505 phydev->state = PHY_UP;
500 spin_unlock_bh(&phydev->lock); 506 mutex_unlock(&phydev->lock);
501 507
502 phydev->adjust_state = NULL; 508 phydev->adjust_state = NULL;
503} 509}
@@ -541,9 +547,9 @@ static void phy_force_reduction(struct phy_device *phydev)
541 */ 547 */
542void phy_error(struct phy_device *phydev) 548void phy_error(struct phy_device *phydev)
543{ 549{
544 spin_lock_bh(&phydev->lock); 550 mutex_lock(&phydev->lock);
545 phydev->state = PHY_HALTED; 551 phydev->state = PHY_HALTED;
546 spin_unlock_bh(&phydev->lock); 552 mutex_unlock(&phydev->lock);
547} 553}
548 554
549/** 555/**
@@ -705,10 +711,10 @@ static void phy_change(struct work_struct *work)
705 if (err) 711 if (err)
706 goto phy_err; 712 goto phy_err;
707 713
708 spin_lock_bh(&phydev->lock); 714 mutex_lock(&phydev->lock);
709 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) 715 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
710 phydev->state = PHY_CHANGELINK; 716 phydev->state = PHY_CHANGELINK;
711 spin_unlock_bh(&phydev->lock); 717 mutex_unlock(&phydev->lock);
712 718
713 atomic_dec(&phydev->irq_disable); 719 atomic_dec(&phydev->irq_disable);
714 enable_irq(phydev->irq); 720 enable_irq(phydev->irq);
@@ -735,7 +741,7 @@ phy_err:
735 */ 741 */
736void phy_stop(struct phy_device *phydev) 742void phy_stop(struct phy_device *phydev)
737{ 743{
738 spin_lock_bh(&phydev->lock); 744 mutex_lock(&phydev->lock);
739 745
740 if (PHY_HALTED == phydev->state) 746 if (PHY_HALTED == phydev->state)
741 goto out_unlock; 747 goto out_unlock;
@@ -751,7 +757,7 @@ void phy_stop(struct phy_device *phydev)
751 phydev->state = PHY_HALTED; 757 phydev->state = PHY_HALTED;
752 758
753out_unlock: 759out_unlock:
754 spin_unlock_bh(&phydev->lock); 760 mutex_unlock(&phydev->lock);
755 761
756 /* 762 /*
757 * Cannot call flush_scheduled_work() here as desired because 763 * Cannot call flush_scheduled_work() here as desired because
@@ -773,7 +779,7 @@ out_unlock:
773 */ 779 */
774void phy_start(struct phy_device *phydev) 780void phy_start(struct phy_device *phydev)
775{ 781{
776 spin_lock_bh(&phydev->lock); 782 mutex_lock(&phydev->lock);
777 783
778 switch (phydev->state) { 784 switch (phydev->state) {
779 case PHY_STARTING: 785 case PHY_STARTING:
@@ -787,19 +793,26 @@ void phy_start(struct phy_device *phydev)
787 default: 793 default:
788 break; 794 break;
789 } 795 }
790 spin_unlock_bh(&phydev->lock); 796 mutex_unlock(&phydev->lock);
791} 797}
792EXPORT_SYMBOL(phy_stop); 798EXPORT_SYMBOL(phy_stop);
793EXPORT_SYMBOL(phy_start); 799EXPORT_SYMBOL(phy_start);
794 800
795/* PHY timer which handles the state machine */ 801/**
796static void phy_timer(unsigned long data) 802 * phy_state_machine - Handle the state machine
803 * @work: work_struct that describes the work to be done
804 *
805 * Description: Scheduled by the state_queue workqueue each time
806 * phy_timer is triggered.
807 */
808static void phy_state_machine(struct work_struct *work)
797{ 809{
798 struct phy_device *phydev = (struct phy_device *)data; 810 struct phy_device *phydev =
811 container_of(work, struct phy_device, state_queue);
799 int needs_aneg = 0; 812 int needs_aneg = 0;
800 int err = 0; 813 int err = 0;
801 814
802 spin_lock_bh(&phydev->lock); 815 mutex_lock(&phydev->lock);
803 816
804 if (phydev->adjust_state) 817 if (phydev->adjust_state)
805 phydev->adjust_state(phydev->attached_dev); 818 phydev->adjust_state(phydev->attached_dev);
@@ -965,7 +978,7 @@ static void phy_timer(unsigned long data)
965 break; 978 break;
966 } 979 }
967 980
968 spin_unlock_bh(&phydev->lock); 981 mutex_unlock(&phydev->lock);
969 982
970 if (needs_aneg) 983 if (needs_aneg)
971 err = phy_start_aneg(phydev); 984 err = phy_start_aneg(phydev);
@@ -976,3 +989,14 @@ static void phy_timer(unsigned long data)
976 mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); 989 mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
977} 990}
978 991
992/* PHY timer which schedules the state machine work */
993static void phy_timer(unsigned long data)
994{
995 struct phy_device *phydev = (struct phy_device *)data;
996
997 /*
998 * PHY I/O operations can potentially sleep so we ensure that
999 * it's done from a process context
1000 */
1001 schedule_work(&phydev->state_queue);
1002}
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 5b9e1751e1b4..f4c4fd85425f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -25,7 +25,6 @@
25#include <linux/netdevice.h> 25#include <linux/netdevice.h>
26#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
27#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/spinlock.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/module.h> 29#include <linux/module.h>
31#include <linux/mii.h> 30#include <linux/mii.h>
@@ -80,7 +79,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
80 79
81 dev->state = PHY_DOWN; 80 dev->state = PHY_DOWN;
82 81
83 spin_lock_init(&dev->lock); 82 mutex_init(&dev->lock);
84 83
85 return dev; 84 return dev;
86} 85}
@@ -656,7 +655,7 @@ static int phy_probe(struct device *dev)
656 if (!(phydrv->flags & PHY_HAS_INTERRUPT)) 655 if (!(phydrv->flags & PHY_HAS_INTERRUPT))
657 phydev->irq = PHY_POLL; 656 phydev->irq = PHY_POLL;
658 657
659 spin_lock_bh(&phydev->lock); 658 mutex_lock(&phydev->lock);
660 659
661 /* Start out supporting everything. Eventually, 660 /* Start out supporting everything. Eventually,
662 * a controller will attach, and may modify one 661 * a controller will attach, and may modify one
@@ -670,7 +669,7 @@ static int phy_probe(struct device *dev)
670 if (phydev->drv->probe) 669 if (phydev->drv->probe)
671 err = phydev->drv->probe(phydev); 670 err = phydev->drv->probe(phydev);
672 671
673 spin_unlock_bh(&phydev->lock); 672 mutex_unlock(&phydev->lock);
674 673
675 return err; 674 return err;
676 675
@@ -682,9 +681,9 @@ static int phy_remove(struct device *dev)
682 681
683 phydev = to_phy_device(dev); 682 phydev = to_phy_device(dev);
684 683
685 spin_lock_bh(&phydev->lock); 684 mutex_lock(&phydev->lock);
686 phydev->state = PHY_DOWN; 685 phydev->state = PHY_DOWN;
687 spin_unlock_bh(&phydev->lock); 686 mutex_unlock(&phydev->lock);
688 687
689 if (phydev->drv->remove) 688 if (phydev->drv->remove)
690 phydev->drv->remove(phydev); 689 phydev->drv->remove(phydev);
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
new file mode 100644
index 000000000000..a052a6744a51
--- /dev/null
+++ b/drivers/net/phy/realtek.c
@@ -0,0 +1,80 @@
1/*
2 * drivers/net/phy/realtek.c
3 *
4 * Driver for Realtek PHYs
5 *
6 * Author: Johnson Leung <r58129@freescale.com>
7 *
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16#include <linux/phy.h>
17
18#define RTL821x_PHYSR 0x11
19#define RTL821x_PHYSR_DUPLEX 0x2000
20#define RTL821x_PHYSR_SPEED 0xc000
21#define RTL821x_INER 0x12
22#define RTL821x_INER_INIT 0x6400
23#define RTL821x_INSR 0x13
24
25MODULE_DESCRIPTION("Realtek PHY driver");
26MODULE_AUTHOR("Johnson Leung");
27MODULE_LICENSE("GPL");
28
29static int rtl821x_ack_interrupt(struct phy_device *phydev)
30{
31 int err;
32
33 err = phy_read(phydev, RTL821x_INSR);
34
35 return (err < 0) ? err : 0;
36}
37
38static int rtl821x_config_intr(struct phy_device *phydev)
39{
40 int err;
41
42 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
43 err = phy_write(phydev, RTL821x_INER,
44 RTL821x_INER_INIT);
45 else
46 err = phy_write(phydev, RTL821x_INER, 0);
47
48 return err;
49}
50
51/* RTL8211B */
52static struct phy_driver rtl821x_driver = {
53 .phy_id = 0x001cc912,
54 .name = "RTL821x Gigabit Ethernet",
55 .phy_id_mask = 0x001fffff,
56 .features = PHY_GBIT_FEATURES,
57 .flags = PHY_HAS_INTERRUPT,
58 .config_aneg = &genphy_config_aneg,
59 .read_status = &genphy_read_status,
60 .ack_interrupt = &rtl821x_ack_interrupt,
61 .config_intr = &rtl821x_config_intr,
62 .driver = { .owner = THIS_MODULE,},
63};
64
65static int __init realtek_init(void)
66{
67 int ret;
68
69 ret = phy_driver_register(&rtl821x_driver);
70
71 return ret;
72}
73
74static void __exit realtek_exit(void)
75{
76 phy_driver_unregister(&rtl821x_driver);
77}
78
79module_init(realtek_init);
80module_exit(realtek_exit);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 5fab7d7b5d74..6179a0a2032c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -8118,7 +8118,7 @@ static void initiate_new_session(struct lro *lro, u8 *l2h,
8118 lro->iph = ip; 8118 lro->iph = ip;
8119 lro->tcph = tcp; 8119 lro->tcph = tcp;
8120 lro->tcp_next_seq = tcp_pyld_len + ntohl(tcp->seq); 8120 lro->tcp_next_seq = tcp_pyld_len + ntohl(tcp->seq);
8121 lro->tcp_ack = ntohl(tcp->ack_seq); 8121 lro->tcp_ack = tcp->ack_seq;
8122 lro->sg_num = 1; 8122 lro->sg_num = 1;
8123 lro->total_len = ntohs(ip->tot_len); 8123 lro->total_len = ntohs(ip->tot_len);
8124 lro->frags_len = 0; 8124 lro->frags_len = 0;
@@ -8127,10 +8127,10 @@ static void initiate_new_session(struct lro *lro, u8 *l2h,
8127 * already been done. 8127 * already been done.
8128 */ 8128 */
8129 if (tcp->doff == 8) { 8129 if (tcp->doff == 8) {
8130 u32 *ptr; 8130 __be32 *ptr;
8131 ptr = (u32 *)(tcp+1); 8131 ptr = (__be32 *)(tcp+1);
8132 lro->saw_ts = 1; 8132 lro->saw_ts = 1;
8133 lro->cur_tsval = *(ptr+1); 8133 lro->cur_tsval = ntohl(*(ptr+1));
8134 lro->cur_tsecr = *(ptr+2); 8134 lro->cur_tsecr = *(ptr+2);
8135 } 8135 }
8136 lro->in_use = 1; 8136 lro->in_use = 1;
@@ -8156,7 +8156,7 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro)
8156 8156
8157 /* Update tsecr field if this session has timestamps enabled */ 8157 /* Update tsecr field if this session has timestamps enabled */
8158 if (lro->saw_ts) { 8158 if (lro->saw_ts) {
8159 u32 *ptr = (u32 *)(tcp + 1); 8159 __be32 *ptr = (__be32 *)(tcp + 1);
8160 *(ptr+2) = lro->cur_tsecr; 8160 *(ptr+2) = lro->cur_tsecr;
8161 } 8161 }
8162 8162
@@ -8181,10 +8181,10 @@ static void aggregate_new_rx(struct lro *lro, struct iphdr *ip,
8181 lro->window = tcp->window; 8181 lro->window = tcp->window;
8182 8182
8183 if (lro->saw_ts) { 8183 if (lro->saw_ts) {
8184 u32 *ptr; 8184 __be32 *ptr;
8185 /* Update tsecr and tsval from this packet */ 8185 /* Update tsecr and tsval from this packet */
8186 ptr = (u32 *) (tcp + 1); 8186 ptr = (__be32 *)(tcp+1);
8187 lro->cur_tsval = *(ptr + 1); 8187 lro->cur_tsval = ntohl(*(ptr+1));
8188 lro->cur_tsecr = *(ptr + 2); 8188 lro->cur_tsecr = *(ptr + 2);
8189 } 8189 }
8190} 8190}
@@ -8235,11 +8235,11 @@ static int verify_l3_l4_lro_capable(struct lro *l_lro, struct iphdr *ip,
8235 8235
8236 /* Ensure timestamp value increases monotonically */ 8236 /* Ensure timestamp value increases monotonically */
8237 if (l_lro) 8237 if (l_lro)
8238 if (l_lro->cur_tsval > *((u32 *)(ptr+2))) 8238 if (l_lro->cur_tsval > ntohl(*((__be32 *)(ptr+2))))
8239 return -1; 8239 return -1;
8240 8240
8241 /* timestamp echo reply should be non-zero */ 8241 /* timestamp echo reply should be non-zero */
8242 if (*((u32 *)(ptr+6)) == 0) 8242 if (*((__be32 *)(ptr+6)) == 0)
8243 return -1; 8243 return -1;
8244 } 8244 }
8245 8245
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 9f6016c6f135..64b88eb48287 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -809,7 +809,7 @@ struct lro {
809 int in_use; 809 int in_use;
810 __be16 window; 810 __be16 window;
811 u32 cur_tsval; 811 u32 cur_tsval;
812 u32 cur_tsecr; 812 __be32 cur_tsecr;
813 u8 saw_ts; 813 u8 saw_ts;
814}; 814};
815 815
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index b570402f7fed..2e9e88be7b33 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -326,7 +326,7 @@ static const struct {
326 { "SiS 191 PCI Gigabit Ethernet adapter" }, 326 { "SiS 191 PCI Gigabit Ethernet adapter" },
327}; 327};
328 328
329static struct pci_device_id sis190_pci_tbl[] __devinitdata = { 329static struct pci_device_id sis190_pci_tbl[] = {
330 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 }, 330 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 },
331 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 }, 331 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 },
332 { 0, }, 332 { 0, },
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 626190eb91e7..dc062367a1c8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -623,6 +623,7 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
623 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; 623 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
624 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; 624 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
625 625
626 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
626 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); 627 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
627 /* Turn on/off phy power saving */ 628 /* Turn on/off phy power saving */
628 if (onoff) 629 if (onoff)
@@ -634,7 +635,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
634 reg1 |= coma_mode[port]; 635 reg1 |= coma_mode[port];
635 636
636 sky2_pci_write32(hw, PCI_DEV_REG1, reg1); 637 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
637 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); 638 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
639 sky2_pci_read32(hw, PCI_DEV_REG1);
638 640
639 udelay(100); 641 udelay(100);
640} 642}
@@ -1422,6 +1424,7 @@ static int sky2_up(struct net_device *dev)
1422 imask |= portirq_msk[port]; 1424 imask |= portirq_msk[port];
1423 sky2_write32(hw, B0_IMSK, imask); 1425 sky2_write32(hw, B0_IMSK, imask);
1424 1426
1427 sky2_set_multicast(dev);
1425 return 0; 1428 return 0;
1426 1429
1427err_out: 1430err_out:
@@ -2436,6 +2439,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2436 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { 2439 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
2437 u16 pci_err; 2440 u16 pci_err;
2438 2441
2442 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2439 pci_err = sky2_pci_read16(hw, PCI_STATUS); 2443 pci_err = sky2_pci_read16(hw, PCI_STATUS);
2440 if (net_ratelimit()) 2444 if (net_ratelimit())
2441 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", 2445 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
@@ -2443,12 +2447,14 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2443 2447
2444 sky2_pci_write16(hw, PCI_STATUS, 2448 sky2_pci_write16(hw, PCI_STATUS,
2445 pci_err | PCI_STATUS_ERROR_BITS); 2449 pci_err | PCI_STATUS_ERROR_BITS);
2450 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2446 } 2451 }
2447 2452
2448 if (status & Y2_IS_PCI_EXP) { 2453 if (status & Y2_IS_PCI_EXP) {
2449 /* PCI-Express uncorrectable Error occurred */ 2454 /* PCI-Express uncorrectable Error occurred */
2450 u32 err; 2455 u32 err;
2451 2456
2457 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2452 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); 2458 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2453 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, 2459 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2454 0xfffffffful); 2460 0xfffffffful);
@@ -2456,6 +2462,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2456 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); 2462 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
2457 2463
2458 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); 2464 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2465 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2459 } 2466 }
2460 2467
2461 if (status & Y2_HWE_L1_MASK) 2468 if (status & Y2_HWE_L1_MASK)
@@ -2831,6 +2838,7 @@ static void sky2_reset(struct sky2_hw *hw)
2831 } 2838 }
2832 2839
2833 sky2_power_on(hw); 2840 sky2_power_on(hw);
2841 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2834 2842
2835 for (i = 0; i < hw->ports; i++) { 2843 for (i = 0; i < hw->ports; i++) {
2836 sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); 2844 sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
@@ -3554,8 +3562,6 @@ static int sky2_set_ringparam(struct net_device *dev,
3554 err = sky2_up(dev); 3562 err = sky2_up(dev);
3555 if (err) 3563 if (err)
3556 dev_close(dev); 3564 dev_close(dev);
3557 else
3558 sky2_set_multicast(dev);
3559 } 3565 }
3560 3566
3561 return err; 3567 return err;
@@ -4389,8 +4395,6 @@ static int sky2_resume(struct pci_dev *pdev)
4389 dev_close(dev); 4395 dev_close(dev);
4390 goto out; 4396 goto out;
4391 } 4397 }
4392
4393 sky2_set_multicast(dev);
4394 } 4398 }
4395 } 4399 }
4396 4400
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index fe3ac6f9ae89..0e4a88d16327 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1075,7 +1075,7 @@ static const struct ethtool_ops bigmac_ethtool_ops = {
1075 .get_link = bigmac_get_link, 1075 .get_link = bigmac_get_link,
1076}; 1076};
1077 1077
1078static int __init bigmac_ether_init(struct sbus_dev *qec_sdev) 1078static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev)
1079{ 1079{
1080 struct net_device *dev; 1080 struct net_device *dev;
1081 static int version_printed; 1081 static int version_printed;
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index ff23c6489efd..e811331d4608 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -747,7 +747,7 @@ static inline void qec_init_once(struct sunqec *qecp, struct sbus_dev *qsdev)
747 qecp->gregs + GLOB_RSIZE); 747 qecp->gregs + GLOB_RSIZE);
748} 748}
749 749
750static u8 __init qec_get_burst(struct device_node *dp) 750static u8 __devinit qec_get_burst(struct device_node *dp)
751{ 751{
752 u8 bsizes, bsizes_more; 752 u8 bsizes, bsizes_more;
753 753
@@ -767,7 +767,7 @@ static u8 __init qec_get_burst(struct device_node *dp)
767 return bsizes; 767 return bsizes;
768} 768}
769 769
770static struct sunqec * __init get_qec(struct sbus_dev *child_sdev) 770static struct sunqec * __devinit get_qec(struct sbus_dev *child_sdev)
771{ 771{
772 struct sbus_dev *qec_sdev = child_sdev->parent; 772 struct sbus_dev *qec_sdev = child_sdev->parent;
773 struct sunqec *qecp; 773 struct sunqec *qecp;
@@ -823,7 +823,7 @@ fail:
823 return NULL; 823 return NULL;
824} 824}
825 825
826static int __init qec_ether_init(struct sbus_dev *sdev) 826static int __devinit qec_ether_init(struct sbus_dev *sdev)
827{ 827{
828 static unsigned version_printed; 828 static unsigned version_printed;
829 struct net_device *dev; 829 struct net_device *dev;
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
index 4a0035f7a842..6415ce15c2ef 100644
--- a/drivers/net/sunvnet.c
+++ b/drivers/net/sunvnet.c
@@ -1130,7 +1130,7 @@ static struct vio_driver_ops vnet_vio_ops = {
1130 .handshake_complete = vnet_handshake_complete, 1130 .handshake_complete = vnet_handshake_complete,
1131}; 1131};
1132 1132
1133static void print_version(void) 1133static void __devinit print_version(void)
1134{ 1134{
1135 static int version_printed; 1135 static int version_printed;
1136 1136
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index e7b4adc5c4e7..433c994ea9d8 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -434,7 +434,7 @@ static int __devinit olympic_init(struct net_device *dev)
434 434
435} 435}
436 436
437static int olympic_open(struct net_device *dev) 437static int __devinit olympic_open(struct net_device *dev)
438{ 438{
439 struct olympic_private *olympic_priv=netdev_priv(dev); 439 struct olympic_private *olympic_priv=netdev_priv(dev);
440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; 440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 4ffd8739f8b7..fba0811d2608 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2084,8 +2084,10 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
2084 if (!ugeth) 2084 if (!ugeth)
2085 return; 2085 return;
2086 2086
2087 if (ugeth->uccf) 2087 if (ugeth->uccf) {
2088 ucc_fast_free(ugeth->uccf); 2088 ucc_fast_free(ugeth->uccf);
2089 ugeth->uccf = NULL;
2090 }
2089 2091
2090 if (ugeth->p_thread_data_tx) { 2092 if (ugeth->p_thread_data_tx) {
2091 qe_muram_free(ugeth->thread_dat_tx_offset); 2093 qe_muram_free(ugeth->thread_dat_tx_offset);
@@ -2305,10 +2307,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2305 ug_info = ugeth->ug_info; 2307 ug_info = ugeth->ug_info;
2306 uf_info = &ug_info->uf_info; 2308 uf_info = &ug_info->uf_info;
2307 2309
2308 /* Create CQs for hash tables */
2309 INIT_LIST_HEAD(&ugeth->group_hash_q);
2310 INIT_LIST_HEAD(&ugeth->ind_hash_q);
2311
2312 if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || 2310 if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) ||
2313 (uf_info->bd_mem_part == MEM_PART_MURAM))) { 2311 (uf_info->bd_mem_part == MEM_PART_MURAM))) {
2314 if (netif_msg_probe(ugeth)) 2312 if (netif_msg_probe(ugeth))
@@ -3668,6 +3666,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3668 return IRQ_HANDLED; 3666 return IRQ_HANDLED;
3669} 3667}
3670 3668
3669#ifdef CONFIG_NET_POLL_CONTROLLER
3670/*
3671 * Polling 'interrupt' - used by things like netconsole to send skbs
3672 * without having to re-enable interrupts. It's not called while
3673 * the interrupt routine is executing.
3674 */
3675static void ucc_netpoll(struct net_device *dev)
3676{
3677 struct ucc_geth_private *ugeth = netdev_priv(dev);
3678 int irq = ugeth->ug_info->uf_info.irq;
3679
3680 disable_irq(irq);
3681 ucc_geth_irq_handler(irq, dev);
3682 enable_irq(irq);
3683}
3684#endif /* CONFIG_NET_POLL_CONTROLLER */
3685
3671/* Called when something needs to use the ethernet device */ 3686/* Called when something needs to use the ethernet device */
3672/* Returns 0 for success. */ 3687/* Returns 0 for success. */
3673static int ucc_geth_open(struct net_device *dev) 3688static int ucc_geth_open(struct net_device *dev)
@@ -3990,6 +4005,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3990 ugeth = netdev_priv(dev); 4005 ugeth = netdev_priv(dev);
3991 spin_lock_init(&ugeth->lock); 4006 spin_lock_init(&ugeth->lock);
3992 4007
4008 /* Create CQs for hash tables */
4009 INIT_LIST_HEAD(&ugeth->group_hash_q);
4010 INIT_LIST_HEAD(&ugeth->ind_hash_q);
4011
3993 dev_set_drvdata(device, dev); 4012 dev_set_drvdata(device, dev);
3994 4013
3995 /* Set the dev->base_addr to the gfar reg region */ 4014 /* Set the dev->base_addr to the gfar reg region */
@@ -4006,6 +4025,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
4006#ifdef CONFIG_UGETH_NAPI 4025#ifdef CONFIG_UGETH_NAPI
4007 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); 4026 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
4008#endif /* CONFIG_UGETH_NAPI */ 4027#endif /* CONFIG_UGETH_NAPI */
4028#ifdef CONFIG_NET_POLL_CONTROLLER
4029 dev->poll_controller = ucc_netpoll;
4030#endif
4009 dev->stop = ucc_geth_close; 4031 dev->stop = ucc_geth_close;
4010// dev->change_mtu = ucc_geth_change_mtu; 4032// dev->change_mtu = ucc_geth_change_mtu;
4011 dev->mtu = 1500; 4033 dev->mtu = 1500;
@@ -4040,9 +4062,10 @@ static int ucc_geth_remove(struct of_device* ofdev)
4040 struct net_device *dev = dev_get_drvdata(device); 4062 struct net_device *dev = dev_get_drvdata(device);
4041 struct ucc_geth_private *ugeth = netdev_priv(dev); 4063 struct ucc_geth_private *ugeth = netdev_priv(dev);
4042 4064
4043 dev_set_drvdata(device, NULL); 4065 unregister_netdev(dev);
4044 ucc_geth_memclean(ugeth);
4045 free_netdev(dev); 4066 free_netdev(dev);
4067 ucc_geth_memclean(ugeth);
4068 dev_set_drvdata(device, NULL);
4046 4069
4047 return 0; 4070 return 0;
4048} 4071}
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 33cbc306226c..7e1f00131f91 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -926,7 +926,6 @@ static int rtl8150_probe(struct usb_interface *intf,
926 netdev->set_multicast_list = rtl8150_set_multicast; 926 netdev->set_multicast_list = rtl8150_set_multicast;
927 netdev->set_mac_address = rtl8150_set_mac_address; 927 netdev->set_mac_address = rtl8150_set_mac_address;
928 netdev->get_stats = rtl8150_netdev_stats; 928 netdev->get_stats = rtl8150_netdev_stats;
929 netdev->mtu = RTL8150_MTU;
930 SET_ETHTOOL_OPS(netdev, &ops); 929 SET_ETHTOOL_OPS(netdev, &ops);
931 dev->intr_interval = 100; /* 100ms */ 930 dev->intr_interval = 100; /* 100ms */
932 931
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 87c180b563d3..7c851b1e6daa 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -606,7 +606,7 @@ static int rhine_napipoll(struct napi_struct *napi, int budget)
606} 606}
607#endif 607#endif
608 608
609static void rhine_hw_init(struct net_device *dev, long pioaddr) 609static void __devinit rhine_hw_init(struct net_device *dev, long pioaddr)
610{ 610{
611 struct rhine_private *rp = netdev_priv(dev); 611 struct rhine_private *rp = netdev_priv(dev);
612 612
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 35cd65d6b9ed..8c9fb824cbd4 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -8,7 +8,6 @@
8 * for 64bit hardware platforms. 8 * for 64bit hardware platforms.
9 * 9 *
10 * TODO 10 * TODO
11 * Big-endian support
12 * rx_copybreak/alignment 11 * rx_copybreak/alignment
13 * Scatter gather 12 * Scatter gather
14 * More testing 13 * More testing
@@ -681,7 +680,7 @@ static void velocity_rx_reset(struct velocity_info *vptr)
681 * Init state, all RD entries belong to the NIC 680 * Init state, all RD entries belong to the NIC
682 */ 681 */
683 for (i = 0; i < vptr->options.numrx; ++i) 682 for (i = 0; i < vptr->options.numrx; ++i)
684 vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; 683 vptr->rd_ring[i].rdesc0.len |= OWNED_BY_NIC;
685 684
686 writew(vptr->options.numrx, &regs->RBRDU); 685 writew(vptr->options.numrx, &regs->RBRDU);
687 writel(vptr->rd_pool_dma, &regs->RDBaseLo); 686 writel(vptr->rd_pool_dma, &regs->RDBaseLo);
@@ -777,7 +776,7 @@ static void velocity_init_registers(struct velocity_info *vptr,
777 776
778 vptr->int_mask = INT_MASK_DEF; 777 vptr->int_mask = INT_MASK_DEF;
779 778
780 writel(cpu_to_le32(vptr->rd_pool_dma), &regs->RDBaseLo); 779 writel(vptr->rd_pool_dma, &regs->RDBaseLo);
781 writew(vptr->options.numrx - 1, &regs->RDCSize); 780 writew(vptr->options.numrx - 1, &regs->RDCSize);
782 mac_rx_queue_run(regs); 781 mac_rx_queue_run(regs);
783 mac_rx_queue_wake(regs); 782 mac_rx_queue_wake(regs);
@@ -785,7 +784,7 @@ static void velocity_init_registers(struct velocity_info *vptr,
785 writew(vptr->options.numtx - 1, &regs->TDCSize); 784 writew(vptr->options.numtx - 1, &regs->TDCSize);
786 785
787 for (i = 0; i < vptr->num_txq; i++) { 786 for (i = 0; i < vptr->num_txq; i++) {
788 writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); 787 writel(vptr->td_pool_dma[i], &regs->TDBaseLo[i]);
789 mac_tx_queue_run(regs, i); 788 mac_tx_queue_run(regs, i);
790 } 789 }
791 790
@@ -1195,7 +1194,7 @@ static inline void velocity_give_many_rx_descs(struct velocity_info *vptr)
1195 dirty = vptr->rd_dirty - unusable; 1194 dirty = vptr->rd_dirty - unusable;
1196 for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { 1195 for (avail = vptr->rd_filled & 0xfffc; avail; avail--) {
1197 dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; 1196 dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1;
1198 vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; 1197 vptr->rd_ring[dirty].rdesc0.len |= OWNED_BY_NIC;
1199 } 1198 }
1200 1199
1201 writew(vptr->rd_filled & 0xfffc, &regs->RBRDU); 1200 writew(vptr->rd_filled & 0xfffc, &regs->RBRDU);
@@ -1210,7 +1209,7 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1210 struct rx_desc *rd = vptr->rd_ring + dirty; 1209 struct rx_desc *rd = vptr->rd_ring + dirty;
1211 1210
1212 /* Fine for an all zero Rx desc at init time as well */ 1211 /* Fine for an all zero Rx desc at init time as well */
1213 if (rd->rdesc0.owner == OWNED_BY_NIC) 1212 if (rd->rdesc0.len & OWNED_BY_NIC)
1214 break; 1213 break;
1215 1214
1216 if (!vptr->rd_info[dirty].skb) { 1215 if (!vptr->rd_info[dirty].skb) {
@@ -1413,7 +1412,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status)
1413 if (!vptr->rd_info[rd_curr].skb) 1412 if (!vptr->rd_info[rd_curr].skb)
1414 break; 1413 break;
1415 1414
1416 if (rd->rdesc0.owner == OWNED_BY_NIC) 1415 if (rd->rdesc0.len & OWNED_BY_NIC)
1417 break; 1416 break;
1418 1417
1419 rmb(); 1418 rmb();
@@ -1421,7 +1420,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status)
1421 /* 1420 /*
1422 * Don't drop CE or RL error frame although RXOK is off 1421 * Don't drop CE or RL error frame although RXOK is off
1423 */ 1422 */
1424 if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { 1423 if (rd->rdesc0.RSR & (RSR_RXOK | RSR_CE | RSR_RL)) {
1425 if (velocity_receive_frame(vptr, rd_curr) < 0) 1424 if (velocity_receive_frame(vptr, rd_curr) < 0)
1426 stats->rx_dropped++; 1425 stats->rx_dropped++;
1427 } else { 1426 } else {
@@ -1433,7 +1432,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status)
1433 stats->rx_dropped++; 1432 stats->rx_dropped++;
1434 } 1433 }
1435 1434
1436 rd->inten = 1; 1435 rd->size |= RX_INTEN;
1437 1436
1438 vptr->dev->last_rx = jiffies; 1437 vptr->dev->last_rx = jiffies;
1439 1438
@@ -1554,7 +1553,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
1554 struct net_device_stats *stats = &vptr->stats; 1553 struct net_device_stats *stats = &vptr->stats;
1555 struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); 1554 struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]);
1556 struct rx_desc *rd = &(vptr->rd_ring[idx]); 1555 struct rx_desc *rd = &(vptr->rd_ring[idx]);
1557 int pkt_len = rd->rdesc0.len; 1556 int pkt_len = le16_to_cpu(rd->rdesc0.len) & 0x3fff;
1558 struct sk_buff *skb; 1557 struct sk_buff *skb;
1559 1558
1560 if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { 1559 if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) {
@@ -1637,8 +1636,7 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1637 */ 1636 */
1638 1637
1639 *((u32 *) & (rd->rdesc0)) = 0; 1638 *((u32 *) & (rd->rdesc0)) = 0;
1640 rd->len = cpu_to_le32(vptr->rx_buf_sz); 1639 rd->size = cpu_to_le16(vptr->rx_buf_sz) | RX_INTEN;
1641 rd->inten = 1;
1642 rd->pa_low = cpu_to_le32(rd_info->skb_dma); 1640 rd->pa_low = cpu_to_le32(rd_info->skb_dma);
1643 rd->pa_high = 0; 1641 rd->pa_high = 0;
1644 return 0; 1642 return 0;
@@ -1674,7 +1672,7 @@ static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
1674 td = &(vptr->td_rings[qnum][idx]); 1672 td = &(vptr->td_rings[qnum][idx]);
1675 tdinfo = &(vptr->td_infos[qnum][idx]); 1673 tdinfo = &(vptr->td_infos[qnum][idx]);
1676 1674
1677 if (td->tdesc0.owner == OWNED_BY_NIC) 1675 if (td->tdesc0.len & OWNED_BY_NIC)
1678 break; 1676 break;
1679 1677
1680 if ((works++ > 15)) 1678 if ((works++ > 15))
@@ -1874,7 +1872,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
1874 1872
1875 for (i = 0; i < tdinfo->nskb_dma; i++) { 1873 for (i = 0; i < tdinfo->nskb_dma; i++) {
1876#ifdef VELOCITY_ZERO_COPY_SUPPORT 1874#ifdef VELOCITY_ZERO_COPY_SUPPORT
1877 pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], td->tdesc1.len, PCI_DMA_TODEVICE); 1875 pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
1878#else 1876#else
1879 pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], skb->len, PCI_DMA_TODEVICE); 1877 pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], skb->len, PCI_DMA_TODEVICE);
1880#endif 1878#endif
@@ -2067,8 +2065,8 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2067 struct velocity_td_info *tdinfo; 2065 struct velocity_td_info *tdinfo;
2068 unsigned long flags; 2066 unsigned long flags;
2069 int index; 2067 int index;
2070
2071 int pktlen = skb->len; 2068 int pktlen = skb->len;
2069 __le16 len = cpu_to_le16(pktlen);
2072 2070
2073#ifdef VELOCITY_ZERO_COPY_SUPPORT 2071#ifdef VELOCITY_ZERO_COPY_SUPPORT
2074 if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) { 2072 if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) {
@@ -2083,9 +2081,8 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2083 td_ptr = &(vptr->td_rings[qnum][index]); 2081 td_ptr = &(vptr->td_rings[qnum][index]);
2084 tdinfo = &(vptr->td_infos[qnum][index]); 2082 tdinfo = &(vptr->td_infos[qnum][index]);
2085 2083
2086 td_ptr->tdesc1.TCPLS = TCPLS_NORMAL;
2087 td_ptr->tdesc1.TCR = TCR0_TIC; 2084 td_ptr->tdesc1.TCR = TCR0_TIC;
2088 td_ptr->td_buf[0].queue = 0; 2085 td_ptr->td_buf[0].size &= ~TD_QUEUE;
2089 2086
2090 /* 2087 /*
2091 * Pad short frames. 2088 * Pad short frames.
@@ -2093,16 +2090,16 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2093 if (pktlen < ETH_ZLEN) { 2090 if (pktlen < ETH_ZLEN) {
2094 /* Cannot occur until ZC support */ 2091 /* Cannot occur until ZC support */
2095 pktlen = ETH_ZLEN; 2092 pktlen = ETH_ZLEN;
2093 len = cpu_to_le16(ETH_ZLEN);
2096 skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); 2094 skb_copy_from_linear_data(skb, tdinfo->buf, skb->len);
2097 memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); 2095 memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
2098 tdinfo->skb = skb; 2096 tdinfo->skb = skb;
2099 tdinfo->skb_dma[0] = tdinfo->buf_dma; 2097 tdinfo->skb_dma[0] = tdinfo->buf_dma;
2100 td_ptr->tdesc0.pktsize = pktlen; 2098 td_ptr->tdesc0.len = len;
2101 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); 2099 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
2102 td_ptr->td_buf[0].pa_high = 0; 2100 td_ptr->td_buf[0].pa_high = 0;
2103 td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; 2101 td_ptr->td_buf[0].size = len; /* queue is 0 anyway */
2104 tdinfo->nskb_dma = 1; 2102 tdinfo->nskb_dma = 1;
2105 td_ptr->tdesc1.CMDZ = 2;
2106 } else 2103 } else
2107#ifdef VELOCITY_ZERO_COPY_SUPPORT 2104#ifdef VELOCITY_ZERO_COPY_SUPPORT
2108 if (skb_shinfo(skb)->nr_frags > 0) { 2105 if (skb_shinfo(skb)->nr_frags > 0) {
@@ -2111,36 +2108,35 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2111 if (nfrags > 6) { 2108 if (nfrags > 6) {
2112 skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); 2109 skb_copy_from_linear_data(skb, tdinfo->buf, skb->len);
2113 tdinfo->skb_dma[0] = tdinfo->buf_dma; 2110 tdinfo->skb_dma[0] = tdinfo->buf_dma;
2114 td_ptr->tdesc0.pktsize = 2111 td_ptr->tdesc0.len = len;
2115 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); 2112 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
2116 td_ptr->td_buf[0].pa_high = 0; 2113 td_ptr->td_buf[0].pa_high = 0;
2117 td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; 2114 td_ptr->td_buf[0].size = len; /* queue is 0 anyway */
2118 tdinfo->nskb_dma = 1; 2115 tdinfo->nskb_dma = 1;
2119 td_ptr->tdesc1.CMDZ = 2;
2120 } else { 2116 } else {
2121 int i = 0; 2117 int i = 0;
2122 tdinfo->nskb_dma = 0; 2118 tdinfo->nskb_dma = 0;
2123 tdinfo->skb_dma[i] = pci_map_single(vptr->pdev, skb->data, skb->len - skb->data_len, PCI_DMA_TODEVICE); 2119 tdinfo->skb_dma[i] = pci_map_single(vptr->pdev, skb->data,
2120 skb_headlen(skb), PCI_DMA_TODEVICE);
2124 2121
2125 td_ptr->tdesc0.pktsize = pktlen; 2122 td_ptr->tdesc0.len = len;
2126 2123
2127 /* FIXME: support 48bit DMA later */ 2124 /* FIXME: support 48bit DMA later */
2128 td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); 2125 td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma);
2129 td_ptr->td_buf[i].pa_high = 0; 2126 td_ptr->td_buf[i].pa_high = 0;
2130 td_ptr->td_buf[i].bufsize = skb->len->skb->data_len; 2127 td_ptr->td_buf[i].size = cpu_to_le16(skb_headlen(skb));
2131 2128
2132 for (i = 0; i < nfrags; i++) { 2129 for (i = 0; i < nfrags; i++) {
2133 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 2130 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2134 void *addr = ((void *) page_address(frag->page + frag->page_offset)); 2131 void *addr = (void *)page_address(frag->page) + frag->page_offset;
2135 2132
2136 tdinfo->skb_dma[i + 1] = pci_map_single(vptr->pdev, addr, frag->size, PCI_DMA_TODEVICE); 2133 tdinfo->skb_dma[i + 1] = pci_map_single(vptr->pdev, addr, frag->size, PCI_DMA_TODEVICE);
2137 2134
2138 td_ptr->td_buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]); 2135 td_ptr->td_buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]);
2139 td_ptr->td_buf[i + 1].pa_high = 0; 2136 td_ptr->td_buf[i + 1].pa_high = 0;
2140 td_ptr->td_buf[i + 1].bufsize = frag->size; 2137 td_ptr->td_buf[i + 1].size = cpu_to_le16(frag->size);
2141 } 2138 }
2142 tdinfo->nskb_dma = i - 1; 2139 tdinfo->nskb_dma = i - 1;
2143 td_ptr->tdesc1.CMDZ = i;
2144 } 2140 }
2145 2141
2146 } else 2142 } else
@@ -2152,18 +2148,16 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2152 */ 2148 */
2153 tdinfo->skb = skb; 2149 tdinfo->skb = skb;
2154 tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); 2150 tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
2155 td_ptr->tdesc0.pktsize = pktlen; 2151 td_ptr->tdesc0.len = len;
2156 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); 2152 td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
2157 td_ptr->td_buf[0].pa_high = 0; 2153 td_ptr->td_buf[0].pa_high = 0;
2158 td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; 2154 td_ptr->td_buf[0].size = len;
2159 tdinfo->nskb_dma = 1; 2155 tdinfo->nskb_dma = 1;
2160 td_ptr->tdesc1.CMDZ = 2;
2161 } 2156 }
2157 td_ptr->tdesc1.cmd = TCPLS_NORMAL + (tdinfo->nskb_dma + 1) * 16;
2162 2158
2163 if (vptr->vlgrp && vlan_tx_tag_present(skb)) { 2159 if (vptr->vlgrp && vlan_tx_tag_present(skb)) {
2164 td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb); 2160 td_ptr->tdesc1.vlan = cpu_to_le16(vlan_tx_tag_get(skb));
2165 td_ptr->tdesc1.pqinf.priority = 0;
2166 td_ptr->tdesc1.pqinf.CFI = 0;
2167 td_ptr->tdesc1.TCR |= TCR0_VETAG; 2161 td_ptr->tdesc1.TCR |= TCR0_VETAG;
2168 } 2162 }
2169 2163
@@ -2185,7 +2179,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2185 2179
2186 if (prev < 0) 2180 if (prev < 0)
2187 prev = vptr->options.numtx - 1; 2181 prev = vptr->options.numtx - 1;
2188 td_ptr->tdesc0.owner = OWNED_BY_NIC; 2182 td_ptr->tdesc0.len |= OWNED_BY_NIC;
2189 vptr->td_used[qnum]++; 2183 vptr->td_used[qnum]++;
2190 vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; 2184 vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx;
2191 2185
@@ -2193,7 +2187,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2193 netif_stop_queue(dev); 2187 netif_stop_queue(dev);
2194 2188
2195 td_ptr = &(vptr->td_rings[qnum][prev]); 2189 td_ptr = &(vptr->td_rings[qnum][prev]);
2196 td_ptr->td_buf[0].queue = 1; 2190 td_ptr->td_buf[0].size |= TD_QUEUE;
2197 mac_tx_queue_wake(vptr->mac_regs, qnum); 2191 mac_tx_queue_wake(vptr->mac_regs, qnum);
2198 } 2192 }
2199 dev->trans_start = jiffies; 2193 dev->trans_start = jiffies;
@@ -3410,7 +3404,7 @@ static int velocity_suspend(struct pci_dev *pdev, pm_message_t state)
3410 velocity_save_context(vptr, &vptr->context); 3404 velocity_save_context(vptr, &vptr->context);
3411 velocity_shutdown(vptr); 3405 velocity_shutdown(vptr);
3412 velocity_set_wol(vptr); 3406 velocity_set_wol(vptr);
3413 pci_enable_wake(pdev, 3, 1); 3407 pci_enable_wake(pdev, PCI_D3hot, 1);
3414 pci_set_power_state(pdev, PCI_D3hot); 3408 pci_set_power_state(pdev, PCI_D3hot);
3415 } else { 3409 } else {
3416 velocity_save_context(vptr, &vptr->context); 3410 velocity_save_context(vptr, &vptr->context);
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index aa9179623d90..7387be4f428d 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -70,40 +70,27 @@
70 * Bits in the RSR0 register 70 * Bits in the RSR0 register
71 */ 71 */
72 72
73#define RSR_DETAG 0x0080 73#define RSR_DETAG cpu_to_le16(0x0080)
74#define RSR_SNTAG 0x0040 74#define RSR_SNTAG cpu_to_le16(0x0040)
75#define RSR_RXER 0x0020 75#define RSR_RXER cpu_to_le16(0x0020)
76#define RSR_RL 0x0010 76#define RSR_RL cpu_to_le16(0x0010)
77#define RSR_CE 0x0008 77#define RSR_CE cpu_to_le16(0x0008)
78#define RSR_FAE 0x0004 78#define RSR_FAE cpu_to_le16(0x0004)
79#define RSR_CRC 0x0002 79#define RSR_CRC cpu_to_le16(0x0002)
80#define RSR_VIDM 0x0001 80#define RSR_VIDM cpu_to_le16(0x0001)
81 81
82/* 82/*
83 * Bits in the RSR1 register 83 * Bits in the RSR1 register
84 */ 84 */
85 85
86#define RSR_RXOK 0x8000 // rx OK 86#define RSR_RXOK cpu_to_le16(0x8000) // rx OK
87#define RSR_PFT 0x4000 // Perfect filtering address match 87#define RSR_PFT cpu_to_le16(0x4000) // Perfect filtering address match
88#define RSR_MAR 0x2000 // MAC accept multicast address packet 88#define RSR_MAR cpu_to_le16(0x2000) // MAC accept multicast address packet
89#define RSR_BAR 0x1000 // MAC accept broadcast address packet 89#define RSR_BAR cpu_to_le16(0x1000) // MAC accept broadcast address packet
90#define RSR_PHY 0x0800 // MAC accept physical address packet 90#define RSR_PHY cpu_to_le16(0x0800) // MAC accept physical address packet
91#define RSR_VTAG 0x0400 // 802.1p/1q tagging packet indicator 91#define RSR_VTAG cpu_to_le16(0x0400) // 802.1p/1q tagging packet indicator
92#define RSR_STP 0x0200 // start of packet 92#define RSR_STP cpu_to_le16(0x0200) // start of packet
93#define RSR_EDP 0x0100 // end of packet 93#define RSR_EDP cpu_to_le16(0x0100) // end of packet
94
95/*
96 * Bits in the RSR1 register
97 */
98
99#define RSR1_RXOK 0x80 // rx OK
100#define RSR1_PFT 0x40 // Perfect filtering address match
101#define RSR1_MAR 0x20 // MAC accept multicast address packet
102#define RSR1_BAR 0x10 // MAC accept broadcast address packet
103#define RSR1_PHY 0x08 // MAC accept physical address packet
104#define RSR1_VTAG 0x04 // 802.1p/1q tagging packet indicator
105#define RSR1_STP 0x02 // start of packet
106#define RSR1_EDP 0x01 // end of packet
107 94
108/* 95/*
109 * Bits in the CSM register 96 * Bits in the CSM register
@@ -120,33 +107,21 @@
120 * Bits in the TSR0 register 107 * Bits in the TSR0 register
121 */ 108 */
122 109
123#define TSR0_ABT 0x0080 // Tx abort because of excessive collision 110#define TSR0_ABT cpu_to_le16(0x0080) // Tx abort because of excessive collision
124#define TSR0_OWT 0x0040 // Jumbo frame Tx abort 111#define TSR0_OWT cpu_to_le16(0x0040) // Jumbo frame Tx abort
125#define TSR0_OWC 0x0020 // Out of window collision 112#define TSR0_OWC cpu_to_le16(0x0020) // Out of window collision
126#define TSR0_COLS 0x0010 // experience collision in this transmit event 113#define TSR0_COLS cpu_to_le16(0x0010) // experience collision in this transmit event
127#define TSR0_NCR3 0x0008 // collision retry counter[3] 114#define TSR0_NCR3 cpu_to_le16(0x0008) // collision retry counter[3]
128#define TSR0_NCR2 0x0004 // collision retry counter[2] 115#define TSR0_NCR2 cpu_to_le16(0x0004) // collision retry counter[2]
129#define TSR0_NCR1 0x0002 // collision retry counter[1] 116#define TSR0_NCR1 cpu_to_le16(0x0002) // collision retry counter[1]
130#define TSR0_NCR0 0x0001 // collision retry counter[0] 117#define TSR0_NCR0 cpu_to_le16(0x0001) // collision retry counter[0]
131#define TSR0_TERR 0x8000 // 118#define TSR0_TERR cpu_to_le16(0x8000) //
132#define TSR0_FDX 0x4000 // current transaction is serviced by full duplex mode 119#define TSR0_FDX cpu_to_le16(0x4000) // current transaction is serviced by full duplex mode
133#define TSR0_GMII 0x2000 // current transaction is serviced by GMII mode 120#define TSR0_GMII cpu_to_le16(0x2000) // current transaction is serviced by GMII mode
134#define TSR0_LNKFL 0x1000 // packet serviced during link down 121#define TSR0_LNKFL cpu_to_le16(0x1000) // packet serviced during link down
135#define TSR0_SHDN 0x0400 // shutdown case 122#define TSR0_SHDN cpu_to_le16(0x0400) // shutdown case
136#define TSR0_CRS 0x0200 // carrier sense lost 123#define TSR0_CRS cpu_to_le16(0x0200) // carrier sense lost
137#define TSR0_CDH 0x0100 // AQE test fail (CD heartbeat) 124#define TSR0_CDH cpu_to_le16(0x0100) // AQE test fail (CD heartbeat)
138
139/*
140 * Bits in the TSR1 register
141 */
142
143#define TSR1_TERR 0x80 //
144#define TSR1_FDX 0x40 // current transaction is serviced by full duplex mode
145#define TSR1_GMII 0x20 // current transaction is serviced by GMII mode
146#define TSR1_LNKFL 0x10 // packet serviced during link down
147#define TSR1_SHDN 0x04 // shutdown case
148#define TSR1_CRS 0x02 // carrier sense lost
149#define TSR1_CDH 0x01 // AQE test fail (CD heartbeat)
150 125
151// 126//
152// Bits in the TCR0 register 127// Bits in the TCR0 register
@@ -197,25 +172,26 @@
197 */ 172 */
198 173
199struct rdesc0 { 174struct rdesc0 {
200 u16 RSR; /* Receive status */ 175 __le16 RSR; /* Receive status */
201 u16 len:14; /* Received packet length */ 176 __le16 len; /* bits 0--13; bit 15 - owner */
202 u16 reserved:1;
203 u16 owner:1; /* Who owns this buffer ? */
204}; 177};
205 178
206struct rdesc1 { 179struct rdesc1 {
207 u16 PQTAG; 180 __le16 PQTAG;
208 u8 CSM; 181 u8 CSM;
209 u8 IPKT; 182 u8 IPKT;
210}; 183};
211 184
185enum {
186 RX_INTEN = __constant_cpu_to_le16(0x8000)
187};
188
212struct rx_desc { 189struct rx_desc {
213 struct rdesc0 rdesc0; 190 struct rdesc0 rdesc0;
214 struct rdesc1 rdesc1; 191 struct rdesc1 rdesc1;
215 u32 pa_low; /* Low 32 bit PCI address */ 192 __le32 pa_low; /* Low 32 bit PCI address */
216 u16 pa_high; /* Next 16 bit PCI address (48 total) */ 193 __le16 pa_high; /* Next 16 bit PCI address (48 total) */
217 u16 len:15; /* Frame size */ 194 __le16 size; /* bits 0--14 - frame size, bit 15 - enable int. */
218 u16 inten:1; /* Enable interrupt */
219} __attribute__ ((__packed__)); 195} __attribute__ ((__packed__));
220 196
221/* 197/*
@@ -223,32 +199,24 @@ struct rx_desc {
223 */ 199 */
224 200
225struct tdesc0 { 201struct tdesc0 {
226 u16 TSR; /* Transmit status register */ 202 __le16 TSR; /* Transmit status register */
227 u16 pktsize:14; /* Size of frame */ 203 __le16 len; /* bits 0--13 - size of frame, bit 15 - owner */
228 u16 reserved:1;
229 u16 owner:1; /* Who owns the buffer */
230}; 204};
231 205
232struct pqinf { /* Priority queue info */
233 u16 VID:12;
234 u16 CFI:1;
235 u16 priority:3;
236} __attribute__ ((__packed__));
237
238struct tdesc1 { 206struct tdesc1 {
239 struct pqinf pqinf; 207 __le16 vlan;
240 u8 TCR; 208 u8 TCR;
241 u8 TCPLS:2; 209 u8 cmd; /* bits 0--1 - TCPLS, bits 4--7 - CMDZ */
242 u8 reserved:2;
243 u8 CMDZ:4;
244} __attribute__ ((__packed__)); 210} __attribute__ ((__packed__));
245 211
212enum {
213 TD_QUEUE = __constant_cpu_to_le16(0x8000)
214};
215
246struct td_buf { 216struct td_buf {
247 u32 pa_low; 217 __le32 pa_low;
248 u16 pa_high; 218 __le16 pa_high;
249 u16 bufsize:14; 219 __le16 size; /* bits 0--13 - size, bit 15 - queue */
250 u16 reserved:1;
251 u16 queue:1;
252} __attribute__ ((__packed__)); 220} __attribute__ ((__packed__));
253 221
254struct tx_desc { 222struct tx_desc {
@@ -276,7 +244,7 @@ struct velocity_td_info {
276 244
277enum velocity_owner { 245enum velocity_owner {
278 OWNED_BY_HOST = 0, 246 OWNED_BY_HOST = 0,
279 OWNED_BY_NIC = 1 247 OWNED_BY_NIC = __constant_cpu_to_le16(0x8000)
280}; 248};
281 249
282 250
@@ -1012,45 +980,45 @@ struct mac_regs {
1012 volatile u8 RCR; 980 volatile u8 RCR;
1013 volatile u8 TCR; 981 volatile u8 TCR;
1014 982
1015 volatile u32 CR0Set; /* 0x08 */ 983 volatile __le32 CR0Set; /* 0x08 */
1016 volatile u32 CR0Clr; /* 0x0C */ 984 volatile __le32 CR0Clr; /* 0x0C */
1017 985
1018 volatile u8 MARCAM[8]; /* 0x10 */ 986 volatile u8 MARCAM[8]; /* 0x10 */
1019 987
1020 volatile u32 DecBaseHi; /* 0x18 */ 988 volatile __le32 DecBaseHi; /* 0x18 */
1021 volatile u16 DbfBaseHi; /* 0x1C */ 989 volatile __le16 DbfBaseHi; /* 0x1C */
1022 volatile u16 reserved_1E; 990 volatile __le16 reserved_1E;
1023 991
1024 volatile u16 ISRCTL; /* 0x20 */ 992 volatile __le16 ISRCTL; /* 0x20 */
1025 volatile u8 TXESR; 993 volatile u8 TXESR;
1026 volatile u8 RXESR; 994 volatile u8 RXESR;
1027 995
1028 volatile u32 ISR; /* 0x24 */ 996 volatile __le32 ISR; /* 0x24 */
1029 volatile u32 IMR; 997 volatile __le32 IMR;
1030 998
1031 volatile u32 TDStatusPort; /* 0x2C */ 999 volatile __le32 TDStatusPort; /* 0x2C */
1032 1000
1033 volatile u16 TDCSRSet; /* 0x30 */ 1001 volatile __le16 TDCSRSet; /* 0x30 */
1034 volatile u8 RDCSRSet; 1002 volatile u8 RDCSRSet;
1035 volatile u8 reserved_33; 1003 volatile u8 reserved_33;
1036 volatile u16 TDCSRClr; 1004 volatile __le16 TDCSRClr;
1037 volatile u8 RDCSRClr; 1005 volatile u8 RDCSRClr;
1038 volatile u8 reserved_37; 1006 volatile u8 reserved_37;
1039 1007
1040 volatile u32 RDBaseLo; /* 0x38 */ 1008 volatile __le32 RDBaseLo; /* 0x38 */
1041 volatile u16 RDIdx; /* 0x3C */ 1009 volatile __le16 RDIdx; /* 0x3C */
1042 volatile u16 reserved_3E; 1010 volatile __le16 reserved_3E;
1043 1011
1044 volatile u32 TDBaseLo[4]; /* 0x40 */ 1012 volatile __le32 TDBaseLo[4]; /* 0x40 */
1045 1013
1046 volatile u16 RDCSize; /* 0x50 */ 1014 volatile __le16 RDCSize; /* 0x50 */
1047 volatile u16 TDCSize; /* 0x52 */ 1015 volatile __le16 TDCSize; /* 0x52 */
1048 volatile u16 TDIdx[4]; /* 0x54 */ 1016 volatile __le16 TDIdx[4]; /* 0x54 */
1049 volatile u16 tx_pause_timer; /* 0x5C */ 1017 volatile __le16 tx_pause_timer; /* 0x5C */
1050 volatile u16 RBRDU; /* 0x5E */ 1018 volatile __le16 RBRDU; /* 0x5E */
1051 1019
1052 volatile u32 FIFOTest0; /* 0x60 */ 1020 volatile __le32 FIFOTest0; /* 0x60 */
1053 volatile u32 FIFOTest1; /* 0x64 */ 1021 volatile __le32 FIFOTest1; /* 0x64 */
1054 1022
1055 volatile u8 CAMADDR; /* 0x68 */ 1023 volatile u8 CAMADDR; /* 0x68 */
1056 volatile u8 CAMCR; /* 0x69 */ 1024 volatile u8 CAMCR; /* 0x69 */
@@ -1063,18 +1031,18 @@ struct mac_regs {
1063 volatile u8 PHYSR1; 1031 volatile u8 PHYSR1;
1064 volatile u8 MIICR; 1032 volatile u8 MIICR;
1065 volatile u8 MIIADR; 1033 volatile u8 MIIADR;
1066 volatile u16 MIIDATA; 1034 volatile __le16 MIIDATA;
1067 1035
1068 volatile u16 SoftTimer0; /* 0x74 */ 1036 volatile __le16 SoftTimer0; /* 0x74 */
1069 volatile u16 SoftTimer1; 1037 volatile __le16 SoftTimer1;
1070 1038
1071 volatile u8 CFGA; /* 0x78 */ 1039 volatile u8 CFGA; /* 0x78 */
1072 volatile u8 CFGB; 1040 volatile u8 CFGB;
1073 volatile u8 CFGC; 1041 volatile u8 CFGC;
1074 volatile u8 CFGD; 1042 volatile u8 CFGD;
1075 1043
1076 volatile u16 DCFG; /* 0x7C */ 1044 volatile __le16 DCFG; /* 0x7C */
1077 volatile u16 MCFG; 1045 volatile __le16 MCFG;
1078 1046
1079 volatile u8 TBIST; /* 0x80 */ 1047 volatile u8 TBIST; /* 0x80 */
1080 volatile u8 RBIST; 1048 volatile u8 RBIST;
@@ -1086,9 +1054,9 @@ struct mac_regs {
1086 volatile u8 rev_id; 1054 volatile u8 rev_id;
1087 volatile u8 PORSTS; 1055 volatile u8 PORSTS;
1088 1056
1089 volatile u32 MIBData; /* 0x88 */ 1057 volatile __le32 MIBData; /* 0x88 */
1090 1058
1091 volatile u16 EEWrData; 1059 volatile __le16 EEWrData;
1092 1060
1093 volatile u8 reserved_8E; 1061 volatile u8 reserved_8E;
1094 volatile u8 BPMDWr; 1062 volatile u8 BPMDWr;
@@ -1098,7 +1066,7 @@ struct mac_regs {
1098 volatile u8 EECHKSUM; /* 0x92 */ 1066 volatile u8 EECHKSUM; /* 0x92 */
1099 volatile u8 EECSR; 1067 volatile u8 EECSR;
1100 1068
1101 volatile u16 EERdData; /* 0x94 */ 1069 volatile __le16 EERdData; /* 0x94 */
1102 volatile u8 EADDR; 1070 volatile u8 EADDR;
1103 volatile u8 EMBCMD; 1071 volatile u8 EMBCMD;
1104 1072
@@ -1112,22 +1080,22 @@ struct mac_regs {
1112 volatile u8 DEBUG; 1080 volatile u8 DEBUG;
1113 volatile u8 CHIPGCR; 1081 volatile u8 CHIPGCR;
1114 1082
1115 volatile u16 WOLCRSet; /* 0xA0 */ 1083 volatile __le16 WOLCRSet; /* 0xA0 */
1116 volatile u8 PWCFGSet; 1084 volatile u8 PWCFGSet;
1117 volatile u8 WOLCFGSet; 1085 volatile u8 WOLCFGSet;
1118 1086
1119 volatile u16 WOLCRClr; /* 0xA4 */ 1087 volatile __le16 WOLCRClr; /* 0xA4 */
1120 volatile u8 PWCFGCLR; 1088 volatile u8 PWCFGCLR;
1121 volatile u8 WOLCFGClr; 1089 volatile u8 WOLCFGClr;
1122 1090
1123 volatile u16 WOLSRSet; /* 0xA8 */ 1091 volatile __le16 WOLSRSet; /* 0xA8 */
1124 volatile u16 reserved_AA; 1092 volatile __le16 reserved_AA;
1125 1093
1126 volatile u16 WOLSRClr; /* 0xAC */ 1094 volatile __le16 WOLSRClr; /* 0xAC */
1127 volatile u16 reserved_AE; 1095 volatile __le16 reserved_AE;
1128 1096
1129 volatile u16 PatternCRC[8]; /* 0xB0 */ 1097 volatile __le16 PatternCRC[8]; /* 0xB0 */
1130 volatile u32 ByteMask[4][4]; /* 0xC0 */ 1098 volatile __le32 ByteMask[4][4]; /* 0xC0 */
1131} __attribute__ ((__packed__)); 1099} __attribute__ ((__packed__));
1132 1100
1133 1101
@@ -1238,12 +1206,12 @@ typedef u8 MCAM_ADDR[ETH_ALEN];
1238struct arp_packet { 1206struct arp_packet {
1239 u8 dest_mac[ETH_ALEN]; 1207 u8 dest_mac[ETH_ALEN];
1240 u8 src_mac[ETH_ALEN]; 1208 u8 src_mac[ETH_ALEN];
1241 u16 type; 1209 __be16 type;
1242 u16 ar_hrd; 1210 __be16 ar_hrd;
1243 u16 ar_pro; 1211 __be16 ar_pro;
1244 u8 ar_hln; 1212 u8 ar_hln;
1245 u8 ar_pln; 1213 u8 ar_pln;
1246 u16 ar_op; 1214 __be16 ar_op;
1247 u8 ar_sha[ETH_ALEN]; 1215 u8 ar_sha[ETH_ALEN];
1248 u8 ar_sip[4]; 1216 u8 ar_sip[4];
1249 u8 ar_tha[ETH_ALEN]; 1217 u8 ar_tha[ETH_ALEN];
@@ -1253,7 +1221,7 @@ struct arp_packet {
1253struct _magic_packet { 1221struct _magic_packet {
1254 u8 dest_mac[6]; 1222 u8 dest_mac[6];
1255 u8 src_mac[6]; 1223 u8 src_mac[6];
1256 u16 type; 1224 __be16 type;
1257 u8 MAC[16][6]; 1225 u8 MAC[16][6];
1258 u8 password[6]; 1226 u8 password[6];
1259} __attribute__ ((__packed__)); 1227} __attribute__ ((__packed__));
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index d6599d219193..ddc87149fe31 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -153,7 +153,7 @@ static int ath5k_pci_resume(struct pci_dev *pdev);
153#define ath5k_pci_resume NULL 153#define ath5k_pci_resume NULL
154#endif /* CONFIG_PM */ 154#endif /* CONFIG_PM */
155 155
156static struct pci_driver ath5k_pci_drv_id = { 156static struct pci_driver ath5k_pci_driver = {
157 .name = "ath5k_pci", 157 .name = "ath5k_pci",
158 .id_table = ath5k_pci_id_table, 158 .id_table = ath5k_pci_id_table,
159 .probe = ath5k_pci_probe, 159 .probe = ath5k_pci_probe,
@@ -329,7 +329,7 @@ init_ath5k_pci(void)
329 329
330 ath5k_debug_init(); 330 ath5k_debug_init();
331 331
332 ret = pci_register_driver(&ath5k_pci_drv_id); 332 ret = pci_register_driver(&ath5k_pci_driver);
333 if (ret) { 333 if (ret) {
334 printk(KERN_ERR "ath5k_pci: can't register pci driver\n"); 334 printk(KERN_ERR "ath5k_pci: can't register pci driver\n");
335 return ret; 335 return ret;
@@ -341,7 +341,7 @@ init_ath5k_pci(void)
341static void __exit 341static void __exit
342exit_ath5k_pci(void) 342exit_ath5k_pci(void)
343{ 343{
344 pci_unregister_driver(&ath5k_pci_drv_id); 344 pci_unregister_driver(&ath5k_pci_driver);
345 345
346 ath5k_debug_finish(); 346 ath5k_debug_finish();
347} 347}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 4fdeb5323248..8d4d91d35fd2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -238,9 +238,10 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b
238 priv->last_statistics_time = jiffies; 238 priv->last_statistics_time = jiffies;
239} 239}
240 240
241void iwl3945_add_radiotap(struct iwl3945_priv *priv, struct sk_buff *skb, 241static void iwl3945_add_radiotap(struct iwl3945_priv *priv,
242 struct iwl3945_rx_frame_hdr *rx_hdr, 242 struct sk_buff *skb,
243 struct ieee80211_rx_status *stats) 243 struct iwl3945_rx_frame_hdr *rx_hdr,
244 struct ieee80211_rx_status *stats)
244{ 245{
245 /* First cache any information we need before we overwrite 246 /* First cache any information we need before we overwrite
246 * the information provided in the skb from the hardware */ 247 * the information provided in the skb from the hardware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 569347ff377b..d727de8b96fe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4658,17 +4658,30 @@ void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
4658 struct ieee80211_ht_info *sta_ht_inf) 4658 struct ieee80211_ht_info *sta_ht_inf)
4659{ 4659{
4660 __le32 sta_flags; 4660 __le32 sta_flags;
4661 u8 mimo_ps_mode;
4661 4662
4662 if (!sta_ht_inf || !sta_ht_inf->ht_supported) 4663 if (!sta_ht_inf || !sta_ht_inf->ht_supported)
4663 goto done; 4664 goto done;
4664 4665
4666 mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2;
4667
4665 sta_flags = priv->stations[index].sta.station_flags; 4668 sta_flags = priv->stations[index].sta.station_flags;
4666 4669
4667 if (((sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS >> 2)) 4670 sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK);
4668 == IWL_MIMO_PS_DYNAMIC) 4671
4672 switch (mimo_ps_mode) {
4673 case WLAN_HT_CAP_MIMO_PS_STATIC:
4674 sta_flags |= STA_FLG_MIMO_DIS_MSK;
4675 break;
4676 case WLAN_HT_CAP_MIMO_PS_DYNAMIC:
4669 sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; 4677 sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK;
4670 else 4678 break;
4671 sta_flags &= ~STA_FLG_RTS_MIMO_PROT_MSK; 4679 case WLAN_HT_CAP_MIMO_PS_DISABLED:
4680 break;
4681 default:
4682 IWL_WARNING("Invalid MIMO PS mode %d", mimo_ps_mode);
4683 break;
4684 }
4672 4685
4673 sta_flags |= cpu_to_le32( 4686 sta_flags |= cpu_to_le32(
4674 (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); 4687 (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS);
@@ -4679,7 +4692,7 @@ void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
4679 if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf)) 4692 if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf))
4680 sta_flags |= STA_FLG_FAT_EN_MSK; 4693 sta_flags |= STA_FLG_FAT_EN_MSK;
4681 else 4694 else
4682 sta_flags &= (~STA_FLG_FAT_EN_MSK); 4695 sta_flags &= ~STA_FLG_FAT_EN_MSK;
4683 4696
4684 priv->stations[index].sta.station_flags = sta_flags; 4697 priv->stations[index].sta.station_flags = sta_flags;
4685 done: 4698 done:
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index cb009f4c401f..8993cca81b40 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -147,9 +147,6 @@ static inline struct ieee80211_conf *ieee80211_get_hw_conf(
147 147
148#define QOS_CONTROL_LEN 2 148#define QOS_CONTROL_LEN 2
149 149
150#define IEEE80211_STYPE_BACK_REQ 0x0080
151#define IEEE80211_STYPE_BACK 0x0090
152
153 150
154static inline int ieee80211_is_management(u16 fc) 151static inline int ieee80211_is_management(u16 fc)
155{ 152{
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 33239f197984..f55c75712b55 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6330,6 +6330,11 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
6330 return -ENODEV; 6330 return -ENODEV;
6331 } 6331 }
6332 6332
6333 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6334 IWL_ERROR("ucode not available for device bringup\n");
6335 return -EIO;
6336 }
6337
6333 /* If platform's RF_KILL switch is NOT set to KILL */ 6338 /* If platform's RF_KILL switch is NOT set to KILL */
6334 if (iwl3945_read32(priv, CSR_GP_CNTRL) & 6339 if (iwl3945_read32(priv, CSR_GP_CNTRL) &
6335 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 6340 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
@@ -6342,11 +6347,6 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
6342 } 6347 }
6343 } 6348 }
6344 6349
6345 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6346 IWL_ERROR("ucode not available for device bringup\n");
6347 return -EIO;
6348 }
6349
6350 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); 6350 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
6351 6351
6352 rc = iwl3945_hw_nic_init(priv); 6352 rc = iwl3945_hw_nic_init(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index bf3a60c037aa..f423241b9567 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6755,6 +6755,11 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
6755 return -ENODEV; 6755 return -ENODEV;
6756 } 6756 }
6757 6757
6758 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6759 IWL_ERROR("ucode not available for device bringup\n");
6760 return -EIO;
6761 }
6762
6758 /* If platform's RF_KILL switch is NOT set to KILL */ 6763 /* If platform's RF_KILL switch is NOT set to KILL */
6759 if (iwl4965_read32(priv, CSR_GP_CNTRL) & 6764 if (iwl4965_read32(priv, CSR_GP_CNTRL) &
6760 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 6765 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
@@ -6767,11 +6772,6 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
6767 } 6772 }
6768 } 6773 }
6769 6774
6770 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6771 IWL_ERROR("ucode not available for device bringup\n");
6772 return -EIO;
6773 }
6774
6775 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); 6775 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
6776 6776
6777 rc = iwl4965_hw_nic_init(priv); 6777 rc = iwl4965_hw_nic_init(priv);
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index f697f3d728eb..9f04d17576d6 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -13,6 +13,9 @@ obj-$(CONFIG_HOTPLUG) += hotplug.o
13 13
14# Build the PCI Hotplug drivers if we were asked to 14# Build the PCI Hotplug drivers if we were asked to
15obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ 15obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
16ifdef CONFIG_HOTPLUG_PCI
17obj-y += hotplug-pci.o
18endif
16 19
17# Build the PCI MSI interrupt support 20# Build the PCI MSI interrupt support
18obj-$(CONFIG_PCI_MSI) += msi.o 21obj-$(CONFIG_PCI_MSI) += msi.o
diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c
new file mode 100644
index 000000000000..a590ef682153
--- /dev/null
+++ b/drivers/pci/hotplug-pci.c
@@ -0,0 +1,20 @@
1/* Core PCI functionality used only by PCI hotplug */
2
3#include <linux/pci.h>
4#include "pci.h"
5
6
7unsigned int pci_do_scan_bus(struct pci_bus *bus)
8{
9 unsigned int max;
10
11 max = pci_scan_child_bus(bus);
12
13 /*
14 * Make the discovered devices available.
15 */
16 pci_bus_add_devices(bus);
17
18 return max;
19}
20EXPORT_SYMBOL(pci_do_scan_bus);
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index abf4203304e4..8dcf1458aa2f 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -21,7 +21,6 @@
21#include <linux/topology.h> 21#include <linux/topology.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/capability.h> 23#include <linux/capability.h>
24#include <linux/aspm.h>
25#include "pci.h" 24#include "pci.h"
26 25
27static int sysfs_initialized; /* = 0 */ 26static int sysfs_initialized; /* = 0 */
@@ -651,8 +650,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
651 if (pcibios_add_platform_entries(pdev)) 650 if (pcibios_add_platform_entries(pdev))
652 goto err_rom_file; 651 goto err_rom_file;
653 652
654 pcie_aspm_create_sysfs_dev_files(pdev);
655
656 return 0; 653 return 0;
657 654
658err_rom_file: 655err_rom_file:
@@ -682,8 +679,6 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
682 if (!sysfs_initialized) 679 if (!sysfs_initialized)
683 return; 680 return;
684 681
685 pcie_aspm_remove_sysfs_dev_files(pdev);
686
687 if (pdev->cfg_size < 4096) 682 if (pdev->cfg_size < 4096)
688 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); 683 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
689 else 684 else
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b3e9294e4a0e..04aac7782468 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -18,7 +18,6 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/log2.h> 20#include <linux/log2.h>
21#include <linux/aspm.h>
22#include <asm/dma.h> /* isa_dma_bridge_buggy */ 21#include <asm/dma.h> /* isa_dma_bridge_buggy */
23#include "pci.h" 22#include "pci.h"
24 23
@@ -520,9 +519,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
520 if (need_restore) 519 if (need_restore)
521 pci_restore_bars(dev); 520 pci_restore_bars(dev);
522 521
523 if (dev->bus->self)
524 pcie_aspm_pm_state_change(dev->bus->self);
525
526 return 0; 522 return 0;
527} 523}
528 524
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index 60104cf98796..287a9311716c 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -26,23 +26,3 @@ config HOTPLUG_PCI_PCIE
26 When in doubt, say N. 26 When in doubt, say N.
27 27
28source "drivers/pci/pcie/aer/Kconfig" 28source "drivers/pci/pcie/aer/Kconfig"
29
30#
31# PCI Express ASPM
32#
33config PCIEASPM
34 bool "PCI Express ASPM support(Experimental)"
35 depends on PCI && EXPERIMENTAL
36 default y
37 help
38 This enables PCI Express ASPM (Active State Power Management) and
39 Clock Power Management. ASPM supports state L0/L0s/L1.
40
41 When in doubt, say N.
42config PCIEASPM_DEBUG
43 bool "Debug PCI Express ASPM"
44 depends on PCIEASPM
45 default n
46 help
47 This enables PCI Express ASPM debug support. It will add per-device
48 interface to control ASPM.
diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile
index 11f6bb1eae24..e00fb99acf44 100644
--- a/drivers/pci/pcie/Makefile
+++ b/drivers/pci/pcie/Makefile
@@ -2,9 +2,6 @@
2# Makefile for PCI-Express PORT Driver 2# Makefile for PCI-Express PORT Driver
3# 3#
4 4
5# Build PCI Express ASPM if needed
6obj-$(CONFIG_PCIEASPM) += aspm.o
7
8pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o 5pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o
9 6
10obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o 7obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
deleted file mode 100644
index 1a5adeb10c95..000000000000
--- a/drivers/pci/pcie/aspm.c
+++ /dev/null
@@ -1,802 +0,0 @@
1/*
2 * File: drivers/pci/pcie/aspm.c
3 * Enabling PCIE link L0s/L1 state and Clock Power Management
4 *
5 * Copyright (C) 2007 Intel
6 * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com)
7 * Copyright (C) Shaohua Li (shaohua.li@intel.com)
8 */
9
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/moduleparam.h>
13#include <linux/pci.h>
14#include <linux/pci_regs.h>
15#include <linux/errno.h>
16#include <linux/pm.h>
17#include <linux/init.h>
18#include <linux/slab.h>
19#include <linux/aspm.h>
20#include <acpi/acpi_bus.h>
21#include <linux/pci-acpi.h>
22#include "../pci.h"
23
24#ifdef MODULE_PARAM_PREFIX
25#undef MODULE_PARAM_PREFIX
26#endif
27#define MODULE_PARAM_PREFIX "pcie_aspm."
28
29struct endpoint_state {
30 unsigned int l0s_acceptable_latency;
31 unsigned int l1_acceptable_latency;
32};
33
34struct pcie_link_state {
35 struct list_head sibiling;
36 struct pci_dev *pdev;
37
38 /* ASPM state */
39 unsigned int support_state;
40 unsigned int enabled_state;
41 unsigned int bios_aspm_state;
42 /* upstream component */
43 unsigned int l0s_upper_latency;
44 unsigned int l1_upper_latency;
45 /* downstream component */
46 unsigned int l0s_down_latency;
47 unsigned int l1_down_latency;
48 /* Clock PM state*/
49 unsigned int clk_pm_capable;
50 unsigned int clk_pm_enabled;
51 unsigned int bios_clk_state;
52
53 /*
54 * A pcie downstream port only has one slot under it, so at most there
55 * are 8 functions
56 */
57 struct endpoint_state endpoints[8];
58};
59
60static int aspm_disabled;
61static DEFINE_MUTEX(aspm_lock);
62static LIST_HEAD(link_list);
63
64#define POLICY_DEFAULT 0 /* BIOS default setting */
65#define POLICY_PERFORMANCE 1 /* high performance */
66#define POLICY_POWERSAVE 2 /* high power saving */
67static int aspm_policy;
68static const char *policy_str[] = {
69 [POLICY_DEFAULT] = "default",
70 [POLICY_PERFORMANCE] = "performance",
71 [POLICY_POWERSAVE] = "powersave"
72};
73
74static int policy_to_aspm_state(struct pci_dev *pdev)
75{
76 struct pcie_link_state *link_state = pdev->link_state;
77
78 switch (aspm_policy) {
79 case POLICY_PERFORMANCE:
80 /* Disable ASPM and Clock PM */
81 return 0;
82 case POLICY_POWERSAVE:
83 /* Enable ASPM L0s/L1 */
84 return PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
85 case POLICY_DEFAULT:
86 return link_state->bios_aspm_state;
87 }
88 return 0;
89}
90
91static int policy_to_clkpm_state(struct pci_dev *pdev)
92{
93 struct pcie_link_state *link_state = pdev->link_state;
94
95 switch (aspm_policy) {
96 case POLICY_PERFORMANCE:
97 /* Disable ASPM and Clock PM */
98 return 0;
99 case POLICY_POWERSAVE:
100 /* Disable Clock PM */
101 return 1;
102 case POLICY_DEFAULT:
103 return link_state->bios_clk_state;
104 }
105 return 0;
106}
107
108static void pcie_set_clock_pm(struct pci_dev *pdev, int enable)
109{
110 struct pci_dev *child_dev;
111 int pos;
112 u16 reg16;
113 struct pcie_link_state *link_state = pdev->link_state;
114
115 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
116 pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
117 if (!pos)
118 return;
119 pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, &reg16);
120 if (enable)
121 reg16 |= PCI_EXP_LNKCTL_CLKREQ_EN;
122 else
123 reg16 &= ~PCI_EXP_LNKCTL_CLKREQ_EN;
124 pci_write_config_word(child_dev, pos + PCI_EXP_LNKCTL, reg16);
125 }
126 link_state->clk_pm_enabled = !!enable;
127}
128
129static void pcie_check_clock_pm(struct pci_dev *pdev)
130{
131 int pos;
132 u32 reg32;
133 u16 reg16;
134 int capable = 1, enabled = 1;
135 struct pci_dev *child_dev;
136 struct pcie_link_state *link_state = pdev->link_state;
137
138 /* All functions should have the same cap and state, take the worst */
139 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
140 pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
141 if (!pos)
142 return;
143 pci_read_config_dword(child_dev, pos + PCI_EXP_LNKCAP, &reg32);
144 if (!(reg32 & PCI_EXP_LNKCAP_CLKPM)) {
145 capable = 0;
146 enabled = 0;
147 break;
148 }
149 pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, &reg16);
150 if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN))
151 enabled = 0;
152 }
153 link_state->clk_pm_capable = capable;
154 link_state->clk_pm_enabled = enabled;
155 link_state->bios_clk_state = enabled;
156 pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
157}
158
159/*
160 * pcie_aspm_configure_common_clock: check if the 2 ends of a link
161 * could use common clock. If they are, configure them to use the
162 * common clock. That will reduce the ASPM state exit latency.
163 */
164static void pcie_aspm_configure_common_clock(struct pci_dev *pdev)
165{
166 int pos, child_pos;
167 u16 reg16 = 0;
168 struct pci_dev *child_dev;
169 int same_clock = 1;
170
171 /*
172 * all functions of a slot should have the same Slot Clock
173 * Configuration, so just check one function
174 * */
175 child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev,
176 bus_list);
177 BUG_ON(!child_dev->is_pcie);
178
179 /* Check downstream component if bit Slot Clock Configuration is 1 */
180 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
181 pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, &reg16);
182 if (!(reg16 & PCI_EXP_LNKSTA_SLC))
183 same_clock = 0;
184
185 /* Check upstream component if bit Slot Clock Configuration is 1 */
186 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
187 pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
188 if (!(reg16 & PCI_EXP_LNKSTA_SLC))
189 same_clock = 0;
190
191 /* Configure downstream component, all functions */
192 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
193 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
194 pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKCTL,
195 &reg16);
196 if (same_clock)
197 reg16 |= PCI_EXP_LNKCTL_CCC;
198 else
199 reg16 &= ~PCI_EXP_LNKCTL_CCC;
200 pci_write_config_word(child_dev, child_pos + PCI_EXP_LNKCTL,
201 reg16);
202 }
203
204 /* Configure upstream component */
205 pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
206 if (same_clock)
207 reg16 |= PCI_EXP_LNKCTL_CCC;
208 else
209 reg16 &= ~PCI_EXP_LNKCTL_CCC;
210 pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
211
212 /* retrain link */
213 reg16 |= PCI_EXP_LNKCTL_RL;
214 pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
215
216 /* Wait for link training end */
217 while (1) {
218 pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
219 if (!(reg16 & PCI_EXP_LNKSTA_LT))
220 break;
221 cpu_relax();
222 }
223}
224
225/*
226 * calc_L0S_latency: Convert L0s latency encoding to ns
227 */
228static unsigned int calc_L0S_latency(unsigned int latency_encoding, int ac)
229{
230 unsigned int ns = 64;
231
232 if (latency_encoding == 0x7) {
233 if (ac)
234 ns = -1U;
235 else
236 ns = 5*1000; /* > 4us */
237 } else
238 ns *= (1 << latency_encoding);
239 return ns;
240}
241
242/*
243 * calc_L1_latency: Convert L1 latency encoding to ns
244 */
245static unsigned int calc_L1_latency(unsigned int latency_encoding, int ac)
246{
247 unsigned int ns = 1000;
248
249 if (latency_encoding == 0x7) {
250 if (ac)
251 ns = -1U;
252 else
253 ns = 65*1000; /* > 64us */
254 } else
255 ns *= (1 << latency_encoding);
256 return ns;
257}
258
259static void pcie_aspm_get_cap_device(struct pci_dev *pdev, u32 *state,
260 unsigned int *l0s, unsigned int *l1, unsigned int *enabled)
261{
262 int pos;
263 u16 reg16;
264 u32 reg32;
265 unsigned int latency;
266
267 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
268 pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, &reg32);
269 *state = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10;
270 if (*state != PCIE_LINK_STATE_L0S &&
271 *state != (PCIE_LINK_STATE_L1|PCIE_LINK_STATE_L0S))
272 * state = 0;
273 if (*state == 0)
274 return;
275
276 latency = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12;
277 *l0s = calc_L0S_latency(latency, 0);
278 if (*state & PCIE_LINK_STATE_L1) {
279 latency = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15;
280 *l1 = calc_L1_latency(latency, 0);
281 }
282 pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
283 *enabled = reg16 & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1);
284}
285
286static void pcie_aspm_cap_init(struct pci_dev *pdev)
287{
288 struct pci_dev *child_dev;
289 u32 state, tmp;
290 struct pcie_link_state *link_state = pdev->link_state;
291
292 /* upstream component states */
293 pcie_aspm_get_cap_device(pdev, &link_state->support_state,
294 &link_state->l0s_upper_latency,
295 &link_state->l1_upper_latency,
296 &link_state->enabled_state);
297 /* downstream component states, all functions have the same setting */
298 child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev,
299 bus_list);
300 pcie_aspm_get_cap_device(child_dev, &state,
301 &link_state->l0s_down_latency,
302 &link_state->l1_down_latency,
303 &tmp);
304 link_state->support_state &= state;
305 if (!link_state->support_state)
306 return;
307 link_state->enabled_state &= link_state->support_state;
308 link_state->bios_aspm_state = link_state->enabled_state;
309
310 /* ENDPOINT states*/
311 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
312 int pos;
313 u32 reg32;
314 unsigned int latency;
315 struct endpoint_state *ep_state =
316 &link_state->endpoints[PCI_FUNC(child_dev->devfn)];
317
318 if (child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT &&
319 child_dev->pcie_type != PCI_EXP_TYPE_LEG_END)
320 continue;
321
322 pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
323 pci_read_config_dword(child_dev, pos + PCI_EXP_DEVCAP, &reg32);
324 latency = (reg32 & PCI_EXP_DEVCAP_L0S) >> 6;
325 latency = calc_L0S_latency(latency, 1);
326 ep_state->l0s_acceptable_latency = latency;
327 if (link_state->support_state & PCIE_LINK_STATE_L1) {
328 latency = (reg32 & PCI_EXP_DEVCAP_L1) >> 9;
329 latency = calc_L1_latency(latency, 1);
330 ep_state->l1_acceptable_latency = latency;
331 }
332 }
333}
334
335static unsigned int __pcie_aspm_check_state_one(struct pci_dev *pdev,
336 unsigned int state)
337{
338 struct pci_dev *parent_dev, *tmp_dev;
339 unsigned int latency, l1_latency = 0;
340 struct pcie_link_state *link_state;
341 struct endpoint_state *ep_state;
342
343 parent_dev = pdev->bus->self;
344 link_state = parent_dev->link_state;
345 state &= link_state->support_state;
346 if (state == 0)
347 return 0;
348 ep_state = &link_state->endpoints[PCI_FUNC(pdev->devfn)];
349
350 /*
351 * Check latency for endpoint device.
352 * TBD: The latency from the endpoint to root complex vary per
353 * switch's upstream link state above the device. Here we just do a
354 * simple check which assumes all links above the device can be in L1
355 * state, that is we just consider the worst case. If switch's upstream
356 * link can't be put into L0S/L1, then our check is too strictly.
357 */
358 tmp_dev = pdev;
359 while (state & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) {
360 parent_dev = tmp_dev->bus->self;
361 link_state = parent_dev->link_state;
362 if (state & PCIE_LINK_STATE_L0S) {
363 latency = max_t(unsigned int,
364 link_state->l0s_upper_latency,
365 link_state->l0s_down_latency);
366 if (latency > ep_state->l0s_acceptable_latency)
367 state &= ~PCIE_LINK_STATE_L0S;
368 }
369 if (state & PCIE_LINK_STATE_L1) {
370 latency = max_t(unsigned int,
371 link_state->l1_upper_latency,
372 link_state->l1_down_latency);
373 if (latency + l1_latency >
374 ep_state->l1_acceptable_latency)
375 state &= ~PCIE_LINK_STATE_L1;
376 }
377 if (!parent_dev->bus->self) /* parent_dev is a root port */
378 break;
379 else {
380 /*
381 * parent_dev is the downstream port of a switch, make
382 * tmp_dev the upstream port of the switch
383 */
384 tmp_dev = parent_dev->bus->self;
385 /*
386 * every switch on the path to root complex need 1 more
387 * microsecond for L1. Spec doesn't mention L0S.
388 */
389 if (state & PCIE_LINK_STATE_L1)
390 l1_latency += 1000;
391 }
392 }
393 return state;
394}
395
396static unsigned int pcie_aspm_check_state(struct pci_dev *pdev,
397 unsigned int state)
398{
399 struct pci_dev *child_dev;
400
401 /* If no child, disable the link */
402 if (list_empty(&pdev->subordinate->devices))
403 return 0;
404 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
405 if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) {
406 /*
407 * If downstream component of a link is pci bridge, we
408 * disable ASPM for now for the link
409 * */
410 state = 0;
411 break;
412 }
413 if ((child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT &&
414 child_dev->pcie_type != PCI_EXP_TYPE_LEG_END))
415 continue;
416 /* Device not in D0 doesn't need check latency */
417 if (child_dev->current_state == PCI_D1 ||
418 child_dev->current_state == PCI_D2 ||
419 child_dev->current_state == PCI_D3hot ||
420 child_dev->current_state == PCI_D3cold)
421 continue;
422 state = __pcie_aspm_check_state_one(child_dev, state);
423 }
424 return state;
425}
426
427static void __pcie_aspm_config_one_dev(struct pci_dev *pdev, unsigned int state)
428{
429 u16 reg16;
430 int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
431
432 pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
433 reg16 &= ~0x3;
434 reg16 |= state;
435 pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
436}
437
438static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state)
439{
440 struct pci_dev *child_dev;
441 int valid = 1;
442 struct pcie_link_state *link_state = pdev->link_state;
443
444 /*
445 * if the downstream component has pci bridge function, don't do ASPM
446 * now
447 */
448 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
449 if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) {
450 valid = 0;
451 break;
452 }
453 }
454 if (!valid)
455 return;
456
457 /*
458 * spec 2.0 suggests all functions should be configured the same
459 * setting for ASPM. Enabling ASPM L1 should be done in upstream
460 * component first and then downstream, and vice versa for disabling
461 * ASPM L1. Spec doesn't mention L0S.
462 */
463 if (state & PCIE_LINK_STATE_L1)
464 __pcie_aspm_config_one_dev(pdev, state);
465
466 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list)
467 __pcie_aspm_config_one_dev(child_dev, state);
468
469 if (!(state & PCIE_LINK_STATE_L1))
470 __pcie_aspm_config_one_dev(pdev, state);
471
472 link_state->enabled_state = state;
473}
474
475static void __pcie_aspm_configure_link_state(struct pci_dev *pdev,
476 unsigned int state)
477{
478 struct pcie_link_state *link_state = pdev->link_state;
479
480 if (link_state->support_state == 0)
481 return;
482 state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
483
484 /* state 0 means disabling aspm */
485 state = pcie_aspm_check_state(pdev, state);
486 if (link_state->enabled_state == state)
487 return;
488 __pcie_aspm_config_link(pdev, state);
489}
490
491/*
492 * pcie_aspm_configure_link_state: enable/disable PCI express link state
493 * @pdev: the root port or switch downstream port
494 */
495static void pcie_aspm_configure_link_state(struct pci_dev *pdev,
496 unsigned int state)
497{
498 down_read(&pci_bus_sem);
499 mutex_lock(&aspm_lock);
500 __pcie_aspm_configure_link_state(pdev, state);
501 mutex_unlock(&aspm_lock);
502 up_read(&pci_bus_sem);
503}
504
505static void free_link_state(struct pci_dev *pdev)
506{
507 kfree(pdev->link_state);
508 pdev->link_state = NULL;
509}
510
511/*
512 * pcie_aspm_init_link_state: Initiate PCI express link state.
513 * It is called after the pcie and its children devices are scaned.
514 * @pdev: the root port or switch downstream port
515 */
516void pcie_aspm_init_link_state(struct pci_dev *pdev)
517{
518 unsigned int state;
519 struct pcie_link_state *link_state;
520 int error = 0;
521
522 if (aspm_disabled || !pdev->is_pcie || pdev->link_state)
523 return;
524 if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
525 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
526 return;
527 down_read(&pci_bus_sem);
528 if (list_empty(&pdev->subordinate->devices))
529 goto out;
530
531 mutex_lock(&aspm_lock);
532
533 link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);
534 if (!link_state)
535 goto unlock_out;
536 pdev->link_state = link_state;
537
538 pcie_aspm_configure_common_clock(pdev);
539
540 pcie_aspm_cap_init(pdev);
541
542 /* config link state to avoid BIOS error */
543 state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev));
544 __pcie_aspm_config_link(pdev, state);
545
546 pcie_check_clock_pm(pdev);
547
548 link_state->pdev = pdev;
549 list_add(&link_state->sibiling, &link_list);
550
551unlock_out:
552 if (error)
553 free_link_state(pdev);
554 mutex_unlock(&aspm_lock);
555out:
556 up_read(&pci_bus_sem);
557}
558
559/* @pdev: the endpoint device */
560void pcie_aspm_exit_link_state(struct pci_dev *pdev)
561{
562 struct pci_dev *parent = pdev->bus->self;
563 struct pcie_link_state *link_state = parent->link_state;
564
565 if (aspm_disabled || !pdev->is_pcie || !parent || !link_state)
566 return;
567 if (parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
568 parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
569 return;
570 down_read(&pci_bus_sem);
571 mutex_lock(&aspm_lock);
572
573 /*
574 * All PCIe functions are in one slot, remove one function will remove
575 * the the whole slot, so just wait
576 */
577 if (!list_empty(&parent->subordinate->devices))
578 goto out;
579
580 /* All functions are removed, so just disable ASPM for the link */
581 __pcie_aspm_config_one_dev(parent, 0);
582 list_del(&link_state->sibiling);
583 /* Clock PM is for endpoint device */
584
585 free_link_state(parent);
586out:
587 mutex_unlock(&aspm_lock);
588 up_read(&pci_bus_sem);
589}
590
591/* @pdev: the root port or switch downstream port */
592void pcie_aspm_pm_state_change(struct pci_dev *pdev)
593{
594 struct pcie_link_state *link_state = pdev->link_state;
595
596 if (aspm_disabled || !pdev->is_pcie || !pdev->link_state)
597 return;
598 if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
599 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
600 return;
601 /*
602 * devices changed PM state, we should recheck if latency meets all
603 * functions' requirement
604 */
605 pcie_aspm_configure_link_state(pdev, link_state->enabled_state);
606}
607
608/*
609 * pci_disable_link_state - disable pci device's link state, so the link will
610 * never enter specific states
611 */
612void pci_disable_link_state(struct pci_dev *pdev, int state)
613{
614 struct pci_dev *parent = pdev->bus->self;
615 struct pcie_link_state *link_state;
616
617 if (aspm_disabled || !pdev->is_pcie)
618 return;
619 if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT ||
620 pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)
621 parent = pdev;
622 if (!parent)
623 return;
624
625 down_read(&pci_bus_sem);
626 mutex_lock(&aspm_lock);
627 link_state = parent->link_state;
628 link_state->support_state &=
629 ~(state & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1));
630 if (state & PCIE_LINK_STATE_CLKPM)
631 link_state->clk_pm_capable = 0;
632
633 __pcie_aspm_configure_link_state(parent, link_state->enabled_state);
634 if (!link_state->clk_pm_capable && link_state->clk_pm_enabled)
635 pcie_set_clock_pm(parent, 0);
636 mutex_unlock(&aspm_lock);
637 up_read(&pci_bus_sem);
638}
639EXPORT_SYMBOL(pci_disable_link_state);
640
641static int pcie_aspm_set_policy(const char *val, struct kernel_param *kp)
642{
643 int i;
644 struct pci_dev *pdev;
645 struct pcie_link_state *link_state;
646
647 for (i = 0; i < ARRAY_SIZE(policy_str); i++)
648 if (!strncmp(val, policy_str[i], strlen(policy_str[i])))
649 break;
650 if (i >= ARRAY_SIZE(policy_str))
651 return -EINVAL;
652 if (i == aspm_policy)
653 return 0;
654
655 down_read(&pci_bus_sem);
656 mutex_lock(&aspm_lock);
657 aspm_policy = i;
658 list_for_each_entry(link_state, &link_list, sibiling) {
659 pdev = link_state->pdev;
660 __pcie_aspm_configure_link_state(pdev,
661 policy_to_aspm_state(pdev));
662 if (link_state->clk_pm_capable &&
663 link_state->clk_pm_enabled != policy_to_clkpm_state(pdev))
664 pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
665
666 }
667 mutex_unlock(&aspm_lock);
668 up_read(&pci_bus_sem);
669 return 0;
670}
671
672static int pcie_aspm_get_policy(char *buffer, struct kernel_param *kp)
673{
674 int i, cnt = 0;
675 for (i = 0; i < ARRAY_SIZE(policy_str); i++)
676 if (i == aspm_policy)
677 cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]);
678 else
679 cnt += sprintf(buffer + cnt, "%s ", policy_str[i]);
680 return cnt;
681}
682
683module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy,
684 NULL, 0644);
685
686#ifdef CONFIG_PCIEASPM_DEBUG
687static ssize_t link_state_show(struct device *dev,
688 struct device_attribute *attr,
689 char *buf)
690{
691 struct pci_dev *pci_device = to_pci_dev(dev);
692 struct pcie_link_state *link_state = pci_device->link_state;
693
694 return sprintf(buf, "%d\n", link_state->enabled_state);
695}
696
697static ssize_t link_state_store(struct device *dev,
698 struct device_attribute *attr,
699 const char *buf,
700 size_t n)
701{
702 struct pci_dev *pci_device = to_pci_dev(dev);
703 int state;
704
705 if (n < 1)
706 return -EINVAL;
707 state = buf[0]-'0';
708 if (state >= 0 && state <= 3) {
709 /* setup link aspm state */
710 pcie_aspm_configure_link_state(pci_device, state);
711 return n;
712 }
713
714 return -EINVAL;
715}
716
717static ssize_t clk_ctl_show(struct device *dev,
718 struct device_attribute *attr,
719 char *buf)
720{
721 struct pci_dev *pci_device = to_pci_dev(dev);
722 struct pcie_link_state *link_state = pci_device->link_state;
723
724 return sprintf(buf, "%d\n", link_state->clk_pm_enabled);
725}
726
727static ssize_t clk_ctl_store(struct device *dev,
728 struct device_attribute *attr,
729 const char *buf,
730 size_t n)
731{
732 struct pci_dev *pci_device = to_pci_dev(dev);
733 int state;
734
735 if (n < 1)
736 return -EINVAL;
737 state = buf[0]-'0';
738
739 down_read(&pci_bus_sem);
740 mutex_lock(&aspm_lock);
741 pcie_set_clock_pm(pci_device, !!state);
742 mutex_unlock(&aspm_lock);
743 up_read(&pci_bus_sem);
744
745 return n;
746}
747
748static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store);
749static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store);
750
751static char power_group[] = "power";
752void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
753{
754 struct pcie_link_state *link_state = pdev->link_state;
755
756 if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
757 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))
758 return;
759
760 if (link_state->support_state)
761 sysfs_add_file_to_group(&pdev->dev.kobj,
762 &dev_attr_link_state.attr, power_group);
763 if (link_state->clk_pm_capable)
764 sysfs_add_file_to_group(&pdev->dev.kobj,
765 &dev_attr_clk_ctl.attr, power_group);
766}
767
768void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
769{
770 struct pcie_link_state *link_state = pdev->link_state;
771
772 if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
773 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))
774 return;
775
776 if (link_state->support_state)
777 sysfs_remove_file_from_group(&pdev->dev.kobj,
778 &dev_attr_link_state.attr, power_group);
779 if (link_state->clk_pm_capable)
780 sysfs_remove_file_from_group(&pdev->dev.kobj,
781 &dev_attr_clk_ctl.attr, power_group);
782}
783#endif
784
785static int __init pcie_aspm_disable(char *str)
786{
787 aspm_disabled = 1;
788 return 1;
789}
790
791__setup("pcie_noaspm", pcie_aspm_disable);
792
793static int __init pcie_aspm_init(void)
794{
795 if (aspm_disabled)
796 return 0;
797 pci_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT|
798 OSC_CLOCK_PWR_CAPABILITY_SUPPORT);
799 return 0;
800}
801
802fs_initcall(pcie_aspm_init);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8b505bd925aa..7f5dab34d315 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -9,7 +9,6 @@
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/cpumask.h> 11#include <linux/cpumask.h>
12#include <linux/aspm.h>
13#include "pci.h" 12#include "pci.h"
14 13
15#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ 14#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
@@ -434,7 +433,7 @@ pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr)
434 return child; 433 return child;
435} 434}
436 435
437struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 436struct pci_bus *__ref pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr)
438{ 437{
439 struct pci_bus *child; 438 struct pci_bus *child;
440 439
@@ -949,7 +948,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
949 up_write(&pci_bus_sem); 948 up_write(&pci_bus_sem);
950} 949}
951 950
952struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) 951struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
953{ 952{
954 struct pci_dev *dev; 953 struct pci_dev *dev;
955 954
@@ -1002,10 +1001,6 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
1002 break; 1001 break;
1003 } 1002 }
1004 } 1003 }
1005
1006 if (bus->self)
1007 pcie_aspm_init_link_state(bus->self);
1008
1009 return nr; 1004 return nr;
1010} 1005}
1011 1006
@@ -1045,20 +1040,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
1045 return max; 1040 return max;
1046} 1041}
1047 1042
1048unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
1049{
1050 unsigned int max;
1051
1052 max = pci_scan_child_bus(bus);
1053
1054 /*
1055 * Make the discovered devices available.
1056 */
1057 pci_bus_add_devices(bus);
1058
1059 return max;
1060}
1061
1062struct pci_bus * pci_create_bus(struct device *parent, 1043struct pci_bus * pci_create_bus(struct device *parent,
1063 int bus, struct pci_ops *ops, void *sysdata) 1044 int bus, struct pci_ops *ops, void *sysdata)
1064{ 1045{
@@ -1145,7 +1126,6 @@ EXPORT_SYMBOL(pci_scan_bus_parented);
1145 1126
1146#ifdef CONFIG_HOTPLUG 1127#ifdef CONFIG_HOTPLUG
1147EXPORT_SYMBOL(pci_add_new_bus); 1128EXPORT_SYMBOL(pci_add_new_bus);
1148EXPORT_SYMBOL(pci_do_scan_bus);
1149EXPORT_SYMBOL(pci_scan_slot); 1129EXPORT_SYMBOL(pci_scan_slot);
1150EXPORT_SYMBOL(pci_scan_bridge); 1130EXPORT_SYMBOL(pci_scan_bridge);
1151EXPORT_SYMBOL_GPL(pci_scan_child_bus); 1131EXPORT_SYMBOL_GPL(pci_scan_child_bus);
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index ec4a82ba29a8..9684e1bde277 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -1,6 +1,5 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/aspm.h>
4#include "pci.h" 3#include "pci.h"
5 4
6static void pci_free_resources(struct pci_dev *dev) 5static void pci_free_resources(struct pci_dev *dev)
@@ -31,9 +30,6 @@ static void pci_stop_dev(struct pci_dev *dev)
31 dev->global_list.next = dev->global_list.prev = NULL; 30 dev->global_list.next = dev->global_list.prev = NULL;
32 up_write(&pci_bus_sem); 31 up_write(&pci_bus_sem);
33 } 32 }
34
35 if (dev->bus->self)
36 pcie_aspm_exit_link_state(dev);
37} 33}
38 34
39static void pci_destroy_dev(struct pci_dev *dev) 35static void pci_destroy_dev(struct pci_dev *dev)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 8a7232feb553..262b0439abe9 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -456,7 +456,7 @@ pci_bus_size_cardbus(struct pci_bus *bus)
456 } 456 }
457} 457}
458 458
459void pci_bus_size_bridges(struct pci_bus *bus) 459void __ref pci_bus_size_bridges(struct pci_bus *bus)
460{ 460{
461 struct pci_dev *dev; 461 struct pci_dev *dev;
462 unsigned long mask, prefmask; 462 unsigned long mask, prefmask;
@@ -511,7 +511,7 @@ void pci_bus_size_bridges(struct pci_bus *bus)
511} 511}
512EXPORT_SYMBOL(pci_bus_size_bridges); 512EXPORT_SYMBOL(pci_bus_size_bridges);
513 513
514void pci_bus_assign_resources(struct pci_bus *bus) 514void __ref pci_bus_assign_resources(struct pci_bus *bus)
515{ 515{
516 struct pci_bus *b; 516 struct pci_bus *b;
517 struct pci_dev *dev; 517 struct pci_dev *dev;
diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile
index e4f70c563bc2..4c549540a35d 100644
--- a/drivers/scsi/aic7xxx/Makefile
+++ b/drivers/scsi/aic7xxx/Makefile
@@ -44,13 +44,8 @@ clean-files += aic79xx_seq.h aic79xx_reg.h aic79xx_reg_print.c
44 44
45# Dependencies for generated files need to be listed explicitly 45# Dependencies for generated files need to be listed explicitly
46 46
47$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h 47$(addprefix $(src)/,$(aic7xxx-y:.o=.c)): $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h
48$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_reg.h 48$(addprefix $(src)/,$(aic79xx-y:.o=.c)): $(obj)/aic79xx_seq.h $(obj)/aic79xx_reg.h
49$(obj)/aic79xx_core.o: $(obj)/aic79xx_seq.h
50$(obj)/aic79xx_core.o: $(obj)/aic79xx_reg.h
51
52$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_seq.h
53$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_seq.h
54 49
55aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h 50aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h
56aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c 51aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 29b4cf9e059b..6cfeba7454d4 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1894,7 +1894,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1894 uint16_t iotag; 1894 uint16_t iotag;
1895 int bars = pci_select_bars(pdev, IORESOURCE_MEM); 1895 int bars = pci_select_bars(pdev, IORESOURCE_MEM);
1896 1896
1897 if (pci_enable_device_bars(pdev, bars)) 1897 if (pci_enable_device_mem(pdev))
1898 goto out; 1898 goto out;
1899 if (pci_request_selected_regions(pdev, bars, LPFC_DRIVER_NAME)) 1899 if (pci_request_selected_regions(pdev, bars, LPFC_DRIVER_NAME))
1900 goto out_disable_device; 1900 goto out_disable_device;
diff --git a/fs/locks.c b/fs/locks.c
index 8b8388eca05e..49354b9c7dc1 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -125,6 +125,7 @@
125#include <linux/syscalls.h> 125#include <linux/syscalls.h>
126#include <linux/time.h> 126#include <linux/time.h>
127#include <linux/rcupdate.h> 127#include <linux/rcupdate.h>
128#include <linux/pid_namespace.h>
128 129
129#include <asm/semaphore.h> 130#include <asm/semaphore.h>
130#include <asm/uaccess.h> 131#include <asm/uaccess.h>
@@ -185,6 +186,7 @@ void locks_init_lock(struct file_lock *fl)
185 fl->fl_fasync = NULL; 186 fl->fl_fasync = NULL;
186 fl->fl_owner = NULL; 187 fl->fl_owner = NULL;
187 fl->fl_pid = 0; 188 fl->fl_pid = 0;
189 fl->fl_nspid = NULL;
188 fl->fl_file = NULL; 190 fl->fl_file = NULL;
189 fl->fl_flags = 0; 191 fl->fl_flags = 0;
190 fl->fl_type = 0; 192 fl->fl_type = 0;
@@ -553,6 +555,8 @@ static void locks_insert_lock(struct file_lock **pos, struct file_lock *fl)
553{ 555{
554 list_add(&fl->fl_link, &file_lock_list); 556 list_add(&fl->fl_link, &file_lock_list);
555 557
558 fl->fl_nspid = get_pid(task_tgid(current));
559
556 /* insert into file's list */ 560 /* insert into file's list */
557 fl->fl_next = *pos; 561 fl->fl_next = *pos;
558 *pos = fl; 562 *pos = fl;
@@ -584,6 +588,11 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
584 if (fl->fl_ops && fl->fl_ops->fl_remove) 588 if (fl->fl_ops && fl->fl_ops->fl_remove)
585 fl->fl_ops->fl_remove(fl); 589 fl->fl_ops->fl_remove(fl);
586 590
591 if (fl->fl_nspid) {
592 put_pid(fl->fl_nspid);
593 fl->fl_nspid = NULL;
594 }
595
587 locks_wake_up_blocks(fl); 596 locks_wake_up_blocks(fl);
588 locks_free_lock(fl); 597 locks_free_lock(fl);
589} 598}
@@ -634,33 +643,6 @@ static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *s
634 return (locks_conflict(caller_fl, sys_fl)); 643 return (locks_conflict(caller_fl, sys_fl));
635} 644}
636 645
637static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout)
638{
639 int result = 0;
640 DECLARE_WAITQUEUE(wait, current);
641
642 __set_current_state(TASK_INTERRUPTIBLE);
643 add_wait_queue(fl_wait, &wait);
644 if (timeout == 0)
645 schedule();
646 else
647 result = schedule_timeout(timeout);
648 if (signal_pending(current))
649 result = -ERESTARTSYS;
650 remove_wait_queue(fl_wait, &wait);
651 __set_current_state(TASK_RUNNING);
652 return result;
653}
654
655static int locks_block_on_timeout(struct file_lock *blocker, struct file_lock *waiter, int time)
656{
657 int result;
658 locks_insert_block(blocker, waiter);
659 result = interruptible_sleep_on_locked(&waiter->fl_wait, time);
660 __locks_delete_block(waiter);
661 return result;
662}
663
664void 646void
665posix_test_lock(struct file *filp, struct file_lock *fl) 647posix_test_lock(struct file *filp, struct file_lock *fl)
666{ 648{
@@ -673,55 +655,67 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
673 if (posix_locks_conflict(fl, cfl)) 655 if (posix_locks_conflict(fl, cfl))
674 break; 656 break;
675 } 657 }
676 if (cfl) 658 if (cfl) {
677 __locks_copy_lock(fl, cfl); 659 __locks_copy_lock(fl, cfl);
678 else 660 if (cfl->fl_nspid)
661 fl->fl_pid = pid_nr_ns(cfl->fl_nspid,
662 task_active_pid_ns(current));
663 } else
679 fl->fl_type = F_UNLCK; 664 fl->fl_type = F_UNLCK;
680 unlock_kernel(); 665 unlock_kernel();
681 return; 666 return;
682} 667}
683
684EXPORT_SYMBOL(posix_test_lock); 668EXPORT_SYMBOL(posix_test_lock);
685 669
686/* This function tests for deadlock condition before putting a process to 670/*
687 * sleep. The detection scheme is no longer recursive. Recursive was neat, 671 * Deadlock detection:
688 * but dangerous - we risked stack corruption if the lock data was bad, or 672 *
689 * if the recursion was too deep for any other reason. 673 * We attempt to detect deadlocks that are due purely to posix file
674 * locks.
690 * 675 *
691 * We rely on the fact that a task can only be on one lock's wait queue 676 * We assume that a task can be waiting for at most one lock at a time.
692 * at a time. When we find blocked_task on a wait queue we can re-search 677 * So for any acquired lock, the process holding that lock may be
693 * with blocked_task equal to that queue's owner, until either blocked_task 678 * waiting on at most one other lock. That lock in turns may be held by
694 * isn't found, or blocked_task is found on a queue owned by my_task. 679 * someone waiting for at most one other lock. Given a requested lock
680 * caller_fl which is about to wait for a conflicting lock block_fl, we
681 * follow this chain of waiters to ensure we are not about to create a
682 * cycle.
695 * 683 *
696 * Note: the above assumption may not be true when handling lock requests 684 * Since we do this before we ever put a process to sleep on a lock, we
697 * from a broken NFS client. But broken NFS clients have a lot more to 685 * are ensured that there is never a cycle; that is what guarantees that
698 * worry about than proper deadlock detection anyway... --okir 686 * the while() loop in posix_locks_deadlock() eventually completes.
699 * 687 *
700 * However, the failure of this assumption (also possible in the case of 688 * Note: the above assumption may not be true when handling lock
701 * multiple tasks sharing the same open file table) also means there's no 689 * requests from a broken NFS client. It may also fail in the presence
702 * guarantee that the loop below will terminate. As a hack, we give up 690 * of tasks (such as posix threads) sharing the same open file table.
703 * after a few iterations. 691 *
692 * To handle those cases, we just bail out after a few iterations.
704 */ 693 */
705 694
706#define MAX_DEADLK_ITERATIONS 10 695#define MAX_DEADLK_ITERATIONS 10
707 696
697/* Find a lock that the owner of the given block_fl is blocking on. */
698static struct file_lock *what_owner_is_waiting_for(struct file_lock *block_fl)
699{
700 struct file_lock *fl;
701
702 list_for_each_entry(fl, &blocked_list, fl_link) {
703 if (posix_same_owner(fl, block_fl))
704 return fl->fl_next;
705 }
706 return NULL;
707}
708
708static int posix_locks_deadlock(struct file_lock *caller_fl, 709static int posix_locks_deadlock(struct file_lock *caller_fl,
709 struct file_lock *block_fl) 710 struct file_lock *block_fl)
710{ 711{
711 struct file_lock *fl;
712 int i = 0; 712 int i = 0;
713 713
714next_task: 714 while ((block_fl = what_owner_is_waiting_for(block_fl))) {
715 if (posix_same_owner(caller_fl, block_fl)) 715 if (i++ > MAX_DEADLK_ITERATIONS)
716 return 1; 716 return 0;
717 list_for_each_entry(fl, &blocked_list, fl_link) { 717 if (posix_same_owner(caller_fl, block_fl))
718 if (posix_same_owner(fl, block_fl)) { 718 return 1;
719 if (i++ > MAX_DEADLK_ITERATIONS)
720 return 0;
721 fl = fl->fl_next;
722 block_fl = fl;
723 goto next_task;
724 }
725 } 719 }
726 return 0; 720 return 0;
727} 721}
@@ -1256,7 +1250,10 @@ restart:
1256 if (break_time == 0) 1250 if (break_time == 0)
1257 break_time++; 1251 break_time++;
1258 } 1252 }
1259 error = locks_block_on_timeout(flock, new_fl, break_time); 1253 locks_insert_block(flock, new_fl);
1254 error = wait_event_interruptible_timeout(new_fl->fl_wait,
1255 !new_fl->fl_next, break_time);
1256 __locks_delete_block(new_fl);
1260 if (error >= 0) { 1257 if (error >= 0) {
1261 if (error == 0) 1258 if (error == 0)
1262 time_out_leases(inode); 1259 time_out_leases(inode);
@@ -2084,6 +2081,12 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
2084 int id, char *pfx) 2081 int id, char *pfx)
2085{ 2082{
2086 struct inode *inode = NULL; 2083 struct inode *inode = NULL;
2084 unsigned int fl_pid;
2085
2086 if (fl->fl_nspid)
2087 fl_pid = pid_nr_ns(fl->fl_nspid, task_active_pid_ns(current));
2088 else
2089 fl_pid = fl->fl_pid;
2087 2090
2088 if (fl->fl_file != NULL) 2091 if (fl->fl_file != NULL)
2089 inode = fl->fl_file->f_path.dentry->d_inode; 2092 inode = fl->fl_file->f_path.dentry->d_inode;
@@ -2124,16 +2127,16 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
2124 } 2127 }
2125 if (inode) { 2128 if (inode) {
2126#ifdef WE_CAN_BREAK_LSLK_NOW 2129#ifdef WE_CAN_BREAK_LSLK_NOW
2127 seq_printf(f, "%d %s:%ld ", fl->fl_pid, 2130 seq_printf(f, "%d %s:%ld ", fl_pid,
2128 inode->i_sb->s_id, inode->i_ino); 2131 inode->i_sb->s_id, inode->i_ino);
2129#else 2132#else
2130 /* userspace relies on this representation of dev_t ;-( */ 2133 /* userspace relies on this representation of dev_t ;-( */
2131 seq_printf(f, "%d %02x:%02x:%ld ", fl->fl_pid, 2134 seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
2132 MAJOR(inode->i_sb->s_dev), 2135 MAJOR(inode->i_sb->s_dev),
2133 MINOR(inode->i_sb->s_dev), inode->i_ino); 2136 MINOR(inode->i_sb->s_dev), inode->i_ino);
2134#endif 2137#endif
2135 } else { 2138 } else {
2136 seq_printf(f, "%d <none>:0 ", fl->fl_pid); 2139 seq_printf(f, "%d <none>:0 ", fl_pid);
2137 } 2140 }
2138 if (IS_POSIX(fl)) { 2141 if (IS_POSIX(fl)) {
2139 if (fl->fl_end == OFFSET_MAX) 2142 if (fl->fl_end == OFFSET_MAX)
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index a94473d3072c..5d8dcb9ee326 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -50,10 +50,6 @@ static int ncp_file_mmap_fault(struct vm_area_struct *area,
50 pos = vmf->pgoff << PAGE_SHIFT; 50 pos = vmf->pgoff << PAGE_SHIFT;
51 51
52 count = PAGE_SIZE; 52 count = PAGE_SIZE;
53 if ((unsigned long)vmf->virtual_address + PAGE_SIZE > area->vm_end) {
54 WARN_ON(1); /* shouldn't happen? */
55 count = area->vm_end - (unsigned long)vmf->virtual_address;
56 }
57 /* what we can read in one go */ 53 /* what we can read in one go */
58 bufsize = NCP_SERVER(inode)->buffer_size; 54 bufsize = NCP_SERVER(inode)->buffer_size;
59 55
diff --git a/include/linux/aspm.h b/include/linux/aspm.h
deleted file mode 100644
index f41a69895485..000000000000
--- a/include/linux/aspm.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * aspm.h
3 *
4 * PCI Express ASPM defines and function prototypes
5 *
6 * Copyright (C) 2007 Intel Corp.
7 * Zhang Yanmin (yanmin.zhang@intel.com)
8 * Shaohua Li (shaohua.li@intel.com)
9 *
10 * For more information, please consult the following manuals (look at
11 * http://www.pcisig.com/ for how to get them):
12 *
13 * PCI Express Specification
14 */
15
16#ifndef LINUX_ASPM_H
17#define LINUX_ASPM_H
18
19#include <linux/pci.h>
20
21#define PCIE_LINK_STATE_L0S 1
22#define PCIE_LINK_STATE_L1 2
23#define PCIE_LINK_STATE_CLKPM 4
24
25#ifdef CONFIG_PCIEASPM
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30#else
31#define pcie_aspm_init_link_state(pdev) do {} while (0)
32#define pcie_aspm_exit_link_state(pdev) do {} while (0)
33#define pcie_aspm_pm_state_change(pdev) do {} while (0)
34#define pci_disable_link_state(pdev, state) do {} while (0)
35#endif
36
37#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
38extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
39extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
40#else
41#define pcie_aspm_create_sysfs_dev_files(pdev) do {} while (0)
42#define pcie_aspm_remove_sysfs_dev_files(pdev) do {} while (0)
43#endif
44#endif /* LINUX_ASPM_H */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 484e45c7c89a..aa0737019e37 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -525,6 +525,7 @@ struct dccp_sock {
525 __u64 dccps_gsr; 525 __u64 dccps_gsr;
526 __u64 dccps_gar; 526 __u64 dccps_gar;
527 __be32 dccps_service; 527 __be32 dccps_service;
528 __u32 dccps_mss_cache;
528 struct dccp_service_list *dccps_service_list; 529 struct dccp_service_list *dccps_service_list;
529 __u32 dccps_timestamp_echo; 530 __u32 dccps_timestamp_echo;
530 __u32 dccps_timestamp_time; 531 __u32 dccps_timestamp_time;
@@ -533,7 +534,6 @@ struct dccp_sock {
533 __u16 dccps_pcslen; 534 __u16 dccps_pcslen;
534 __u16 dccps_pcrlen; 535 __u16 dccps_pcrlen;
535 unsigned long dccps_ndp_count; 536 unsigned long dccps_ndp_count;
536 __u32 dccps_mss_cache;
537 unsigned long dccps_rate_last; 537 unsigned long dccps_rate_last;
538 struct dccp_minisock dccps_minisock; 538 struct dccp_minisock dccps_minisock;
539 struct dccp_ackvec *dccps_hc_rx_ackvec; 539 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index db375be333c7..479c0b31593c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -534,11 +534,17 @@ extern struct device *device_create(struct class *cls, struct device *parent,
534extern void device_destroy(struct class *cls, dev_t devt); 534extern void device_destroy(struct class *cls, dev_t devt);
535#ifdef CONFIG_PM_SLEEP 535#ifdef CONFIG_PM_SLEEP
536extern void destroy_suspended_device(struct class *cls, dev_t devt); 536extern void destroy_suspended_device(struct class *cls, dev_t devt);
537extern void device_pm_schedule_removal(struct device *);
537#else /* !CONFIG_PM_SLEEP */ 538#else /* !CONFIG_PM_SLEEP */
538static inline void destroy_suspended_device(struct class *cls, dev_t devt) 539static inline void destroy_suspended_device(struct class *cls, dev_t devt)
539{ 540{
540 device_destroy(cls, devt); 541 device_destroy(cls, devt);
541} 542}
543
544static inline void device_pm_schedule_removal(struct device *dev)
545{
546 device_unregister(dev);
547}
542#endif /* !CONFIG_PM_SLEEP */ 548#endif /* !CONFIG_PM_SLEEP */
543 549
544/* 550/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bcae3acab288..56bd421c1208 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -872,6 +872,7 @@ struct file_lock {
872 struct list_head fl_block; /* circular list of blocked processes */ 872 struct list_head fl_block; /* circular list of blocked processes */
873 fl_owner_t fl_owner; 873 fl_owner_t fl_owner;
874 unsigned int fl_pid; 874 unsigned int fl_pid;
875 struct pid *fl_nspid;
875 wait_queue_head_t fl_wait; 876 wait_queue_head_t fl_wait;
876 struct file *fl_file; 877 struct file *fl_file;
877 unsigned char fl_flags; 878 unsigned char fl_flags;
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 5de6d911cdf7..f577c8f1c66d 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -287,6 +287,12 @@ struct ieee80211_ht_addt_info {
287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
289 289
290/* MIMO Power Save Modes */
291#define WLAN_HT_CAP_MIMO_PS_STATIC 0
292#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
293#define WLAN_HT_CAP_MIMO_PS_INVALID 2
294#define WLAN_HT_CAP_MIMO_PS_DISABLED 3
295
290/* Authentication algorithms */ 296/* Authentication algorithms */
291#define WLAN_AUTH_OPEN 0 297#define WLAN_AUTH_OPEN 0
292#define WLAN_AUTH_SHARED_KEY 1 298#define WLAN_AUTH_SHARED_KEY 1
diff --git a/include/linux/init.h b/include/linux/init.h
index 2efbda016741..90cdbbbbe077 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -124,9 +124,6 @@
124#define __REF .section ".ref.text", "ax" 124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw" 125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw" 126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
130 127
131#ifndef __ASSEMBLY__ 128#ifndef __ASSEMBLY__
132/* 129/*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 4f96f1d94ac4..cee75c0ff6e7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -128,7 +128,6 @@ struct pci_cap_saved_state {
128 u32 data[0]; 128 u32 data[0];
129}; 129};
130 130
131struct pcie_link_state;
132/* 131/*
133 * The pci_dev structure is used to describe PCI devices. 132 * The pci_dev structure is used to describe PCI devices.
134 */ 133 */
@@ -164,10 +163,6 @@ struct pci_dev {
164 this is D0-D3, D0 being fully functional, 163 this is D0-D3, D0 being fully functional,
165 and D3 being off. */ 164 and D3 being off. */
166 165
167#ifdef CONFIG_PCIEASPM
168 struct pcie_link_state *link_state; /* ASPM link state. */
169#endif
170
171 pci_channel_state_t error_state; /* current connectivity state */ 166 pci_channel_state_t error_state; /* current connectivity state */
172 struct device dev; /* Generic device interface */ 167 struct device dev; /* Generic device interface */
173 168
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c0c1223c9194..c1914a8b94a9 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -395,17 +395,9 @@
395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ 395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
398#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */
399#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */
400#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */
401#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */
402#define PCI_EXP_LNKCTL 16 /* Link Control */ 398#define PCI_EXP_LNKCTL 16 /* Link Control */
403#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */
404#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */
405#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ 399#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
406#define PCI_EXP_LNKSTA 18 /* Link Status */ 400#define PCI_EXP_LNKSTA 18 /* Link Status */
407#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */
408#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
409#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 401#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
410#define PCI_EXP_SLTCTL 24 /* Slot Control */ 402#define PCI_EXP_SLTCTL 24 /* Slot Control */
411#define PCI_EXP_SLTSTA 26 /* Slot Status */ 403#define PCI_EXP_SLTSTA 26 /* Slot Status */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 554836edd915..5e43ae751412 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -88,7 +88,7 @@ struct mii_bus {
88 88
89 /* A lock to ensure that only one thing can read/write 89 /* A lock to ensure that only one thing can read/write
90 * the MDIO bus at a time */ 90 * the MDIO bus at a time */
91 spinlock_t mdio_lock; 91 struct mutex mdio_lock;
92 92
93 struct device *dev; 93 struct device *dev;
94 94
@@ -284,10 +284,11 @@ struct phy_device {
284 284
285 /* Interrupt and Polling infrastructure */ 285 /* Interrupt and Polling infrastructure */
286 struct work_struct phy_queue; 286 struct work_struct phy_queue;
287 struct work_struct state_queue;
287 struct timer_list phy_timer; 288 struct timer_list phy_timer;
288 atomic_t irq_disable; 289 atomic_t irq_disable;
289 290
290 spinlock_t lock; 291 struct mutex lock;
291 292
292 struct net_device *attached_dev; 293 struct net_device *attached_dev;
293 294
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index b24508abb850..b2cfc4927257 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -112,13 +112,13 @@ struct ifmcaddr6
112 struct ip6_sf_list *mca_sources; 112 struct ip6_sf_list *mca_sources;
113 struct ip6_sf_list *mca_tomb; 113 struct ip6_sf_list *mca_tomb;
114 unsigned int mca_sfmode; 114 unsigned int mca_sfmode;
115 unsigned char mca_crcount;
115 unsigned long mca_sfcount[2]; 116 unsigned long mca_sfcount[2];
116 struct timer_list mca_timer; 117 struct timer_list mca_timer;
117 unsigned mca_flags; 118 unsigned mca_flags;
118 int mca_users; 119 int mca_users;
119 atomic_t mca_refcnt; 120 atomic_t mca_refcnt;
120 spinlock_t mca_lock; 121 spinlock_t mca_lock;
121 unsigned char mca_crcount;
122 unsigned long mca_cstamp; 122 unsigned long mca_cstamp;
123 unsigned long mca_tstamp; 123 unsigned long mca_tstamp;
124}; 124};
@@ -166,11 +166,11 @@ struct inet6_dev
166 struct ifmcaddr6 *mc_list; 166 struct ifmcaddr6 *mc_list;
167 struct ifmcaddr6 *mc_tomb; 167 struct ifmcaddr6 *mc_tomb;
168 rwlock_t mc_lock; 168 rwlock_t mc_lock;
169 unsigned long mc_v1_seen;
170 unsigned long mc_maxdelay;
171 unsigned char mc_qrv; 169 unsigned char mc_qrv;
172 unsigned char mc_gq_running; 170 unsigned char mc_gq_running;
173 unsigned char mc_ifc_count; 171 unsigned char mc_ifc_count;
172 unsigned long mc_v1_seen;
173 unsigned long mc_maxdelay;
174 struct timer_list mc_gq_timer; /* general query timer */ 174 struct timer_list mc_gq_timer; /* general query timer */
175 struct timer_list mc_ifc_timer; /* interface change timer */ 175 struct timer_list mc_ifc_timer; /* interface change timer */
176 176
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index fdff630708ce..62a5b691858e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -49,7 +49,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
49 return inet6_ehashfn(laddr, lport, faddr, fport); 49 return inet6_ehashfn(laddr, lport, faddr, fport);
50} 50}
51 51
52extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk); 52extern void __inet6_hash(struct sock *sk);
53 53
54/* 54/*
55 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 55 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 133cf30d2d79..f00f0573627b 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -29,7 +29,6 @@
29#undef INET_CSK_CLEAR_TIMERS 29#undef INET_CSK_CLEAR_TIMERS
30 30
31struct inet_bind_bucket; 31struct inet_bind_bucket;
32struct inet_hashinfo;
33struct tcp_congestion_ops; 32struct tcp_congestion_ops;
34 33
35/* 34/*
@@ -59,6 +58,8 @@ struct inet_connection_sock_af_ops {
59 int level, int optname, 58 int level, int optname,
60 char __user *optval, int __user *optlen); 59 char __user *optval, int __user *optlen);
61 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 60 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
61 int (*bind_conflict)(const struct sock *sk,
62 const struct inet_bind_bucket *tb);
62}; 63};
63 64
64/** inet_connection_sock - INET connection oriented sock 65/** inet_connection_sock - INET connection oriented sock
@@ -244,10 +245,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
244 const __be32 laddr); 245 const __be32 laddr);
245extern int inet_csk_bind_conflict(const struct sock *sk, 246extern int inet_csk_bind_conflict(const struct sock *sk,
246 const struct inet_bind_bucket *tb); 247 const struct inet_bind_bucket *tb);
247extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 248extern int inet_csk_get_port(struct sock *sk, unsigned short snum);
248 struct sock *sk, unsigned short snum,
249 int (*bind_conflict)(const struct sock *sk,
250 const struct inet_bind_bucket *tb));
251 249
252extern struct dst_entry* inet_csk_route_req(struct sock *sk, 250extern struct dst_entry* inet_csk_route_req(struct sock *sk,
253 const struct request_sock *req); 251 const struct request_sock *req);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index c23c4ed30724..48ac620cb846 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -221,9 +221,9 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
221} 221}
222 222
223/* Caller must disable local BH processing. */ 223/* Caller must disable local BH processing. */
224static inline void __inet_inherit_port(struct inet_hashinfo *table, 224static inline void __inet_inherit_port(struct sock *sk, struct sock *child)
225 struct sock *sk, struct sock *child)
226{ 225{
226 struct inet_hashinfo *table = sk->sk_prot->hashinfo;
227 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); 227 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size);
228 struct inet_bind_hashbucket *head = &table->bhash[bhash]; 228 struct inet_bind_hashbucket *head = &table->bhash[bhash];
229 struct inet_bind_bucket *tb; 229 struct inet_bind_bucket *tb;
@@ -235,15 +235,14 @@ static inline void __inet_inherit_port(struct inet_hashinfo *table,
235 spin_unlock(&head->lock); 235 spin_unlock(&head->lock);
236} 236}
237 237
238static inline void inet_inherit_port(struct inet_hashinfo *table, 238static inline void inet_inherit_port(struct sock *sk, struct sock *child)
239 struct sock *sk, struct sock *child)
240{ 239{
241 local_bh_disable(); 240 local_bh_disable();
242 __inet_inherit_port(table, sk, child); 241 __inet_inherit_port(sk, child);
243 local_bh_enable(); 242 local_bh_enable();
244} 243}
245 244
246extern void inet_put_port(struct inet_hashinfo *table, struct sock *sk); 245extern void inet_put_port(struct sock *sk);
247 246
248extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 247extern void inet_listen_wlock(struct inet_hashinfo *hashinfo);
249 248
@@ -266,41 +265,9 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
266 wake_up(&hashinfo->lhash_wait); 265 wake_up(&hashinfo->lhash_wait);
267} 266}
268 267
269extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); 268extern void __inet_hash_nolisten(struct sock *sk);
270extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); 269extern void inet_hash(struct sock *sk);
271 270extern void inet_unhash(struct sock *sk);
272static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
273{
274 if (sk->sk_state != TCP_CLOSE) {
275 local_bh_disable();
276 __inet_hash(hashinfo, sk);
277 local_bh_enable();
278 }
279}
280
281static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
282{
283 rwlock_t *lock;
284
285 if (sk_unhashed(sk))
286 goto out;
287
288 if (sk->sk_state == TCP_LISTEN) {
289 local_bh_disable();
290 inet_listen_wlock(hashinfo);
291 lock = &hashinfo->lhash_lock;
292 } else {
293 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
294 write_lock_bh(lock);
295 }
296
297 if (__sk_del_node_init(sk))
298 sock_prot_inuse_add(sk->sk_prot, -1);
299 write_unlock_bh(lock);
300out:
301 if (sk->sk_state == TCP_LISTEN)
302 wake_up(&hashinfo->lhash_wait);
303}
304 271
305extern struct sock *__inet_lookup_listener(struct net *net, 272extern struct sock *__inet_lookup_listener(struct net *net,
306 struct inet_hashinfo *hashinfo, 273 struct inet_hashinfo *hashinfo,
@@ -425,7 +392,7 @@ extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
425 struct sock *sk, 392 struct sock *sk,
426 int (*check_established)(struct inet_timewait_death_row *, 393 int (*check_established)(struct inet_timewait_death_row *,
427 struct sock *, __u16, struct inet_timewait_sock **), 394 struct sock *, __u16, struct inet_timewait_sock **),
428 void (*hash)(struct inet_hashinfo *, struct sock *)); 395 void (*hash)(struct sock *sk));
429extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 396extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
430 struct sock *sk); 397 struct sock *sk);
431#endif /* _INET_HASHTABLES_H */ 398#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 67e925065aae..296547bfb0b7 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -116,6 +116,7 @@ struct inet_timewait_sock {
116#define tw_hash __tw_common.skc_hash 116#define tw_hash __tw_common.skc_hash
117#define tw_prot __tw_common.skc_prot 117#define tw_prot __tw_common.skc_prot
118#define tw_net __tw_common.skc_net 118#define tw_net __tw_common.skc_net
119 int tw_timeout;
119 volatile unsigned char tw_substate; 120 volatile unsigned char tw_substate;
120 /* 3 bits hole, try to pack */ 121 /* 3 bits hole, try to pack */
121 unsigned char tw_rcv_wscale; 122 unsigned char tw_rcv_wscale;
@@ -130,7 +131,6 @@ struct inet_timewait_sock {
130 __u8 tw_ipv6only:1; 131 __u8 tw_ipv6only:1;
131 /* 15 bits hole, try to pack */ 132 /* 15 bits hole, try to pack */
132 __u16 tw_ipv6_offset; 133 __u16 tw_ipv6_offset;
133 int tw_timeout;
134 unsigned long tw_ttd; 134 unsigned long tw_ttd;
135 struct inet_bind_bucket *tw_tb; 135 struct inet_bind_bucket *tw_tb;
136 struct hlist_node tw_death_node; 136 struct hlist_node tw_death_node;
diff --git a/include/net/sock.h b/include/net/sock.h
index e3fb4c047f4c..8a7889b35810 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -496,6 +496,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
496 496
497struct request_sock_ops; 497struct request_sock_ops;
498struct timewait_sock_ops; 498struct timewait_sock_ops;
499struct inet_hashinfo;
499 500
500/* Networking protocol blocks we attach to sockets. 501/* Networking protocol blocks we attach to sockets.
501 * socket layer -> transport layer interface 502 * socket layer -> transport layer interface
@@ -578,6 +579,8 @@ struct proto {
578 struct request_sock_ops *rsk_prot; 579 struct request_sock_ops *rsk_prot;
579 struct timewait_sock_ops *twsk_prot; 580 struct timewait_sock_ops *twsk_prot;
580 581
582 struct inet_hashinfo *hashinfo;
583
581 struct module *owner; 584 struct module *owner;
582 585
583 char name[32]; 586 char name[32];
diff --git a/init/Kconfig b/init/Kconfig
index dcc96a8c8c69..b2acdeb2d312 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -665,6 +665,20 @@ config SLOB
665 665
666endchoice 666endchoice
667 667
668config PROFILING
669 bool "Profiling support (EXPERIMENTAL)"
670 help
671 Say Y here to enable the extended profiling support mechanisms used
672 by profilers such as OProfile.
673
674config MARKERS
675 bool "Activate markers"
676 help
677 Place an empty function call at each marker site. Can be
678 dynamically changed for a probe function.
679
680source "arch/Kconfig"
681
668endmenu # General setup 682endmenu # General setup
669 683
670config SLABINFO 684config SLABINFO
diff --git a/kernel/Kconfig.instrumentation b/kernel/Kconfig.instrumentation
deleted file mode 100644
index 468f47ad7503..000000000000
--- a/kernel/Kconfig.instrumentation
+++ /dev/null
@@ -1,49 +0,0 @@
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 depends on ARCH_SUPPORTS_OPROFILE || ALPHA || ARM || BLACKFIN || IA64 || M32R || PARISC || PPC || S390 || SUPERH || SPARC
25 help
26 OProfile is a profiling system capable of profiling the
27 whole system, include the kernel, kernel modules, libraries,
28 and applications.
29
30 If unsure, say N.
31
32config KPROBES
33 bool "Kprobes"
34 depends on KALLSYMS && MODULES && !UML
35 depends on X86_32 || IA64 || PPC || S390 || SPARC64 || X86_64 || AVR32
36 help
37 Kprobes allows you to trap at almost any kernel address and
38 execute a callback function. register_kprobe() establishes
39 a probepoint and specifies the callback. Kprobes is useful
40 for kernel debugging, non-intrusive instrumentation and testing.
41 If in doubt, say "N".
42
43config MARKERS
44 bool "Activate markers"
45 help
46 Place an empty function call at each marker site. Can be
47 dynamically changed for a probe function.
48
49endif # INSTRUMENTATION
diff --git a/kernel/Makefile b/kernel/Makefile
index 8885627ea021..db9af707ff5b 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -9,7 +9,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
9 rcupdate.o extable.o params.o posix-timers.o \ 9 rcupdate.o extable.o params.o posix-timers.o \
10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \
12 utsname.o notifier.o 12 utsname.o notifier.o ksysfs.o
13 13
14obj-$(CONFIG_SYSCTL) += sysctl_check.o 14obj-$(CONFIG_SYSCTL) += sysctl_check.o
15obj-$(CONFIG_STACKTRACE) += stacktrace.o 15obj-$(CONFIG_STACKTRACE) += stacktrace.o
@@ -49,7 +49,6 @@ obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
49obj-$(CONFIG_AUDITSYSCALL) += auditsc.o 49obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
50obj-$(CONFIG_AUDIT_TREE) += audit_tree.o 50obj-$(CONFIG_AUDIT_TREE) += audit_tree.o
51obj-$(CONFIG_KPROBES) += kprobes.o 51obj-$(CONFIG_KPROBES) += kprobes.o
52obj-$(CONFIG_SYSFS) += ksysfs.o
53obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o 52obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o
54obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ 53obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
55obj-$(CONFIG_SECCOMP) += seccomp.o 54obj-$(CONFIG_SECCOMP) += seccomp.o
diff --git a/kernel/relay.c b/kernel/relay.c
index 61134eb7a0c8..7c0373322f18 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -92,6 +92,7 @@ static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
92 return -EINVAL; 92 return -EINVAL;
93 93
94 vma->vm_ops = &relay_file_mmap_ops; 94 vma->vm_ops = &relay_file_mmap_ops;
95 vma->vm_flags |= VM_DONTEXPAND;
95 vma->vm_private_data = buf; 96 vma->vm_private_data = buf;
96 buf->chan->cb->buf_mapped(buf, filp); 97 buf->chan->cb->buf_mapped(buf, filp);
97 98
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 0d8a5a4a789d..0d385be682db 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -81,7 +81,7 @@ config HEADERS_CHECK
81 81
82config DEBUG_SECTION_MISMATCH 82config DEBUG_SECTION_MISMATCH
83 bool "Enable full Section mismatch analysis" 83 bool "Enable full Section mismatch analysis"
84 default n 84 depends on UNDEFINED
85 help 85 help
86 The section mismatch analysis checks if there are illegal 86 The section mismatch analysis checks if there are illegal
87 references from one section to another section. 87 references from one section to another section.
@@ -90,19 +90,19 @@ config DEBUG_SECTION_MISMATCH
90 most likely result in an oops. 90 most likely result in an oops.
91 In the code functions and variables are annotated with 91 In the code functions and variables are annotated with
92 __init, __devinit etc. (see full list in include/linux/init.h) 92 __init, __devinit etc. (see full list in include/linux/init.h)
93 which result in the code/data being placed in specific sections. 93 which results in the code/data being placed in specific sections.
94 The section mismatch anaylsis are always done after a full 94 The section mismatch analysis is always done after a full
95 kernel build but enabling this options will in addition 95 kernel build but enabling this option will in addition
96 do the following: 96 do the following:
97 - Add the option -fno-inline-functions-called-once to gcc 97 - Add the option -fno-inline-functions-called-once to gcc
98 When inlining a function annotated __init in a non-init 98 When inlining a function annotated __init in a non-init
99 function we would loose the section information and thus 99 function we would lose the section information and thus
100 the analysis would not catch the illegal reference. 100 the analysis would not catch the illegal reference.
101 This options tell gcc to inline less but will also 101 This option tells gcc to inline less but will also
102 result in a larger kernel. 102 result in a larger kernel.
103 - Run the section mismatch analysis for each module/built-in.o 103 - Run the section mismatch analysis for each module/built-in.o
104 When we run the section mismatch analysis on vmlinux.o we 104 When we run the section mismatch analysis on vmlinux.o we
105 looses valueable information about where the mismatch was 105 lose valueble information about where the mismatch was
106 introduced. 106 introduced.
107 Running the analysis for each module/built-in.o file 107 Running the analysis for each module/built-in.o file
108 will tell where the mismatch happens much closer to the 108 will tell where the mismatch happens much closer to the
diff --git a/lib/kobject.c b/lib/kobject.c
index 1d63ead1815e..d784daeb8571 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -637,7 +637,7 @@ struct kobject *kobject_create(void)
637 * @name: the name for the kset 637 * @name: the name for the kset
638 * @parent: the parent kobject of this kobject, if any. 638 * @parent: the parent kobject of this kobject, if any.
639 * 639 *
640 * This function creates a kset structure dynamically and registers it 640 * This function creates a kobject structure dynamically and registers it
641 * with sysfs. When you are finished with this structure, call 641 * with sysfs. When you are finished with this structure, call
642 * kobject_put() and the structure will be dynamically freed when 642 * kobject_put() and the structure will be dynamically freed when
643 * it is no longer being used. 643 * it is no longer being used.
diff --git a/mm/mmap.c b/mm/mmap.c
index d2b6d44962b7..8295577a83b2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2216,7 +2216,7 @@ int install_special_mapping(struct mm_struct *mm,
2216 vma->vm_start = addr; 2216 vma->vm_start = addr;
2217 vma->vm_end = addr + len; 2217 vma->vm_end = addr + len;
2218 2218
2219 vma->vm_flags = vm_flags | mm->def_flags; 2219 vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND;
2220 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); 2220 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
2221 2221
2222 vma->vm_ops = &special_mapping_vmops; 2222 vma->vm_ops = &special_mapping_vmops;
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index ebe59d98721a..287a62bc2e0f 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -271,8 +271,6 @@ extern struct sk_buff *dccp_make_response(struct sock *sk,
271 271
272extern int dccp_connect(struct sock *sk); 272extern int dccp_connect(struct sock *sk);
273extern int dccp_disconnect(struct sock *sk, int flags); 273extern int dccp_disconnect(struct sock *sk, int flags);
274extern void dccp_hash(struct sock *sk);
275extern void dccp_unhash(struct sock *sk);
276extern int dccp_getsockopt(struct sock *sk, int level, int optname, 274extern int dccp_getsockopt(struct sock *sk, int level, int optname,
277 char __user *optval, int __user *optlen); 275 char __user *optval, int __user *optlen);
278extern int dccp_setsockopt(struct sock *sk, int level, int optname, 276extern int dccp_setsockopt(struct sock *sk, int level, int optname,
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index c982ad88223d..474075adbde4 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -38,12 +38,6 @@
38 */ 38 */
39static struct socket *dccp_v4_ctl_socket; 39static struct socket *dccp_v4_ctl_socket;
40 40
41static int dccp_v4_get_port(struct sock *sk, const unsigned short snum)
42{
43 return inet_csk_get_port(&dccp_hashinfo, sk, snum,
44 inet_csk_bind_conflict);
45}
46
47int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 41int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
48{ 42{
49 struct inet_sock *inet = inet_sk(sk); 43 struct inet_sock *inet = inet_sk(sk);
@@ -408,8 +402,8 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
408 402
409 dccp_sync_mss(newsk, dst_mtu(dst)); 403 dccp_sync_mss(newsk, dst_mtu(dst));
410 404
411 __inet_hash_nolisten(&dccp_hashinfo, newsk); 405 __inet_hash_nolisten(newsk);
412 __inet_inherit_port(&dccp_hashinfo, sk, newsk); 406 __inet_inherit_port(sk, newsk);
413 407
414 return newsk; 408 return newsk;
415 409
@@ -898,6 +892,7 @@ static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
898 .getsockopt = ip_getsockopt, 892 .getsockopt = ip_getsockopt,
899 .addr2sockaddr = inet_csk_addr2sockaddr, 893 .addr2sockaddr = inet_csk_addr2sockaddr,
900 .sockaddr_len = sizeof(struct sockaddr_in), 894 .sockaddr_len = sizeof(struct sockaddr_in),
895 .bind_conflict = inet_csk_bind_conflict,
901#ifdef CONFIG_COMPAT 896#ifdef CONFIG_COMPAT
902 .compat_setsockopt = compat_ip_setsockopt, 897 .compat_setsockopt = compat_ip_setsockopt,
903 .compat_getsockopt = compat_ip_getsockopt, 898 .compat_getsockopt = compat_ip_getsockopt,
@@ -937,10 +932,10 @@ static struct proto dccp_v4_prot = {
937 .sendmsg = dccp_sendmsg, 932 .sendmsg = dccp_sendmsg,
938 .recvmsg = dccp_recvmsg, 933 .recvmsg = dccp_recvmsg,
939 .backlog_rcv = dccp_v4_do_rcv, 934 .backlog_rcv = dccp_v4_do_rcv,
940 .hash = dccp_hash, 935 .hash = inet_hash,
941 .unhash = dccp_unhash, 936 .unhash = inet_unhash,
942 .accept = inet_csk_accept, 937 .accept = inet_csk_accept,
943 .get_port = dccp_v4_get_port, 938 .get_port = inet_csk_get_port,
944 .shutdown = dccp_shutdown, 939 .shutdown = dccp_shutdown,
945 .destroy = dccp_destroy_sock, 940 .destroy = dccp_destroy_sock,
946 .orphan_count = &dccp_orphan_count, 941 .orphan_count = &dccp_orphan_count,
@@ -948,6 +943,7 @@ static struct proto dccp_v4_prot = {
948 .obj_size = sizeof(struct dccp_sock), 943 .obj_size = sizeof(struct dccp_sock),
949 .rsk_prot = &dccp_request_sock_ops, 944 .rsk_prot = &dccp_request_sock_ops,
950 .twsk_prot = &dccp_timewait_sock_ops, 945 .twsk_prot = &dccp_timewait_sock_ops,
946 .hashinfo = &dccp_hashinfo,
951#ifdef CONFIG_COMPAT 947#ifdef CONFIG_COMPAT
952 .compat_setsockopt = compat_dccp_setsockopt, 948 .compat_setsockopt = compat_dccp_setsockopt,
953 .compat_getsockopt = compat_dccp_getsockopt, 949 .compat_getsockopt = compat_dccp_getsockopt,
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index ed0a0053a797..490333d47c7b 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -39,21 +39,15 @@ static struct socket *dccp_v6_ctl_socket;
39static struct inet_connection_sock_af_ops dccp_ipv6_mapped; 39static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
40static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; 40static struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
41 41
42static int dccp_v6_get_port(struct sock *sk, unsigned short snum)
43{
44 return inet_csk_get_port(&dccp_hashinfo, sk, snum,
45 inet6_csk_bind_conflict);
46}
47
48static void dccp_v6_hash(struct sock *sk) 42static void dccp_v6_hash(struct sock *sk)
49{ 43{
50 if (sk->sk_state != DCCP_CLOSED) { 44 if (sk->sk_state != DCCP_CLOSED) {
51 if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) { 45 if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) {
52 dccp_hash(sk); 46 inet_hash(sk);
53 return; 47 return;
54 } 48 }
55 local_bh_disable(); 49 local_bh_disable();
56 __inet6_hash(&dccp_hashinfo, sk); 50 __inet6_hash(sk);
57 local_bh_enable(); 51 local_bh_enable();
58 } 52 }
59} 53}
@@ -630,8 +624,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
630 624
631 newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; 625 newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6;
632 626
633 __inet6_hash(&dccp_hashinfo, newsk); 627 __inet6_hash(newsk);
634 inet_inherit_port(&dccp_hashinfo, sk, newsk); 628 inet_inherit_port(sk, newsk);
635 629
636 return newsk; 630 return newsk;
637 631
@@ -1054,6 +1048,7 @@ static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
1054 .getsockopt = ipv6_getsockopt, 1048 .getsockopt = ipv6_getsockopt,
1055 .addr2sockaddr = inet6_csk_addr2sockaddr, 1049 .addr2sockaddr = inet6_csk_addr2sockaddr,
1056 .sockaddr_len = sizeof(struct sockaddr_in6), 1050 .sockaddr_len = sizeof(struct sockaddr_in6),
1051 .bind_conflict = inet6_csk_bind_conflict,
1057#ifdef CONFIG_COMPAT 1052#ifdef CONFIG_COMPAT
1058 .compat_setsockopt = compat_ipv6_setsockopt, 1053 .compat_setsockopt = compat_ipv6_setsockopt,
1059 .compat_getsockopt = compat_ipv6_getsockopt, 1054 .compat_getsockopt = compat_ipv6_getsockopt,
@@ -1123,9 +1118,9 @@ static struct proto dccp_v6_prot = {
1123 .recvmsg = dccp_recvmsg, 1118 .recvmsg = dccp_recvmsg,
1124 .backlog_rcv = dccp_v6_do_rcv, 1119 .backlog_rcv = dccp_v6_do_rcv,
1125 .hash = dccp_v6_hash, 1120 .hash = dccp_v6_hash,
1126 .unhash = dccp_unhash, 1121 .unhash = inet_unhash,
1127 .accept = inet_csk_accept, 1122 .accept = inet_csk_accept,
1128 .get_port = dccp_v6_get_port, 1123 .get_port = inet_csk_get_port,
1129 .shutdown = dccp_shutdown, 1124 .shutdown = dccp_shutdown,
1130 .destroy = dccp_v6_destroy_sock, 1125 .destroy = dccp_v6_destroy_sock,
1131 .orphan_count = &dccp_orphan_count, 1126 .orphan_count = &dccp_orphan_count,
@@ -1133,6 +1128,7 @@ static struct proto dccp_v6_prot = {
1133 .obj_size = sizeof(struct dccp6_sock), 1128 .obj_size = sizeof(struct dccp6_sock),
1134 .rsk_prot = &dccp6_request_sock_ops, 1129 .rsk_prot = &dccp6_request_sock_ops,
1135 .twsk_prot = &dccp6_timewait_sock_ops, 1130 .twsk_prot = &dccp6_timewait_sock_ops,
1131 .hashinfo = &dccp_hashinfo,
1136#ifdef CONFIG_COMPAT 1132#ifdef CONFIG_COMPAT
1137 .compat_setsockopt = compat_dccp_setsockopt, 1133 .compat_setsockopt = compat_dccp_setsockopt,
1138 .compat_getsockopt = compat_dccp_getsockopt, 1134 .compat_getsockopt = compat_dccp_getsockopt,
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 0bed4a6095b7..e3f5d37b84be 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -78,7 +78,7 @@ void dccp_set_state(struct sock *sk, const int state)
78 sk->sk_prot->unhash(sk); 78 sk->sk_prot->unhash(sk);
79 if (inet_csk(sk)->icsk_bind_hash != NULL && 79 if (inet_csk(sk)->icsk_bind_hash != NULL &&
80 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) 80 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
81 inet_put_port(&dccp_hashinfo, sk); 81 inet_put_port(sk);
82 /* fall through */ 82 /* fall through */
83 default: 83 default:
84 if (oldstate == DCCP_OPEN) 84 if (oldstate == DCCP_OPEN)
@@ -173,20 +173,6 @@ const char *dccp_state_name(const int state)
173 173
174EXPORT_SYMBOL_GPL(dccp_state_name); 174EXPORT_SYMBOL_GPL(dccp_state_name);
175 175
176void dccp_hash(struct sock *sk)
177{
178 inet_hash(&dccp_hashinfo, sk);
179}
180
181EXPORT_SYMBOL_GPL(dccp_hash);
182
183void dccp_unhash(struct sock *sk)
184{
185 inet_unhash(&dccp_hashinfo, sk);
186}
187
188EXPORT_SYMBOL_GPL(dccp_unhash);
189
190int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) 176int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
191{ 177{
192 struct dccp_sock *dp = dccp_sk(sk); 178 struct dccp_sock *dp = dccp_sk(sk);
@@ -268,7 +254,7 @@ int dccp_destroy_sock(struct sock *sk)
268 254
269 /* Clean up a referenced DCCP bind bucket. */ 255 /* Clean up a referenced DCCP bind bucket. */
270 if (inet_csk(sk)->icsk_bind_hash != NULL) 256 if (inet_csk(sk)->icsk_bind_hash != NULL)
271 inet_put_port(&dccp_hashinfo, sk); 257 inet_put_port(sk);
272 258
273 kfree(dp->dccps_service_list); 259 kfree(dp->dccps_service_list);
274 dp->dccps_service_list = NULL; 260 dp->dccps_service_list = NULL;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index de5a41de191a..b189278c7bc1 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -78,11 +78,9 @@ EXPORT_SYMBOL_GPL(inet_csk_bind_conflict);
78/* Obtain a reference to a local port for the given sock, 78/* Obtain a reference to a local port for the given sock,
79 * if snum is zero it means select any available local port. 79 * if snum is zero it means select any available local port.
80 */ 80 */
81int inet_csk_get_port(struct inet_hashinfo *hashinfo, 81int inet_csk_get_port(struct sock *sk, unsigned short snum)
82 struct sock *sk, unsigned short snum,
83 int (*bind_conflict)(const struct sock *sk,
84 const struct inet_bind_bucket *tb))
85{ 82{
83 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
86 struct inet_bind_hashbucket *head; 84 struct inet_bind_hashbucket *head;
87 struct hlist_node *node; 85 struct hlist_node *node;
88 struct inet_bind_bucket *tb; 86 struct inet_bind_bucket *tb;
@@ -142,7 +140,7 @@ tb_found:
142 goto success; 140 goto success;
143 } else { 141 } else {
144 ret = 1; 142 ret = 1;
145 if (bind_conflict(sk, tb)) 143 if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb))
146 goto fail_unlock; 144 goto fail_unlock;
147 } 145 }
148 } 146 }
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 48d45008f749..90f422c9447b 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -66,8 +66,9 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
66/* 66/*
67 * Get rid of any references to a local port held by the given sock. 67 * Get rid of any references to a local port held by the given sock.
68 */ 68 */
69static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) 69static void __inet_put_port(struct sock *sk)
70{ 70{
71 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
71 const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size); 72 const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size);
72 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; 73 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash];
73 struct inet_bind_bucket *tb; 74 struct inet_bind_bucket *tb;
@@ -81,10 +82,10 @@ static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk)
81 spin_unlock(&head->lock); 82 spin_unlock(&head->lock);
82} 83}
83 84
84void inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) 85void inet_put_port(struct sock *sk)
85{ 86{
86 local_bh_disable(); 87 local_bh_disable();
87 __inet_put_port(hashinfo, sk); 88 __inet_put_port(sk);
88 local_bh_enable(); 89 local_bh_enable();
89} 90}
90 91
@@ -317,8 +318,9 @@ static inline u32 inet_sk_port_offset(const struct sock *sk)
317 inet->dport); 318 inet->dport);
318} 319}
319 320
320void __inet_hash_nolisten(struct inet_hashinfo *hashinfo, struct sock *sk) 321void __inet_hash_nolisten(struct sock *sk)
321{ 322{
323 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
322 struct hlist_head *list; 324 struct hlist_head *list;
323 rwlock_t *lock; 325 rwlock_t *lock;
324 struct inet_ehash_bucket *head; 326 struct inet_ehash_bucket *head;
@@ -337,13 +339,14 @@ void __inet_hash_nolisten(struct inet_hashinfo *hashinfo, struct sock *sk)
337} 339}
338EXPORT_SYMBOL_GPL(__inet_hash_nolisten); 340EXPORT_SYMBOL_GPL(__inet_hash_nolisten);
339 341
340void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) 342static void __inet_hash(struct sock *sk)
341{ 343{
344 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
342 struct hlist_head *list; 345 struct hlist_head *list;
343 rwlock_t *lock; 346 rwlock_t *lock;
344 347
345 if (sk->sk_state != TCP_LISTEN) { 348 if (sk->sk_state != TCP_LISTEN) {
346 __inet_hash_nolisten(hashinfo, sk); 349 __inet_hash_nolisten(sk);
347 return; 350 return;
348 } 351 }
349 352
@@ -357,13 +360,48 @@ void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
357 write_unlock(lock); 360 write_unlock(lock);
358 wake_up(&hashinfo->lhash_wait); 361 wake_up(&hashinfo->lhash_wait);
359} 362}
360EXPORT_SYMBOL_GPL(__inet_hash); 363
364void inet_hash(struct sock *sk)
365{
366 if (sk->sk_state != TCP_CLOSE) {
367 local_bh_disable();
368 __inet_hash(sk);
369 local_bh_enable();
370 }
371}
372EXPORT_SYMBOL_GPL(inet_hash);
373
374void inet_unhash(struct sock *sk)
375{
376 rwlock_t *lock;
377 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
378
379 if (sk_unhashed(sk))
380 goto out;
381
382 if (sk->sk_state == TCP_LISTEN) {
383 local_bh_disable();
384 inet_listen_wlock(hashinfo);
385 lock = &hashinfo->lhash_lock;
386 } else {
387 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
388 write_lock_bh(lock);
389 }
390
391 if (__sk_del_node_init(sk))
392 sock_prot_inuse_add(sk->sk_prot, -1);
393 write_unlock_bh(lock);
394out:
395 if (sk->sk_state == TCP_LISTEN)
396 wake_up(&hashinfo->lhash_wait);
397}
398EXPORT_SYMBOL_GPL(inet_unhash);
361 399
362int __inet_hash_connect(struct inet_timewait_death_row *death_row, 400int __inet_hash_connect(struct inet_timewait_death_row *death_row,
363 struct sock *sk, 401 struct sock *sk,
364 int (*check_established)(struct inet_timewait_death_row *, 402 int (*check_established)(struct inet_timewait_death_row *,
365 struct sock *, __u16, struct inet_timewait_sock **), 403 struct sock *, __u16, struct inet_timewait_sock **),
366 void (*hash)(struct inet_hashinfo *, struct sock *)) 404 void (*hash)(struct sock *sk))
367{ 405{
368 struct inet_hashinfo *hinfo = death_row->hashinfo; 406 struct inet_hashinfo *hinfo = death_row->hashinfo;
369 const unsigned short snum = inet_sk(sk)->num; 407 const unsigned short snum = inet_sk(sk)->num;
@@ -427,7 +465,7 @@ ok:
427 inet_bind_hash(sk, tb, port); 465 inet_bind_hash(sk, tb, port);
428 if (sk_unhashed(sk)) { 466 if (sk_unhashed(sk)) {
429 inet_sk(sk)->sport = htons(port); 467 inet_sk(sk)->sport = htons(port);
430 hash(hinfo, sk); 468 hash(sk);
431 } 469 }
432 spin_unlock(&head->lock); 470 spin_unlock(&head->lock);
433 471
@@ -444,7 +482,7 @@ ok:
444 tb = inet_csk(sk)->icsk_bind_hash; 482 tb = inet_csk(sk)->icsk_bind_hash;
445 spin_lock_bh(&head->lock); 483 spin_lock_bh(&head->lock);
446 if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { 484 if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) {
447 hash(hinfo, sk); 485 hash(sk);
448 spin_unlock_bh(&head->lock); 486 spin_unlock_bh(&head->lock);
449 return 0; 487 return 0;
450 } else { 488 } else {
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index a0d373bd9065..071e83a894ad 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1669,7 +1669,7 @@ void tcp_set_state(struct sock *sk, int state)
1669 sk->sk_prot->unhash(sk); 1669 sk->sk_prot->unhash(sk);
1670 if (inet_csk(sk)->icsk_bind_hash && 1670 if (inet_csk(sk)->icsk_bind_hash &&
1671 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) 1671 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
1672 inet_put_port(&tcp_hashinfo, sk); 1672 inet_put_port(sk);
1673 /* fall through */ 1673 /* fall through */
1674 default: 1674 default:
1675 if (oldstate==TCP_ESTABLISHED) 1675 if (oldstate==TCP_ESTABLISHED)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 77c1939a2b0d..63414ea427c5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -108,22 +108,6 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
108 .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), 108 .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
109}; 109};
110 110
111static int tcp_v4_get_port(struct sock *sk, unsigned short snum)
112{
113 return inet_csk_get_port(&tcp_hashinfo, sk, snum,
114 inet_csk_bind_conflict);
115}
116
117static void tcp_v4_hash(struct sock *sk)
118{
119 inet_hash(&tcp_hashinfo, sk);
120}
121
122void tcp_unhash(struct sock *sk)
123{
124 inet_unhash(&tcp_hashinfo, sk);
125}
126
127static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) 111static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb)
128{ 112{
129 return secure_tcp_sequence_number(ip_hdr(skb)->daddr, 113 return secure_tcp_sequence_number(ip_hdr(skb)->daddr,
@@ -1478,8 +1462,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1478 } 1462 }
1479#endif 1463#endif
1480 1464
1481 __inet_hash_nolisten(&tcp_hashinfo, newsk); 1465 __inet_hash_nolisten(newsk);
1482 __inet_inherit_port(&tcp_hashinfo, sk, newsk); 1466 __inet_inherit_port(sk, newsk);
1483 1467
1484 return newsk; 1468 return newsk;
1485 1469
@@ -1827,6 +1811,7 @@ struct inet_connection_sock_af_ops ipv4_specific = {
1827 .getsockopt = ip_getsockopt, 1811 .getsockopt = ip_getsockopt,
1828 .addr2sockaddr = inet_csk_addr2sockaddr, 1812 .addr2sockaddr = inet_csk_addr2sockaddr,
1829 .sockaddr_len = sizeof(struct sockaddr_in), 1813 .sockaddr_len = sizeof(struct sockaddr_in),
1814 .bind_conflict = inet_csk_bind_conflict,
1830#ifdef CONFIG_COMPAT 1815#ifdef CONFIG_COMPAT
1831 .compat_setsockopt = compat_ip_setsockopt, 1816 .compat_setsockopt = compat_ip_setsockopt,
1832 .compat_getsockopt = compat_ip_getsockopt, 1817 .compat_getsockopt = compat_ip_getsockopt,
@@ -1926,7 +1911,7 @@ int tcp_v4_destroy_sock(struct sock *sk)
1926 1911
1927 /* Clean up a referenced TCP bind bucket. */ 1912 /* Clean up a referenced TCP bind bucket. */
1928 if (inet_csk(sk)->icsk_bind_hash) 1913 if (inet_csk(sk)->icsk_bind_hash)
1929 inet_put_port(&tcp_hashinfo, sk); 1914 inet_put_port(sk);
1930 1915
1931 /* 1916 /*
1932 * If sendmsg cached page exists, toss it. 1917 * If sendmsg cached page exists, toss it.
@@ -2435,9 +2420,9 @@ struct proto tcp_prot = {
2435 .getsockopt = tcp_getsockopt, 2420 .getsockopt = tcp_getsockopt,
2436 .recvmsg = tcp_recvmsg, 2421 .recvmsg = tcp_recvmsg,
2437 .backlog_rcv = tcp_v4_do_rcv, 2422 .backlog_rcv = tcp_v4_do_rcv,
2438 .hash = tcp_v4_hash, 2423 .hash = inet_hash,
2439 .unhash = tcp_unhash, 2424 .unhash = inet_unhash,
2440 .get_port = tcp_v4_get_port, 2425 .get_port = inet_csk_get_port,
2441 .enter_memory_pressure = tcp_enter_memory_pressure, 2426 .enter_memory_pressure = tcp_enter_memory_pressure,
2442 .sockets_allocated = &tcp_sockets_allocated, 2427 .sockets_allocated = &tcp_sockets_allocated,
2443 .orphan_count = &tcp_orphan_count, 2428 .orphan_count = &tcp_orphan_count,
@@ -2450,6 +2435,7 @@ struct proto tcp_prot = {
2450 .obj_size = sizeof(struct tcp_sock), 2435 .obj_size = sizeof(struct tcp_sock),
2451 .twsk_prot = &tcp_timewait_sock_ops, 2436 .twsk_prot = &tcp_timewait_sock_ops,
2452 .rsk_prot = &tcp_request_sock_ops, 2437 .rsk_prot = &tcp_request_sock_ops,
2438 .hashinfo = &tcp_hashinfo,
2453#ifdef CONFIG_COMPAT 2439#ifdef CONFIG_COMPAT
2454 .compat_setsockopt = compat_tcp_setsockopt, 2440 .compat_setsockopt = compat_tcp_setsockopt,
2455 .compat_getsockopt = compat_tcp_getsockopt, 2441 .compat_getsockopt = compat_tcp_getsockopt,
@@ -2467,7 +2453,6 @@ void __init tcp_v4_init(struct net_proto_family *ops)
2467EXPORT_SYMBOL(ipv4_specific); 2453EXPORT_SYMBOL(ipv4_specific);
2468EXPORT_SYMBOL(tcp_hashinfo); 2454EXPORT_SYMBOL(tcp_hashinfo);
2469EXPORT_SYMBOL(tcp_prot); 2455EXPORT_SYMBOL(tcp_prot);
2470EXPORT_SYMBOL(tcp_unhash);
2471EXPORT_SYMBOL(tcp_v4_conn_request); 2456EXPORT_SYMBOL(tcp_v4_conn_request);
2472EXPORT_SYMBOL(tcp_v4_connect); 2457EXPORT_SYMBOL(tcp_v4_connect);
2473EXPORT_SYMBOL(tcp_v4_do_rcv); 2458EXPORT_SYMBOL(tcp_v4_do_rcv);
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index d325a9958909..43f3993e1f30 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -22,9 +22,9 @@
22#include <net/inet6_hashtables.h> 22#include <net/inet6_hashtables.h>
23#include <net/ip.h> 23#include <net/ip.h>
24 24
25void __inet6_hash(struct inet_hashinfo *hashinfo, 25void __inet6_hash(struct sock *sk)
26 struct sock *sk)
27{ 26{
27 struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
28 struct hlist_head *list; 28 struct hlist_head *list;
29 rwlock_t *lock; 29 rwlock_t *lock;
30 30
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 59d0029e93a7..12750f2b05ab 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -86,12 +86,6 @@ static struct tcp_sock_af_ops tcp_sock_ipv6_specific;
86static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; 86static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
87#endif 87#endif
88 88
89static int tcp_v6_get_port(struct sock *sk, unsigned short snum)
90{
91 return inet_csk_get_port(&tcp_hashinfo, sk, snum,
92 inet6_csk_bind_conflict);
93}
94
95static void tcp_v6_hash(struct sock *sk) 89static void tcp_v6_hash(struct sock *sk)
96{ 90{
97 if (sk->sk_state != TCP_CLOSE) { 91 if (sk->sk_state != TCP_CLOSE) {
@@ -100,7 +94,7 @@ static void tcp_v6_hash(struct sock *sk)
100 return; 94 return;
101 } 95 }
102 local_bh_disable(); 96 local_bh_disable();
103 __inet6_hash(&tcp_hashinfo, sk); 97 __inet6_hash(sk);
104 local_bh_enable(); 98 local_bh_enable();
105 } 99 }
106} 100}
@@ -1504,8 +1498,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1504 } 1498 }
1505#endif 1499#endif
1506 1500
1507 __inet6_hash(&tcp_hashinfo, newsk); 1501 __inet6_hash(newsk);
1508 inet_inherit_port(&tcp_hashinfo, sk, newsk); 1502 inet_inherit_port(sk, newsk);
1509 1503
1510 return newsk; 1504 return newsk;
1511 1505
@@ -1833,6 +1827,7 @@ static struct inet_connection_sock_af_ops ipv6_specific = {
1833 .getsockopt = ipv6_getsockopt, 1827 .getsockopt = ipv6_getsockopt,
1834 .addr2sockaddr = inet6_csk_addr2sockaddr, 1828 .addr2sockaddr = inet6_csk_addr2sockaddr,
1835 .sockaddr_len = sizeof(struct sockaddr_in6), 1829 .sockaddr_len = sizeof(struct sockaddr_in6),
1830 .bind_conflict = inet6_csk_bind_conflict,
1836#ifdef CONFIG_COMPAT 1831#ifdef CONFIG_COMPAT
1837 .compat_setsockopt = compat_ipv6_setsockopt, 1832 .compat_setsockopt = compat_ipv6_setsockopt,
1838 .compat_getsockopt = compat_ipv6_getsockopt, 1833 .compat_getsockopt = compat_ipv6_getsockopt,
@@ -1864,6 +1859,7 @@ static struct inet_connection_sock_af_ops ipv6_mapped = {
1864 .getsockopt = ipv6_getsockopt, 1859 .getsockopt = ipv6_getsockopt,
1865 .addr2sockaddr = inet6_csk_addr2sockaddr, 1860 .addr2sockaddr = inet6_csk_addr2sockaddr,
1866 .sockaddr_len = sizeof(struct sockaddr_in6), 1861 .sockaddr_len = sizeof(struct sockaddr_in6),
1862 .bind_conflict = inet6_csk_bind_conflict,
1867#ifdef CONFIG_COMPAT 1863#ifdef CONFIG_COMPAT
1868 .compat_setsockopt = compat_ipv6_setsockopt, 1864 .compat_setsockopt = compat_ipv6_setsockopt,
1869 .compat_getsockopt = compat_ipv6_getsockopt, 1865 .compat_getsockopt = compat_ipv6_getsockopt,
@@ -2127,8 +2123,8 @@ struct proto tcpv6_prot = {
2127 .recvmsg = tcp_recvmsg, 2123 .recvmsg = tcp_recvmsg,
2128 .backlog_rcv = tcp_v6_do_rcv, 2124 .backlog_rcv = tcp_v6_do_rcv,
2129 .hash = tcp_v6_hash, 2125 .hash = tcp_v6_hash,
2130 .unhash = tcp_unhash, 2126 .unhash = inet_unhash,
2131 .get_port = tcp_v6_get_port, 2127 .get_port = inet_csk_get_port,
2132 .enter_memory_pressure = tcp_enter_memory_pressure, 2128 .enter_memory_pressure = tcp_enter_memory_pressure,
2133 .sockets_allocated = &tcp_sockets_allocated, 2129 .sockets_allocated = &tcp_sockets_allocated,
2134 .memory_allocated = &tcp_memory_allocated, 2130 .memory_allocated = &tcp_memory_allocated,
@@ -2141,6 +2137,7 @@ struct proto tcpv6_prot = {
2141 .obj_size = sizeof(struct tcp6_sock), 2137 .obj_size = sizeof(struct tcp6_sock),
2142 .twsk_prot = &tcp6_timewait_sock_ops, 2138 .twsk_prot = &tcp6_timewait_sock_ops,
2143 .rsk_prot = &tcp6_request_sock_ops, 2139 .rsk_prot = &tcp6_request_sock_ops,
2140 .hashinfo = &tcp_hashinfo,
2144#ifdef CONFIG_COMPAT 2141#ifdef CONFIG_COMPAT
2145 .compat_setsockopt = compat_tcp_setsockopt, 2142 .compat_setsockopt = compat_tcp_setsockopt,
2146 .compat_getsockopt = compat_tcp_getsockopt, 2143 .compat_getsockopt = compat_tcp_getsockopt,
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 09c255002e56..e77592d050ce 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -98,6 +98,18 @@ config MAC80211_DEBUGFS
98 98
99 Say N unless you know you need this. 99 Say N unless you know you need this.
100 100
101config MAC80211_DEBUG_PACKET_ALIGNMENT
102 bool "Enable packet alignment debugging"
103 depends on MAC80211
104 help
105 This option is recommended for driver authors and strongly
106 discouraged for everybody else, it will trigger a warning
107 when a driver hands mac80211 a buffer that is aligned in
108 a way that will cause problems with the IP stack on some
109 architectures.
110
111 Say N unless you're writing a mac80211 based driver.
112
101config MAC80211_DEBUG 113config MAC80211_DEBUG
102 bool "Enable debugging output" 114 bool "Enable debugging output"
103 depends on MAC80211 115 depends on MAC80211
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 5dcc2d61551f..67b7c75c430d 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1344,17 +1344,17 @@ static int __init ieee80211_init(void)
1344 1344
1345 ret = rc80211_simple_init(); 1345 ret = rc80211_simple_init();
1346 if (ret) 1346 if (ret)
1347 goto fail; 1347 goto out;
1348 1348
1349 ret = rc80211_pid_init(); 1349 ret = rc80211_pid_init();
1350 if (ret) 1350 if (ret)
1351 goto fail_simple; 1351 goto out_cleanup_simple;
1352 1352
1353 ret = ieee80211_wme_register(); 1353 ret = ieee80211_wme_register();
1354 if (ret) { 1354 if (ret) {
1355 printk(KERN_DEBUG "ieee80211_init: failed to " 1355 printk(KERN_DEBUG "ieee80211_init: failed to "
1356 "initialize WME (err=%d)\n", ret); 1356 "initialize WME (err=%d)\n", ret);
1357 goto fail_pid; 1357 goto out_cleanup_pid;
1358 } 1358 }
1359 1359
1360 ieee80211_debugfs_netdev_init(); 1360 ieee80211_debugfs_netdev_init();
@@ -1362,11 +1362,11 @@ static int __init ieee80211_init(void)
1362 1362
1363 return 0; 1363 return 0;
1364 1364
1365 fail_pid: 1365 out_cleanup_pid:
1366 rc80211_simple_exit();
1367 fail_simple:
1368 rc80211_pid_exit(); 1366 rc80211_pid_exit();
1369 fail: 1367 out_cleanup_simple:
1368 rc80211_simple_exit();
1369 out:
1370 return ret; 1370 return ret;
1371} 1371}
1372 1372
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 554c4baed6fb..c339571632b2 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -538,7 +538,7 @@ int __init rc80211_pid_init(void)
538 return ieee80211_rate_control_register(&mac80211_rcpid); 538 return ieee80211_rate_control_register(&mac80211_rcpid);
539} 539}
540 540
541void __exit rc80211_pid_exit(void) 541void rc80211_pid_exit(void)
542{ 542{
543 ieee80211_rate_control_unregister(&mac80211_rcpid); 543 ieee80211_rate_control_unregister(&mac80211_rcpid);
544} 544}
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index 934676d687d6..9a78b116acff 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -389,7 +389,7 @@ int __init rc80211_simple_init(void)
389 return ieee80211_rate_control_register(&mac80211_rcsimple); 389 return ieee80211_rate_control_register(&mac80211_rcsimple);
390} 390}
391 391
392void __exit rc80211_simple_exit(void) 392void rc80211_simple_exit(void)
393{ 393{
394 ieee80211_rate_control_unregister(&mac80211_rcsimple); 394 ieee80211_rate_control_unregister(&mac80211_rcsimple);
395} 395}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d44c87269bcb..535407d07fa4 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -340,11 +340,15 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
340 return load; 340 return load;
341} 341}
342 342
343#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
343static ieee80211_txrx_result 344static ieee80211_txrx_result
344ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx) 345ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
345{ 346{
346 int hdrlen; 347 int hdrlen;
347 348
349 if (!WLAN_FC_DATA_PRESENT(rx->fc))
350 return TXRX_CONTINUE;
351
348 /* 352 /*
349 * Drivers are required to align the payload data in a way that 353 * Drivers are required to align the payload data in a way that
350 * guarantees that the contained IP header is aligned to a four- 354 * guarantees that the contained IP header is aligned to a four-
@@ -371,11 +375,14 @@ ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
371 375
372 return TXRX_CONTINUE; 376 return TXRX_CONTINUE;
373} 377}
378#endif
374 379
375ieee80211_rx_handler ieee80211_rx_pre_handlers[] = 380ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
376{ 381{
377 ieee80211_rx_h_parse_qos, 382 ieee80211_rx_h_parse_qos,
383#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
378 ieee80211_rx_h_verify_ip_alignment, 384 ieee80211_rx_h_verify_ip_alignment,
385#endif
379 NULL 386 NULL
380}; 387};
381 388
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 50e61c411bc0..734cf4f3131e 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -821,6 +821,7 @@ static void conf_load(void)
821 return; 821 return;
822 if (!conf_read(dialog_input_result)) { 822 if (!conf_read(dialog_input_result)) {
823 set_config_filename(dialog_input_result); 823 set_config_filename(dialog_input_result);
824 sym_set_change_count(1);
824 return; 825 return;
825 } 826 }
826 show_textbox(NULL, _("File does not exist!"), 5, 38); 827 show_textbox(NULL, _("File does not exist!"), 5, 38);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index fdad17367f61..606ceb9e746e 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -203,12 +203,9 @@ void sym_check_prop(struct symbol *sym)
203 prop_warn(prop, 203 prop_warn(prop,
204 "config symbol '%s' uses select, but is " 204 "config symbol '%s' uses select, but is "
205 "not boolean or tristate", sym->name); 205 "not boolean or tristate", sym->name);
206 else if (sym2->type == S_UNKNOWN) 206 else if (sym2->type != S_UNKNOWN &&
207 prop_warn(prop, 207 sym2->type != S_BOOLEAN &&
208 "'select' used by config symbol '%s' " 208 sym2->type != S_TRISTATE)
209 "refers to undefined symbol '%s'",
210 sym->name, sym2->name);
211 else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)
212 prop_warn(prop, 209 prop_warn(prop,
213 "'%s' has wrong type. 'select' only " 210 "'%s' has wrong type. 'select' only "
214 "accept arguments of boolean and " 211 "accept arguments of boolean and "
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f8efc93eb700..5d546466e6b1 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -870,7 +870,7 @@ const struct sectioncheck sectioncheck[] = {
870/* Do not export init/exit functions or data */ 870/* Do not export init/exit functions or data */
871{ 871{
872 .fromsec = { "__ksymtab*", NULL }, 872 .fromsec = { "__ksymtab*", NULL },
873 .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }, 873 .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
874 .mismatch = EXPORT_TO_INIT_EXIT 874 .mismatch = EXPORT_TO_INIT_EXIT
875} 875}
876}; 876};
@@ -1125,15 +1125,15 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1125 to = to_is_func ? "function" : "variable"; 1125 to = to_is_func ? "function" : "variable";
1126 to_p = to_is_func ? "()" : ""; 1126 to_p = to_is_func ? "()" : "";
1127 1127
1128 sec_mismatch_count++;
1129 if (!sec_mismatch_verbose)
1130 return;
1131
1128 fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in" 1132 fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in"
1129 " reference from the %s %s%s to the %s %s:%s%s\n", 1133 " reference from the %s %s%s to the %s %s:%s%s\n",
1130 modname, fromsec, fromaddr, from, fromsym, from_p, 1134 modname, fromsec, fromaddr, from, fromsym, from_p,
1131 to, tosec, tosym, to_p); 1135 to, tosec, tosym, to_p);
1132 1136
1133 sec_mismatch_count++;
1134 if (!sec_mismatch_verbose)
1135 return;
1136
1137 switch (mismatch) { 1137 switch (mismatch) {
1138 case TEXT_TO_INIT: 1138 case TEXT_TO_INIT:
1139 fprintf(stderr, 1139 fprintf(stderr,
@@ -1939,10 +1939,9 @@ int main(int argc, char **argv)
1939 write_dump(dump_write); 1939 write_dump(dump_write);
1940 if (sec_mismatch_count && !sec_mismatch_verbose) 1940 if (sec_mismatch_count && !sec_mismatch_verbose)
1941 fprintf(stderr, "modpost: Found %d section mismatch(es).\n" 1941 fprintf(stderr, "modpost: Found %d section mismatch(es).\n"
1942 "To see additional details select \"Enable full " 1942 "To see full details build your kernel with:\n"
1943 "Section mismatch analysis\"\n" 1943 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
1944 "in the Kernel Hacking menu " 1944 sec_mismatch_count);
1945 "(CONFIG_SECTION_MISMATCH).\n", sec_mismatch_count);
1946 1945
1947 return err; 1946 return err;
1948} 1947}
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 52f032e409a3..1c1bdaf7348a 100644..100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -45,3 +45,19 @@ if hgid=`hg id 2>/dev/null`; then
45 # All done with mercurial 45 # All done with mercurial
46 exit 46 exit
47fi 47fi
48
49# Check for svn and a svn repo.
50if rev=`svn info 2>/dev/null | grep '^Revision'`; then
51 rev=`echo $rev | awk '{print $NF}'`
52 changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
53
54 # Are there uncommitted changes?
55 if [ $changes != 0 ]; then
56 printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
57 else
58 printf -- '-svn%s' "$rev"
59 fi
60
61 # All done with svn
62 exit
63fi
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 5d3c0372df32..f95aa0946758 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -2104,6 +2104,7 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
2104{ 2104{
2105 struct via_info *card = vma->vm_private_data; 2105 struct via_info *card = vma->vm_private_data;
2106 struct via_channel *chan = &card->ch_out; 2106 struct via_channel *chan = &card->ch_out;
2107 unsigned long max_bufs;
2107 struct page *dmapage; 2108 struct page *dmapage;
2108 unsigned long pgoff; 2109 unsigned long pgoff;
2109 int rd, wr; 2110 int rd, wr;
@@ -2127,14 +2128,11 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
2127 rd = card->ch_in.is_mapped; 2128 rd = card->ch_in.is_mapped;
2128 wr = card->ch_out.is_mapped; 2129 wr = card->ch_out.is_mapped;
2129 2130
2130#ifndef VIA_NDEBUG 2131 max_bufs = chan->frag_number;
2131 { 2132 if (rd && wr)
2132 unsigned long max_bufs = chan->frag_number; 2133 max_bufs *= 2;
2133 if (rd && wr) max_bufs *= 2; 2134 if (pgoff >= max_bufs)
2134 /* via_dsp_mmap() should ensure this */ 2135 return NOPAGE_SIGBUS;
2135 assert (pgoff < max_bufs);
2136 }
2137#endif
2138 2136
2139 /* if full-duplex (read+write) and we have two sets of bufs, 2137 /* if full-duplex (read+write) and we have two sets of bufs,
2140 * then the playback buffers come first, sez soundcard.c */ 2138 * then the playback buffers come first, sez soundcard.c */
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 6495534e5bf6..1558a5c4094f 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -84,7 +84,7 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
84 us428->us428ctls_sharedmem->CtlSnapShotLast = -2; 84 us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
85 } 85 }
86 area->vm_ops = &us428ctls_vm_ops; 86 area->vm_ops = &us428ctls_vm_ops;
87 area->vm_flags |= VM_RESERVED; 87 area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
88 area->vm_private_data = hw->private_data; 88 area->vm_private_data = hw->private_data;
89 return 0; 89 return 0;
90} 90}
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 800b5cecfc80..117946f2debb 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -722,7 +722,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, st
722 return -ENODEV; 722 return -ENODEV;
723 } 723 }
724 area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; 724 area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
725 area->vm_flags |= VM_RESERVED; 725 area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
726 area->vm_private_data = hw->private_data; 726 area->vm_private_data = hw->private_data;
727 return 0; 727 return 0;
728} 728}