aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/powerpc/booting-without-of.txt59
-rw-r--r--Documentation/thinkpad-acpi.txt25
-rw-r--r--Documentation/watchdog/pcwd-watchdog.txt8
-rw-r--r--Documentation/watchdog/watchdog-api.txt236
-rw-r--r--Documentation/watchdog/watchdog.txt94
-rw-r--r--Documentation/watchdog/wdt.txt43
-rw-r--r--MAINTAINERS9
-rw-r--r--Makefile2
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c5
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/emma2rh/markeins/setup.c24
-rw-r--r--arch/mips/kernel/linux32.c10
-rw-r--r--arch/mips/kernel/r4k_switch.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/traps.c12
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/display.c24
-rw-r--r--arch/mips/mips-boards/generic/time.c31
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c6
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c2
-rw-r--r--arch/mips/mm/dma-default.c5
-rw-r--r--arch/mips/qemu/q-irq.c2
-rw-r--r--arch/mips/sni/pcimt.c18
-rw-r--r--arch/mips/sni/setup.c33
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/boot/Makefile22
-rw-r--r--arch/powerpc/boot/crt0.S1
-rwxr-xr-xarch/powerpc/boot/wrapper4
-rw-r--r--arch/powerpc/kernel/irq.c6
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/prom.c11
-rw-r--r--arch/powerpc/kernel/ptrace.c2
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c33
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c57
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c62
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c161
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h2
-rw-r--r--arch/powerpc/platforms/celleb/Makefile2
-rw-r--r--arch/powerpc/platforms/pasemi/idle.c1
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c8
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c1
-rw-r--r--arch/powerpc/platforms/pseries/xics.c10
-rw-r--r--arch/ppc/syslib/ibm_ocp.c1
-rw-r--r--arch/sh/boards/se/73180/setup.c4
-rw-r--r--arch/sh/boards/superh/microdev/irq.c1
-rw-r--r--arch/sh/cchips/voyagergx/irq.c13
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S2
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c2
-rw-r--r--arch/sh/mm/ioremap.c1
-rw-r--r--arch/sparc64/Kconfig9
-rw-r--r--arch/sparc64/kernel/Makefile4
-rw-r--r--arch/sparc64/kernel/entry.S62
-rw-r--r--arch/sparc64/kernel/mdesc.c53
-rw-r--r--arch/sparc64/kernel/prom.c5
-rw-r--r--arch/sparc64/kernel/setup.c19
-rw-r--r--arch/sparc64/kernel/smp.c21
-rw-r--r--arch/sparc64/kernel/sysfs.c297
-rw-r--r--drivers/acpi/numa.c2
-rw-r--r--drivers/acpi/osl.c118
-rw-r--r--drivers/acpi/tables/tbinstal.c8
-rw-r--r--drivers/acpi/thermal.c13
-rw-r--r--drivers/acpi/utilities/utcopy.c120
-rw-r--r--drivers/acpi/utilities/uteval.c28
-rw-r--r--drivers/acpi/utilities/utobject.c42
-rw-r--r--drivers/acpi/utilities/utxface.c4
-rw-r--r--drivers/ata/libata-core.c13
-rw-r--r--drivers/ata/pata_via.c12
-rw-r--r--drivers/atm/firestream.c15
-rw-r--r--drivers/char/watchdog/Kconfig7
-rw-r--r--drivers/char/watchdog/Makefile1
-rw-r--r--drivers/char/watchdog/ks8695_wdt.c308
-rw-r--r--drivers/input/evdev.c2
-rw-r--r--drivers/input/joydev.c2
-rw-r--r--drivers/input/joystick/db9.c2
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mousedev.c2
-rw-r--r--drivers/input/tsdev.c2
-rw-r--r--drivers/macintosh/Kconfig2
-rw-r--r--drivers/mfd/ucb1x00-ts.c7
-rw-r--r--drivers/misc/thinkpad_acpi.c17
-rw-r--r--drivers/misc/thinkpad_acpi.h6
-rw-r--r--drivers/mtd/Makefile3
-rw-r--r--drivers/mtd/maps/uclinux.c5
-rw-r--r--drivers/mtd/mtdsuper.c232
-rw-r--r--drivers/net/8139cp.c17
-rw-r--r--drivers/net/acenic.c21
-rw-r--r--drivers/net/acenic.h1
-rw-r--r--drivers/net/amd8111e.c11
-rw-r--r--drivers/net/atl1/atl1_main.c33
-rw-r--r--drivers/net/bnx2.c14
-rw-r--r--drivers/net/chelsio/cxgb2.c10
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c6
-rw-r--r--drivers/net/e1000/e1000_main.c11
-rw-r--r--drivers/net/forcedeth.c8
-rw-r--r--drivers/net/gianfar.c16
-rw-r--r--drivers/net/myri10ge/myri10ge.c1
-rw-r--r--drivers/net/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ns83820.c12
-rwxr-xr-xdrivers/net/qla3xxx.c2
-rw-r--r--drivers/net/r8169.c11
-rw-r--r--drivers/net/s2io.c12
-rw-r--r--drivers/net/sky2.c31
-rw-r--r--drivers/net/smc91x.h5
-rw-r--r--drivers/net/spider_net.c40
-rw-r--r--drivers/net/tg3.c21
-rw-r--r--drivers/net/typhoon.c11
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/aacraid/linit.c22
-rw-r--r--drivers/scsi/atari_NCR5380.c44
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/scsi_scan.c9
-rw-r--r--drivers/spi/spi.c2
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/console/Makefile2
-rw-r--r--drivers/video/ffb.c4
-rw-r--r--drivers/video/sunxvr2500.c17
-rw-r--r--drivers/video/sunxvr500.c6
-rw-r--r--fs/ioctl.c14
-rw-r--r--fs/jffs2/readinode.c22
-rw-r--r--fs/jffs2/super.c194
-rw-r--r--fs/jffs2/xattr.c6
-rw-r--r--include/acpi/acpi_numa.h2
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/acutils.h2
-rw-r--r--include/asm-frv/system.h1
-rw-r--r--include/asm-mips/asmmacro.h15
-rw-r--r--include/asm-mips/mips-boards/prom.h1
-rw-r--r--include/asm-mips/unistd.h1
-rw-r--r--include/asm-powerpc/pgalloc-64.h3
-rw-r--r--include/asm-powerpc/tlb.h9
-rw-r--r--include/asm-sh/se73180.h11
-rw-r--r--include/asm-sparc64/cpudata.h2
-rw-r--r--include/asm-sparc64/dma-mapping.h83
-rw-r--r--include/asm-sparc64/hypervisor.h5
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-sparc64/topology.h13
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/mtd/super.h30
-rw-r--r--include/net/af_unix.h8
-rw-r--r--kernel/signal.c16
-rw-r--r--net/8021q/vlan.c13
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/probe.c2
-rw-r--r--net/ipv4/datagram.c6
-rw-r--r--net/ipv4/icmp.c15
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/tcp.c3
-rw-r--r--net/ipv4/tcp_input.c4
-rw-r--r--net/ipv4/tcp_ipv4.c5
-rw-r--r--net/ipv4/udp.c5
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c3
-rw-r--r--net/sched/act_pedit.c3
-rw-r--r--net/sched/sch_generic.c3
-rw-r--r--net/sctp/debug.c8
-rw-r--r--net/sctp/sm_statetable.c2
-rw-r--r--net/unix/af_unix.c127
-rw-r--r--net/wanrouter/wanmain.c2
-rwxr-xr-x[-rw-r--r--]scripts/checkpatch.pl0
164 files changed, 2147 insertions, 1448 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index ce91560229f5..5d0283cd3a81 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -170,7 +170,10 @@ and is between 256 and 4096 characters. It is defined in the file
170 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 170 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
171 Format: To spoof as Windows 98: ="Microsoft Windows" 171 Format: To spoof as Windows 98: ="Microsoft Windows"
172 172
173 acpi_osi= [HW,ACPI] empty param disables _OSI 173 acpi_osi= [HW,ACPI] Modify list of supported OS interface strings
174 acpi_osi="string1" # add string1 -- only one string
175 acpi_osi="!string2" # remove built-in string2
176 acpi_osi= # disable all strings
174 177
175 acpi_serialize [HW,ACPI] force serialization of AML methods 178 acpi_serialize [HW,ACPI] force serialization of AML methods
176 179
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index b49ce169a63a..d42d98107d49 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1,7 +1,6 @@
1 Booting the Linux/ppc kernel without Open Firmware 1 Booting the Linux/ppc kernel without Open Firmware
2 -------------------------------------------------- 2 --------------------------------------------------
3 3
4
5(c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 4(c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
6 IBM Corp. 5 IBM Corp.
7(c) 2005 Becky Bruce <becky.bruce at freescale.com>, 6(c) 2005 Becky Bruce <becky.bruce at freescale.com>,
@@ -9,6 +8,62 @@
9(c) 2006 MontaVista Software, Inc. 8(c) 2006 MontaVista Software, Inc.
10 Flash chip node definition 9 Flash chip node definition
11 10
11Table of Contents
12=================
13
14 I - Introduction
15 1) Entry point for arch/powerpc
16 2) Board support
17
18 II - The DT block format
19 1) Header
20 2) Device tree generalities
21 3) Device tree "structure" block
22 4) Device tree "strings" block
23
24 III - Required content of the device tree
25 1) Note about cells and address representation
26 2) Note about "compatible" properties
27 3) Note about "name" properties
28 4) Note about node and property names and character set
29 5) Required nodes and properties
30 a) The root node
31 b) The /cpus node
32 c) The /cpus/* nodes
33 d) the /memory node(s)
34 e) The /chosen node
35 f) the /soc<SOCname> node
36
37 IV - "dtc", the device tree compiler
38
39 V - Recommendations for a bootloader
40
41 VI - System-on-a-chip devices and nodes
42 1) Defining child nodes of an SOC
43 2) Representing devices without a current OF specification
44 a) MDIO IO device
45 c) PHY nodes
46 b) Gianfar-compatible ethernet nodes
47 d) Interrupt controllers
48 e) I2C
49 f) Freescale SOC USB controllers
50 g) Freescale SOC SEC Security Engines
51 h) Board Control and Status (BCSR)
52 i) Freescale QUICC Engine module (QE)
53 g) Flash chip nodes
54
55 VII - Specifying interrupt information for devices
56 1) interrupts property
57 2) interrupt-parent property
58 3) OpenPIC Interrupt Controllers
59 4) ISA Interrupt Controllers
60
61 Appendix A - Sample SOC node for MPC8540
62
63
64Revision Information
65====================
66
12 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. 67 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
13 68
14 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or 69 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
@@ -1687,7 +1742,7 @@ platforms are moved over to use the flattened-device-tree model.
1687 }; 1742 };
1688 }; 1743 };
1689 1744
1690 g) Flash chip nodes 1745 j) Flash chip nodes
1691 1746
1692 Flash chips (Memory Technology Devices) are often used for solid state 1747 Flash chips (Memory Technology Devices) are often used for solid state
1693 file systems on embedded devices. 1748 file systems on embedded devices.
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 2d4803359a04..9e6b94face4b 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -138,7 +138,7 @@ Hot keys
138-------- 138--------
139 139
140procfs: /proc/acpi/ibm/hotkey 140procfs: /proc/acpi/ibm/hotkey
141sysfs device attribute: hotkey/* 141sysfs device attribute: hotkey_*
142 142
143Without this driver, only the Fn-F4 key (sleep button) generates an 143Without this driver, only the Fn-F4 key (sleep button) generates an
144ACPI event. With the driver loaded, the hotkey feature enabled and the 144ACPI event. With the driver loaded, the hotkey feature enabled and the
@@ -196,10 +196,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
196 196
197sysfs notes: 197sysfs notes:
198 198
199 The hot keys attributes are in a hotkey/ subdirectory off the 199 hotkey_bios_enabled:
200 thinkpad device.
201
202 bios_enabled:
203 Returns the status of the hot keys feature when 200 Returns the status of the hot keys feature when
204 thinkpad-acpi was loaded. Upon module unload, the hot 201 thinkpad-acpi was loaded. Upon module unload, the hot
205 key feature status will be restored to this value. 202 key feature status will be restored to this value.
@@ -207,19 +204,19 @@ sysfs notes:
207 0: hot keys were disabled 204 0: hot keys were disabled
208 1: hot keys were enabled 205 1: hot keys were enabled
209 206
210 bios_mask: 207 hotkey_bios_mask:
211 Returns the hot keys mask when thinkpad-acpi was loaded. 208 Returns the hot keys mask when thinkpad-acpi was loaded.
212 Upon module unload, the hot keys mask will be restored 209 Upon module unload, the hot keys mask will be restored
213 to this value. 210 to this value.
214 211
215 enable: 212 hotkey_enable:
216 Enables/disables the hot keys feature, and reports 213 Enables/disables the hot keys feature, and reports
217 current status of the hot keys feature. 214 current status of the hot keys feature.
218 215
219 0: disables the hot keys feature / feature disabled 216 0: disables the hot keys feature / feature disabled
220 1: enables the hot keys feature / feature enabled 217 1: enables the hot keys feature / feature enabled
221 218
222 mask: 219 hotkey_mask:
223 bit mask to enable ACPI event generation for each hot 220 bit mask to enable ACPI event generation for each hot
224 key (see above). Returns the current status of the hot 221 key (see above). Returns the current status of the hot
225 keys mask, and allows one to modify it. 222 keys mask, and allows one to modify it.
@@ -229,7 +226,7 @@ Bluetooth
229--------- 226---------
230 227
231procfs: /proc/acpi/ibm/bluetooth 228procfs: /proc/acpi/ibm/bluetooth
232sysfs device attribute: bluetooth/enable 229sysfs device attribute: bluetooth_enable
233 230
234This feature shows the presence and current state of a ThinkPad 231This feature shows the presence and current state of a ThinkPad
235Bluetooth device in the internal ThinkPad CDC slot. 232Bluetooth device in the internal ThinkPad CDC slot.
@@ -244,7 +241,7 @@ If Bluetooth is installed, the following commands can be used:
244Sysfs notes: 241Sysfs notes:
245 242
246 If the Bluetooth CDC card is installed, it can be enabled / 243 If the Bluetooth CDC card is installed, it can be enabled /
247 disabled through the "bluetooth/enable" thinkpad-acpi device 244 disabled through the "bluetooth_enable" thinkpad-acpi device
248 attribute, and its current status can also be queried. 245 attribute, and its current status can also be queried.
249 246
250 enable: 247 enable:
@@ -252,7 +249,7 @@ Sysfs notes:
252 1: enables Bluetooth / Bluetooth is enabled. 249 1: enables Bluetooth / Bluetooth is enabled.
253 250
254 Note: this interface will be probably be superseeded by the 251 Note: this interface will be probably be superseeded by the
255 generic rfkill class. 252 generic rfkill class, so it is NOT to be considered stable yet.
256 253
257Video output control -- /proc/acpi/ibm/video 254Video output control -- /proc/acpi/ibm/video
258-------------------------------------------- 255--------------------------------------------
@@ -898,7 +895,7 @@ EXPERIMENTAL: WAN
898----------------- 895-----------------
899 896
900procfs: /proc/acpi/ibm/wan 897procfs: /proc/acpi/ibm/wan
901sysfs device attribute: wwan/enable 898sysfs device attribute: wwan_enable
902 899
903This feature is marked EXPERIMENTAL because the implementation 900This feature is marked EXPERIMENTAL because the implementation
904directly accesses hardware registers and may not work as expected. USE 901directly accesses hardware registers and may not work as expected. USE
@@ -921,7 +918,7 @@ If the W-WAN card is installed, the following commands can be used:
921Sysfs notes: 918Sysfs notes:
922 919
923 If the W-WAN card is installed, it can be enabled / 920 If the W-WAN card is installed, it can be enabled /
924 disabled through the "wwan/enable" thinkpad-acpi device 921 disabled through the "wwan_enable" thinkpad-acpi device
925 attribute, and its current status can also be queried. 922 attribute, and its current status can also be queried.
926 923
927 enable: 924 enable:
@@ -929,7 +926,7 @@ Sysfs notes:
929 1: enables WWAN card / WWAN card is enabled. 926 1: enables WWAN card / WWAN card is enabled.
930 927
931 Note: this interface will be probably be superseeded by the 928 Note: this interface will be probably be superseeded by the
932 generic rfkill class. 929 generic rfkill class, so it is NOT to be considered stable yet.
933 930
934Multiple Commands, Module Parameters 931Multiple Commands, Module Parameters
935------------------------------------ 932------------------------------------
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt
index d9ee6336c1d4..4f68052395c0 100644
--- a/Documentation/watchdog/pcwd-watchdog.txt
+++ b/Documentation/watchdog/pcwd-watchdog.txt
@@ -1,3 +1,5 @@
1Last reviewed: 10/05/2007
2
1 Berkshire Products PC Watchdog Card 3 Berkshire Products PC Watchdog Card
2 Support for ISA Cards Revision A and C 4 Support for ISA Cards Revision A and C
3 Documentation and Driver by Ken Hollis <kenji@bitgate.com> 5 Documentation and Driver by Ken Hollis <kenji@bitgate.com>
@@ -14,8 +16,8 @@
14 16
15 The Watchdog Driver will automatically find your watchdog card, and will 17 The Watchdog Driver will automatically find your watchdog card, and will
16 attach a running driver for use with that card. After the watchdog 18 attach a running driver for use with that card. After the watchdog
17 drivers have initialized, you can then talk to the card using the PC 19 drivers have initialized, you can then talk to the card using a PC
18 Watchdog program, available from http://ftp.bitgate.com/pcwd/. 20 Watchdog program.
19 21
20 I suggest putting a "watchdog -d" before the beginning of an fsck, and 22 I suggest putting a "watchdog -d" before the beginning of an fsck, and
21 a "watchdog -e -t 1" immediately after the end of an fsck. (Remember 23 a "watchdog -e -t 1" immediately after the end of an fsck. (Remember
@@ -62,5 +64,3 @@
62 -- Ken Hollis 64 -- Ken Hollis
63 (kenji@bitgate.com) 65 (kenji@bitgate.com)
64 66
65(This documentation may be out of date. Check
66 http://ftp.bitgate.com/pcwd/ for the absolute latest additions.)
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt
index 8d16f6f3c4ec..bb7cb1d31ec7 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.txt
@@ -1,3 +1,6 @@
1Last reviewed: 10/05/2007
2
3
1The Linux Watchdog driver API. 4The Linux Watchdog driver API.
2 5
3Copyright 2002 Christer Weingel <wingel@nano-system.com> 6Copyright 2002 Christer Weingel <wingel@nano-system.com>
@@ -22,7 +25,7 @@ the system. If userspace fails (RAM error, kernel bug, whatever), the
22notifications cease to occur, and the hardware watchdog will reset the 25notifications cease to occur, and the hardware watchdog will reset the
23system (causing a reboot) after the timeout occurs. 26system (causing a reboot) after the timeout occurs.
24 27
25The Linux watchdog API is a rather AD hoc construction and different 28The Linux watchdog API is a rather ad-hoc construction and different
26drivers implement different, and sometimes incompatible, parts of it. 29drivers implement different, and sometimes incompatible, parts of it.
27This file is an attempt to document the existing usage and allow 30This file is an attempt to document the existing usage and allow
28future driver writers to use it as a reference. 31future driver writers to use it as a reference.
@@ -46,14 +49,16 @@ some of the drivers support the configuration option "Disable watchdog
46shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when 49shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when
47compiling the kernel, there is no way of disabling the watchdog once 50compiling the kernel, there is no way of disabling the watchdog once
48it has been started. So, if the watchdog daemon crashes, the system 51it has been started. So, if the watchdog daemon crashes, the system
49will reboot after the timeout has passed. 52will reboot after the timeout has passed. Watchdog devices also usually
53support the nowayout module parameter so that this option can be controlled
54at runtime.
50 55
51Some other drivers will not disable the watchdog, unless a specific 56Drivers will not disable the watchdog, unless a specific magic character 'V'
52magic character 'V' has been sent /dev/watchdog just before closing 57has been sent /dev/watchdog just before closing the file. If the userspace
53the file. If the userspace daemon closes the file without sending 58daemon closes the file without sending this special character, the driver
54this special character, the driver will assume that the daemon (and 59will assume that the daemon (and userspace in general) died, and will stop
55userspace in general) died, and will stop pinging the watchdog without 60pinging the watchdog without disabling it first. This will then cause a
56disabling it first. This will then cause a reboot. 61reboot if the watchdog is not re-opened in sufficient time.
57 62
58The ioctl API: 63The ioctl API:
59 64
@@ -227,218 +232,3 @@ The following options are available:
227 232
228[FIXME -- better explanations] 233[FIXME -- better explanations]
229 234
230Implementations in the current drivers in the kernel tree:
231
232Here I have tried to summarize what the different drivers support and
233where they do strange things compared to the other drivers.
234
235acquirewdt.c -- Acquire Single Board Computer
236
237 This driver has a hardcoded timeout of 1 minute
238
239 Supports CONFIG_WATCHDOG_NOWAYOUT
240
241 GETSUPPORT returns KEEPALIVEPING. GETSTATUS will return 1 if
242 the device is open, 0 if not. [FIXME -- isn't this rather
243 silly? To be able to use the ioctl, the device must be open
244 and so GETSTATUS will always return 1].
245
246advantechwdt.c -- Advantech Single Board Computer
247
248 Timeout that defaults to 60 seconds, supports SETTIMEOUT.
249
250 Supports CONFIG_WATCHDOG_NOWAYOUT
251
252 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
253 The GETSTATUS call returns if the device is open or not.
254 [FIXME -- silliness again?]
255
256booke_wdt.c -- PowerPC BookE Watchdog Timer
257
258 Timeout default varies according to frequency, supports
259 SETTIMEOUT
260
261 Watchdog cannot be turned off, CONFIG_WATCHDOG_NOWAYOUT
262 does not make sense
263
264 GETSUPPORT returns the watchdog_info struct, and
265 GETSTATUS returns the supported options. GETBOOTSTATUS
266 returns a 1 if the last reset was caused by the
267 watchdog and a 0 otherwise. This watchdog cannot be
268 disabled once it has been started. The wdt_period kernel
269 parameter selects which bit of the time base changing
270 from 0->1 will trigger the watchdog exception. Changing
271 the timeout from the ioctl calls will change the
272 wdt_period as defined above. Finally if you would like to
273 replace the default Watchdog Handler you can implement the
274 WatchdogHandler() function in your own code.
275
276eurotechwdt.c -- Eurotech CPU-1220/1410
277
278 The timeout can be set using the SETTIMEOUT ioctl and defaults
279 to 60 seconds.
280
281 Also has a module parameter "ev", event type which controls
282 what should happen on a timeout, the string "int" or anything
283 else that causes a reboot. [FIXME -- better description]
284
285 Supports CONFIG_WATCHDOG_NOWAYOUT
286
287 GETSUPPORT returns CARDRESET and WDIOF_SETTIMEOUT but
288 GETSTATUS is not supported and GETBOOTSTATUS just returns 0.
289
290i810-tco.c -- Intel 810 chipset
291
292 Also has support for a lot of other i8x0 stuff, but the
293 watchdog is one of the things.
294
295 The timeout is set using the module parameter "i810_margin",
296 which is in steps of 0.6 seconds where 2<i810_margin<64. The
297 driver supports the SETTIMEOUT ioctl.
298
299 Supports CONFIG_WATCHDOG_NOWAYOUT.
300
301 GETSUPPORT returns WDIOF_SETTIMEOUT. The GETSTATUS call
302 returns some kind of timer value which ist not compatible with
303 the other drivers. GETBOOT status returns some kind of
304 hardware specific boot status. [FIXME -- describe this]
305
306ib700wdt.c -- IB700 Single Board Computer
307
308 Default timeout of 30 seconds and the timeout is settable
309 using the SETTIMEOUT ioctl. Note that only a few timeout
310 values are supported.
311
312 Supports CONFIG_WATCHDOG_NOWAYOUT
313
314 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
315 The GETSTATUS call returns if the device is open or not.
316 [FIXME -- silliness again?]
317
318machzwd.c -- MachZ ZF-Logic
319
320 Hardcoded timeout of 10 seconds
321
322 Has a module parameter "action" that controls what happens
323 when the timeout runs out which can be 0 = RESET (default),
324 1 = SMI, 2 = NMI, 3 = SCI.
325
326 Supports CONFIG_WATCHDOG_NOWAYOUT and the magic character
327 'V' close handling.
328
329 GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call
330 returns if the device is open or not. [FIXME -- silliness
331 again?]
332
333mixcomwd.c -- MixCom Watchdog
334
335 [FIXME -- I'm unable to tell what the timeout is]
336
337 Supports CONFIG_WATCHDOG_NOWAYOUT
338
339 GETSUPPORT returns WDIOF_KEEPALIVEPING, GETSTATUS returns if
340 the device is opened or not [FIXME -- I'm not really sure how
341 this works, there seems to be some magic connected to
342 CONFIG_WATCHDOG_NOWAYOUT]
343
344pcwd.c -- Berkshire PC Watchdog
345
346 Hardcoded timeout of 1.5 seconds
347
348 Supports CONFIG_WATCHDOG_NOWAYOUT
349
350 GETSUPPORT returns WDIOF_OVERHEAT|WDIOF_CARDRESET and both
351 GETSTATUS and GETBOOTSTATUS return something useful.
352
353 The SETOPTIONS call can be used to enable and disable the card
354 and to ask the driver to call panic if the system overheats.
355
356sbc60xxwdt.c -- 60xx Single Board Computer
357
358 Hardcoded timeout of 10 seconds
359
360 Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic
361 character 'V' close handling.
362
363 No bits set in GETSUPPORT
364
365scx200.c -- National SCx200 CPUs
366
367 Not in the kernel yet.
368
369 The timeout is set using a module parameter "margin" which
370 defaults to 60 seconds. The timeout can also be set using
371 SETTIMEOUT and read using GETTIMEOUT.
372
373 Supports a module parameter "nowayout" that is initialized
374 with the value of CONFIG_WATCHDOG_NOWAYOUT. Also supports the
375 magic character 'V' handling.
376
377shwdt.c -- SuperH 3/4 processors
378
379 [FIXME -- I'm unable to tell what the timeout is]
380
381 Supports CONFIG_WATCHDOG_NOWAYOUT
382
383 GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call
384 returns if the device is open or not. [FIXME -- silliness
385 again?]
386
387softdog.c -- Software watchdog
388
389 The timeout is set with the module parameter "soft_margin"
390 which defaults to 60 seconds, the timeout is also settable
391 using the SETTIMEOUT ioctl.
392
393 Supports CONFIG_WATCHDOG_NOWAYOUT
394
395 WDIOF_SETTIMEOUT bit set in GETSUPPORT
396
397w83877f_wdt.c -- W83877F Computer
398
399 Hardcoded timeout of 30 seconds
400
401 Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic
402 character 'V' close handling.
403
404 No bits set in GETSUPPORT
405
406w83627hf_wdt.c -- w83627hf watchdog
407
408 Timeout that defaults to 60 seconds, supports SETTIMEOUT.
409
410 Supports CONFIG_WATCHDOG_NOWAYOUT
411
412 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
413 The GETSTATUS call returns if the device is open or not.
414
415wdt.c -- ICS WDT500/501 ISA and
416wdt_pci.c -- ICS WDT500/501 PCI
417
418 Default timeout of 60 seconds. The timeout is also settable
419 using the SETTIMEOUT ioctl.
420
421 Supports CONFIG_WATCHDOG_NOWAYOUT
422
423 GETSUPPORT returns with bits set depending on the actual
424 card. The WDT501 supports a lot of external monitoring, the
425 WDT500 much less.
426
427wdt285.c -- Footbridge watchdog
428
429 The timeout is set with the module parameter "soft_margin"
430 which defaults to 60 seconds. The timeout is also settable
431 using the SETTIMEOUT ioctl.
432
433 Does not support CONFIG_WATCHDOG_NOWAYOUT
434
435 WDIOF_SETTIMEOUT bit set in GETSUPPORT
436
437wdt977.c -- Netwinder W83977AF chip
438
439 Hardcoded timeout of 3 minutes
440
441 Supports CONFIG_WATCHDOG_NOWAYOUT
442
443 Does not support any ioctls at all.
444
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt
deleted file mode 100644
index 4b1ff69cc19a..000000000000
--- a/Documentation/watchdog/watchdog.txt
+++ /dev/null
@@ -1,94 +0,0 @@
1 Watchdog Timer Interfaces For The Linux Operating System
2
3 Alan Cox <alan@lxorguk.ukuu.org.uk>
4
5 Custom Linux Driver And Program Development
6
7
8The following watchdog drivers are currently implemented:
9
10 ICS WDT501-P
11 ICS WDT501-P (no fan tachometer)
12 ICS WDT500-P
13 Software Only
14 SA1100 Internal Watchdog
15 Berkshire Products PC Watchdog Revision A & C (by Ken Hollis)
16
17
18All six interfaces provide /dev/watchdog, which when open must be written
19to within a timeout or the machine will reboot. Each write delays the reboot
20time another timeout. In the case of the software watchdog the ability to
21reboot will depend on the state of the machines and interrupts. The hardware
22boards physically pull the machine down off their own onboard timers and
23will reboot from almost anything.
24
25A second temperature monitoring interface is available on the WDT501P cards
26and some Berkshire cards. This provides /dev/temperature. This is the machine
27internal temperature in degrees Fahrenheit. Each read returns a single byte
28giving the temperature.
29
30The third interface logs kernel messages on additional alert events.
31
32Both software and hardware watchdog drivers are available in the standard
33kernel. If you are using the software watchdog, you probably also want
34to use "panic=60" as a boot argument as well.
35
36The wdt card cannot be safely probed for. Instead you need to pass
37wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11".
38
39The SA1100 watchdog module can be configured with the "sa1100_margin"
40commandline argument which specifies timeout value in seconds.
41
42The i810 TCO watchdog modules can be configured with the "i810_margin"
43commandline argument which specifies the counter initial value. The counter
44is decremented every 0.6 seconds and default to 50 (30 seconds). Values can
45range between 3 and 63.
46
47The i810 TCO watchdog driver also implements the WDIOC_GETSTATUS and
48WDIOC_GETBOOTSTATUS ioctl()s. WDIOC_GETSTATUS returns the actual counter value
49and WDIOC_GETBOOTSTATUS returns the value of TCO2 Status Register (see Intel's
50documentation for the 82801AA and 82801AB datasheet).
51
52Features
53--------
54 WDT501P WDT500P Software Berkshire i810 TCO SA1100WD
55Reboot Timer X X X X X X
56External Reboot X X o o o X
57I/O Port Monitor o o o X o o
58Temperature X o o X o o
59Fan Speed X o o o o o
60Power Under X o o o o o
61Power Over X o o o o o
62Overheat X o o o o o
63
64The external event interfaces on the WDT boards are not currently supported.
65Minor numbers are however allocated for it.
66
67
68Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c
69
70
71Contact Information
72
73People keep asking about the WDT watchdog timer hardware: The phone contacts
74for Industrial Computer Source are:
75
76Industrial Computer Source
77http://www.indcompsrc.com
78ICS Advent, San Diego
796260 Sequence Dr.
80San Diego, CA 92121-4371
81Phone (858) 677-0877
82FAX: (858) 677-0895
83>
84ICS Advent Europe, UK
85Oving Road
86Chichester,
87West Sussex,
88PO19 4ET, UK
89Phone: 00.44.1243.533900
90
91
92and please mention Linux when enquiring.
93
94For full information about the PCWD cards see the pcwd-watchdog.txt document.
diff --git a/Documentation/watchdog/wdt.txt b/Documentation/watchdog/wdt.txt
new file mode 100644
index 000000000000..03fd756d976d
--- /dev/null
+++ b/Documentation/watchdog/wdt.txt
@@ -0,0 +1,43 @@
1Last Reviewed: 10/05/2007
2
3 WDT Watchdog Timer Interfaces For The Linux Operating System
4 Alan Cox <alan@lxorguk.ukuu.org.uk>
5
6 ICS WDT501-P
7 ICS WDT501-P (no fan tachometer)
8 ICS WDT500-P
9
10All the interfaces provide /dev/watchdog, which when open must be written
11to within a timeout or the machine will reboot. Each write delays the reboot
12time another timeout. In the case of the software watchdog the ability to
13reboot will depend on the state of the machines and interrupts. The hardware
14boards physically pull the machine down off their own onboard timers and
15will reboot from almost anything.
16
17A second temperature monitoring interface is available on the WDT501P cards
18This provides /dev/temperature. This is the machine internal temperature in
19degrees Fahrenheit. Each read returns a single byte giving the temperature.
20
21The third interface logs kernel messages on additional alert events.
22
23The wdt card cannot be safely probed for. Instead you need to pass
24wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11".
25
26Features
27--------
28 WDT501P WDT500P
29Reboot Timer X X
30External Reboot X X
31I/O Port Monitor o o
32Temperature X o
33Fan Speed X o
34Power Under X o
35Power Over X o
36Overheat X o
37
38The external event interfaces on the WDT boards are not currently supported.
39Minor numbers are however allocated for it.
40
41
42Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c
43
diff --git a/MAINTAINERS b/MAINTAINERS
index 124b9508ae2e..f3b5a391e074 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1487,6 +1487,13 @@ L: linux-usb-devel@lists.sourceforge.net
1487L: linuxppc-embedded@ozlabs.org 1487L: linuxppc-embedded@ozlabs.org
1488S: Maintained 1488S: Maintained
1489 1489
1490FREESCALE QUICC ENGINE UCC ETHERNET DRIVER
1491P: Li Yang
1492M: leoli@freescale.com
1493L: netdev@vger.kernel.org
1494L: linuxppc-embedded@ozlabs.org
1495S: Maintained
1496
1490FILE LOCKING (flock() and fcntl()/lockf()) 1497FILE LOCKING (flock() and fcntl()/lockf())
1491P: Matthew Wilcox 1498P: Matthew Wilcox
1492M: matthew@wil.cx 1499M: matthew@wil.cx
@@ -3545,7 +3552,7 @@ S: Maintained
3545 3552
3546TULIP NETWORK DRIVER 3553TULIP NETWORK DRIVER
3547P: Valerie Henson 3554P: Valerie Henson
3548M: val_henson@linux.intel.com 3555M: val@nmt.edu
3549L: tulip-users@lists.sourceforge.net 3556L: tulip-users@lists.sourceforge.net
3550W: http://sourceforge.net/projects/tulip/ 3557W: http://sourceforge.net/projects/tulip/
3551S: Maintained 3558S: Maintained
diff --git a/Makefile b/Makefile
index 562a90902cf6..30d685b629a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 22 3SUBLEVEL = 22
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Jeff Thinks I Should Change This, But To What? 5NAME = Jeff Thinks I Should Change This, But To What?
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 1cf466df330a..7202b98aac4f 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -734,10 +734,13 @@ void mtrr_ap_init(void)
734 */ 734 */
735void mtrr_save_state(void) 735void mtrr_save_state(void)
736{ 736{
737 if (smp_processor_id() == 0) 737 int cpu = get_cpu();
738
739 if (cpu == 0)
738 mtrr_save_fixed_ranges(NULL); 740 mtrr_save_fixed_ranges(NULL);
739 else 741 else
740 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1); 742 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
743 put_cpu();
741} 744}
742 745
743static int __init mtrr_init_finialize(void) 746static int __init mtrr_init_finialize(void)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0f09412e1b7f..9528ee90640a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -747,9 +747,9 @@ config EARLY_PRINTK
747 to print messages very early in the bootup process. 747 to print messages very early in the bootup process.
748 748
749 This is useful for kernel debugging when your machine crashes very 749 This is useful for kernel debugging when your machine crashes very
750 early before the console code is initialized. For normal operation 750 early before the console code is initialized. For normal operation,
751 it is not recommended because it looks on some machines ugly and 751 it is not recommended because it looks ugly on some machines and
752 oesn't cooperate with an X server. You should normally N here, 752 doesn't cooperate with an X server. You should normally say N here,
753 unless you want to debug such a crash. 753 unless you want to debug such a crash.
754 754
755config SYS_HAS_EARLY_PRINTK 755config SYS_HAS_EARLY_PRINTK
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index b29a44739230..2f060e1ed36c 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -115,30 +115,6 @@ extern void markeins_irq_setup(void);
115 115
116static void inline __init markeins_sio_setup(void) 116static void inline __init markeins_sio_setup(void)
117{ 117{
118#ifdef CONFIG_KGDB_8250
119 struct uart_port emma_port;
120
121 memset(&emma_port, 0, sizeof(emma_port));
122
123 emma_port.flags =
124 UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
125 emma_port.iotype = UPIO_MEM;
126 emma_port.regshift = 4; /* I/O addresses are every 8 bytes */
127 emma_port.uartclk = 18544000; /* Clock rate of the chip */
128
129 emma_port.line = 0;
130 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3);
131 emma_port.membase = (u8*)emma_port.mapbase;
132 early_serial_setup(&emma_port);
133
134 emma_port.line = 1;
135 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3);
136 emma_port.membase = (u8*)emma_port.mapbase;
137 early_serial_setup(&emma_port);
138
139 emma_port.irq = EMMA2RH_IRQ_PFUR1;
140 kgdb8250_add_port(1, &emma_port);
141#endif
142} 118}
143 119
144void __init plat_mem_setup(void) 120void __init plat_mem_setup(void)
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 37849edd0645..06e04da211d5 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -556,6 +556,16 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
556 flags); 556 flags);
557} 557}
558 558
559asmlinkage long sys32_fadvise64_64(int fd, int __pad,
560 unsigned long a2, unsigned long a3,
561 unsigned long a4, unsigned long a5,
562 int flags)
563{
564 return sys_fadvise64_64(fd,
565 merge_64(a2, a3), merge_64(a4, a5),
566 flags);
567}
568
559save_static_function(sys32_clone); 569save_static_function(sys32_clone);
560__attribute_used__ noinline static int 570__attribute_used__ noinline static int
561_sys32_clone(nabi_no_regargs struct pt_regs regs) 571_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index cc566cf12246..06729596812f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -174,7 +174,7 @@ LEAF(_init_fpu)
174 or t0, t1 174 or t0, t1
175 mtc0 t0, CP0_STATUS 175 mtc0 t0, CP0_STATUS
176#endif /* CONFIG_MIPS_MT_SMTC */ 176#endif /* CONFIG_MIPS_MT_SMTC */
177 fpu_enable_hazard 177 enable_fpu_hazard
178 178
179 li t1, FPU_DEFAULT 179 li t1, FPU_DEFAULT
180 ctc1 t1, fcr31 180 ctc1 t1, fcr31
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6eac28337423..1631035ffc24 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -299,7 +299,7 @@ EXPORT(sysn32_call_table)
299 PTR sys_ni_syscall /* res. for afs_syscall */ 299 PTR sys_ni_syscall /* res. for afs_syscall */
300 PTR sys_ni_syscall /* res. for security */ 300 PTR sys_ni_syscall /* res. for security */
301 PTR sys_gettid 301 PTR sys_gettid
302 PTR sys32_readahead 302 PTR sys_readahead
303 PTR sys_setxattr /* 6180 */ 303 PTR sys_setxattr /* 6180 */
304 PTR sys_lsetxattr 304 PTR sys_lsetxattr
305 PTR sys_fsetxattr 305 PTR sys_fsetxattr
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 7e74b412a782..2aa99426ac1c 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -459,7 +459,7 @@ sys_call_table:
459 PTR sys_remap_file_pages 459 PTR sys_remap_file_pages
460 PTR sys_set_tid_address 460 PTR sys_set_tid_address
461 PTR sys_restart_syscall 461 PTR sys_restart_syscall
462 PTR sys_fadvise64_64 462 PTR sys32_fadvise64_64
463 PTR compat_sys_statfs64 /* 4255 */ 463 PTR compat_sys_statfs64 /* 4255 */
464 PTR compat_sys_fstatfs64 464 PTR compat_sys_fstatfs64
465 PTR compat_sys_timer_create 465 PTR compat_sys_timer_create
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 200de027f354..3f58b6ac1358 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -927,12 +927,6 @@ asmlinkage void do_reserved(struct pt_regs *regs)
927 (regs->cp0_cause & 0x7f) >> 2); 927 (regs->cp0_cause & 0x7f) >> 2);
928} 928}
929 929
930static asmlinkage void do_default_vi(void)
931{
932 show_regs(get_irq_regs());
933 panic("Caught unexpected vectored interrupt.");
934}
935
936/* 930/*
937 * Some MIPS CPUs can enable/disable for cache parity detection, but do 931 * Some MIPS CPUs can enable/disable for cache parity detection, but do
938 * it different ways. 932 * it different ways.
@@ -1128,6 +1122,12 @@ void mips_srs_free(int set)
1128 clear_bit(set, &sr->sr_allocated); 1122 clear_bit(set, &sr->sr_allocated);
1129} 1123}
1130 1124
1125static asmlinkage void do_default_vi(void)
1126{
1127 show_regs(get_irq_regs());
1128 panic("Caught unexpected vectored interrupt.");
1129}
1130
1131static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) 1131static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1132{ 1132{
1133 unsigned long handler; 1133 unsigned long handler;
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 0c6b0ce15028..1cc6ebbedfdd 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -48,6 +48,8 @@ const char *get_system_type(void)
48 return "MIPS Atlas"; 48 return "MIPS Atlas";
49} 49}
50 50
51const char display_string[] = " LINUX ON ATLAS ";
52
51void __init plat_mem_setup(void) 53void __init plat_mem_setup(void)
52{ 54{
53 mips_pcibios_init(); 55 mips_pcibios_init();
diff --git a/arch/mips/mips-boards/generic/display.c b/arch/mips/mips-boards/generic/display.c
index 548dbe5ce7c8..5d600054090a 100644
--- a/arch/mips/mips-boards/generic/display.c
+++ b/arch/mips/mips-boards/generic/display.c
@@ -19,9 +19,14 @@
19 */ 19 */
20 20
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/timer.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/mips-boards/generic.h> 24#include <asm/mips-boards/generic.h>
24 25
26extern const char display_string[];
27static unsigned int display_count;
28static unsigned int max_display_count;
29
25void mips_display_message(const char *str) 30void mips_display_message(const char *str)
26{ 31{
27 static unsigned int __iomem *display = NULL; 32 static unsigned int __iomem *display = NULL;
@@ -37,3 +42,22 @@ void mips_display_message(const char *str)
37 writel(' ', display + i); 42 writel(' ', display + i);
38 } 43 }
39} 44}
45
46static void scroll_display_message(unsigned long data);
47static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
48
49static void scroll_display_message(unsigned long data)
50{
51 mips_display_message(&display_string[display_count++]);
52 if (display_count == max_display_count)
53 display_count = 0;
54
55 mod_timer(&mips_scroll_timer, jiffies + HZ);
56}
57
58void mips_scroll_message(void)
59{
60 del_timer_sync(&mips_scroll_timer);
61 max_display_count = strlen(display_string) + 1 - 8;
62 mod_timer(&mips_scroll_timer, jiffies + 1);
63}
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index df2a2bd3aa5d..37735bfc3afd 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -53,37 +53,11 @@
53 53
54unsigned long cpu_khz; 54unsigned long cpu_khz;
55 55
56#if defined(CONFIG_MIPS_ATLAS)
57static char display_string[] = " LINUX ON ATLAS ";
58#endif
59#if defined(CONFIG_MIPS_MALTA)
60#if defined(CONFIG_MIPS_MT_SMTC)
61static char display_string[] = " SMTC LINUX ON MALTA ";
62#else
63static char display_string[] = " LINUX ON MALTA ";
64#endif /* CONFIG_MIPS_MT_SMTC */
65#endif
66#if defined(CONFIG_MIPS_SEAD)
67static char display_string[] = " LINUX ON SEAD ";
68#endif
69static unsigned int display_count;
70#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
71
72#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR) 56#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
73 57
74static unsigned int timer_tick_count;
75static int mips_cpu_timer_irq; 58static int mips_cpu_timer_irq;
76extern void smtc_timer_broadcast(int); 59extern void smtc_timer_broadcast(int);
77 60
78static inline void scroll_display_message(void)
79{
80 if ((timer_tick_count++ % HZ) == 0) {
81 mips_display_message(&display_string[display_count++]);
82 if (display_count == MAX_DISPLAY_COUNT)
83 display_count = 0;
84 }
85}
86
87static void mips_timer_dispatch(void) 61static void mips_timer_dispatch(void)
88{ 62{
89 do_IRQ(mips_cpu_timer_irq); 63 do_IRQ(mips_cpu_timer_irq);
@@ -143,7 +117,6 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
143 if (cpu_data[cpu].vpe_id == 0) { 117 if (cpu_data[cpu].vpe_id == 0) {
144 timer_interrupt(irq, NULL); 118 timer_interrupt(irq, NULL);
145 smtc_timer_broadcast(cpu_data[cpu].vpe_id); 119 smtc_timer_broadcast(cpu_data[cpu].vpe_id);
146 scroll_display_message();
147 } else { 120 } else {
148 write_c0_compare(read_c0_count() + 121 write_c0_compare(read_c0_count() +
149 (mips_hpt_frequency/HZ)); 122 (mips_hpt_frequency/HZ));
@@ -167,8 +140,6 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
167 /* we keep interrupt disabled all the time */ 140 /* we keep interrupt disabled all the time */
168 if (!r2 || (read_c0_cause() & (1 << 30))) 141 if (!r2 || (read_c0_cause() & (1 << 30)))
169 timer_interrupt(irq, NULL); 142 timer_interrupt(irq, NULL);
170
171 scroll_display_message();
172 } else { 143 } else {
173 /* Everyone else needs to reset the timer int here as 144 /* Everyone else needs to reset the timer int here as
174 ll_local_timer_interrupt doesn't */ 145 ll_local_timer_interrupt doesn't */
@@ -262,6 +233,8 @@ void __init mips_time_init(void)
262 (est_freq%1000000)*100/1000000); 233 (est_freq%1000000)*100/1000000);
263 234
264 cpu_khz = est_freq / 1000; 235 cpu_khz = est_freq / 1000;
236
237 mips_scroll_message();
265} 238}
266 239
267void __init plat_timer_setup(struct irqaction *irq) 240void __init plat_timer_setup(struct irqaction *irq)
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 7873932532a1..c14b7bf89950 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -56,6 +56,12 @@ const char *get_system_type(void)
56 return "MIPS Malta"; 56 return "MIPS Malta";
57} 57}
58 58
59#if defined(CONFIG_MIPS_MT_SMTC)
60const char display_string[] = " SMTC LINUX ON MALTA ";
61#else
62const char display_string[] = " LINUX ON MALTA ";
63#endif /* CONFIG_MIPS_MT_SMTC */
64
59#ifdef CONFIG_BLK_DEV_FD 65#ifdef CONFIG_BLK_DEV_FD
60void __init fd_activate(void) 66void __init fd_activate(void)
61{ 67{
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index a189dec7c7bc..811aba100605 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -43,6 +43,8 @@ const char *get_system_type(void)
43 return "MIPS SEAD"; 43 return "MIPS SEAD";
44} 44}
45 45
46const char display_string[] = " LINUX ON SEAD ";
47
46void __init plat_mem_setup(void) 48void __init plat_mem_setup(void)
47{ 49{
48 ioport_resource.end = 0x7fffffff; 50 ioport_resource.end = 0x7fffffff;
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index f0eb29917d9a..76903c727647 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -168,8 +168,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
168 addr = (unsigned long) page_address(sg->page); 168 addr = (unsigned long) page_address(sg->page);
169 if (!plat_device_is_coherent(dev) && addr) 169 if (!plat_device_is_coherent(dev) && addr)
170 __dma_sync(addr + sg->offset, sg->length, direction); 170 __dma_sync(addr + sg->offset, sg->length, direction);
171 sg->dma_address = plat_map_dma_mem_page(dev, sg->page) + 171 sg->dma_address = plat_map_dma_mem(dev,
172 sg->offset; 172 (void *)(addr + sg->offset),
173 sg->length);
173 } 174 }
174 175
175 return nents; 176 return nents;
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
index f5ea2fe10f14..89891e984b3b 100644
--- a/arch/mips/qemu/q-irq.c
+++ b/arch/mips/qemu/q-irq.c
@@ -7,8 +7,6 @@
7#include <asm/system.h> 7#include <asm/system.h>
8#include <asm/time.h> 8#include <asm/time.h>
9 9
10extern asmlinkage void qemu_handle_int(void);
11
12asmlinkage void plat_irq_dispatch(void) 10asmlinkage void plat_irq_dispatch(void)
13{ 11{
14 unsigned int pending = read_c0_status() & read_c0_cause(); 12 unsigned int pending = read_c0_status() & read_c0_cause();
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 9ee208daa8b1..97b234361b4d 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -6,7 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
@@ -131,6 +131,19 @@ static struct resource pcimt_io_resources[] = {
131 } 131 }
132}; 132};
133 133
134static struct resource pcimt_mem_resources[] = {
135 {
136 /*
137 * this region should only be 4 bytes long,
138 * but it's 16MB on all RM300C I've checked
139 */
140 .start = 0x1a000000,
141 .end = 0x1affffff,
142 .name = "PCI INT ACK",
143 .flags = IORESOURCE_BUSY
144 }
145};
146
134static struct resource sni_mem_resource = { 147static struct resource sni_mem_resource = {
135 .start = 0x18000000UL, 148 .start = 0x18000000UL,
136 .end = 0x1fbfffffUL, 149 .end = 0x1fbfffffUL,
@@ -145,6 +158,9 @@ static void __init sni_pcimt_resource_init(void)
145 /* request I/O space for devices used on all i[345]86 PCs */ 158 /* request I/O space for devices used on all i[345]86 PCs */
146 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++) 159 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
147 request_resource(&sni_io_resource, pcimt_io_resources + i); 160 request_resource(&sni_io_resource, pcimt_io_resources + i);
161 /* request MEM space for devices used on all i[345]86 PCs */
162 for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
163 request_resource(&sni_mem_resource, pcimt_mem_resources + i);
148} 164}
149 165
150extern struct pci_ops sni_pcimt_ops; 166extern struct pci_ops sni_pcimt_ops;
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 68d7cf609b4f..4fedfbda0c79 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -6,7 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11#include <linux/eisa.h> 11#include <linux/eisa.h>
12#include <linux/init.h> 12#include <linux/init.h>
@@ -92,3 +92,34 @@ void __init plat_mem_setup(void)
92 92
93 sni_display_setup(); 93 sni_display_setup();
94} 94}
95
96#if CONFIG_PCI
97
98#include <linux/pci.h>
99#include <video/vga.h>
100#include <video/cirrus.h>
101
102static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev)
103{
104 u16 cmd;
105
106 /*
107 * firmware doesn't set the ram size correct, so we
108 * need to do it here, otherwise we get screen corruption
109 * on older Cirrus chips
110 */
111 pci_read_config_word (dev, PCI_COMMAND, &cmd);
112 if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY))
113 == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) {
114 vga_wseq (NULL, CL_SEQR6, 0x12); /* unlock all extension registers */
115 vga_wseq (NULL, CL_SEQRF, 0x18);
116 }
117}
118
119DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8,
120 quirk_cirrus_ram_size);
121DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436,
122 quirk_cirrus_ram_size);
123DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
124 quirk_cirrus_ram_size);
125#endif
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6238b5875fd1..fbafd965dcd2 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -142,7 +142,6 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
142 142
143# Default to zImage, override when needed 143# Default to zImage, override when needed
144defaultimage-y := zImage 144defaultimage-y := zImage
145defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
146defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage 145defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage
147KBUILD_IMAGE := $(defaultimage-y) 146KBUILD_IMAGE := $(defaultimage-y)
148all: $(KBUILD_IMAGE) 147all: $(KBUILD_IMAGE)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 83788986b93b..ff2701949ee1 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -11,20 +11,18 @@
11# bootloader and increase compatibility with OpenFirmware. 11# bootloader and increase compatibility with OpenFirmware.
12# 12#
13# To this end we need to define BOOTCC, etc, as the tools 13# To this end we need to define BOOTCC, etc, as the tools
14# needed to build the 32 bit image. These are normally HOSTCC, 14# needed to build the 32 bit image. That's normally the same
15# but may be a third compiler if, for example, you are cross 15# compiler for the rest of the kernel, with the -m32 flag added.
16# compiling from an intel box. Once the 64bit ppc gcc is
17# stable it will probably simply be a compiler switch to
18# compile for 32bit mode.
19# To make it easier to setup a cross compiler, 16# To make it easier to setup a cross compiler,
20# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 17# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
21# in the toplevel makefile. 18# in the toplevel makefile.
22 19
23all: $(obj)/zImage 20all: $(obj)/zImage
24 21
25HOSTCC := gcc 22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
26BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ 23 -fno-strict-aliasing -Os -msoft-float -pipe \
27 $(shell $(CROSS32CC) -print-file-name=include) -fPIC 24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25 -isystem $(shell $(CROSS32CC) -print-file-name=include)
28BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
29 27
30ifeq ($(call cc-option-yn, -fstack-protector),y) 28ifeq ($(call cc-option-yn, -fstack-protector),y)
@@ -33,8 +31,8 @@ endif
33 31
34BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 32BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
35 33
36$(obj)/44x.o: BOOTCFLAGS += -Wa,-mbooke 34$(obj)/44x.o: BOOTCFLAGS += -mcpu=440
37$(obj)/ebony.o: BOOTCFLAGS += -Wa,-mbooke 35$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
38 36
39zlib := inffast.c inflate.c inftrees.c 37zlib := inffast.c inflate.c inftrees.c
40zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 38zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
@@ -136,6 +134,7 @@ image-$(CONFIG_PPC_EFIKA) += zImage.chrp
136image-$(CONFIG_PPC_PMAC) += zImage.pmac 134image-$(CONFIG_PPC_PMAC) += zImage.pmac
137image-$(CONFIG_PPC_HOLLY) += zImage.holly-elf 135image-$(CONFIG_PPC_HOLLY) += zImage.holly-elf
138image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800 136image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800
137image-$(CONFIG_PPC_ISERIES) += zImage.iseries
139image-$(CONFIG_DEFAULT_UIMAGE) += uImage 138image-$(CONFIG_DEFAULT_UIMAGE) += uImage
140 139
141ifneq ($(CONFIG_DEVICE_TREE),"") 140ifneq ($(CONFIG_DEVICE_TREE),"")
@@ -185,6 +184,9 @@ $(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
185$(obj)/zImage.%: vmlinux $(wrapperbits) 184$(obj)/zImage.%: vmlinux $(wrapperbits)
186 $(call if_changed,wrap,$*) 185 $(call if_changed,wrap,$*)
187 186
187$(obj)/zImage.iseries: vmlinux
188 $(STRIP) -s -R .comment $< -o $@
189
188$(obj)/zImage.ps3: vmlinux 190$(obj)/zImage.ps3: vmlinux
189 $(STRIP) -s -R .comment $< -o $@ 191 $(STRIP) -s -R .comment $< -o $@
190 192
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 5a4215c4b014..f1c4dfc635be 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -13,6 +13,7 @@
13 13
14 .text 14 .text
15 /* a procedure descriptor used when booting this as a COFF file */ 15 /* a procedure descriptor used when booting this as a COFF file */
16 .globl _zimage_start_opd
16_zimage_start_opd: 17_zimage_start_opd:
17 .long _zimage_start, 0, 0, 0 18 .long _zimage_start, 0, 0, 0
18 19
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 2ed8b8b3f0ec..da77adc73078 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -129,7 +129,7 @@ case "$platform" in
129pmac|pseries|chrp) 129pmac|pseries|chrp)
130 platformo=$object/of.o 130 platformo=$object/of.o
131 ;; 131 ;;
132pmaccoff) 132coff)
133 platformo=$object/of.o 133 platformo=$object/of.o
134 lds=$object/zImage.coff.lds 134 lds=$object/zImage.coff.lds
135 ;; 135 ;;
@@ -220,7 +220,7 @@ case "$platform" in
220pseries|chrp) 220pseries|chrp)
221 $object/addnote "$ofile" 221 $object/addnote "$ofile"
222 ;; 222 ;;
223pmaccoff) 223coff)
224 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" 224 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
225 $object/hack-coff "$ofile" 225 $object/hack-coff "$ofile"
226 ;; 226 ;;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 068377a2a8dc..42c8ed6ed528 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -489,7 +489,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type,
489 case IRQ_HOST_MAP_LINEAR: 489 case IRQ_HOST_MAP_LINEAR:
490 rmap = (unsigned int *)(host + 1); 490 rmap = (unsigned int *)(host + 1);
491 for (i = 0; i < revmap_arg; i++) 491 for (i = 0; i < revmap_arg; i++)
492 rmap[i] = IRQ_NONE; 492 rmap[i] = NO_IRQ;
493 host->revmap_data.linear.size = revmap_arg; 493 host->revmap_data.linear.size = revmap_arg;
494 smp_wmb(); 494 smp_wmb();
495 host->revmap_data.linear.revmap = rmap; 495 host->revmap_data.linear.revmap = rmap;
@@ -614,7 +614,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
614 * host->ops->map() to update the flags 614 * host->ops->map() to update the flags
615 */ 615 */
616 virq = irq_find_mapping(host, hwirq); 616 virq = irq_find_mapping(host, hwirq);
617 if (virq != IRQ_NONE) { 617 if (virq != NO_IRQ) {
618 if (host->ops->remap) 618 if (host->ops->remap)
619 host->ops->remap(host, virq, hwirq); 619 host->ops->remap(host, virq, hwirq);
620 pr_debug("irq: -> existing mapping on virq %d\n", virq); 620 pr_debug("irq: -> existing mapping on virq %d\n", virq);
@@ -741,7 +741,7 @@ void irq_dispose_mapping(unsigned int virq)
741 switch(host->revmap_type) { 741 switch(host->revmap_type) {
742 case IRQ_HOST_MAP_LINEAR: 742 case IRQ_HOST_MAP_LINEAR:
743 if (hwirq < host->revmap_data.linear.size) 743 if (hwirq < host->revmap_data.linear.size)
744 host->revmap_data.linear.revmap[hwirq] = IRQ_NONE; 744 host->revmap_data.linear.revmap[hwirq] = NO_IRQ;
745 break; 745 break;
746 case IRQ_HOST_MAP_TREE: 746 case IRQ_HOST_MAP_TREE:
747 /* Check if radix tree allocated yet */ 747 /* Check if radix tree allocated yet */
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index d501c23e5159..d454f61c9c7c 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -433,7 +433,7 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
433 * Note also that we don't do ISA, this will also be fixed with a 433 * Note also that we don't do ISA, this will also be fixed with a
434 * more massive rework. 434 * more massive rework.
435 */ 435 */
436 pci_setup_phb_io(phb, 0); 436 pci_setup_phb_io(phb, pci_io_base == 0);
437 437
438 /* Init pci_dn data structures */ 438 /* Init pci_dn data structures */
439 pci_devs_phb_init_dynamic(phb); 439 pci_devs_phb_init_dynamic(phb);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 066a6a7a25b8..af42ddab3ab4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1171,11 +1171,12 @@ EXPORT_SYMBOL(of_find_node_by_name);
1171 1171
1172/** 1172/**
1173 * of_find_node_by_type - Find a node by its "device_type" property 1173 * of_find_node_by_type - Find a node by its "device_type" property
1174 * @from: The node to start searching from or NULL, the node 1174 * @from: The node to start searching from, or NULL to start searching
1175 * you pass will not be searched, only the next one 1175 * the entire device tree. The node you pass will not be
1176 * will; typically, you pass what the previous call 1176 * searched, only the next one will; typically, you pass
1177 * returned. of_node_put() will be called on it 1177 * what the previous call returned. of_node_put() will be
1178 * @name: The type string to match against 1178 * called on from for you.
1179 * @type: The type string to match against
1179 * 1180 *
1180 * Returns a node pointer with refcount incremented, use 1181 * Returns a node pointer with refcount incremented, use
1181 * of_node_put() on it when done. 1182 * of_node_put() on it when done.
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f4f391cdd8f5..bf76562167c3 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -218,6 +218,7 @@ set_single_step(struct task_struct *task)
218 regs->msr |= MSR_SE; 218 regs->msr |= MSR_SE;
219#endif 219#endif
220 } 220 }
221 set_tsk_thread_flag(task, TIF_SINGLESTEP);
221} 222}
222 223
223static inline void 224static inline void
@@ -233,6 +234,7 @@ clear_single_step(struct task_struct *task)
233 regs->msr &= ~MSR_SE; 234 regs->msr &= ~MSR_SE;
234#endif 235#endif
235 } 236 }
237 clear_tsk_thread_flag(task, TIF_SINGLESTEP);
236} 238}
237#endif /* CONFIG_PPC32 */ 239#endif /* CONFIG_PPC32 */
238 240
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index f9ac3fe3be97..ac445998d831 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -67,6 +67,7 @@ static u64 MIC_Slow_Next_Timer_table[] = {
67 0x00003FC000000000ull, 67 0x00003FC000000000ull,
68}; 68};
69 69
70static unsigned int pmi_frequency_limit = 0;
70/* 71/*
71 * hardware specific functions 72 * hardware specific functions
72 */ 73 */
@@ -164,7 +165,6 @@ static int set_pmode(int cpu, unsigned int slow_mode) {
164 165
165static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) 166static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
166{ 167{
167 struct cpufreq_policy policy;
168 u8 cpu; 168 u8 cpu;
169 u8 cbe_pmode_new; 169 u8 cbe_pmode_new;
170 170
@@ -173,15 +173,27 @@ static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
173 cpu = cbe_node_to_cpu(pmi_msg.data1); 173 cpu = cbe_node_to_cpu(pmi_msg.data1);
174 cbe_pmode_new = pmi_msg.data2; 174 cbe_pmode_new = pmi_msg.data2;
175 175
176 cpufreq_get_policy(&policy, cpu); 176 pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency;
177 177
178 policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency); 178 pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit);
179 policy.min = min(policy.min, policy.max); 179}
180
181static int pmi_notifier(struct notifier_block *nb,
182 unsigned long event, void *data)
183{
184 struct cpufreq_policy *policy = data;
180 185
181 pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max); 186 if (event != CPUFREQ_INCOMPATIBLE)
182 cpufreq_set_policy(&policy); 187 return 0;
188
189 cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit);
190 return 0;
183} 191}
184 192
193static struct notifier_block pmi_notifier_block = {
194 .notifier_call = pmi_notifier,
195};
196
185static struct pmi_handler cbe_pmi_handler = { 197static struct pmi_handler cbe_pmi_handler = {
186 .type = PMI_TYPE_FREQ_CHANGE, 198 .type = PMI_TYPE_FREQ_CHANGE,
187 .handle_pmi_message = cbe_cpufreq_handle_pmi, 199 .handle_pmi_message = cbe_cpufreq_handle_pmi,
@@ -238,12 +250,21 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
238 250
239 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); 251 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
240 252
253 if (pmi_dev) {
254 /* frequency might get limited later, initialize limit with max_freq */
255 pmi_frequency_limit = max_freq;
256 cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
257 }
258
241 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ 259 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
242 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); 260 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
243} 261}
244 262
245static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) 263static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
246{ 264{
265 if (pmi_dev)
266 cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
267
247 cpufreq_frequency_table_put_attr(policy->cpu); 268 cpufreq_frequency_table_put_attr(policy->cpu);
248 return 0; 269 return 0;
249} 270}
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 8654749e317b..7c51cb54bca1 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -39,7 +39,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
39 if (spu_init_csa(&ctx->csa)) 39 if (spu_init_csa(&ctx->csa))
40 goto out_free; 40 goto out_free;
41 spin_lock_init(&ctx->mmio_lock); 41 spin_lock_init(&ctx->mmio_lock);
42 spin_lock_init(&ctx->mapping_lock); 42 mutex_init(&ctx->mapping_lock);
43 kref_init(&ctx->kref); 43 kref_init(&ctx->kref);
44 mutex_init(&ctx->state_mutex); 44 mutex_init(&ctx->state_mutex);
45 mutex_init(&ctx->run_mutex); 45 mutex_init(&ctx->run_mutex);
@@ -103,6 +103,7 @@ void spu_forget(struct spu_context *ctx)
103 103
104void spu_unmap_mappings(struct spu_context *ctx) 104void spu_unmap_mappings(struct spu_context *ctx)
105{ 105{
106 mutex_lock(&ctx->mapping_lock);
106 if (ctx->local_store) 107 if (ctx->local_store)
107 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); 108 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
108 if (ctx->mfc) 109 if (ctx->mfc)
@@ -117,6 +118,7 @@ void spu_unmap_mappings(struct spu_context *ctx)
117 unmap_mapping_range(ctx->mss, 0, 0x1000, 1); 118 unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
118 if (ctx->psmap) 119 if (ctx->psmap)
119 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1); 120 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
121 mutex_unlock(&ctx->mapping_lock);
120} 122}
121 123
122/** 124/**
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 45614c73c784..b1e7e2f8a2e9 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -45,11 +45,11 @@ spufs_mem_open(struct inode *inode, struct file *file)
45 struct spufs_inode_info *i = SPUFS_I(inode); 45 struct spufs_inode_info *i = SPUFS_I(inode);
46 struct spu_context *ctx = i->i_ctx; 46 struct spu_context *ctx = i->i_ctx;
47 47
48 spin_lock(&ctx->mapping_lock); 48 mutex_lock(&ctx->mapping_lock);
49 file->private_data = ctx; 49 file->private_data = ctx;
50 if (!i->i_openers++) 50 if (!i->i_openers++)
51 ctx->local_store = inode->i_mapping; 51 ctx->local_store = inode->i_mapping;
52 spin_unlock(&ctx->mapping_lock); 52 mutex_unlock(&ctx->mapping_lock);
53 return 0; 53 return 0;
54} 54}
55 55
@@ -59,10 +59,10 @@ spufs_mem_release(struct inode *inode, struct file *file)
59 struct spufs_inode_info *i = SPUFS_I(inode); 59 struct spufs_inode_info *i = SPUFS_I(inode);
60 struct spu_context *ctx = i->i_ctx; 60 struct spu_context *ctx = i->i_ctx;
61 61
62 spin_lock(&ctx->mapping_lock); 62 mutex_lock(&ctx->mapping_lock);
63 if (!--i->i_openers) 63 if (!--i->i_openers)
64 ctx->local_store = NULL; 64 ctx->local_store = NULL;
65 spin_unlock(&ctx->mapping_lock); 65 mutex_unlock(&ctx->mapping_lock);
66 return 0; 66 return 0;
67} 67}
68 68
@@ -217,6 +217,7 @@ unsigned long spufs_get_unmapped_area(struct file *file, unsigned long addr,
217 217
218static const struct file_operations spufs_mem_fops = { 218static const struct file_operations spufs_mem_fops = {
219 .open = spufs_mem_open, 219 .open = spufs_mem_open,
220 .release = spufs_mem_release,
220 .read = spufs_mem_read, 221 .read = spufs_mem_read,
221 .write = spufs_mem_write, 222 .write = spufs_mem_write,
222 .llseek = generic_file_llseek, 223 .llseek = generic_file_llseek,
@@ -309,11 +310,11 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
309 struct spufs_inode_info *i = SPUFS_I(inode); 310 struct spufs_inode_info *i = SPUFS_I(inode);
310 struct spu_context *ctx = i->i_ctx; 311 struct spu_context *ctx = i->i_ctx;
311 312
312 spin_lock(&ctx->mapping_lock); 313 mutex_lock(&ctx->mapping_lock);
313 file->private_data = ctx; 314 file->private_data = ctx;
314 if (!i->i_openers++) 315 if (!i->i_openers++)
315 ctx->cntl = inode->i_mapping; 316 ctx->cntl = inode->i_mapping;
316 spin_unlock(&ctx->mapping_lock); 317 mutex_unlock(&ctx->mapping_lock);
317 return simple_attr_open(inode, file, spufs_cntl_get, 318 return simple_attr_open(inode, file, spufs_cntl_get,
318 spufs_cntl_set, "0x%08lx"); 319 spufs_cntl_set, "0x%08lx");
319} 320}
@@ -326,10 +327,10 @@ spufs_cntl_release(struct inode *inode, struct file *file)
326 327
327 simple_attr_close(inode, file); 328 simple_attr_close(inode, file);
328 329
329 spin_lock(&ctx->mapping_lock); 330 mutex_lock(&ctx->mapping_lock);
330 if (!--i->i_openers) 331 if (!--i->i_openers)
331 ctx->cntl = NULL; 332 ctx->cntl = NULL;
332 spin_unlock(&ctx->mapping_lock); 333 mutex_unlock(&ctx->mapping_lock);
333 return 0; 334 return 0;
334} 335}
335 336
@@ -812,11 +813,11 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
812 struct spufs_inode_info *i = SPUFS_I(inode); 813 struct spufs_inode_info *i = SPUFS_I(inode);
813 struct spu_context *ctx = i->i_ctx; 814 struct spu_context *ctx = i->i_ctx;
814 815
815 spin_lock(&ctx->mapping_lock); 816 mutex_lock(&ctx->mapping_lock);
816 file->private_data = ctx; 817 file->private_data = ctx;
817 if (!i->i_openers++) 818 if (!i->i_openers++)
818 ctx->signal1 = inode->i_mapping; 819 ctx->signal1 = inode->i_mapping;
819 spin_unlock(&ctx->mapping_lock); 820 mutex_unlock(&ctx->mapping_lock);
820 return nonseekable_open(inode, file); 821 return nonseekable_open(inode, file);
821} 822}
822 823
@@ -826,10 +827,10 @@ spufs_signal1_release(struct inode *inode, struct file *file)
826 struct spufs_inode_info *i = SPUFS_I(inode); 827 struct spufs_inode_info *i = SPUFS_I(inode);
827 struct spu_context *ctx = i->i_ctx; 828 struct spu_context *ctx = i->i_ctx;
828 829
829 spin_lock(&ctx->mapping_lock); 830 mutex_lock(&ctx->mapping_lock);
830 if (!--i->i_openers) 831 if (!--i->i_openers)
831 ctx->signal1 = NULL; 832 ctx->signal1 = NULL;
832 spin_unlock(&ctx->mapping_lock); 833 mutex_unlock(&ctx->mapping_lock);
833 return 0; 834 return 0;
834} 835}
835 836
@@ -936,11 +937,11 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
936 struct spufs_inode_info *i = SPUFS_I(inode); 937 struct spufs_inode_info *i = SPUFS_I(inode);
937 struct spu_context *ctx = i->i_ctx; 938 struct spu_context *ctx = i->i_ctx;
938 939
939 spin_lock(&ctx->mapping_lock); 940 mutex_lock(&ctx->mapping_lock);
940 file->private_data = ctx; 941 file->private_data = ctx;
941 if (!i->i_openers++) 942 if (!i->i_openers++)
942 ctx->signal2 = inode->i_mapping; 943 ctx->signal2 = inode->i_mapping;
943 spin_unlock(&ctx->mapping_lock); 944 mutex_unlock(&ctx->mapping_lock);
944 return nonseekable_open(inode, file); 945 return nonseekable_open(inode, file);
945} 946}
946 947
@@ -950,10 +951,10 @@ spufs_signal2_release(struct inode *inode, struct file *file)
950 struct spufs_inode_info *i = SPUFS_I(inode); 951 struct spufs_inode_info *i = SPUFS_I(inode);
951 struct spu_context *ctx = i->i_ctx; 952 struct spu_context *ctx = i->i_ctx;
952 953
953 spin_lock(&ctx->mapping_lock); 954 mutex_lock(&ctx->mapping_lock);
954 if (!--i->i_openers) 955 if (!--i->i_openers)
955 ctx->signal2 = NULL; 956 ctx->signal2 = NULL;
956 spin_unlock(&ctx->mapping_lock); 957 mutex_unlock(&ctx->mapping_lock);
957 return 0; 958 return 0;
958} 959}
959 960
@@ -1154,10 +1155,10 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
1154 1155
1155 file->private_data = i->i_ctx; 1156 file->private_data = i->i_ctx;
1156 1157
1157 spin_lock(&ctx->mapping_lock); 1158 mutex_lock(&ctx->mapping_lock);
1158 if (!i->i_openers++) 1159 if (!i->i_openers++)
1159 ctx->mss = inode->i_mapping; 1160 ctx->mss = inode->i_mapping;
1160 spin_unlock(&ctx->mapping_lock); 1161 mutex_unlock(&ctx->mapping_lock);
1161 return nonseekable_open(inode, file); 1162 return nonseekable_open(inode, file);
1162} 1163}
1163 1164
@@ -1167,10 +1168,10 @@ spufs_mss_release(struct inode *inode, struct file *file)
1167 struct spufs_inode_info *i = SPUFS_I(inode); 1168 struct spufs_inode_info *i = SPUFS_I(inode);
1168 struct spu_context *ctx = i->i_ctx; 1169 struct spu_context *ctx = i->i_ctx;
1169 1170
1170 spin_lock(&ctx->mapping_lock); 1171 mutex_lock(&ctx->mapping_lock);
1171 if (!--i->i_openers) 1172 if (!--i->i_openers)
1172 ctx->mss = NULL; 1173 ctx->mss = NULL;
1173 spin_unlock(&ctx->mapping_lock); 1174 mutex_unlock(&ctx->mapping_lock);
1174 return 0; 1175 return 0;
1175} 1176}
1176 1177
@@ -1211,11 +1212,11 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
1211 struct spufs_inode_info *i = SPUFS_I(inode); 1212 struct spufs_inode_info *i = SPUFS_I(inode);
1212 struct spu_context *ctx = i->i_ctx; 1213 struct spu_context *ctx = i->i_ctx;
1213 1214
1214 spin_lock(&ctx->mapping_lock); 1215 mutex_lock(&ctx->mapping_lock);
1215 file->private_data = i->i_ctx; 1216 file->private_data = i->i_ctx;
1216 if (!i->i_openers++) 1217 if (!i->i_openers++)
1217 ctx->psmap = inode->i_mapping; 1218 ctx->psmap = inode->i_mapping;
1218 spin_unlock(&ctx->mapping_lock); 1219 mutex_unlock(&ctx->mapping_lock);
1219 return nonseekable_open(inode, file); 1220 return nonseekable_open(inode, file);
1220} 1221}
1221 1222
@@ -1225,10 +1226,10 @@ spufs_psmap_release(struct inode *inode, struct file *file)
1225 struct spufs_inode_info *i = SPUFS_I(inode); 1226 struct spufs_inode_info *i = SPUFS_I(inode);
1226 struct spu_context *ctx = i->i_ctx; 1227 struct spu_context *ctx = i->i_ctx;
1227 1228
1228 spin_lock(&ctx->mapping_lock); 1229 mutex_lock(&ctx->mapping_lock);
1229 if (!--i->i_openers) 1230 if (!--i->i_openers)
1230 ctx->psmap = NULL; 1231 ctx->psmap = NULL;
1231 spin_unlock(&ctx->mapping_lock); 1232 mutex_unlock(&ctx->mapping_lock);
1232 return 0; 1233 return 0;
1233} 1234}
1234 1235
@@ -1281,11 +1282,11 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
1281 if (atomic_read(&inode->i_count) != 1) 1282 if (atomic_read(&inode->i_count) != 1)
1282 return -EBUSY; 1283 return -EBUSY;
1283 1284
1284 spin_lock(&ctx->mapping_lock); 1285 mutex_lock(&ctx->mapping_lock);
1285 file->private_data = ctx; 1286 file->private_data = ctx;
1286 if (!i->i_openers++) 1287 if (!i->i_openers++)
1287 ctx->mfc = inode->i_mapping; 1288 ctx->mfc = inode->i_mapping;
1288 spin_unlock(&ctx->mapping_lock); 1289 mutex_unlock(&ctx->mapping_lock);
1289 return nonseekable_open(inode, file); 1290 return nonseekable_open(inode, file);
1290} 1291}
1291 1292
@@ -1295,10 +1296,10 @@ spufs_mfc_release(struct inode *inode, struct file *file)
1295 struct spufs_inode_info *i = SPUFS_I(inode); 1296 struct spufs_inode_info *i = SPUFS_I(inode);
1296 struct spu_context *ctx = i->i_ctx; 1297 struct spu_context *ctx = i->i_ctx;
1297 1298
1298 spin_lock(&ctx->mapping_lock); 1299 mutex_lock(&ctx->mapping_lock);
1299 if (!--i->i_openers) 1300 if (!--i->i_openers)
1300 ctx->mfc = NULL; 1301 ctx->mfc = NULL;
1301 spin_unlock(&ctx->mapping_lock); 1302 mutex_unlock(&ctx->mapping_lock);
1302 return 0; 1303 return 0;
1303} 1304}
1304 1305
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 7150730e2ff1..9807206e0219 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -177,7 +177,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
177static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files, 177static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
178 int mode, struct spu_context *ctx) 178 int mode, struct spu_context *ctx)
179{ 179{
180 struct dentry *dentry; 180 struct dentry *dentry, *tmp;
181 int ret; 181 int ret;
182 182
183 while (files->name && files->name[0]) { 183 while (files->name && files->name[0]) {
@@ -193,7 +193,20 @@ static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
193 } 193 }
194 return 0; 194 return 0;
195out: 195out:
196 spufs_prune_dir(dir); 196 /*
197 * remove all children from dir. dir->inode is not set so don't
198 * just simply use spufs_prune_dir() and panic afterwards :)
199 * dput() looks like it will do the right thing:
200 * - dec parent's ref counter
201 * - remove child from parent's child list
202 * - free child's inode if possible
203 * - free child
204 */
205 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
206 dput(dentry);
207 }
208
209 shrink_dcache_parent(dir);
197 return ret; 210 return ret;
198} 211}
199 212
@@ -274,6 +287,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
274 goto out; 287 goto out;
275 288
276out_free_ctx: 289out_free_ctx:
290 spu_forget(ctx);
277 put_spu_context(ctx); 291 put_spu_context(ctx);
278out_iput: 292out_iput:
279 iput(inode); 293 iput(inode);
@@ -349,37 +363,6 @@ out:
349 return ret; 363 return ret;
350} 364}
351 365
352static int spufs_rmgang(struct inode *root, struct dentry *dir)
353{
354 /* FIXME: this fails if the dir is not empty,
355 which causes a leak of gangs. */
356 return simple_rmdir(root, dir);
357}
358
359static int spufs_gang_close(struct inode *inode, struct file *file)
360{
361 struct inode *parent;
362 struct dentry *dir;
363 int ret;
364
365 dir = file->f_path.dentry;
366 parent = dir->d_parent->d_inode;
367
368 ret = spufs_rmgang(parent, dir);
369 WARN_ON(ret);
370
371 return dcache_dir_close(inode, file);
372}
373
374const struct file_operations spufs_gang_fops = {
375 .open = dcache_dir_open,
376 .release = spufs_gang_close,
377 .llseek = dcache_dir_lseek,
378 .read = generic_read_dir,
379 .readdir = dcache_readdir,
380 .fsync = simple_sync_file,
381};
382
383static int 366static int
384spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode) 367spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
385{ 368{
@@ -407,7 +390,6 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
407 inode->i_fop = &simple_dir_operations; 390 inode->i_fop = &simple_dir_operations;
408 391
409 d_instantiate(dentry, inode); 392 d_instantiate(dentry, inode);
410 dget(dentry);
411 dir->i_nlink++; 393 dir->i_nlink++;
412 dentry->d_inode->i_nlink++; 394 dentry->d_inode->i_nlink++;
413 return ret; 395 return ret;
@@ -437,7 +419,7 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
437 goto out; 419 goto out;
438 } 420 }
439 421
440 filp->f_op = &spufs_gang_fops; 422 filp->f_op = &simple_dir_operations;
441 fd_install(ret, filp); 423 fd_install(ret, filp);
442out: 424out:
443 return ret; 425 return ret;
@@ -458,8 +440,10 @@ static int spufs_create_gang(struct inode *inode,
458 * in error path of *_open(). 440 * in error path of *_open().
459 */ 441 */
460 ret = spufs_gang_open(dget(dentry), mntget(mnt)); 442 ret = spufs_gang_open(dget(dentry), mntget(mnt));
461 if (ret < 0) 443 if (ret < 0) {
462 WARN_ON(spufs_rmgang(inode, dentry)); 444 int err = simple_rmdir(inode, dentry);
445 WARN_ON(err);
446 }
463 447
464out: 448out:
465 mutex_unlock(&inode->i_mutex); 449 mutex_unlock(&inode->i_mutex);
@@ -600,6 +584,10 @@ spufs_create_root(struct super_block *sb, void *data)
600 struct inode *inode; 584 struct inode *inode;
601 int ret; 585 int ret;
602 586
587 ret = -ENODEV;
588 if (!spu_management_ops)
589 goto out;
590
603 ret = -ENOMEM; 591 ret = -ENOMEM;
604 inode = spufs_new_inode(sb, S_IFDIR | 0775); 592 inode = spufs_new_inode(sb, S_IFDIR | 0775);
605 if (!inode) 593 if (!inode)
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index b6ecb30e7d58..3b831e07f1ed 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -93,43 +93,6 @@ void spu_stop_tick(struct spu_context *ctx)
93 } 93 }
94} 94}
95 95
96void spu_sched_tick(struct work_struct *work)
97{
98 struct spu_context *ctx =
99 container_of(work, struct spu_context, sched_work.work);
100 struct spu *spu;
101 int preempted = 0;
102
103 /*
104 * If this context is being stopped avoid rescheduling from the
105 * scheduler tick because we would block on the state_mutex.
106 * The caller will yield the spu later on anyway.
107 */
108 if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
109 return;
110
111 mutex_lock(&ctx->state_mutex);
112 spu = ctx->spu;
113 if (spu) {
114 int best = sched_find_first_bit(spu_prio->bitmap);
115 if (best <= ctx->prio) {
116 spu_deactivate(ctx);
117 preempted = 1;
118 }
119 }
120 mutex_unlock(&ctx->state_mutex);
121
122 if (preempted) {
123 /*
124 * We need to break out of the wait loop in spu_run manually
125 * to ensure this context gets put on the runqueue again
126 * ASAP.
127 */
128 wake_up(&ctx->stop_wq);
129 } else
130 spu_start_tick(ctx);
131}
132
133/** 96/**
134 * spu_add_to_active_list - add spu to active list 97 * spu_add_to_active_list - add spu to active list
135 * @spu: spu to add to the active list 98 * @spu: spu to add to the active list
@@ -273,34 +236,6 @@ static void spu_prio_wait(struct spu_context *ctx)
273 remove_wait_queue(&ctx->stop_wq, &wait); 236 remove_wait_queue(&ctx->stop_wq, &wait);
274} 237}
275 238
276/**
277 * spu_reschedule - try to find a runnable context for a spu
278 * @spu: spu available
279 *
280 * This function is called whenever a spu becomes idle. It looks for the
281 * most suitable runnable spu context and schedules it for execution.
282 */
283static void spu_reschedule(struct spu *spu)
284{
285 int best;
286
287 spu_free(spu);
288
289 spin_lock(&spu_prio->runq_lock);
290 best = sched_find_first_bit(spu_prio->bitmap);
291 if (best < MAX_PRIO) {
292 struct list_head *rq = &spu_prio->runq[best];
293 struct spu_context *ctx;
294
295 BUG_ON(list_empty(rq));
296
297 ctx = list_entry(rq->next, struct spu_context, rq);
298 __spu_del_from_rq(ctx);
299 wake_up(&ctx->stop_wq);
300 }
301 spin_unlock(&spu_prio->runq_lock);
302}
303
304static struct spu *spu_get_idle(struct spu_context *ctx) 239static struct spu *spu_get_idle(struct spu_context *ctx)
305{ 240{
306 struct spu *spu = NULL; 241 struct spu *spu = NULL;
@@ -429,6 +364,51 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
429} 364}
430 365
431/** 366/**
367 * grab_runnable_context - try to find a runnable context
368 *
369 * Remove the highest priority context on the runqueue and return it
370 * to the caller. Returns %NULL if no runnable context was found.
371 */
372static struct spu_context *grab_runnable_context(int prio)
373{
374 struct spu_context *ctx = NULL;
375 int best;
376
377 spin_lock(&spu_prio->runq_lock);
378 best = sched_find_first_bit(spu_prio->bitmap);
379 if (best < prio) {
380 struct list_head *rq = &spu_prio->runq[best];
381
382 BUG_ON(list_empty(rq));
383
384 ctx = list_entry(rq->next, struct spu_context, rq);
385 __spu_del_from_rq(ctx);
386 }
387 spin_unlock(&spu_prio->runq_lock);
388
389 return ctx;
390}
391
392static int __spu_deactivate(struct spu_context *ctx, int force, int max_prio)
393{
394 struct spu *spu = ctx->spu;
395 struct spu_context *new = NULL;
396
397 if (spu) {
398 new = grab_runnable_context(max_prio);
399 if (new || force) {
400 spu_unbind_context(spu, ctx);
401 spu_free(spu);
402 if (new)
403 wake_up(&new->stop_wq);
404 }
405
406 }
407
408 return new != NULL;
409}
410
411/**
432 * spu_deactivate - unbind a context from it's physical spu 412 * spu_deactivate - unbind a context from it's physical spu
433 * @ctx: spu context to unbind 413 * @ctx: spu context to unbind
434 * 414 *
@@ -437,12 +417,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
437 */ 417 */
438void spu_deactivate(struct spu_context *ctx) 418void spu_deactivate(struct spu_context *ctx)
439{ 419{
440 struct spu *spu = ctx->spu; 420 __spu_deactivate(ctx, 1, MAX_PRIO);
441
442 if (spu) {
443 spu_unbind_context(spu, ctx);
444 spu_reschedule(spu);
445 }
446} 421}
447 422
448/** 423/**
@@ -455,21 +430,43 @@ void spu_deactivate(struct spu_context *ctx)
455 */ 430 */
456void spu_yield(struct spu_context *ctx) 431void spu_yield(struct spu_context *ctx)
457{ 432{
458 struct spu *spu; 433 if (!(ctx->flags & SPU_CREATE_NOSCHED)) {
459 434 mutex_lock(&ctx->state_mutex);
460 if (mutex_trylock(&ctx->state_mutex)) { 435 __spu_deactivate(ctx, 0, MAX_PRIO);
461 if ((spu = ctx->spu) != NULL) {
462 int best = sched_find_first_bit(spu_prio->bitmap);
463 if (best < MAX_PRIO) {
464 pr_debug("%s: yielding SPU %d NODE %d\n",
465 __FUNCTION__, spu->number, spu->node);
466 spu_deactivate(ctx);
467 }
468 }
469 mutex_unlock(&ctx->state_mutex); 436 mutex_unlock(&ctx->state_mutex);
470 } 437 }
471} 438}
472 439
440void spu_sched_tick(struct work_struct *work)
441{
442 struct spu_context *ctx =
443 container_of(work, struct spu_context, sched_work.work);
444 int preempted;
445
446 /*
447 * If this context is being stopped avoid rescheduling from the
448 * scheduler tick because we would block on the state_mutex.
449 * The caller will yield the spu later on anyway.
450 */
451 if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
452 return;
453
454 mutex_lock(&ctx->state_mutex);
455 preempted = __spu_deactivate(ctx, 0, ctx->prio + 1);
456 mutex_unlock(&ctx->state_mutex);
457
458 if (preempted) {
459 /*
460 * We need to break out of the wait loop in spu_run manually
461 * to ensure this context gets put on the runqueue again
462 * ASAP.
463 */
464 wake_up(&ctx->stop_wq);
465 } else {
466 spu_start_tick(ctx);
467 }
468}
469
473int __init spu_sched_init(void) 470int __init spu_sched_init(void)
474{ 471{
475 int i; 472 int i;
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 0a947fd7de57..47617e8014a5 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -55,7 +55,7 @@ struct spu_context {
55 struct address_space *signal2; /* 'signal2' area mappings. */ 55 struct address_space *signal2; /* 'signal2' area mappings. */
56 struct address_space *mss; /* 'mss' area mappings. */ 56 struct address_space *mss; /* 'mss' area mappings. */
57 struct address_space *psmap; /* 'psmap' area mappings. */ 57 struct address_space *psmap; /* 'psmap' area mappings. */
58 spinlock_t mapping_lock; 58 struct mutex mapping_lock;
59 u64 object_id; /* user space pointer for oprofile */ 59 u64 object_id; /* user space pointer for oprofile */
60 60
61 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 61 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
diff --git a/arch/powerpc/platforms/celleb/Makefile b/arch/powerpc/platforms/celleb/Makefile
index f4f82520dc4f..5240046d8671 100644
--- a/arch/powerpc/platforms/celleb/Makefile
+++ b/arch/powerpc/platforms/celleb/Makefile
@@ -4,5 +4,5 @@ obj-y += interrupt.o iommu.o setup.o \
4 4
5obj-$(CONFIG_SMP) += smp.o 5obj-$(CONFIG_SMP) += smp.o
6obj-$(CONFIG_PPC_UDBG_BEAT) += udbg_beat.o 6obj-$(CONFIG_PPC_UDBG_BEAT) += udbg_beat.o
7obj-$(CONFIG_HAS_TXX9_SERIAL) += scc_sio.o 7obj-$(CONFIG_SERIAL_TXX9) += scc_sio.o
8obj-$(CONFIG_SPU_BASE) += spu_priv1.o 8obj-$(CONFIG_SPU_BASE) += spu_priv1.o
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index 03cd45d8fefa..3c962d5757be 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/reg.h> 28#include <asm/reg.h>
29#include <asm/smp.h>
29 30
30#include "pasemi.h" 31#include "pasemi.h"
31 32
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 95fa6a7d15ee..f33b21b9f5d4 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -31,8 +31,6 @@
31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT) 31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT)
32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1) 32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1)
33 33
34#define IOBMAP_PAGE_FACTOR (PAGE_SHIFT - IOBMAP_PAGE_SHIFT)
35
36#define IOB_BASE 0xe0000000 34#define IOB_BASE 0xe0000000
37#define IOB_SIZE 0x3000 35#define IOB_SIZE 0x3000
38/* Configuration registers */ 36/* Configuration registers */
@@ -97,9 +95,6 @@ static void iobmap_build(struct iommu_table *tbl, long index,
97 95
98 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; 96 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
99 97
100 npages <<= IOBMAP_PAGE_FACTOR;
101 index <<= IOBMAP_PAGE_FACTOR;
102
103 ip = ((u32 *)tbl->it_base) + index; 98 ip = ((u32 *)tbl->it_base) + index;
104 99
105 while (npages--) { 100 while (npages--) {
@@ -125,9 +120,6 @@ static void iobmap_free(struct iommu_table *tbl, long index,
125 120
126 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; 121 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
127 122
128 npages <<= IOBMAP_PAGE_FACTOR;
129 index <<= IOBMAP_PAGE_FACTOR;
130
131 ip = ((u32 *)tbl->it_base) + index; 123 ip = ((u32 *)tbl->it_base) + index;
132 124
133 while (npages--) { 125 while (npages--) {
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 9da82c266ba9..ec9030dbb5f1 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -25,6 +25,7 @@
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/udbg.h> 26#include <asm/udbg.h>
27#include <asm/lv1call.h> 27#include <asm/lv1call.h>
28#include <asm/smp.h>
28 29
29#include "platform.h" 30#include "platform.h"
30 31
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index b854e7f1001c..f1df942072bb 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -752,6 +752,7 @@ skip_gserver_check:
752void xics_request_IPIs(void) 752void xics_request_IPIs(void)
753{ 753{
754 unsigned int ipi; 754 unsigned int ipi;
755 int rc;
755 756
756 ipi = irq_create_mapping(xics_host, XICS_IPI); 757 ipi = irq_create_mapping(xics_host, XICS_IPI);
757 BUG_ON(ipi == NO_IRQ); 758 BUG_ON(ipi == NO_IRQ);
@@ -762,11 +763,12 @@ void xics_request_IPIs(void)
762 */ 763 */
763 set_irq_handler(ipi, handle_percpu_irq); 764 set_irq_handler(ipi, handle_percpu_irq);
764 if (firmware_has_feature(FW_FEATURE_LPAR)) 765 if (firmware_has_feature(FW_FEATURE_LPAR))
765 request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED, 766 rc = request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED,
766 "IPI", NULL); 767 "IPI", NULL);
767 else 768 else
768 request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED, 769 rc = request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED,
769 "IPI", NULL); 770 "IPI", NULL);
771 BUG_ON(rc);
770} 772}
771#endif /* CONFIG_SMP */ 773#endif /* CONFIG_SMP */
772 774
diff --git a/arch/ppc/syslib/ibm_ocp.c b/arch/ppc/syslib/ibm_ocp.c
index 3f6e55c79181..2ee176610e7c 100644
--- a/arch/ppc/syslib/ibm_ocp.c
+++ b/arch/ppc/syslib/ibm_ocp.c
@@ -1,4 +1,5 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <asm/ibm4xx.h>
2#include <asm/ocp.h> 3#include <asm/ocp.h>
3 4
4struct ocp_sys_info_data ocp_sys_info = { 5struct ocp_sys_info_data ocp_sys_info = {
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c
index 911ce1cdbd7f..e143017c8975 100644
--- a/arch/sh/boards/se/73180/setup.c
+++ b/arch/sh/boards/se/73180/setup.c
@@ -38,8 +38,8 @@ static struct platform_device *se73180_devices[] __initdata = {
38 38
39static int __init se73180_devices_setup(void) 39static int __init se73180_devices_setup(void)
40{ 40{
41 return platform_add_devices(sh7343se_platform_devices, 41 return platform_add_devices(se73180_devices,
42 ARRAY_SIZE(sh7343se_platform_devices)); 42 ARRAY_SIZE(se73180_devices));
43} 43}
44__initcall(se73180_devices_setup); 44__initcall(se73180_devices_setup);
45 45
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c
index cc1cb04fa618..4d335077a3ff 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/superh/microdev/irq.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h>
14#include <asm/system.h> 15#include <asm/system.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/microdev.h> 17#include <asm/microdev.h>
diff --git a/arch/sh/cchips/voyagergx/irq.c b/arch/sh/cchips/voyagergx/irq.c
index 70f12907647f..d70e5c8461b5 100644
--- a/arch/sh/cchips/voyagergx/irq.c
+++ b/arch/sh/cchips/voyagergx/irq.c
@@ -28,7 +28,7 @@ static void disable_voyagergx_irq(unsigned int irq)
28 unsigned long val; 28 unsigned long val;
29 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE); 29 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
30 30
31 pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask); 31 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
32 val = readl((void __iomem *)VOYAGER_INT_MASK); 32 val = readl((void __iomem *)VOYAGER_INT_MASK);
33 val &= ~mask; 33 val &= ~mask;
34 writel(val, (void __iomem *)VOYAGER_INT_MASK); 34 writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -39,7 +39,7 @@ static void enable_voyagergx_irq(unsigned int irq)
39 unsigned long val; 39 unsigned long val;
40 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE); 40 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
41 41
42 pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask); 42 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
43 val = readl((void __iomem *)VOYAGER_INT_MASK); 43 val = readl((void __iomem *)VOYAGER_INT_MASK);
44 val |= mask; 44 val |= mask;
45 writel(val, (void __iomem *)VOYAGER_INT_MASK); 45 writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -125,11 +125,12 @@ int voyagergx_irq_demux(int irq)
125 i = 17; 125 i = 17;
126 else 126 else
127 printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val); 127 printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val);
128 pr_debug("voyagergx_irq_demux %d \n", i); 128 pr_debug("voyagergx_irq_demux %ld \n", i);
129 if (i < VOYAGER_IRQ_NUM) { 129 if (i < VOYAGER_IRQ_NUM) {
130 irq = VOYAGER_IRQ_BASE + i; 130 irq = VOYAGER_IRQ_BASE + i;
131 if (voyagergx_demux[i].func != 0) 131 if (voyagergx_demux[i].func != 0)
132 irq = voyagergx_demux[i].func(irq, voyagergx_demux[i].dev); 132 irq = voyagergx_demux[i].func(irq,
133 voyagergx_demux[i].dev);
133 } 134 }
134 } 135 }
135 return irq; 136 return irq;
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 659cc081e5e7..b0b59d4a33ca 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -320,7 +320,9 @@ skip_restore:
320 320
321 .align 2 321 .align 2
3225: .long 0x00001000 ! DSP 3225: .long 0x00001000 ! DSP
323#ifdef CONFIG_KGDB_NMI
3236: .long in_nmi 3246: .long in_nmi
325#endif
3247: .long 0x30000000 3267: .long 0x30000000
325 327
326! common exception handler 328! common exception handler
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
index fcb2c41bc34e..a33429463e96 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -111,7 +111,7 @@ static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate)
111 return 0; 111 return 0;
112} 112}
113 113
114static int shoc_clk_set_rate(struct clk *clk, unsigned long rate) 114static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)
115{ 115{
116 unsigned long frqcr3; 116 unsigned long frqcr3;
117 unsigned int tmp; 117 unsigned int tmp;
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index be03d74e99cb..0c7b7e33abdc 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -22,6 +22,7 @@
22#include <asm/addrspace.h> 22#include <asm/addrspace.h>
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/mmu.h>
25 26
26/* 27/*
27 * Remap an arbitrary physical address space into the kernel virtual 28 * Remap an arbitrary physical address space into the kernel virtual
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index bd00f89eed1e..89a1b469b93d 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -396,6 +396,15 @@ config SCHED_SMT
396 when dealing with UltraSPARC cpus at a cost of slightly increased 396 when dealing with UltraSPARC cpus at a cost of slightly increased
397 overhead in some places. If unsure say N here. 397 overhead in some places. If unsure say N here.
398 398
399config SCHED_MC
400 bool "Multi-core scheduler support"
401 depends on SMP
402 default y
403 help
404 Multi-core scheduler support improves the CPU scheduler's decision
405 making when dealing with multi-core CPU chips at a cost of slightly
406 increased overhead in some places. If unsure say N here.
407
399source "kernel/Kconfig.preempt" 408source "kernel/Kconfig.preempt"
400 409
401config CMDLINE_BOOL 410config CMDLINE_BOOL
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index d8d19093d12f..f964bf28d21a 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.70 2002/02/09 19:49:30 davem Exp $ 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror
8extra-y := head.o init_task.o vmlinux.lds 8extra-y := head.o init_task.o vmlinux.lds
9 9
10obj-y := process.o setup.o cpu.o idprom.o \ 10obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o \ 11 traps.o auxio.o una_asm.o sysfs.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index ed712e0b3372..7d1a11822a1e 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -2514,9 +2514,9 @@ sun4v_ncs_request:
2514 nop 2514 nop
2515 .size sun4v_ncs_request, .-sun4v_ncs_request 2515 .size sun4v_ncs_request, .-sun4v_ncs_request
2516 2516
2517 .globl sun4v_scv_send 2517 .globl sun4v_svc_send
2518 .type sun4v_scv_send,#function 2518 .type sun4v_svc_send,#function
2519sun4v_scv_send: 2519sun4v_svc_send:
2520 save %sp, -192, %sp 2520 save %sp, -192, %sp
2521 mov %i0, %o0 2521 mov %i0, %o0
2522 mov %i1, %o1 2522 mov %i1, %o1
@@ -2526,11 +2526,11 @@ sun4v_scv_send:
2526 stx %o1, [%i3] 2526 stx %o1, [%i3]
2527 ret 2527 ret
2528 restore 2528 restore
2529 .size sun4v_scv_send, .-sun4v_scv_send 2529 .size sun4v_svc_send, .-sun4v_svc_send
2530 2530
2531 .globl sun4v_scv_recv 2531 .globl sun4v_svc_recv
2532 .type sun4v_scv_recv,#function 2532 .type sun4v_svc_recv,#function
2533sun4v_scv_recv: 2533sun4v_svc_recv:
2534 save %sp, -192, %sp 2534 save %sp, -192, %sp
2535 mov %i0, %o0 2535 mov %i0, %o0
2536 mov %i1, %o1 2536 mov %i1, %o1
@@ -2540,33 +2540,55 @@ sun4v_scv_recv:
2540 stx %o1, [%i3] 2540 stx %o1, [%i3]
2541 ret 2541 ret
2542 restore 2542 restore
2543 .size sun4v_scv_recv, .-sun4v_scv_recv 2543 .size sun4v_svc_recv, .-sun4v_svc_recv
2544 2544
2545 .globl sun4v_scv_getstatus 2545 .globl sun4v_svc_getstatus
2546 .type sun4v_scv_getstatus,#function 2546 .type sun4v_svc_getstatus,#function
2547sun4v_scv_getstatus: 2547sun4v_svc_getstatus:
2548 mov HV_FAST_SVC_GETSTATUS, %o5 2548 mov HV_FAST_SVC_GETSTATUS, %o5
2549 mov %o1, %o4 2549 mov %o1, %o4
2550 ta HV_FAST_TRAP 2550 ta HV_FAST_TRAP
2551 stx %o1, [%o4] 2551 stx %o1, [%o4]
2552 retl 2552 retl
2553 nop 2553 nop
2554 .size sun4v_scv_getstatus, .-sun4v_scv_getstatus 2554 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
2555 2555
2556 .globl sun4v_scv_setstatus 2556 .globl sun4v_svc_setstatus
2557 .type sun4v_scv_setstatus,#function 2557 .type sun4v_svc_setstatus,#function
2558sun4v_scv_setstatus: 2558sun4v_svc_setstatus:
2559 mov HV_FAST_SVC_SETSTATUS, %o5 2559 mov HV_FAST_SVC_SETSTATUS, %o5
2560 ta HV_FAST_TRAP 2560 ta HV_FAST_TRAP
2561 retl 2561 retl
2562 nop 2562 nop
2563 .size sun4v_scv_setstatus, .-sun4v_scv_setstatus 2563 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
2564 2564
2565 .globl sun4v_scv_clrstatus 2565 .globl sun4v_svc_clrstatus
2566 .type sun4v_scv_clrstatus,#function 2566 .type sun4v_svc_clrstatus,#function
2567sun4v_scv_clrstatus: 2567sun4v_svc_clrstatus:
2568 mov HV_FAST_SVC_CLRSTATUS, %o5 2568 mov HV_FAST_SVC_CLRSTATUS, %o5
2569 ta HV_FAST_TRAP 2569 ta HV_FAST_TRAP
2570 retl 2570 retl
2571 nop 2571 nop
2572 .size sun4v_scv_clrstatus, .-sun4v_scv_clrstatus 2572 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
2573
2574 .globl sun4v_mmustat_conf
2575 .type sun4v_mmustat_conf,#function
2576sun4v_mmustat_conf:
2577 mov %o1, %o4
2578 mov HV_FAST_MMUSTAT_CONF, %o5
2579 ta HV_FAST_TRAP
2580 stx %o1, [%o4]
2581 retl
2582 nop
2583 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
2584
2585 .globl sun4v_mmustat_info
2586 .type sun4v_mmustat_info,#function
2587sun4v_mmustat_info:
2588 mov %o0, %o4
2589 mov HV_FAST_MMUSTAT_INFO, %o5
2590 ta HV_FAST_TRAP
2591 stx %o1, [%o4]
2592 retl
2593 nop
2594 .size sun4v_mmustat_info, .-sun4v_mmustat_info
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 9246c2cf9574..f0e16045fb16 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -473,6 +473,53 @@ static void __init set_core_ids(void)
473 } 473 }
474} 474}
475 475
476static void __init mark_proc_ids(struct mdesc_node *mp, int proc_id)
477{
478 int i;
479
480 for (i = 0; i < mp->num_arcs; i++) {
481 struct mdesc_node *t = mp->arcs[i].arc;
482 const u64 *id;
483
484 if (strcmp(mp->arcs[i].name, "back"))
485 continue;
486
487 if (strcmp(t->name, "cpu"))
488 continue;
489
490 id = md_get_property(t, "id", NULL);
491 if (*id < NR_CPUS)
492 cpu_data(*id).proc_id = proc_id;
493 }
494}
495
496static void __init __set_proc_ids(const char *exec_unit_name)
497{
498 struct mdesc_node *mp;
499 int idx;
500
501 idx = 0;
502 md_for_each_node_by_name(mp, exec_unit_name) {
503 const char *type;
504 int len;
505
506 type = md_get_property(mp, "type", &len);
507 if (!find_in_proplist(type, "int", len) &&
508 !find_in_proplist(type, "integer", len))
509 continue;
510
511 mark_proc_ids(mp, idx);
512
513 idx++;
514 }
515}
516
517static void __init set_proc_ids(void)
518{
519 __set_proc_ids("exec_unit");
520 __set_proc_ids("exec-unit");
521}
522
476static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def) 523static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def)
477{ 524{
478 u64 val; 525 u64 val;
@@ -574,9 +621,15 @@ static void __init mdesc_fill_in_cpu_data(void)
574#endif 621#endif
575 622
576 c->core_id = 0; 623 c->core_id = 0;
624 c->proc_id = -1;
577 } 625 }
578 626
627#ifdef CONFIG_SMP
628 sparc64_multi_core = 1;
629#endif
630
579 set_core_ids(); 631 set_core_ids();
632 set_proc_ids();
580 633
581 smp_fill_in_sib_core_maps(); 634 smp_fill_in_sib_core_maps();
582} 635}
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index dad4b3ba705f..6f4a5284b0ea 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1781,6 +1781,10 @@ static void __init of_fill_in_cpu_data(void)
1781 } 1781 }
1782 1782
1783 cpu_data(cpuid).core_id = portid + 1; 1783 cpu_data(cpuid).core_id = portid + 1;
1784 cpu_data(cpuid).proc_id = portid;
1785#ifdef CONFIG_SMP
1786 sparc64_multi_core = 1;
1787#endif
1784 } else { 1788 } else {
1785 cpu_data(cpuid).dcache_size = 1789 cpu_data(cpuid).dcache_size =
1786 of_getintprop_default(dp, "dcache-size", 16 * 1024); 1790 of_getintprop_default(dp, "dcache-size", 16 * 1024);
@@ -1799,6 +1803,7 @@ static void __init of_fill_in_cpu_data(void)
1799 of_getintprop_default(dp, "ecache-line-size", 64); 1803 of_getintprop_default(dp, "ecache-line-size", 64);
1800 1804
1801 cpu_data(cpuid).core_id = 0; 1805 cpu_data(cpuid).core_id = 0;
1806 cpu_data(cpuid).proc_id = -1;
1802 } 1807 }
1803 1808
1804#ifdef CONFIG_SMP 1809#ifdef CONFIG_SMP
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index de9b4c13f1c7..7490cc670a53 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -513,22 +513,3 @@ void sun_do_break(void)
513 513
514int serial_console = -1; 514int serial_console = -1;
515int stop_a_enabled = 1; 515int stop_a_enabled = 1;
516
517static int __init topology_init(void)
518{
519 int i, err;
520
521 err = -ENOMEM;
522
523 for_each_possible_cpu(i) {
524 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
525 if (p) {
526 register_cpu(p, i);
527 err = 0;
528 }
529 }
530
531 return err;
532}
533
534subsys_initcall(topology_init);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c550bba3490a..4dcd7d0b60f2 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -44,6 +44,8 @@
44 44
45extern void calibrate_delay(void); 45extern void calibrate_delay(void);
46 46
47int sparc64_multi_core __read_mostly;
48
47/* Please don't make this stuff initdata!!! --DaveM */ 49/* Please don't make this stuff initdata!!! --DaveM */
48unsigned char boot_cpu_id; 50unsigned char boot_cpu_id;
49 51
@@ -51,6 +53,8 @@ cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
51cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE; 53cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
52cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly = 54cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly =
53 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 55 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
56cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
57 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
54static cpumask_t smp_commenced_mask; 58static cpumask_t smp_commenced_mask;
55static cpumask_t cpu_callout_map; 59static cpumask_t cpu_callout_map;
56 60
@@ -1217,13 +1221,28 @@ void __devinit smp_fill_in_sib_core_maps(void)
1217 unsigned int j; 1221 unsigned int j;
1218 1222
1219 if (cpu_data(i).core_id == 0) { 1223 if (cpu_data(i).core_id == 0) {
1220 cpu_set(i, cpu_sibling_map[i]); 1224 cpu_set(i, cpu_core_map[i]);
1221 continue; 1225 continue;
1222 } 1226 }
1223 1227
1224 for_each_possible_cpu(j) { 1228 for_each_possible_cpu(j) {
1225 if (cpu_data(i).core_id == 1229 if (cpu_data(i).core_id ==
1226 cpu_data(j).core_id) 1230 cpu_data(j).core_id)
1231 cpu_set(j, cpu_core_map[i]);
1232 }
1233 }
1234
1235 for_each_possible_cpu(i) {
1236 unsigned int j;
1237
1238 if (cpu_data(i).proc_id == -1) {
1239 cpu_set(i, cpu_sibling_map[i]);
1240 continue;
1241 }
1242
1243 for_each_possible_cpu(j) {
1244 if (cpu_data(i).proc_id ==
1245 cpu_data(j).proc_id)
1227 cpu_set(j, cpu_sibling_map[i]); 1246 cpu_set(j, cpu_sibling_map[i]);
1228 } 1247 }
1229 } 1248 }
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c
new file mode 100644
index 000000000000..cdb1477af89f
--- /dev/null
+++ b/arch/sparc64/kernel/sysfs.c
@@ -0,0 +1,297 @@
1/* sysfs.c: Toplogy sysfs support code for sparc64.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5#include <linux/sysdev.h>
6#include <linux/cpu.h>
7#include <linux/smp.h>
8#include <linux/percpu.h>
9#include <linux/init.h>
10
11#include <asm/hypervisor.h>
12#include <asm/spitfire.h>
13
14static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
15
16#define SHOW_MMUSTAT_ULONG(NAME) \
17static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
18{ \
19 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
20 return sprintf(buf, "%lu\n", p->NAME); \
21} \
22static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL)
23
24SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
25SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
26SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_64k_tte);
27SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_64k_tte);
28SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_4mb_tte);
29SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_4mb_tte);
30SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_256mb_tte);
31SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_256mb_tte);
32SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_8k_tte);
33SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_8k_tte);
34SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_64k_tte);
35SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_64k_tte);
36SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_4mb_tte);
37SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_4mb_tte);
38SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_256mb_tte);
39SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_256mb_tte);
40SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_8k_tte);
41SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_8k_tte);
42SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_64k_tte);
43SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_64k_tte);
44SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_4mb_tte);
45SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_4mb_tte);
46SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_256mb_tte);
47SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_256mb_tte);
48SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_8k_tte);
49SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_8k_tte);
50SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_64k_tte);
51SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_64k_tte);
52SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_4mb_tte);
53SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_4mb_tte);
54SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
55SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
56
57static struct attribute *mmu_stat_attrs[] = {
58 &attr_immu_tsb_hits_ctx0_8k_tte.attr,
59 &attr_immu_tsb_ticks_ctx0_8k_tte.attr,
60 &attr_immu_tsb_hits_ctx0_64k_tte.attr,
61 &attr_immu_tsb_ticks_ctx0_64k_tte.attr,
62 &attr_immu_tsb_hits_ctx0_4mb_tte.attr,
63 &attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
64 &attr_immu_tsb_hits_ctx0_256mb_tte.attr,
65 &attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
66 &attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
67 &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
68 &attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
69 &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
70 &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
71 &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
72 &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
73 &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
74 &attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
75 &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
76 &attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
77 &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
78 &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
79 &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
80 &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
81 &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
82 &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
83 &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
84 &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
85 &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
86 &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
87 &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
88 &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
89 &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
90 NULL,
91};
92
93static struct attribute_group mmu_stat_group = {
94 .attrs = mmu_stat_attrs,
95 .name = "mmu_stats",
96};
97
98/* XXX convert to rusty's on_one_cpu */
99static unsigned long run_on_cpu(unsigned long cpu,
100 unsigned long (*func)(unsigned long),
101 unsigned long arg)
102{
103 cpumask_t old_affinity = current->cpus_allowed;
104 unsigned long ret;
105
106 /* should return -EINVAL to userspace */
107 if (set_cpus_allowed(current, cpumask_of_cpu(cpu)))
108 return 0;
109
110 ret = func(arg);
111
112 set_cpus_allowed(current, old_affinity);
113
114 return ret;
115}
116
117static unsigned long read_mmustat_enable(unsigned long junk)
118{
119 unsigned long ra = 0;
120
121 sun4v_mmustat_info(&ra);
122
123 return ra != 0;
124}
125
126static unsigned long write_mmustat_enable(unsigned long val)
127{
128 unsigned long ra, orig_ra;
129
130 if (val)
131 ra = __pa(&per_cpu(mmu_stats, smp_processor_id()));
132 else
133 ra = 0UL;
134
135 return sun4v_mmustat_conf(ra, &orig_ra);
136}
137
138static ssize_t show_mmustat_enable(struct sys_device *s, char *buf)
139{
140 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
141 return sprintf(buf, "%lx\n", val);
142}
143
144static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count)
145{
146 unsigned long val, err;
147 int ret = sscanf(buf, "%ld", &val);
148
149 if (ret != 1)
150 return -EINVAL;
151
152 err = run_on_cpu(s->id, write_mmustat_enable, val);
153 if (err)
154 return -EIO;
155
156 return count;
157}
158
159static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
160
161static int mmu_stats_supported;
162
163static int register_mmu_stats(struct sys_device *s)
164{
165 if (!mmu_stats_supported)
166 return 0;
167 sysdev_create_file(s, &attr_mmustat_enable);
168 return sysfs_create_group(&s->kobj, &mmu_stat_group);
169}
170
171#ifdef CONFIG_HOTPLUG_CPU
172static void unregister_mmu_stats(struct sys_device *s)
173{
174 if (!mmu_stats_supported)
175 return;
176 sysfs_remove_group(&s->kobj, &mmu_stat_group);
177 sysdev_remove_file(s, &attr_mmustat_enable);
178}
179#endif
180
181#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
182static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
183{ \
184 cpuinfo_sparc *c = &cpu_data(dev->id); \
185 return sprintf(buf, "%lu\n", c->MEMBER); \
186}
187
188#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
189static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
190{ \
191 cpuinfo_sparc *c = &cpu_data(dev->id); \
192 return sprintf(buf, "%u\n", c->MEMBER); \
193}
194
195SHOW_CPUDATA_ULONG_NAME(clock_tick, clock_tick);
196SHOW_CPUDATA_ULONG_NAME(udelay_val, udelay_val);
197SHOW_CPUDATA_UINT_NAME(l1_dcache_size, dcache_size);
198SHOW_CPUDATA_UINT_NAME(l1_dcache_line_size, dcache_line_size);
199SHOW_CPUDATA_UINT_NAME(l1_icache_size, icache_size);
200SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
201SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
202SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
203
204static struct sysdev_attribute cpu_core_attrs[] = {
205 _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL),
206 _SYSDEV_ATTR(udelay_val, 0444, show_udelay_val, NULL),
207 _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL),
208 _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
209 _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL),
210 _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
211 _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL),
212 _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL),
213};
214
215static DEFINE_PER_CPU(struct cpu, cpu_devices);
216
217static void register_cpu_online(unsigned int cpu)
218{
219 struct cpu *c = &per_cpu(cpu_devices, cpu);
220 struct sys_device *s = &c->sysdev;
221 int i;
222
223 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
224 sysdev_create_file(s, &cpu_core_attrs[i]);
225
226 register_mmu_stats(s);
227}
228
229#ifdef CONFIG_HOTPLUG_CPU
230static void unregister_cpu_online(unsigned int cpu)
231{
232 struct cpu *c = &per_cpu(cpu_devices, cpu);
233 struct sys_device *s = &c->sysdev;
234 int i;
235
236 unregister_mmu_stats(s);
237 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
238 sysdev_remove_file(s, &cpu_core_attrs[i]);
239}
240#endif
241
242static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
243 unsigned long action, void *hcpu)
244{
245 unsigned int cpu = (unsigned int)(long)hcpu;
246
247 switch (action) {
248 case CPU_ONLINE:
249 case CPU_ONLINE_FROZEN:
250 register_cpu_online(cpu);
251 break;
252#ifdef CONFIG_HOTPLUG_CPU
253 case CPU_DEAD:
254 case CPU_DEAD_FROZEN:
255 unregister_cpu_online(cpu);
256 break;
257#endif
258 }
259 return NOTIFY_OK;
260}
261
262static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
263 .notifier_call = sysfs_cpu_notify,
264};
265
266static void __init check_mmu_stats(void)
267{
268 unsigned long dummy1, err;
269
270 if (tlb_type != hypervisor)
271 return;
272
273 err = sun4v_mmustat_info(&dummy1);
274 if (!err)
275 mmu_stats_supported = 1;
276}
277
278static int __init topology_init(void)
279{
280 int cpu;
281
282 check_mmu_stats();
283
284 register_cpu_notifier(&sysfs_cpu_nb);
285
286 for_each_possible_cpu(cpu) {
287 struct cpu *c = &per_cpu(cpu_devices, cpu);
288
289 register_cpu(c, cpu);
290 if (cpu_online(cpu))
291 register_cpu_online(cpu);
292 }
293
294 return 0;
295}
296
297subsys_initcall(topology_init);
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index a2efae8a4c4e..0c9f15c54e8c 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -59,7 +59,7 @@ int node_to_pxm(int node)
59 return node_to_pxm_map[node]; 59 return node_to_pxm_map[node];
60} 60}
61 61
62int __cpuinit acpi_map_pxm_to_node(int pxm) 62int acpi_map_pxm_to_node(int pxm)
63{ 63{
64 int node = pxm_to_node_map[pxm]; 64 int node = pxm_to_node_map[pxm];
65 65
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index b998340e23d4..58ceb18ec997 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -33,6 +33,7 @@
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/kmod.h> 34#include <linux/kmod.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/dmi.h>
36#include <linux/workqueue.h> 37#include <linux/workqueue.h>
37#include <linux/nmi.h> 38#include <linux/nmi.h>
38#include <linux/acpi.h> 39#include <linux/acpi.h>
@@ -73,6 +74,21 @@ static void *acpi_irq_context;
73static struct workqueue_struct *kacpid_wq; 74static struct workqueue_struct *kacpid_wq;
74static struct workqueue_struct *kacpi_notify_wq; 75static struct workqueue_struct *kacpi_notify_wq;
75 76
77#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78static char osi_additional_string[OSI_STRING_LENGTH_MAX];
79
80#define OSI_LINUX_ENABLED
81#ifdef OSI_LINUX_ENABLED
82int osi_linux = 1; /* enable _OSI(Linux) by default */
83#else
84int osi_linux; /* disable _OSI(Linux) by default */
85#endif
86
87
88#ifdef CONFIG_DMI
89static struct __initdata dmi_system_id acpi_osl_dmi_table[];
90#endif
91
76static void __init acpi_request_region (struct acpi_generic_address *addr, 92static void __init acpi_request_region (struct acpi_generic_address *addr,
77 unsigned int length, char *desc) 93 unsigned int length, char *desc)
78{ 94{
@@ -121,8 +137,9 @@ static int __init acpi_reserve_resources(void)
121} 137}
122device_initcall(acpi_reserve_resources); 138device_initcall(acpi_reserve_resources);
123 139
124acpi_status acpi_os_initialize(void) 140acpi_status __init acpi_os_initialize(void)
125{ 141{
142 dmi_check_system(acpi_osl_dmi_table);
126 return AE_OK; 143 return AE_OK;
127} 144}
128 145
@@ -960,20 +977,38 @@ static int __init acpi_os_name_setup(char *str)
960 977
961__setup("acpi_os_name=", acpi_os_name_setup); 978__setup("acpi_os_name=", acpi_os_name_setup);
962 979
980static void enable_osi_linux(int enable) {
981
982 if (osi_linux != enable)
983 printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n",
984 enable ? "En": "Dis");
985
986 osi_linux = enable;
987 return;
988}
989
963/* 990/*
964 * _OSI control 991 * Modify the list of "OS Interfaces" reported to BIOS via _OSI
992 *
965 * empty string disables _OSI 993 * empty string disables _OSI
966 * TBD additional string adds to _OSI 994 * string starting with '!' disables that string
995 * otherwise string is added to list, augmenting built-in strings
967 */ 996 */
968static int __init acpi_osi_setup(char *str) 997static int __init acpi_osi_setup(char *str)
969{ 998{
970 if (str == NULL || *str == '\0') { 999 if (str == NULL || *str == '\0') {
971 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1000 printk(KERN_INFO PREFIX "_OSI method disabled\n");
972 acpi_gbl_create_osi_method = FALSE; 1001 acpi_gbl_create_osi_method = FALSE;
973 } else { 1002 } else if (*str == '!') {
974 /* TBD */ 1003 if (acpi_osi_invalidate(++str) == AE_OK)
975 printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", 1004 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
976 str); 1005 } else if (!strcmp("!Linux", str)) {
1006 enable_osi_linux(0);
1007 } else if (!strcmp("Linux", str)) {
1008 enable_osi_linux(1);
1009 } else if (*osi_additional_string == '\0') {
1010 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
1011 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
977 } 1012 }
978 1013
979 return 1; 1014 return 1;
@@ -1143,11 +1178,28 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1143acpi_status 1178acpi_status
1144acpi_os_validate_interface (char *interface) 1179acpi_os_validate_interface (char *interface)
1145{ 1180{
1146 1181 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1147 return AE_SUPPORT; 1182 return AE_OK;
1183 if (!strcmp("Linux", interface)) {
1184 printk(KERN_WARNING PREFIX
1185 "System BIOS is requesting _OSI(Linux)\n");
1186#ifdef OSI_LINUX_ENABLED
1187 printk(KERN_WARNING PREFIX
1188 "Please test with \"acpi_osi=!Linux\"\n"
1189 "Please send dmidecode "
1190 "to linux-acpi@vger.kernel.org\n");
1191#else
1192 printk(KERN_WARNING PREFIX
1193 "If \"acpi_osi=Linux\" works better,\n"
1194 "Please send dmidecode "
1195 "to linux-acpi@vger.kernel.org\n");
1196#endif
1197 if(osi_linux)
1198 return AE_OK;
1199 }
1200 return AE_SUPPORT;
1148} 1201}
1149 1202
1150
1151/****************************************************************************** 1203/******************************************************************************
1152 * 1204 *
1153 * FUNCTION: acpi_os_validate_address 1205 * FUNCTION: acpi_os_validate_address
@@ -1174,5 +1226,51 @@ acpi_os_validate_address (
1174 return AE_OK; 1226 return AE_OK;
1175} 1227}
1176 1228
1229#ifdef CONFIG_DMI
1230#ifdef OSI_LINUX_ENABLED
1231static int dmi_osi_not_linux(struct dmi_system_id *d)
1232{
1233 printk(KERN_NOTICE "%s detected: requires not _OSI(Linux)\n", d->ident);
1234 enable_osi_linux(0);
1235 return 0;
1236}
1237#else
1238static int dmi_osi_linux(struct dmi_system_id *d)
1239{
1240 printk(KERN_NOTICE "%s detected: requires _OSI(Linux)\n", d->ident);
1241 enable_osi_linux(1);
1242 return 0;
1243}
1244#endif
1245
1246static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
1247#ifdef OSI_LINUX_ENABLED
1248 /*
1249 * Boxes that need NOT _OSI(Linux)
1250 */
1251 {
1252 .callback = dmi_osi_not_linux,
1253 .ident = "Toshiba Satellite P100",
1254 .matches = {
1255 DMI_MATCH(DMI_BOARD_VENDOR, "TOSHIBA"),
1256 DMI_MATCH(DMI_BOARD_NAME, "Satellite P100"),
1257 },
1258 },
1259#else
1260 /*
1261 * Boxes that need _OSI(Linux)
1262 */
1263 {
1264 .callback = dmi_osi_linux,
1265 .ident = "Intel Napa CRB",
1266 .matches = {
1267 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
1268 DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"),
1269 },
1270 },
1271#endif
1272 {}
1273};
1274#endif /* CONFIG_DMI */
1177 1275
1178#endif 1276#endif
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 0e7b121a99ce..3bc0c67a9283 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -123,14 +123,14 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
123 } 123 }
124 } 124 }
125 125
126 /* The table must be either an SSDT or a PSDT */ 126 /* The table must be either an SSDT or a PSDT or an OEMx */
127 127
128 if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) 128 if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT))
129 && 129 &&
130 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))) 130 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))
131 { 131 && (strncmp(table_desc->pointer->signature, "OEM", 3))) {
132 ACPI_ERROR((AE_INFO, 132 ACPI_ERROR((AE_INFO,
133 "Table has invalid signature [%4.4s], must be SSDT or PSDT", 133 "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx",
134 table_desc->pointer->signature)); 134 table_desc->pointer->signature));
135 return_ACPI_STATUS(AE_BAD_SIGNATURE); 135 return_ACPI_STATUS(AE_BAD_SIGNATURE);
136 } 136 }
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1ada017d01ef..194ecfe8b360 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -827,6 +827,7 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
827static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) 827static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
828{ 828{
829 struct acpi_thermal *tz = seq->private; 829 struct acpi_thermal *tz = seq->private;
830 struct acpi_device *device;
830 int i = 0; 831 int i = 0;
831 int j = 0; 832 int j = 0;
832 833
@@ -849,9 +850,8 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
849 tz->trips.passive.tc1, tz->trips.passive.tc2, 850 tz->trips.passive.tc1, tz->trips.passive.tc2,
850 tz->trips.passive.tsp); 851 tz->trips.passive.tsp);
851 for (j = 0; j < tz->trips.passive.devices.count; j++) { 852 for (j = 0; j < tz->trips.passive.devices.count; j++) {
852 853 acpi_bus_get_device(tz->trips.passive.devices.handles[j], &device);
853 seq_printf(seq, "0x%p ", 854 seq_printf(seq, "%4.4s ", acpi_device_bid(device));
854 tz->trips.passive.devices.handles[j]);
855 } 855 }
856 seq_puts(seq, "\n"); 856 seq_puts(seq, "\n");
857 } 857 }
@@ -862,9 +862,10 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
862 seq_printf(seq, "active[%d]: %ld C: devices=", 862 seq_printf(seq, "active[%d]: %ld C: devices=",
863 i, 863 i,
864 KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); 864 KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
865 for (j = 0; j < tz->trips.active[i].devices.count; j++) 865 for (j = 0; j < tz->trips.active[i].devices.count; j++){
866 seq_printf(seq, "0x%p ", 866 acpi_bus_get_device(tz->trips.active[i].devices.handles[j], &device);
867 tz->trips.active[i].devices.handles[j]); 867 seq_printf(seq, "%4.4s ", acpi_device_bid(device));
868 }
868 seq_puts(seq, "\n"); 869 seq_puts(seq, "\n");
869 } 870 }
870 871
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 4c1e00874dff..879eaa10d3ae 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -68,6 +68,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
68 union acpi_operand_object **return_obj); 68 union acpi_operand_object **return_obj);
69 69
70static acpi_status 70static acpi_status
71acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
72 union acpi_operand_object **internal_object);
73
74static acpi_status
71acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, 75acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
72 union acpi_operand_object *dest_desc); 76 union acpi_operand_object *dest_desc);
73 77
@@ -518,77 +522,73 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
518 return_ACPI_STATUS(AE_NO_MEMORY); 522 return_ACPI_STATUS(AE_NO_MEMORY);
519} 523}
520 524
521#ifdef ACPI_FUTURE_IMPLEMENTATION
522/* Code to convert packages that are parameters to control methods */
523
524/******************************************************************************* 525/*******************************************************************************
525 * 526 *
526 * FUNCTION: acpi_ut_copy_epackage_to_ipackage 527 * FUNCTION: acpi_ut_copy_epackage_to_ipackage
527 * 528 *
528 * PARAMETERS: *internal_object - Pointer to the object we are returning 529 * PARAMETERS: external_object - The external object to be converted
529 * *Buffer - Where the object is returned 530 * internal_object - Where the internal object is returned
530 * *space_used - Where the length of the object is returned
531 * 531 *
532 * RETURN: Status 532 * RETURN: Status
533 * 533 *
534 * DESCRIPTION: This function is called to place a package object in a user 534 * DESCRIPTION: Copy an external package object to an internal package.
535 * buffer. A package object by definition contains other objects. 535 * Handles nested packages.
536 *
537 * The buffer is assumed to have sufficient space for the object.
538 * The caller must have verified the buffer length needed using the
539 * acpi_ut_get_object_size function before calling this function.
540 * 536 *
541 ******************************************************************************/ 537 ******************************************************************************/
542 538
543static acpi_status 539static acpi_status
544acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, 540acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
545 u8 * buffer, u32 * space_used) 541 union acpi_operand_object **internal_object)
546{ 542{
547 u8 *free_space; 543 acpi_status status = AE_OK;
548 union acpi_object *external_object; 544 union acpi_operand_object *package_object;
549 u32 length = 0; 545 union acpi_operand_object **package_elements;
550 u32 this_index; 546 acpi_native_uint i;
551 u32 object_space = 0;
552 union acpi_operand_object *this_internal_obj;
553 union acpi_object *this_external_obj;
554 547
555 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); 548 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
556 549
557 /* 550 /* Create the package object */
558 * First package at head of the buffer
559 */
560 external_object = (union acpi_object *)buffer;
561 551
562 /* 552 package_object =
563 * Free space begins right after the first package 553 acpi_ut_create_package_object(external_object->package.count);
564 */ 554 if (!package_object) {
565 free_space = buffer + sizeof(union acpi_object); 555 return_ACPI_STATUS(AE_NO_MEMORY);
556 }
566 557
567 external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); 558 package_elements = package_object->package.elements;
568 external_object->package.count = internal_object->package.count;
569 external_object->package.elements = (union acpi_object *)free_space;
570 559
571 /* 560 /*
572 * Build an array of ACPI_OBJECTS in the buffer 561 * Recursive implementation. Probably ok, since nested external packages
573 * and move the free space past it 562 * as parameters should be very rare.
574 */ 563 */
575 free_space += 564 for (i = 0; i < external_object->package.count; i++) {
576 external_object->package.count * sizeof(union acpi_object); 565 status =
566 acpi_ut_copy_eobject_to_iobject(&external_object->package.
567 elements[i],
568 &package_elements[i]);
569 if (ACPI_FAILURE(status)) {
577 570
578 /* Call walk_package */ 571 /* Truncate package and delete it */
579 572
580} 573 package_object->package.count = i;
574 package_elements[i] = NULL;
575 acpi_ut_remove_reference(package_object);
576 return_ACPI_STATUS(status);
577 }
578 }
581 579
582#endif /* Future implementation */ 580 *internal_object = package_object;
581 return_ACPI_STATUS(status);
582}
583 583
584/******************************************************************************* 584/*******************************************************************************
585 * 585 *
586 * FUNCTION: acpi_ut_copy_eobject_to_iobject 586 * FUNCTION: acpi_ut_copy_eobject_to_iobject
587 * 587 *
588 * PARAMETERS: *internal_object - The external object to be converted 588 * PARAMETERS: external_object - The external object to be converted
589 * *buffer_ptr - Where the internal object is returned 589 * internal_object - Where the internal object is returned
590 * 590 *
591 * RETURN: Status - the status of the call 591 * RETURN: Status - the status of the call
592 * 592 *
593 * DESCRIPTION: Converts an external object to an internal object. 593 * DESCRIPTION: Converts an external object to an internal object.
594 * 594 *
@@ -603,16 +603,10 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
603 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); 603 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
604 604
605 if (external_object->type == ACPI_TYPE_PACKAGE) { 605 if (external_object->type == ACPI_TYPE_PACKAGE) {
606 /* 606 status =
607 * Packages as external input to control methods are not supported, 607 acpi_ut_copy_epackage_to_ipackage(external_object,
608 */ 608 internal_object);
609 ACPI_ERROR((AE_INFO, 609 } else {
610 "Packages as parameters not implemented!"));
611
612 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
613 }
614
615 else {
616 /* 610 /*
617 * Build a simple object (no nested objects) 611 * Build a simple object (no nested objects)
618 */ 612 */
@@ -803,33 +797,19 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
803 * Create and build the package object 797 * Create and build the package object
804 */ 798 */
805 target_object = 799 target_object =
806 acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); 800 acpi_ut_create_package_object(source_object->package.count);
807 if (!target_object) { 801 if (!target_object) {
808 return (AE_NO_MEMORY); 802 return (AE_NO_MEMORY);
809 } 803 }
810 804
811 target_object->package.count = source_object->package.count;
812 target_object->common.flags = source_object->common.flags; 805 target_object->common.flags = source_object->common.flags;
813 806
814 /* 807 /* Pass the new package object back to the package walk routine */
815 * Create the object array
816 */
817 target_object->package.elements =
818 ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.
819 count + 1) * sizeof(void *));
820 if (!target_object->package.elements) {
821 status = AE_NO_MEMORY;
822 goto error_exit;
823 }
824 808
825 /*
826 * Pass the new package object back to the package walk routine
827 */
828 state->pkg.this_target_obj = target_object; 809 state->pkg.this_target_obj = target_object;
829 810
830 /* 811 /* Store the object pointer in the parent package object */
831 * Store the object pointer in the parent package object 812
832 */
833 *this_target_ptr = target_object; 813 *this_target_ptr = target_object;
834 break; 814 break;
835 815
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 13d5879cd98b..8ec6f8e48138 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -59,10 +59,9 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
59/* 59/*
60 * Strings supported by the _OSI predefined (internal) method. 60 * Strings supported by the _OSI predefined (internal) method.
61 */ 61 */
62static const char *acpi_interfaces_supported[] = { 62static char *acpi_interfaces_supported[] = {
63 /* Operating System Vendor Strings */ 63 /* Operating System Vendor Strings */
64 64
65 "Linux",
66 "Windows 2000", 65 "Windows 2000",
67 "Windows 2001", 66 "Windows 2001",
68 "Windows 2001 SP0", 67 "Windows 2001 SP0",
@@ -158,6 +157,31 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
158 157
159/******************************************************************************* 158/*******************************************************************************
160 * 159 *
160 * FUNCTION: acpi_osi_invalidate
161 *
162 * PARAMETERS: interface_string
163 *
164 * RETURN: Status
165 *
166 * DESCRIPTION: invalidate string in pre-defiend _OSI string list
167 *
168 ******************************************************************************/
169
170acpi_status acpi_osi_invalidate(char *interface)
171{
172 int i;
173
174 for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
175 if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) {
176 *acpi_interfaces_supported[i] = '\0';
177 return AE_OK;
178 }
179 }
180 return AE_NOT_FOUND;
181}
182
183/*******************************************************************************
184 *
161 * FUNCTION: acpi_ut_evaluate_object 185 * FUNCTION: acpi_ut_evaluate_object
162 * 186 *
163 * PARAMETERS: prefix_node - Starting node 187 * PARAMETERS: prefix_node - Starting node
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 4696124759e1..db0b9bac7945 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -146,6 +146,48 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
146 146
147/******************************************************************************* 147/*******************************************************************************
148 * 148 *
149 * FUNCTION: acpi_ut_create_package_object
150 *
151 * PARAMETERS: Count - Number of package elements
152 *
153 * RETURN: Pointer to a new Package object, null on failure
154 *
155 * DESCRIPTION: Create a fully initialized package object
156 *
157 ******************************************************************************/
158
159union acpi_operand_object *acpi_ut_create_package_object(u32 count)
160{
161 union acpi_operand_object *package_desc;
162 union acpi_operand_object **package_elements;
163
164 ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count);
165
166 /* Create a new Package object */
167
168 package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
169 if (!package_desc) {
170 return_PTR(NULL);
171 }
172
173 /*
174 * Create the element array. Count+1 allows the array to be null
175 * terminated.
176 */
177 package_elements = ACPI_ALLOCATE_ZEROED((acpi_size)
178 (count + 1) * sizeof(void *));
179 if (!package_elements) {
180 ACPI_FREE(package_desc);
181 return_PTR(NULL);
182 }
183
184 package_desc->package.count = count;
185 package_desc->package.elements = package_elements;
186 return_PTR(package_desc);
187}
188
189/*******************************************************************************
190 *
149 * FUNCTION: acpi_ut_create_buffer_object 191 * FUNCTION: acpi_ut_create_buffer_object
150 * 192 *
151 * PARAMETERS: buffer_size - Size of buffer to be created 193 * PARAMETERS: buffer_size - Size of buffer to be created
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index e9a57806cd34..2d496918b3cd 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utxface")
61 * called, so any early initialization belongs here. 61 * called, so any early initialization belongs here.
62 * 62 *
63 ******************************************************************************/ 63 ******************************************************************************/
64acpi_status acpi_initialize_subsystem(void) 64acpi_status __init acpi_initialize_subsystem(void)
65{ 65{
66 acpi_status status; 66 acpi_status status;
67 67
@@ -108,8 +108,6 @@ acpi_status acpi_initialize_subsystem(void)
108 return_ACPI_STATUS(status); 108 return_ACPI_STATUS(status);
109} 109}
110 110
111ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem)
112
113/******************************************************************************* 111/*******************************************************************************
114 * 112 *
115 * FUNCTION: acpi_enable_subsystem 113 * FUNCTION: acpi_enable_subsystem
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index af625147df62..4733f009c7c9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3933,10 +3933,13 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
3933 /* set up set-features taskfile */ 3933 /* set up set-features taskfile */
3934 DPRINTK("set features - xfer mode\n"); 3934 DPRINTK("set features - xfer mode\n");
3935 3935
3936 /* Some controllers and ATAPI devices show flaky interrupt
3937 * behavior after setting xfer mode. Use polling instead.
3938 */
3936 ata_tf_init(dev, &tf); 3939 ata_tf_init(dev, &tf);
3937 tf.command = ATA_CMD_SET_FEATURES; 3940 tf.command = ATA_CMD_SET_FEATURES;
3938 tf.feature = SETFEATURES_XFER; 3941 tf.feature = SETFEATURES_XFER;
3939 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 3942 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
3940 tf.protocol = ATA_PROT_NODATA; 3943 tf.protocol = ATA_PROT_NODATA;
3941 tf.nsect = dev->xfer_mode; 3944 tf.nsect = dev->xfer_mode;
3942 3945
@@ -5414,14 +5417,6 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
5414 } 5417 }
5415 } 5418 }
5416 5419
5417 /* Some controllers show flaky interrupt behavior after
5418 * setting xfer mode. Use polling instead.
5419 */
5420 if (unlikely(qc->tf.command == ATA_CMD_SET_FEATURES &&
5421 qc->tf.feature == SETFEATURES_XFER) &&
5422 (ap->flags & ATA_FLAG_SETXFER_POLLING))
5423 qc->tf.flags |= ATA_TFLAG_POLLING;
5424
5425 /* select the device */ 5420 /* select the device */
5426 ata_dev_select(ap, qc->dev->devno, 1, 0); 5421 ata_dev_select(ap, qc->dev->devno, 1, 0);
5427 5422
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index a8462f1e890b..63eca299c62b 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -452,7 +452,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
452 /* Early VIA without UDMA support */ 452 /* Early VIA without UDMA support */
453 static const struct ata_port_info via_mwdma_info = { 453 static const struct ata_port_info via_mwdma_info = {
454 .sht = &via_sht, 454 .sht = &via_sht,
455 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 455 .flags = ATA_FLAG_SLAVE_POSS,
456 .pio_mask = 0x1f, 456 .pio_mask = 0x1f,
457 .mwdma_mask = 0x07, 457 .mwdma_mask = 0x07,
458 .port_ops = &via_port_ops 458 .port_ops = &via_port_ops
@@ -460,7 +460,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
460 /* Ditto with IRQ masking required */ 460 /* Ditto with IRQ masking required */
461 static const struct ata_port_info via_mwdma_info_borked = { 461 static const struct ata_port_info via_mwdma_info_borked = {
462 .sht = &via_sht, 462 .sht = &via_sht,
463 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 463 .flags = ATA_FLAG_SLAVE_POSS,
464 .pio_mask = 0x1f, 464 .pio_mask = 0x1f,
465 .mwdma_mask = 0x07, 465 .mwdma_mask = 0x07,
466 .port_ops = &via_port_ops_noirq, 466 .port_ops = &via_port_ops_noirq,
@@ -468,7 +468,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
468 /* VIA UDMA 33 devices (and borked 66) */ 468 /* VIA UDMA 33 devices (and borked 66) */
469 static const struct ata_port_info via_udma33_info = { 469 static const struct ata_port_info via_udma33_info = {
470 .sht = &via_sht, 470 .sht = &via_sht,
471 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 471 .flags = ATA_FLAG_SLAVE_POSS,
472 .pio_mask = 0x1f, 472 .pio_mask = 0x1f,
473 .mwdma_mask = 0x07, 473 .mwdma_mask = 0x07,
474 .udma_mask = 0x7, 474 .udma_mask = 0x7,
@@ -477,7 +477,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
477 /* VIA UDMA 66 devices */ 477 /* VIA UDMA 66 devices */
478 static const struct ata_port_info via_udma66_info = { 478 static const struct ata_port_info via_udma66_info = {
479 .sht = &via_sht, 479 .sht = &via_sht,
480 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 480 .flags = ATA_FLAG_SLAVE_POSS,
481 .pio_mask = 0x1f, 481 .pio_mask = 0x1f,
482 .mwdma_mask = 0x07, 482 .mwdma_mask = 0x07,
483 .udma_mask = 0x1f, 483 .udma_mask = 0x1f,
@@ -486,7 +486,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
486 /* VIA UDMA 100 devices */ 486 /* VIA UDMA 100 devices */
487 static const struct ata_port_info via_udma100_info = { 487 static const struct ata_port_info via_udma100_info = {
488 .sht = &via_sht, 488 .sht = &via_sht,
489 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 489 .flags = ATA_FLAG_SLAVE_POSS,
490 .pio_mask = 0x1f, 490 .pio_mask = 0x1f,
491 .mwdma_mask = 0x07, 491 .mwdma_mask = 0x07,
492 .udma_mask = 0x3f, 492 .udma_mask = 0x3f,
@@ -495,7 +495,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
495 /* UDMA133 with bad AST (All current 133) */ 495 /* UDMA133 with bad AST (All current 133) */
496 static const struct ata_port_info via_udma133_info = { 496 static const struct ata_port_info via_udma133_info = {
497 .sht = &via_sht, 497 .sht = &via_sht,
498 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 498 .flags = ATA_FLAG_SLAVE_POSS,
499 .pio_mask = 0x1f, 499 .pio_mask = 0x1f,
500 .mwdma_mask = 0x07, 500 .mwdma_mask = 0x07,
501 .udma_mask = 0x7f, /* FIXME: should check north bridge */ 501 .udma_mask = 0x7f, /* FIXME: should check north bridge */
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 9c67df5ccfa4..7f6d02ce1b5f 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1475,6 +1475,7 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1475 struct FS_BPENTRY *qe, *ne; 1475 struct FS_BPENTRY *qe, *ne;
1476 struct sk_buff *skb; 1476 struct sk_buff *skb;
1477 int n = 0; 1477 int n = 0;
1478 u32 qe_tmp;
1478 1479
1479 fs_dprintk (FS_DEBUG_QUEUE, "Topping off queue at %x (%d-%d/%d)\n", 1480 fs_dprintk (FS_DEBUG_QUEUE, "Topping off queue at %x (%d-%d/%d)\n",
1480 fp->offset, read_fs (dev, FP_CNT (fp->offset)), fp->n, 1481 fp->offset, read_fs (dev, FP_CNT (fp->offset)), fp->n,
@@ -1502,10 +1503,16 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1502 ne->skb = skb; 1503 ne->skb = skb;
1503 ne->fp = fp; 1504 ne->fp = fp;
1504 1505
1505 qe = (struct FS_BPENTRY *) (read_fs (dev, FP_EA(fp->offset))); 1506 /*
1506 fs_dprintk (FS_DEBUG_QUEUE, "link at %p\n", qe); 1507 * FIXME: following code encodes and decodes
1507 if (qe) { 1508 * machine pointers (could be 64-bit) into a
1508 qe = bus_to_virt ((long) qe); 1509 * 32-bit register.
1510 */
1511
1512 qe_tmp = read_fs (dev, FP_EA(fp->offset));
1513 fs_dprintk (FS_DEBUG_QUEUE, "link at %x\n", qe_tmp);
1514 if (qe_tmp) {
1515 qe = bus_to_virt ((long) qe_tmp);
1509 qe->next = virt_to_bus(ne); 1516 qe->next = virt_to_bus(ne);
1510 qe->flags &= ~FP_FLAGS_EPI; 1517 qe->flags &= ~FP_FLAGS_EPI;
1511 } else 1518 } else
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index 1cad32c62ed3..53f5538c0c05 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -115,6 +115,13 @@ config IXP4XX_WATCHDOG
115 115
116 Say N if you are unsure. 116 Say N if you are unsure.
117 117
118config KS8695_WATCHDOG
119 tristate "KS8695 watchdog"
120 depends on ARCH_KS8695
121 help
122 Watchdog timer embedded into KS8695 processor. This will reboot your
123 system when the timeout is reached.
124
118config S3C2410_WATCHDOG 125config S3C2410_WATCHDOG
119 tristate "S3C2410 Watchdog" 126 tristate "S3C2410 Watchdog"
120 depends on ARCH_S3C2410 127 depends on ARCH_S3C2410
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
index 8bfc00cc7c2b..d90f649038c2 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/char/watchdog/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
29obj-$(CONFIG_977_WATCHDOG) += wdt977.o 29obj-$(CONFIG_977_WATCHDOG) += wdt977.o
30obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o 30obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
31obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o 31obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
32obj-$(CONFIG_KS8695_WATCHDOG) += ks8695_wdt.o
32obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o 33obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
33obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o 34obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
34obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o 35obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
diff --git a/drivers/char/watchdog/ks8695_wdt.c b/drivers/char/watchdog/ks8695_wdt.c
new file mode 100644
index 000000000000..7150fb945eaf
--- /dev/null
+++ b/drivers/char/watchdog/ks8695_wdt.c
@@ -0,0 +1,308 @@
1/*
2 * Watchdog driver for Kendin/Micrel KS8695.
3 *
4 * (C) 2007 Andrew Victor
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/errno.h>
12#include <linux/fs.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/miscdevice.h>
16#include <linux/module.h>
17#include <linux/moduleparam.h>
18#include <linux/platform_device.h>
19#include <linux/types.h>
20#include <linux/watchdog.h>
21#include <asm/bitops.h>
22#include <asm/io.h>
23#include <asm/uaccess.h>
24#include <asm/arch/regs-timer.h>
25
26
27#define WDT_DEFAULT_TIME 5 /* seconds */
28#define WDT_MAX_TIME 171 /* seconds */
29
30static int wdt_time = WDT_DEFAULT_TIME;
31static int nowayout = WATCHDOG_NOWAYOUT;
32
33module_param(wdt_time, int, 0);
34MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
35
36#ifdef CONFIG_WATCHDOG_NOWAYOUT
37module_param(nowayout, int, 0);
38MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
39#endif
40
41
42static unsigned long ks8695wdt_busy;
43
44/* ......................................................................... */
45
46/*
47 * Disable the watchdog.
48 */
49static void inline ks8695_wdt_stop(void)
50{
51 unsigned long tmcon;
52
53 /* disable timer0 */
54 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
55 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
56}
57
58/*
59 * Enable and reset the watchdog.
60 */
61static void inline ks8695_wdt_start(void)
62{
63 unsigned long tmcon;
64 unsigned long tval = wdt_time * CLOCK_TICK_RATE;
65
66 /* disable timer0 */
67 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
68 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
69
70 /* program timer0 */
71 __raw_writel(tval | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC);
72
73 /* re-enable timer0 */
74 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
75 __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
76}
77
78/*
79 * Reload the watchdog timer. (ie, pat the watchdog)
80 */
81static void inline ks8695_wdt_reload(void)
82{
83 unsigned long tmcon;
84
85 /* disable, then re-enable timer0 */
86 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
87 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
88 __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
89}
90
91/*
92 * Change the watchdog time interval.
93 */
94static int ks8695_wdt_settimeout(int new_time)
95{
96 /*
97 * All counting occurs at SLOW_CLOCK / 128 = 0.256 Hz
98 *
99 * Since WDV is a 16-bit counter, the maximum period is
100 * 65536 / 0.256 = 256 seconds.
101 */
102 if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
103 return -EINVAL;
104
105 /* Set new watchdog time. It will be used when ks8695_wdt_start() is called. */
106 wdt_time = new_time;
107 return 0;
108}
109
110/* ......................................................................... */
111
112/*
113 * Watchdog device is opened, and watchdog starts running.
114 */
115static int ks8695_wdt_open(struct inode *inode, struct file *file)
116{
117 if (test_and_set_bit(0, &ks8695wdt_busy))
118 return -EBUSY;
119
120 ks8695_wdt_start();
121 return nonseekable_open(inode, file);
122}
123
124/*
125 * Close the watchdog device.
126 * If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also
127 * disabled.
128 */
129static int ks8695_wdt_close(struct inode *inode, struct file *file)
130{
131 if (!nowayout)
132 ks8695_wdt_stop(); /* Disable the watchdog when file is closed */
133
134 clear_bit(0, &ks8695wdt_busy);
135 return 0;
136}
137
138static struct watchdog_info ks8695_wdt_info = {
139 .identity = "ks8695 watchdog",
140 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
141};
142
143/*
144 * Handle commands from user-space.
145 */
146static int ks8695_wdt_ioctl(struct inode *inode, struct file *file,
147 unsigned int cmd, unsigned long arg)
148{
149 void __user *argp = (void __user *)arg;
150 int __user *p = argp;
151 int new_value;
152
153 switch(cmd) {
154 case WDIOC_KEEPALIVE:
155 ks8695_wdt_reload(); /* pat the watchdog */
156 return 0;
157
158 case WDIOC_GETSUPPORT:
159 return copy_to_user(argp, &ks8695_wdt_info, sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
160
161 case WDIOC_SETTIMEOUT:
162 if (get_user(new_value, p))
163 return -EFAULT;
164
165 if (ks8695_wdt_settimeout(new_value))
166 return -EINVAL;
167
168 /* Enable new time value */
169 ks8695_wdt_start();
170
171 /* Return current value */
172 return put_user(wdt_time, p);
173
174 case WDIOC_GETTIMEOUT:
175 return put_user(wdt_time, p);
176
177 case WDIOC_GETSTATUS:
178 case WDIOC_GETBOOTSTATUS:
179 return put_user(0, p);
180
181 case WDIOC_SETOPTIONS:
182 if (get_user(new_value, p))
183 return -EFAULT;
184
185 if (new_value & WDIOS_DISABLECARD)
186 ks8695_wdt_stop();
187 if (new_value & WDIOS_ENABLECARD)
188 ks8695_wdt_start();
189 return 0;
190
191 default:
192 return -ENOTTY;
193 }
194}
195
196/*
197 * Pat the watchdog whenever device is written to.
198 */
199static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
200{
201 ks8695_wdt_reload(); /* pat the watchdog */
202 return len;
203}
204
205/* ......................................................................... */
206
207static const struct file_operations ks8695wdt_fops = {
208 .owner = THIS_MODULE,
209 .llseek = no_llseek,
210 .ioctl = ks8695_wdt_ioctl,
211 .open = ks8695_wdt_open,
212 .release = ks8695_wdt_close,
213 .write = ks8695_wdt_write,
214};
215
216static struct miscdevice ks8695wdt_miscdev = {
217 .minor = WATCHDOG_MINOR,
218 .name = "watchdog",
219 .fops = &ks8695wdt_fops,
220};
221
222static int __init ks8695wdt_probe(struct platform_device *pdev)
223{
224 int res;
225
226 if (ks8695wdt_miscdev.parent)
227 return -EBUSY;
228 ks8695wdt_miscdev.parent = &pdev->dev;
229
230 res = misc_register(&ks8695wdt_miscdev);
231 if (res)
232 return res;
233
234 printk("KS8695 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
235 return 0;
236}
237
238static int __exit ks8695wdt_remove(struct platform_device *pdev)
239{
240 int res;
241
242 res = misc_deregister(&ks8695wdt_miscdev);
243 if (!res)
244 ks8695wdt_miscdev.parent = NULL;
245
246 return res;
247}
248
249static void ks8695wdt_shutdown(struct platform_device *pdev)
250{
251 ks8695_wdt_stop();
252}
253
254#ifdef CONFIG_PM
255
256static int ks8695wdt_suspend(struct platform_device *pdev, pm_message_t message)
257{
258 ks8695_wdt_stop();
259 return 0;
260}
261
262static int ks8695wdt_resume(struct platform_device *pdev)
263{
264 if (ks8695wdt_busy)
265 ks8695_wdt_start();
266 return 0;
267}
268
269#else
270#define ks8695wdt_suspend NULL
271#define ks8695wdt_resume NULL
272#endif
273
274static struct platform_driver ks8695wdt_driver = {
275 .probe = ks8695wdt_probe,
276 .remove = __exit_p(ks8695wdt_remove),
277 .shutdown = ks8695wdt_shutdown,
278 .suspend = ks8695wdt_suspend,
279 .resume = ks8695wdt_resume,
280 .driver = {
281 .name = "ks8695_wdt",
282 .owner = THIS_MODULE,
283 },
284};
285
286static int __init ks8695_wdt_init(void)
287{
288 /* Check that the heartbeat value is within range; if not reset to the default */
289 if (ks8695_wdt_settimeout(wdt_time)) {
290 ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
291 pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", wdt_time, WDT_MAX_TIME);
292 }
293
294 return platform_driver_register(&ks8695wdt_driver);
295}
296
297static void __exit ks8695_wdt_exit(void)
298{
299 platform_driver_unregister(&ks8695wdt_driver);
300}
301
302module_init(ks8695_wdt_init);
303module_exit(ks8695_wdt_exit);
304
305MODULE_AUTHOR("Andrew Victor");
306MODULE_DESCRIPTION("Watchdog driver for KS8695");
307MODULE_LICENSE("GPL");
308MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b234729706be..be6b93c20f60 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -699,9 +699,9 @@ static void evdev_disconnect(struct input_handle *handle)
699 if (evdev->open) { 699 if (evdev->open) {
700 input_flush_device(handle, NULL); 700 input_flush_device(handle, NULL);
701 input_close_device(handle); 701 input_close_device(handle);
702 wake_up_interruptible(&evdev->wait);
703 list_for_each_entry(client, &evdev->client_list, node) 702 list_for_each_entry(client, &evdev->client_list, node)
704 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 703 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
704 wake_up_interruptible(&evdev->wait);
705 } else 705 } else
706 evdev_free(evdev); 706 evdev_free(evdev);
707} 707}
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 06f0541b24da..10e3b7bc925f 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -594,9 +594,9 @@ static void joydev_disconnect(struct input_handle *handle)
594 594
595 if (joydev->open) { 595 if (joydev->open) {
596 input_close_device(handle); 596 input_close_device(handle);
597 wake_up_interruptible(&joydev->wait);
598 list_for_each_entry(client, &joydev->client_list, node) 597 list_for_each_entry(client, &joydev->client_list, node)
599 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 598 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
599 wake_up_interruptible(&joydev->wait);
600 } else 600 } else
601 joydev_free(joydev); 601 joydev_free(joydev);
602} 602}
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 86ad1027e12a..b069ee18e353 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -54,7 +54,7 @@ static struct db9_config db9_cfg[DB9_MAX_PORTS] __initdata;
54 54
55module_param_array_named(dev, db9_cfg[0].args, int, &db9_cfg[0].nargs, 0); 55module_param_array_named(dev, db9_cfg[0].args, int, &db9_cfg[0].nargs, 0);
56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)"); 56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)");
57module_param_array_named(dev2, db9_cfg[1].args, int, &db9_cfg[0].nargs, 0); 57module_param_array_named(dev2, db9_cfg[1].args, int, &db9_cfg[1].nargs, 0);
58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)"); 58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)");
59module_param_array_named(dev3, db9_cfg[2].args, int, &db9_cfg[2].nargs, 0); 59module_param_array_named(dev3, db9_cfg[2].args, int, &db9_cfg[2].nargs, 0);
60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)"); 60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)");
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index eb0167e9f0cb..50e06e8dd05d 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -48,7 +48,7 @@ config MOUSE_PS2_ALPS
48 If unsure, say Y. 48 If unsure, say Y.
49 49
50config MOUSE_PS2_LOGIPS2PP 50config MOUSE_PS2_LOGIPS2PP
51 bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED 51 bool "Logitech PS/2++ mouse protocol extension" if EMBEDDED
52 default y 52 default y
53 depends on MOUSE_PS2 53 depends on MOUSE_PS2
54 help 54 help
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 8675f9509393..3f4866d8d18c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -766,9 +766,9 @@ static void mousedev_disconnect(struct input_handle *handle)
766 766
767 if (mousedev->open) { 767 if (mousedev->open) {
768 input_close_device(handle); 768 input_close_device(handle);
769 wake_up_interruptible(&mousedev->wait);
770 list_for_each_entry(client, &mousedev->client_list, node) 769 list_for_each_entry(client, &mousedev->client_list, node)
771 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 770 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
771 wake_up_interruptible(&mousedev->wait);
772 } else 772 } else
773 mousedev_free(mousedev); 773 mousedev_free(mousedev);
774} 774}
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 8238b13874c2..2db364898e15 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -476,9 +476,9 @@ static void tsdev_disconnect(struct input_handle *handle)
476 476
477 if (tsdev->open) { 477 if (tsdev->open) {
478 input_close_device(handle); 478 input_close_device(handle);
479 wake_up_interruptible(&tsdev->wait);
480 list_for_each_entry(client, &tsdev->client_list, node) 479 list_for_each_entry(client, &tsdev->client_list, node)
481 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 480 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
481 wake_up_interruptible(&tsdev->wait);
482 } else 482 } else
483 tsdev_free(tsdev); 483 tsdev_free(tsdev);
484} 484}
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index f44c94abd883..ee699a7d6214 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -114,7 +114,7 @@ config PMAC_SMU
114config PMAC_APM_EMU 114config PMAC_APM_EMU
115 tristate "APM emulation" 115 tristate "APM emulation"
116 select APM_EMULATION 116 select APM_EMULATION
117 depends on ADB_PMU && PM 117 depends on ADB_PMU && PM && PPC32
118 118
119config PMAC_MEDIABAY 119config PMAC_MEDIABAY
120 bool "Support PowerBook hotswap media bay" 120 bool "Support PowerBook hotswap media bay"
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index 7772bd1d92b4..38e815a2e871 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -291,7 +291,7 @@ static void ucb1x00_ts_irq(int idx, void *id)
291 291
292static int ucb1x00_ts_open(struct input_dev *idev) 292static int ucb1x00_ts_open(struct input_dev *idev)
293{ 293{
294 struct ucb1x00_ts *ts = idev->private; 294 struct ucb1x00_ts *ts = input_get_drvdata(idev);
295 int ret = 0; 295 int ret = 0;
296 296
297 BUG_ON(ts->rtask); 297 BUG_ON(ts->rtask);
@@ -328,7 +328,7 @@ static int ucb1x00_ts_open(struct input_dev *idev)
328 */ 328 */
329static void ucb1x00_ts_close(struct input_dev *idev) 329static void ucb1x00_ts_close(struct input_dev *idev)
330{ 330{
331 struct ucb1x00_ts *ts = idev->private; 331 struct ucb1x00_ts *ts = input_get_drvdata(idev);
332 332
333 if (ts->rtask) 333 if (ts->rtask)
334 kthread_stop(ts->rtask); 334 kthread_stop(ts->rtask);
@@ -380,7 +380,6 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
380 ts->idev = idev; 380 ts->idev = idev;
381 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 381 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
382 382
383 idev->private = ts;
384 idev->name = "Touchscreen panel"; 383 idev->name = "Touchscreen panel";
385 idev->id.product = ts->ucb->id; 384 idev->id.product = ts->ucb->id;
386 idev->open = ucb1x00_ts_open; 385 idev->open = ucb1x00_ts_open;
@@ -391,6 +390,8 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
391 __set_bit(ABS_Y, idev->absbit); 390 __set_bit(ABS_Y, idev->absbit);
392 __set_bit(ABS_PRESSURE, idev->absbit); 391 __set_bit(ABS_PRESSURE, idev->absbit);
393 392
393 input_set_drvdata(idev, ts);
394
394 err = input_register_device(idev); 395 err = input_register_device(idev);
395 if (err) 396 if (err)
396 goto fail; 397 goto fail;
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 6c36a55cb3d1..95c0b96e83f2 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -740,7 +740,7 @@ static ssize_t hotkey_enable_store(struct device *dev,
740} 740}
741 741
742static struct device_attribute dev_attr_hotkey_enable = 742static struct device_attribute dev_attr_hotkey_enable =
743 __ATTR(enable, S_IWUSR | S_IRUGO, 743 __ATTR(hotkey_enable, S_IWUSR | S_IRUGO,
744 hotkey_enable_show, hotkey_enable_store); 744 hotkey_enable_show, hotkey_enable_store);
745 745
746/* sysfs hotkey mask --------------------------------------------------- */ 746/* sysfs hotkey mask --------------------------------------------------- */
@@ -775,7 +775,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
775} 775}
776 776
777static struct device_attribute dev_attr_hotkey_mask = 777static struct device_attribute dev_attr_hotkey_mask =
778 __ATTR(mask, S_IWUSR | S_IRUGO, 778 __ATTR(hotkey_mask, S_IWUSR | S_IRUGO,
779 hotkey_mask_show, hotkey_mask_store); 779 hotkey_mask_show, hotkey_mask_store);
780 780
781/* sysfs hotkey bios_enabled ------------------------------------------- */ 781/* sysfs hotkey bios_enabled ------------------------------------------- */
@@ -787,7 +787,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
787} 787}
788 788
789static struct device_attribute dev_attr_hotkey_bios_enabled = 789static struct device_attribute dev_attr_hotkey_bios_enabled =
790 __ATTR(bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL); 790 __ATTR(hotkey_bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);
791 791
792/* sysfs hotkey bios_mask ---------------------------------------------- */ 792/* sysfs hotkey bios_mask ---------------------------------------------- */
793static ssize_t hotkey_bios_mask_show(struct device *dev, 793static ssize_t hotkey_bios_mask_show(struct device *dev,
@@ -798,7 +798,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev,
798} 798}
799 799
800static struct device_attribute dev_attr_hotkey_bios_mask = 800static struct device_attribute dev_attr_hotkey_bios_mask =
801 __ATTR(bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL); 801 __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);
802 802
803/* --------------------------------------------------------------------- */ 803/* --------------------------------------------------------------------- */
804 804
@@ -824,8 +824,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
824 str_supported(tp_features.hotkey)); 824 str_supported(tp_features.hotkey));
825 825
826 if (tp_features.hotkey) { 826 if (tp_features.hotkey) {
827 hotkey_dev_attributes = create_attr_set(4, 827 hotkey_dev_attributes = create_attr_set(4, NULL);
828 TPACPI_HOTKEY_SYSFS_GROUP);
829 if (!hotkey_dev_attributes) 828 if (!hotkey_dev_attributes)
830 return -ENOMEM; 829 return -ENOMEM;
831 res = add_to_attr_set(hotkey_dev_attributes, 830 res = add_to_attr_set(hotkey_dev_attributes,
@@ -1050,7 +1049,7 @@ static ssize_t bluetooth_enable_store(struct device *dev,
1050} 1049}
1051 1050
1052static struct device_attribute dev_attr_bluetooth_enable = 1051static struct device_attribute dev_attr_bluetooth_enable =
1053 __ATTR(enable, S_IWUSR | S_IRUGO, 1052 __ATTR(bluetooth_enable, S_IWUSR | S_IRUGO,
1054 bluetooth_enable_show, bluetooth_enable_store); 1053 bluetooth_enable_show, bluetooth_enable_store);
1055 1054
1056/* --------------------------------------------------------------------- */ 1055/* --------------------------------------------------------------------- */
@@ -1061,7 +1060,6 @@ static struct attribute *bluetooth_attributes[] = {
1061}; 1060};
1062 1061
1063static const struct attribute_group bluetooth_attr_group = { 1062static const struct attribute_group bluetooth_attr_group = {
1064 .name = TPACPI_BLUETH_SYSFS_GROUP,
1065 .attrs = bluetooth_attributes, 1063 .attrs = bluetooth_attributes,
1066}; 1064};
1067 1065
@@ -1215,7 +1213,7 @@ static ssize_t wan_enable_store(struct device *dev,
1215} 1213}
1216 1214
1217static struct device_attribute dev_attr_wan_enable = 1215static struct device_attribute dev_attr_wan_enable =
1218 __ATTR(enable, S_IWUSR | S_IRUGO, 1216 __ATTR(wwan_enable, S_IWUSR | S_IRUGO,
1219 wan_enable_show, wan_enable_store); 1217 wan_enable_show, wan_enable_store);
1220 1218
1221/* --------------------------------------------------------------------- */ 1219/* --------------------------------------------------------------------- */
@@ -1226,7 +1224,6 @@ static struct attribute *wan_attributes[] = {
1226}; 1224};
1227 1225
1228static const struct attribute_group wan_attr_group = { 1226static const struct attribute_group wan_attr_group = {
1229 .name = TPACPI_WAN_SYSFS_GROUP,
1230 .attrs = wan_attributes, 1227 .attrs = wan_attributes,
1231}; 1228};
1232 1229
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 440145a02617..72d62f2dabb9 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -278,8 +278,6 @@ static int beep_write(char *buf);
278 * Bluetooth subdriver 278 * Bluetooth subdriver
279 */ 279 */
280 280
281#define TPACPI_BLUETH_SYSFS_GROUP "bluetooth"
282
283enum { 281enum {
284 /* ACPI GBDC/SBDC bits */ 282 /* ACPI GBDC/SBDC bits */
285 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ 283 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */
@@ -416,8 +414,6 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc);
416 * Hotkey subdriver 414 * Hotkey subdriver
417 */ 415 */
418 416
419#define TPACPI_HOTKEY_SYSFS_GROUP "hotkey"
420
421static int hotkey_orig_status; 417static int hotkey_orig_status;
422static int hotkey_orig_mask; 418static int hotkey_orig_mask;
423 419
@@ -553,8 +549,6 @@ static int volume_write(char *buf);
553 * Wan subdriver 549 * Wan subdriver
554 */ 550 */
555 551
556#define TPACPI_WAN_SYSFS_GROUP "wwan"
557
558enum { 552enum {
559 /* ACPI GWAN/SWAN bits */ 553 /* ACPI GWAN/SWAN bits */
560 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ 554 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 92055405cb30..451adcc52b3c 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -1,10 +1,9 @@
1# 1#
2# Makefile for the memory technology device drivers. 2# Makefile for the memory technology device drivers.
3# 3#
4# $Id: Makefile.common,v 1.7 2005/07/11 10:39:27 gleixner Exp $
5 4
6# Core functionality. 5# Core functionality.
7mtd-y := mtdcore.o 6mtd-y := mtdcore.o mtdsuper.o
8mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 7mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
9obj-$(CONFIG_MTD) += $(mtd-y) 8obj-$(CONFIG_MTD) += $(mtd-y)
10 9
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 389fea28b9a6..14ffb1a9302a 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/root_dev.h>
20#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h> 20#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
@@ -89,10 +88,6 @@ int __init uclinux_mtd_init(void)
89 uclinux_ram_mtdinfo = mtd; 88 uclinux_ram_mtdinfo = mtd;
90 add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS); 89 add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
91 90
92 printk("uclinux[mtd]: set %s to be root filesystem\n",
93 uclinux_romfs[0].name);
94 ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
95
96 return(0); 91 return(0);
97} 92}
98 93
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
new file mode 100644
index 000000000000..aca331971201
--- /dev/null
+++ b/drivers/mtd/mtdsuper.c
@@ -0,0 +1,232 @@
1/* MTD-based superblock management
2 *
3 * Copyright © 2001-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by: David Howells <dhowells@redhat.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/mtd/super.h>
14#include <linux/namei.h>
15#include <linux/ctype.h>
16
17/*
18 * compare superblocks to see if they're equivalent
19 * - they are if the underlying MTD device is the same
20 */
21static int get_sb_mtd_compare(struct super_block *sb, void *_mtd)
22{
23 struct mtd_info *mtd = _mtd;
24
25 if (sb->s_mtd == mtd) {
26 DEBUG(2, "MTDSB: Match on device %d (\"%s\")\n",
27 mtd->index, mtd->name);
28 return 1;
29 }
30
31 DEBUG(2, "MTDSB: No match, device %d (\"%s\"), device %d (\"%s\")\n",
32 sb->s_mtd->index, sb->s_mtd->name, mtd->index, mtd->name);
33 return 0;
34}
35
36/*
37 * mark the superblock by the MTD device it is using
38 * - set the device number to be the correct MTD block device for pesuperstence
39 * of NFS exports
40 */
41static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
42{
43 struct mtd_info *mtd = _mtd;
44
45 sb->s_mtd = mtd;
46 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
47 return 0;
48}
49
50/*
51 * get a superblock on an MTD-backed filesystem
52 */
53static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
54 const char *dev_name, void *data,
55 struct mtd_info *mtd,
56 int (*fill_super)(struct super_block *, void *, int),
57 struct vfsmount *mnt)
58{
59 struct super_block *sb;
60 int ret;
61
62 sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, mtd);
63 if (IS_ERR(sb))
64 goto out_error;
65
66 if (sb->s_root)
67 goto already_mounted;
68
69 /* fresh new superblock */
70 DEBUG(1, "MTDSB: New superblock for device %d (\"%s\")\n",
71 mtd->index, mtd->name);
72
73 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
74 if (ret < 0) {
75 up_write(&sb->s_umount);
76 deactivate_super(sb);
77 return ret;
78 }
79
80 /* go */
81 sb->s_flags |= MS_ACTIVE;
82 return simple_set_mnt(mnt, sb);
83
84 /* new mountpoint for an already mounted superblock */
85already_mounted:
86 DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
87 mtd->index, mtd->name);
88 ret = simple_set_mnt(mnt, sb);
89 goto out_put;
90
91out_error:
92 ret = PTR_ERR(sb);
93out_put:
94 put_mtd_device(mtd);
95 return ret;
96}
97
98/*
99 * get a superblock on an MTD-backed filesystem by MTD device number
100 */
101static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags,
102 const char *dev_name, void *data, int mtdnr,
103 int (*fill_super)(struct super_block *, void *, int),
104 struct vfsmount *mnt)
105{
106 struct mtd_info *mtd;
107
108 mtd = get_mtd_device(NULL, mtdnr);
109 if (IS_ERR(mtd)) {
110 DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
111 return PTR_ERR(mtd);
112 }
113
114 return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super,
115 mnt);
116}
117
118/*
119 * set up an MTD-based superblock
120 */
121int get_sb_mtd(struct file_system_type *fs_type, int flags,
122 const char *dev_name, void *data,
123 int (*fill_super)(struct super_block *, void *, int),
124 struct vfsmount *mnt)
125{
126 struct nameidata nd;
127 int mtdnr, ret;
128
129 if (!dev_name)
130 return -EINVAL;
131
132 DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name);
133
134 /* the preferred way of mounting in future; especially when
135 * CONFIG_BLOCK=n - we specify the underlying MTD device by number or
136 * by name, so that we don't require block device support to be present
137 * in the kernel. */
138 if (dev_name[0] == 'm' && dev_name[1] == 't' && dev_name[2] == 'd') {
139 if (dev_name[3] == ':') {
140 struct mtd_info *mtd;
141
142 /* mount by MTD device name */
143 DEBUG(1, "MTDSB: mtd:%%s, name \"%s\"\n",
144 dev_name + 4);
145
146 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
147 mtd = get_mtd_device(NULL, mtdnr);
148 if (!IS_ERR(mtd)) {
149 if (!strcmp(mtd->name, dev_name + 4))
150 return get_sb_mtd_aux(
151 fs_type, flags,
152 dev_name, data, mtd,
153 fill_super, mnt);
154
155 put_mtd_device(mtd);
156 }
157 }
158
159 printk(KERN_NOTICE "MTD:"
160 " MTD device with name \"%s\" not found.\n",
161 dev_name + 4);
162
163 } else if (isdigit(dev_name[3])) {
164 /* mount by MTD device number name */
165 char *endptr;
166
167 mtdnr = simple_strtoul(dev_name + 3, &endptr, 0);
168 if (!*endptr) {
169 /* It was a valid number */
170 DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n",
171 mtdnr);
172 return get_sb_mtd_nr(fs_type, flags,
173 dev_name, data,
174 mtdnr, fill_super, mnt);
175 }
176 }
177 }
178
179 /* try the old way - the hack where we allowed users to mount
180 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
181 */
182 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
183
184 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
185 ret, nd.dentry ? nd.dentry->d_inode : NULL);
186
187 if (ret)
188 return ret;
189
190 ret = -EINVAL;
191
192 if (!S_ISBLK(nd.dentry->d_inode->i_mode))
193 goto out;
194
195 if (nd.mnt->mnt_flags & MNT_NODEV) {
196 ret = -EACCES;
197 goto out;
198 }
199
200 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR)
201 goto not_an_MTD_device;
202
203 mtdnr = iminor(nd.dentry->d_inode);
204 path_release(&nd);
205
206 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
207 mnt);
208
209not_an_MTD_device:
210 if (!(flags & MS_SILENT))
211 printk(KERN_NOTICE
212 "MTD: Attempt to mount non-MTD device \"%s\"\n",
213 dev_name);
214out:
215 path_release(&nd);
216 return ret;
217
218}
219
220EXPORT_SYMBOL_GPL(get_sb_mtd);
221
222/*
223 * destroy an MTD-based superblock
224 */
225void kill_mtd_super(struct super_block *sb)
226{
227 generic_shutdown_super(sb);
228 put_mtd_device(sb->s_mtd);
229 sb->s_mtd = NULL;
230}
231
232EXPORT_SYMBOL_GPL(kill_mtd_super);
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index e8c9f27817b0..a804965e6542 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -435,20 +435,12 @@ static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
435 435
436 spin_lock_irqsave(&cp->lock, flags); 436 spin_lock_irqsave(&cp->lock, flags);
437 cp->vlgrp = grp; 437 cp->vlgrp = grp;
438 cp->cpcmd |= RxVlanOn; 438 if (grp)
439 cpw16(CpCmd, cp->cpcmd); 439 cp->cpcmd |= RxVlanOn;
440 spin_unlock_irqrestore(&cp->lock, flags); 440 else
441} 441 cp->cpcmd &= ~RxVlanOn;
442
443static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
444{
445 struct cp_private *cp = netdev_priv(dev);
446 unsigned long flags;
447 442
448 spin_lock_irqsave(&cp->lock, flags);
449 cp->cpcmd &= ~RxVlanOn;
450 cpw16(CpCmd, cp->cpcmd); 443 cpw16(CpCmd, cp->cpcmd);
451 vlan_group_set_device(cp->vlgrp, vid, NULL);
452 spin_unlock_irqrestore(&cp->lock, flags); 444 spin_unlock_irqrestore(&cp->lock, flags);
453} 445}
454#endif /* CP_VLAN_TAG_USED */ 446#endif /* CP_VLAN_TAG_USED */
@@ -1944,7 +1936,6 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1944#if CP_VLAN_TAG_USED 1936#if CP_VLAN_TAG_USED
1945 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1937 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1946 dev->vlan_rx_register = cp_vlan_rx_register; 1938 dev->vlan_rx_register = cp_vlan_rx_register;
1947 dev->vlan_rx_kill_vid = cp_vlan_rx_kill_vid;
1948#endif 1939#endif
1949 1940
1950 if (pci_using_dac) 1941 if (pci_using_dac)
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 7122b7ba8d61..04382f979c99 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -480,12 +480,10 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,
480#if ACENIC_DO_VLAN 480#if ACENIC_DO_VLAN
481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
482 dev->vlan_rx_register = ace_vlan_rx_register; 482 dev->vlan_rx_register = ace_vlan_rx_register;
483 dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid;
484#endif 483#endif
485 if (1) { 484
486 dev->tx_timeout = &ace_watchdog; 485 dev->tx_timeout = &ace_watchdog;
487 dev->watchdog_timeo = 5*HZ; 486 dev->watchdog_timeo = 5*HZ;
488 }
489 487
490 dev->open = &ace_open; 488 dev->open = &ace_open;
491 dev->stop = &ace_close; 489 dev->stop = &ace_close;
@@ -2283,19 +2281,6 @@ static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2283 ace_unmask_irq(dev); 2281 ace_unmask_irq(dev);
2284 local_irq_restore(flags); 2282 local_irq_restore(flags);
2285} 2283}
2286
2287
2288static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2289{
2290 struct ace_private *ap = netdev_priv(dev);
2291 unsigned long flags;
2292
2293 local_irq_save(flags);
2294 ace_mask_irq(dev);
2295 vlan_group_set_device(ap->vlgrp, vid, NULL);
2296 ace_unmask_irq(dev);
2297 local_irq_restore(flags);
2298}
2299#endif /* ACENIC_DO_VLAN */ 2284#endif /* ACENIC_DO_VLAN */
2300 2285
2301 2286
diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h
index 8ca8534d70bf..60ed1837fa8f 100644
--- a/drivers/net/acenic.h
+++ b/drivers/net/acenic.h
@@ -787,7 +787,6 @@ static struct net_device_stats *ace_get_stats(struct net_device *dev);
787static int read_eeprom_byte(struct net_device *dev, unsigned long offset); 787static int read_eeprom_byte(struct net_device *dev, unsigned long offset);
788#if ACENIC_DO_VLAN 788#if ACENIC_DO_VLAN
789static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp); 789static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp);
790static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
791#endif 790#endif
792 791
793#endif /* _ACENIC_H_ */ 792#endif /* _ACENIC_H_ */
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 84b81642011c..a61b2f89fc33 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1728,15 +1728,8 @@ static void amd8111e_vlan_rx_register(struct net_device *dev, struct vlan_group
1728 lp->vlgrp = grp; 1728 lp->vlgrp = grp;
1729 spin_unlock_irq(&lp->lock); 1729 spin_unlock_irq(&lp->lock);
1730} 1730}
1731
1732static void amd8111e_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1733{
1734 struct amd8111e_priv *lp = netdev_priv(dev);
1735 spin_lock_irq(&lp->lock);
1736 vlan_group_set_device(lp->vlgrp, vid, NULL);
1737 spin_unlock_irq(&lp->lock);
1738}
1739#endif 1731#endif
1732
1740static int amd8111e_enable_magicpkt(struct amd8111e_priv* lp) 1733static int amd8111e_enable_magicpkt(struct amd8111e_priv* lp)
1741{ 1734{
1742 writel( VAL1|MPPLBA, lp->mmio + CMD3); 1735 writel( VAL1|MPPLBA, lp->mmio + CMD3);
@@ -1996,7 +1989,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
1996#if AMD8111E_VLAN_TAG_USED 1989#if AMD8111E_VLAN_TAG_USED
1997 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; 1990 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ;
1998 dev->vlan_rx_register =amd8111e_vlan_rx_register; 1991 dev->vlan_rx_register =amd8111e_vlan_rx_register;
1999 dev->vlan_rx_kill_vid = amd8111e_vlan_rx_kill_vid;
2000#endif 1992#endif
2001 1993
2002 lp = netdev_priv(dev); 1994 lp = netdev_priv(dev);
@@ -2049,7 +2041,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
2049#if AMD8111E_VLAN_TAG_USED 2041#if AMD8111E_VLAN_TAG_USED
2050 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2042 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2051 dev->vlan_rx_register =amd8111e_vlan_rx_register; 2043 dev->vlan_rx_register =amd8111e_vlan_rx_register;
2052 dev->vlan_rx_kill_vid = amd8111e_vlan_rx_kill_vid;
2053#endif 2044#endif
2054 /* Probe the external PHY */ 2045 /* Probe the external PHY */
2055 amd8111e_probe_ext_phy(dev); 2046 amd8111e_probe_ext_phy(dev);
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 78cf00ff3d38..6862c11ff864 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1229,39 +1229,9 @@ static void atl1_vlan_rx_register(struct net_device *netdev,
1229 spin_unlock_irqrestore(&adapter->lock, flags); 1229 spin_unlock_irqrestore(&adapter->lock, flags);
1230} 1230}
1231 1231
1232/* FIXME: justify or remove -- CHS */
1233static void atl1_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1234{
1235 /* We don't do Vlan filtering */
1236 return;
1237}
1238
1239/* FIXME: this looks wrong too -- CHS */
1240static void atl1_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1241{
1242 struct atl1_adapter *adapter = netdev_priv(netdev);
1243 unsigned long flags;
1244
1245 spin_lock_irqsave(&adapter->lock, flags);
1246 /* atl1_irq_disable(adapter); */
1247 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1248 /* atl1_irq_enable(adapter); */
1249 spin_unlock_irqrestore(&adapter->lock, flags);
1250 /* We don't do Vlan filtering */
1251 return;
1252}
1253
1254static void atl1_restore_vlan(struct atl1_adapter *adapter) 1232static void atl1_restore_vlan(struct atl1_adapter *adapter)
1255{ 1233{
1256 atl1_vlan_rx_register(adapter->netdev, adapter->vlgrp); 1234 atl1_vlan_rx_register(adapter->netdev, adapter->vlgrp);
1257 if (adapter->vlgrp) {
1258 u16 vid;
1259 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
1260 if (!vlan_group_get_device(adapter->vlgrp, vid))
1261 continue;
1262 atl1_vlan_rx_add_vid(adapter->netdev, vid);
1263 }
1264 }
1265} 1235}
1266 1236
1267static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring) 1237static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring)
@@ -2203,8 +2173,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
2203 netdev->poll_controller = atl1_poll_controller; 2173 netdev->poll_controller = atl1_poll_controller;
2204#endif 2174#endif
2205 netdev->vlan_rx_register = atl1_vlan_rx_register; 2175 netdev->vlan_rx_register = atl1_vlan_rx_register;
2206 netdev->vlan_rx_add_vid = atl1_vlan_rx_add_vid; 2176
2207 netdev->vlan_rx_kill_vid = atl1_vlan_rx_kill_vid;
2208 netdev->ethtool_ops = &atl1_ethtool_ops; 2177 netdev->ethtool_ops = &atl1_ethtool_ops;
2209 adapter->bd_number = cards_found; 2178 adapter->bd_number = cards_found;
2210 adapter->pci_using_64 = pci_using_64; 2179 adapter->pci_using_64 = pci_using_64;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 88b33c6ddda8..da7c3b0c533c 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4786,19 +4786,6 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
4786 4786
4787 bnx2_netif_start(bp); 4787 bnx2_netif_start(bp);
4788} 4788}
4789
4790/* Called with rtnl_lock */
4791static void
4792bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
4793{
4794 struct bnx2 *bp = netdev_priv(dev);
4795
4796 bnx2_netif_stop(bp);
4797 vlan_group_set_device(bp->vlgrp, vid, NULL);
4798 bnx2_set_rx_mode(dev);
4799
4800 bnx2_netif_start(bp);
4801}
4802#endif 4789#endif
4803 4790
4804/* Called with netif_tx_lock. 4791/* Called with netif_tx_lock.
@@ -6453,7 +6440,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6453 dev->watchdog_timeo = TX_TIMEOUT; 6440 dev->watchdog_timeo = TX_TIMEOUT;
6454#ifdef BCM_VLAN 6441#ifdef BCM_VLAN
6455 dev->vlan_rx_register = bnx2_vlan_rx_register; 6442 dev->vlan_rx_register = bnx2_vlan_rx_register;
6456 dev->vlan_rx_kill_vid = bnx2_vlan_rx_kill_vid;
6457#endif 6443#endif
6458 dev->poll = bnx2_poll; 6444 dev->poll = bnx2_poll;
6459 dev->ethtool_ops = &bnx2_ethtool_ops; 6445 dev->ethtool_ops = &bnx2_ethtool_ops;
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 125c9b105869..231ce43b97cf 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -883,15 +883,6 @@ static void vlan_rx_register(struct net_device *dev,
883 t1_set_vlan_accel(adapter, grp != NULL); 883 t1_set_vlan_accel(adapter, grp != NULL);
884 spin_unlock_irq(&adapter->async_lock); 884 spin_unlock_irq(&adapter->async_lock);
885} 885}
886
887static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
888{
889 struct adapter *adapter = dev->priv;
890
891 spin_lock_irq(&adapter->async_lock);
892 vlan_group_set_device(adapter->vlan_grp, vid, NULL);
893 spin_unlock_irq(&adapter->async_lock);
894}
895#endif 886#endif
896 887
897#ifdef CONFIG_NET_POLL_CONTROLLER 888#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1099,7 +1090,6 @@ static int __devinit init_one(struct pci_dev *pdev,
1099 netdev->features |= 1090 netdev->features |=
1100 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1091 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1101 netdev->vlan_rx_register = vlan_rx_register; 1092 netdev->vlan_rx_register = vlan_rx_register;
1102 netdev->vlan_rx_kill_vid = vlan_rx_kill_vid;
1103#endif 1093#endif
1104 1094
1105 /* T204: disable TSO */ 1095 /* T204: disable TSO */
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 67b4b219d927..1b20f4060e2d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2067,11 +2067,6 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2067 t3_synchronize_rx(adapter, pi); 2067 t3_synchronize_rx(adapter, pi);
2068} 2068}
2069 2069
2070static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2071{
2072 /* nothing */
2073}
2074
2075#ifdef CONFIG_NET_POLL_CONTROLLER 2070#ifdef CONFIG_NET_POLL_CONTROLLER
2076static void cxgb_netpoll(struct net_device *dev) 2071static void cxgb_netpoll(struct net_device *dev)
2077{ 2072{
@@ -2409,7 +2404,6 @@ static int __devinit init_one(struct pci_dev *pdev,
2409 2404
2410 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2405 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2411 netdev->vlan_rx_register = vlan_rx_register; 2406 netdev->vlan_rx_register = vlan_rx_register;
2412 netdev->vlan_rx_kill_vid = vlan_rx_kill_vid;
2413 2407
2414 netdev->open = cxgb_open; 2408 netdev->open = cxgb_open;
2415 netdev->stop = cxgb_close; 2409 netdev->stop = cxgb_close;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 9ec35b7a8207..cf8af928a69c 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1142,13 +1142,16 @@ e1000_probe(struct pci_dev *pdev,
1142 !e1000_check_mng_mode(&adapter->hw)) 1142 !e1000_check_mng_mode(&adapter->hw))
1143 e1000_get_hw_control(adapter); 1143 e1000_get_hw_control(adapter);
1144 1144
1145 strcpy(netdev->name, "eth%d");
1146 if ((err = register_netdev(netdev)))
1147 goto err_register;
1148
1149 /* tell the stack to leave us alone until e1000_open() is called */ 1145 /* tell the stack to leave us alone until e1000_open() is called */
1150 netif_carrier_off(netdev); 1146 netif_carrier_off(netdev);
1151 netif_stop_queue(netdev); 1147 netif_stop_queue(netdev);
1148#ifdef CONFIG_E1000_NAPI
1149 netif_poll_disable(netdev);
1150#endif
1151
1152 strcpy(netdev->name, "eth%d");
1153 if ((err = register_netdev(netdev)))
1154 goto err_register;
1152 1155
1153 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); 1156 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
1154 1157
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 4154fd000746..32788ca40d25 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -4605,12 +4605,7 @@ static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
4605 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 4605 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
4606 4606
4607 spin_unlock_irq(&np->lock); 4607 spin_unlock_irq(&np->lock);
4608}; 4608}
4609
4610static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
4611{
4612 /* nothing to do */
4613};
4614 4609
4615/* The mgmt unit and driver use a semaphore to access the phy during init */ 4610/* The mgmt unit and driver use a semaphore to access the phy during init */
4616static int nv_mgmt_acquire_sema(struct net_device *dev) 4611static int nv_mgmt_acquire_sema(struct net_device *dev)
@@ -4956,7 +4951,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
4956 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; 4951 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE;
4957 dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; 4952 dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
4958 dev->vlan_rx_register = nv_vlan_rx_register; 4953 dev->vlan_rx_register = nv_vlan_rx_register;
4959 dev->vlan_rx_kill_vid = nv_vlan_rx_kill_vid;
4960 } 4954 }
4961 4955
4962 np->msi_flags = 0; 4956 np->msi_flags = 0;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index f5b3cba23fc5..6822bf14267b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -140,7 +140,6 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
140static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); 140static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length);
141static void gfar_vlan_rx_register(struct net_device *netdev, 141static void gfar_vlan_rx_register(struct net_device *netdev,
142 struct vlan_group *grp); 142 struct vlan_group *grp);
143static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
144void gfar_halt(struct net_device *dev); 143void gfar_halt(struct net_device *dev);
145void gfar_start(struct net_device *dev); 144void gfar_start(struct net_device *dev);
146static void gfar_clear_exact_match(struct net_device *dev); 145static void gfar_clear_exact_match(struct net_device *dev);
@@ -284,7 +283,6 @@ static int gfar_probe(struct platform_device *pdev)
284 283
285 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { 284 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
286 dev->vlan_rx_register = gfar_vlan_rx_register; 285 dev->vlan_rx_register = gfar_vlan_rx_register;
287 dev->vlan_rx_kill_vid = gfar_vlan_rx_kill_vid;
288 286
289 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 287 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
290 288
@@ -1133,20 +1131,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
1133 spin_unlock_irqrestore(&priv->rxlock, flags); 1131 spin_unlock_irqrestore(&priv->rxlock, flags);
1134} 1132}
1135 1133
1136
1137static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
1138{
1139 struct gfar_private *priv = netdev_priv(dev);
1140 unsigned long flags;
1141
1142 spin_lock_irqsave(&priv->rxlock, flags);
1143
1144 vlan_group_set_device(priv->vlgrp, vid, NULL);
1145
1146 spin_unlock_irqrestore(&priv->rxlock, flags);
1147}
1148
1149
1150static int gfar_change_mtu(struct net_device *dev, int new_mtu) 1134static int gfar_change_mtu(struct net_device *dev, int new_mtu)
1151{ 1135{
1152 int tempsize, tempval; 1136 int tempsize, tempval;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 5d14be7405a3..b53b7ad999bc 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1472,6 +1472,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1472 .set_sg = ethtool_op_set_sg, 1472 .set_sg = ethtool_op_set_sg,
1473 .get_tso = ethtool_op_get_tso, 1473 .get_tso = ethtool_op_get_tso,
1474 .set_tso = ethtool_op_set_tso, 1474 .set_tso = ethtool_op_set_tso,
1475 .get_link = ethtool_op_get_link,
1475 .get_strings = myri10ge_get_strings, 1476 .get_strings = myri10ge_get_strings,
1476 .get_stats_count = myri10ge_get_stats_count, 1477 .get_stats_count = myri10ge_get_stats_count,
1477 .get_ethtool_stats = myri10ge_get_ethtool_stats, 1478 .get_ethtool_stats = myri10ge_get_ethtool_stats,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 2c5c6d20e6e9..c61181f23bd5 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -654,8 +654,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
654 if (adapter->portnum == 0) 654 if (adapter->portnum == 0)
655 netxen_free_adapter_offload(adapter); 655 netxen_free_adapter_offload(adapter);
656 656
657 if (adapter->irq)
658 free_irq(adapter->irq, adapter);
659 if(adapter->portnum == 0) { 657 if(adapter->portnum == 0) {
660 /* leave the hw in the same state as reboot */ 658 /* leave the hw in the same state as reboot */
661 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 659 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 3439f8c649f9..717d8e9b9833 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -506,17 +506,6 @@ static void ns83820_vlan_rx_register(struct net_device *ndev, struct vlan_group
506 spin_unlock(&dev->tx_lock); 506 spin_unlock(&dev->tx_lock);
507 spin_unlock_irq(&dev->misc_lock); 507 spin_unlock_irq(&dev->misc_lock);
508} 508}
509
510static void ns83820_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid)
511{
512 struct ns83820 *dev = PRIV(ndev);
513
514 spin_lock_irq(&dev->misc_lock);
515 spin_lock(&dev->tx_lock);
516 vlan_group_set_device(dev->vlgrp, vid, NULL);
517 spin_unlock(&dev->tx_lock);
518 spin_unlock_irq(&dev->misc_lock);
519}
520#endif 509#endif
521 510
522/* Packet Receiver 511/* Packet Receiver
@@ -2083,7 +2072,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
2083 /* We also support hardware vlan acceleration */ 2072 /* We also support hardware vlan acceleration */
2084 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2073 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2085 ndev->vlan_rx_register = ns83820_vlan_rx_register; 2074 ndev->vlan_rx_register = ns83820_vlan_rx_register;
2086 ndev->vlan_rx_kill_vid = ns83820_vlan_rx_kill_vid;
2087#endif 2075#endif
2088 2076
2089 if (using_dac) { 2077 if (using_dac) {
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index d8766c0e8255..585be044ebbb 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -4044,7 +4044,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
4044 if (pci_using_dac) 4044 if (pci_using_dac)
4045 ndev->features |= NETIF_F_HIGHDMA; 4045 ndev->features |= NETIF_F_HIGHDMA;
4046 if (qdev->device_id == QL3032_DEVICE_ID) 4046 if (qdev->device_id == QL3032_DEVICE_ID)
4047 ndev->features |= (NETIF_F_HW_CSUM | NETIF_F_SG); 4047 ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
4048 4048
4049 qdev->mem_map_registers = 4049 qdev->mem_map_registers =
4050 ioremap_nocache(pci_resource_start(pdev, 1), 4050 ioremap_nocache(pci_resource_start(pdev, 1),
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 45876a854f00..5ec7752caa48 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -886,16 +886,6 @@ static void rtl8169_vlan_rx_register(struct net_device *dev,
886 spin_unlock_irqrestore(&tp->lock, flags); 886 spin_unlock_irqrestore(&tp->lock, flags);
887} 887}
888 888
889static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
890{
891 struct rtl8169_private *tp = netdev_priv(dev);
892 unsigned long flags;
893
894 spin_lock_irqsave(&tp->lock, flags);
895 vlan_group_set_device(tp->vlgrp, vid, NULL);
896 spin_unlock_irqrestore(&tp->lock, flags);
897}
898
899static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc, 889static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc,
900 struct sk_buff *skb) 890 struct sk_buff *skb)
901{ 891{
@@ -1671,7 +1661,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1671#ifdef CONFIG_R8169_VLAN 1661#ifdef CONFIG_R8169_VLAN
1672 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1662 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1673 dev->vlan_rx_register = rtl8169_vlan_rx_register; 1663 dev->vlan_rx_register = rtl8169_vlan_rx_register;
1674 dev->vlan_rx_kill_vid = rtl8169_vlan_rx_kill_vid;
1675#endif 1664#endif
1676 1665
1677#ifdef CONFIG_NET_POLL_CONTROLLER 1666#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e3e6d410d72c..c6ba3dee8ae0 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -340,17 +340,6 @@ static void s2io_vlan_rx_register(struct net_device *dev,
340/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ 340/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
341static int vlan_strip_flag; 341static int vlan_strip_flag;
342 342
343/* Unregister the vlan */
344static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
345{
346 struct s2io_nic *nic = dev->priv;
347 unsigned long flags;
348
349 spin_lock_irqsave(&nic->tx_lock, flags);
350 vlan_group_set_device(nic->vlgrp, vid, NULL);
351 spin_unlock_irqrestore(&nic->tx_lock, flags);
352}
353
354/* 343/*
355 * Constants to be programmed into the Xena's registers, to configure 344 * Constants to be programmed into the Xena's registers, to configure
356 * the XAUI. 345 * the XAUI.
@@ -7412,7 +7401,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7412 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 7401 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
7413 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7402 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
7414 dev->vlan_rx_register = s2io_vlan_rx_register; 7403 dev->vlan_rx_register = s2io_vlan_rx_register;
7415 dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
7416 7404
7417 /* 7405 /*
7418 * will use eth_mac_addr() for dev->set_mac_address 7406 * will use eth_mac_addr() for dev->set_mac_address
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index adfbe81693a6..fe01b961b597 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1049,26 +1049,22 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1049 u16 port = sky2->port; 1049 u16 port = sky2->port;
1050 1050
1051 netif_tx_lock_bh(dev); 1051 netif_tx_lock_bh(dev);
1052 netif_poll_disable(sky2->hw->dev[0]);
1052 1053
1053 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_ON);
1054 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
1055 sky2->vlgrp = grp; 1054 sky2->vlgrp = grp;
1055 if (grp) {
1056 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1057 RX_VLAN_STRIP_ON);
1058 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1059 TX_VLAN_TAG_ON);
1060 } else {
1061 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1062 RX_VLAN_STRIP_OFF);
1063 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1064 TX_VLAN_TAG_OFF);
1065 }
1056 1066
1057 netif_tx_unlock_bh(dev); 1067 netif_poll_enable(sky2->hw->dev[0]);
1058}
1059
1060static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1061{
1062 struct sky2_port *sky2 = netdev_priv(dev);
1063 struct sky2_hw *hw = sky2->hw;
1064 u16 port = sky2->port;
1065
1066 netif_tx_lock_bh(dev);
1067
1068 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
1069 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
1070 vlan_group_set_device(sky2->vlgrp, vid, NULL);
1071
1072 netif_tx_unlock_bh(dev); 1068 netif_tx_unlock_bh(dev);
1073} 1069}
1074#endif 1070#endif
@@ -3484,7 +3480,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3484#ifdef SKY2_VLAN_TAG_USED 3480#ifdef SKY2_VLAN_TAG_USED
3485 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 3481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3486 dev->vlan_rx_register = sky2_vlan_rx_register; 3482 dev->vlan_rx_register = sky2_vlan_rx_register;
3487 dev->vlan_rx_kill_vid = sky2_vlan_rx_kill_vid;
3488#endif 3483#endif
3489 3484
3490 /* read the mac address */ 3485 /* read the mac address */
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 111f23d05764..506bffcbc6dc 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -281,17 +281,14 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
281 281
282#elif defined(CONFIG_SUPERH) 282#elif defined(CONFIG_SUPERH)
283 283
284#if defined(CONFIG_SH_7780_SOLUTION_ENGINE) || defined(CONFIG_SH_7722_SOLUTION_ENGINE) 284#ifdef CONFIG_SOLUTION_ENGINE
285#define SMC_CAN_USE_8BIT 0 285#define SMC_CAN_USE_8BIT 0
286#define SMC_CAN_USE_16BIT 1 286#define SMC_CAN_USE_16BIT 1
287#define SMC_CAN_USE_32BIT 0 287#define SMC_CAN_USE_32BIT 0
288#define SMC_IO_SHIFT 0 288#define SMC_IO_SHIFT 0
289#define SMC_NOWAIT 1 289#define SMC_NOWAIT 1
290 290
291#define SMC_inb(a, r) (inw((a) + ((r)&~1)) >> (8*(r%2)))&0xff
292#define SMC_inw(a, r) inw((a) + (r)) 291#define SMC_inw(a, r) inw((a) + (r))
293#define SMC_outb(v, a, r) outw(((inw((a)+((r)&~1))*(0xff<<8*(r%2)))) | ((v)<<(8*(r&2)))), (a) + ((r)&~1))
294
295#define SMC_outw(v, a, r) outw(v, (a) + (r)) 292#define SMC_outw(v, a, r) outw(v, (a) + (r))
296#define SMC_insw(a, r, p, l) insw((a) + (r), p, l) 293#define SMC_insw(a, r, p, l) insw((a) + (r), p, l)
297#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) 294#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l)
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index ef84d7c757a0..b47ad1df2e0c 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1191,43 +1191,6 @@ spider_net_poll(struct net_device *netdev, int *budget)
1191} 1191}
1192 1192
1193/** 1193/**
1194 * spider_net_vlan_rx_reg - initializes VLAN structures in the driver and card
1195 * @netdev: interface device structure
1196 * @grp: vlan_group structure that is registered (NULL on destroying interface)
1197 */
1198static void
1199spider_net_vlan_rx_reg(struct net_device *netdev, struct vlan_group *grp)
1200{
1201 /* further enhancement... yet to do */
1202 return;
1203}
1204
1205/**
1206 * spider_net_vlan_rx_add - adds VLAN id to the card filter
1207 * @netdev: interface device structure
1208 * @vid: VLAN id to add
1209 */
1210static void
1211spider_net_vlan_rx_add(struct net_device *netdev, uint16_t vid)
1212{
1213 /* further enhancement... yet to do */
1214 /* add vid to card's VLAN filter table */
1215 return;
1216}
1217
1218/**
1219 * spider_net_vlan_rx_kill - removes VLAN id to the card filter
1220 * @netdev: interface device structure
1221 * @vid: VLAN id to remove
1222 */
1223static void
1224spider_net_vlan_rx_kill(struct net_device *netdev, uint16_t vid)
1225{
1226 /* further enhancement... yet to do */
1227 /* remove vid from card's VLAN filter table */
1228}
1229
1230/**
1231 * spider_net_get_stats - get interface statistics 1194 * spider_net_get_stats - get interface statistics
1232 * @netdev: interface device structure 1195 * @netdev: interface device structure
1233 * 1196 *
@@ -2177,9 +2140,6 @@ spider_net_setup_netdev_ops(struct net_device *netdev)
2177 netdev->poll = &spider_net_poll; 2140 netdev->poll = &spider_net_poll;
2178 netdev->weight = SPIDER_NET_NAPI_WEIGHT; 2141 netdev->weight = SPIDER_NET_NAPI_WEIGHT;
2179 /* HW VLAN */ 2142 /* HW VLAN */
2180 netdev->vlan_rx_register = &spider_net_vlan_rx_reg;
2181 netdev->vlan_rx_add_vid = &spider_net_vlan_rx_add;
2182 netdev->vlan_rx_kill_vid = &spider_net_vlan_rx_kill;
2183#ifdef CONFIG_NET_POLL_CONTROLLER 2143#ifdef CONFIG_NET_POLL_CONTROLLER
2184 /* poll controller */ 2144 /* poll controller */
2185 netdev->poll_controller = &spider_net_poll_controller; 2145 netdev->poll_controller = &spider_net_poll_controller;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 923b9c725cc3..2f3184184ad9 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.76" 67#define DRV_MODULE_VERSION "3.77"
68#define DRV_MODULE_RELDATE "May 5, 2007" 68#define DRV_MODULE_RELDATE "May 31, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -9121,21 +9121,6 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
9121 if (netif_running(dev)) 9121 if (netif_running(dev))
9122 tg3_netif_start(tp); 9122 tg3_netif_start(tp);
9123} 9123}
9124
9125static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
9126{
9127 struct tg3 *tp = netdev_priv(dev);
9128
9129 if (netif_running(dev))
9130 tg3_netif_stop(tp);
9131
9132 tg3_full_lock(tp, 0);
9133 vlan_group_set_device(tp->vlgrp, vid, NULL);
9134 tg3_full_unlock(tp);
9135
9136 if (netif_running(dev))
9137 tg3_netif_start(tp);
9138}
9139#endif 9124#endif
9140 9125
9141static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) 9126static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
@@ -10976,6 +10961,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10976 * upon subsystem IDs. 10961 * upon subsystem IDs.
10977 */ 10962 */
10978 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL && 10963 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
10964 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
10979 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 10965 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
10980 tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT | 10966 tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT |
10981 TG3_FLAG_USE_LINKCHG_REG); 10967 TG3_FLAG_USE_LINKCHG_REG);
@@ -11778,7 +11764,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11778#if TG3_VLAN_TAG_USED 11764#if TG3_VLAN_TAG_USED
11779 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 11765 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
11780 dev->vlan_rx_register = tg3_vlan_rx_register; 11766 dev->vlan_rx_register = tg3_vlan_rx_register;
11781 dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid;
11782#endif 11767#endif
11783 11768
11784 tp = netdev_priv(dev); 11769 tp = netdev_priv(dev);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index f72573594121..15b2fb8aa492 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -741,15 +741,6 @@ typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
741 spin_unlock_bh(&tp->state_lock); 741 spin_unlock_bh(&tp->state_lock);
742} 742}
743 743
744static void
745typhoon_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
746{
747 struct typhoon *tp = netdev_priv(dev);
748 spin_lock_bh(&tp->state_lock);
749 vlan_group_set_device(tp->vlgrp, vid, NULL);
750 spin_unlock_bh(&tp->state_lock);
751}
752
753static inline void 744static inline void
754typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing, 745typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
755 u32 ring_dma) 746 u32 ring_dma)
@@ -2542,7 +2533,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2542 dev->get_stats = typhoon_get_stats; 2533 dev->get_stats = typhoon_get_stats;
2543 dev->set_mac_address = typhoon_set_mac_address; 2534 dev->set_mac_address = typhoon_set_mac_address;
2544 dev->vlan_rx_register = typhoon_vlan_rx_register; 2535 dev->vlan_rx_register = typhoon_vlan_rx_register;
2545 dev->vlan_rx_kill_vid = typhoon_vlan_rx_kill_vid; 2536
2546 SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops); 2537 SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);
2547 2538
2548 /* We can handle scatter gather, up to 16 entries, and 2539 /* We can handle scatter gather, up to 16 entries, and
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 572034ceb143..2b2f5c12019b 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1532,6 +1532,7 @@ source "drivers/scsi/arm/Kconfig"
1532config JAZZ_ESP 1532config JAZZ_ESP
1533 bool "MIPS JAZZ FAS216 SCSI support" 1533 bool "MIPS JAZZ FAS216 SCSI support"
1534 depends on MACH_JAZZ && SCSI 1534 depends on MACH_JAZZ && SCSI
1535 select SCSI_SPI_ATTRS
1535 help 1536 help
1536 This is the driver for the onboard SCSI host adapter of MIPS Magnum 1537 This is the driver for the onboard SCSI host adapter of MIPS Magnum
1537 4000, Acer PICA, Olivetti M700-10 and a few other identical OEM 1538 4000, Acer PICA, Olivetti M700-10 and a few other identical OEM
@@ -1756,6 +1757,7 @@ config SUN3X_ESP
1756config SCSI_SUNESP 1757config SCSI_SUNESP
1757 tristate "Sparc ESP Scsi Driver" 1758 tristate "Sparc ESP Scsi Driver"
1758 depends on SBUS && SCSI 1759 depends on SBUS && SCSI
1760 select SCSI_SPI_ATTRS
1759 help 1761 help
1760 This is the driver for the Sun ESP SCSI host adapter. The ESP 1762 This is the driver for the Sun ESP SCSI host adapter. The ESP
1761 chipset is present in most SPARC SBUS-based computers. 1763 chipset is present in most SPARC SBUS-based computers.
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 350ea7feb61d..5c487ff096c7 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -863,6 +863,14 @@ static struct scsi_host_template aac_driver_template = {
863 .emulated = 1, 863 .emulated = 1,
864}; 864};
865 865
866static void __aac_shutdown(struct aac_dev * aac)
867{
868 kthread_stop(aac->thread);
869 aac_send_shutdown(aac);
870 aac_adapter_disable_int(aac);
871 free_irq(aac->pdev->irq, aac);
872}
873
866static int __devinit aac_probe_one(struct pci_dev *pdev, 874static int __devinit aac_probe_one(struct pci_dev *pdev,
867 const struct pci_device_id *id) 875 const struct pci_device_id *id)
868{ 876{
@@ -1015,10 +1023,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1015 return 0; 1023 return 0;
1016 1024
1017 out_deinit: 1025 out_deinit:
1018 kthread_stop(aac->thread); 1026 __aac_shutdown(aac);
1019 aac_send_shutdown(aac);
1020 aac_adapter_disable_int(aac);
1021 free_irq(pdev->irq, aac);
1022 out_unmap: 1027 out_unmap:
1023 aac_fib_map_free(aac); 1028 aac_fib_map_free(aac);
1024 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); 1029 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
@@ -1038,7 +1043,8 @@ static void aac_shutdown(struct pci_dev *dev)
1038{ 1043{
1039 struct Scsi_Host *shost = pci_get_drvdata(dev); 1044 struct Scsi_Host *shost = pci_get_drvdata(dev);
1040 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; 1045 struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
1041 aac_send_shutdown(aac); 1046 scsi_block_requests(shost);
1047 __aac_shutdown(aac);
1042} 1048}
1043 1049
1044static void __devexit aac_remove_one(struct pci_dev *pdev) 1050static void __devexit aac_remove_one(struct pci_dev *pdev)
@@ -1048,16 +1054,12 @@ static void __devexit aac_remove_one(struct pci_dev *pdev)
1048 1054
1049 scsi_remove_host(shost); 1055 scsi_remove_host(shost);
1050 1056
1051 kthread_stop(aac->thread); 1057 __aac_shutdown(aac);
1052
1053 aac_send_shutdown(aac);
1054 aac_adapter_disable_int(aac);
1055 aac_fib_map_free(aac); 1058 aac_fib_map_free(aac);
1056 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, 1059 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr,
1057 aac->comm_phys); 1060 aac->comm_phys);
1058 kfree(aac->queues); 1061 kfree(aac->queues);
1059 1062
1060 free_irq(pdev->irq, aac);
1061 aac_adapter_ioremap(aac, 0); 1063 aac_adapter_ioremap(aac, 0);
1062 1064
1063 kfree(aac->fibs); 1065 kfree(aac->fibs);
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index eff846ae0aff..03dbe60c264a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -894,45 +894,6 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
894} 894}
895 895
896/* 896/*
897 * our own old-style timeout update
898 */
899/*
900 * The strategy is to cause the timer code to call scsi_times_out()
901 * when the soonest timeout is pending.
902 * The arguments are used when we are queueing a new command, because
903 * we do not want to subtract the time used from this time, but when we
904 * set the timer, we want to take this value into account.
905 */
906
907int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout)
908{
909 int rtn;
910
911 /*
912 * We are using the new error handling code to actually register/deregister
913 * timers for timeout.
914 */
915
916 if (!timer_pending(&SCset->eh_timeout))
917 rtn = 0;
918 else
919 rtn = SCset->eh_timeout.expires - jiffies;
920
921 if (timeout == 0) {
922 del_timer(&SCset->eh_timeout);
923 SCset->eh_timeout.data = (unsigned long)NULL;
924 SCset->eh_timeout.expires = 0;
925 } else {
926 if (SCset->eh_timeout.data != (unsigned long)NULL)
927 del_timer(&SCset->eh_timeout);
928 SCset->eh_timeout.data = (unsigned long)SCset;
929 SCset->eh_timeout.expires = jiffies + timeout;
930 add_timer(&SCset->eh_timeout);
931 }
932 return rtn;
933}
934
935/*
936 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, 897 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd,
937 * void (*done)(Scsi_Cmnd *)) 898 * void (*done)(Scsi_Cmnd *))
938 * 899 *
@@ -956,7 +917,6 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
956 Scsi_Cmnd *tmp; 917 Scsi_Cmnd *tmp;
957 int oldto; 918 int oldto;
958 unsigned long flags; 919 unsigned long flags;
959 // extern int update_timeout(Scsi_Cmnd * SCset, int timeout);
960 920
961#if (NDEBUG & NDEBUG_NO_WRITE) 921#if (NDEBUG & NDEBUG_NO_WRITE)
962 switch (cmd->cmnd[0]) { 922 switch (cmd->cmnd[0]) {
@@ -1029,9 +989,9 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1029 * alter queues and touch the lock. 989 * alter queues and touch the lock.
1030 */ 990 */
1031 if (!IS_A_TT()) { 991 if (!IS_A_TT()) {
1032 oldto = atari_scsi_update_timeout(cmd, 0); 992 /* perhaps stop command timer here */
1033 falcon_get_lock(); 993 falcon_get_lock();
1034 atari_scsi_update_timeout(cmd, oldto); 994 /* perhaps restart command timer here */
1035 } 995 }
1036 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { 996 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
1037 LIST(cmd, hostdata->issue_queue); 997 LIST(cmd, hostdata->issue_queue);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index dd076da86a46..b98136adaaae 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2590,7 +2590,7 @@ qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
2590 return 0; 2590 return 0;
2591 if (msleep_interruptible(step)) 2591 if (msleep_interruptible(step))
2592 break; 2592 break;
2593 } while (--iterations >= 0); 2593 } while (--iterations > 0);
2594 2594
2595 return -ETIMEDOUT; 2595 return -ETIMEDOUT;
2596} 2596}
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a67f315244d7..662577fbe7a8 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -184,6 +184,15 @@ int scsi_complete_async_scans(void)
184/* Only exported for the benefit of scsi_wait_scan */ 184/* Only exported for the benefit of scsi_wait_scan */
185EXPORT_SYMBOL_GPL(scsi_complete_async_scans); 185EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
186 186
187#ifndef MODULE
188/*
189 * For async scanning we need to wait for all the scans to complete before
190 * trying to mount the root fs. Otherwise non-modular drivers may not be ready
191 * yet.
192 */
193late_initcall(scsi_complete_async_scans);
194#endif
195
187/** 196/**
188 * scsi_unlock_floptical - unlock device via a special MODE SENSE command 197 * scsi_unlock_floptical - unlock device via a special MODE SENSE command
189 * @sdev: scsi device to send command to 198 * @sdev: scsi device to send command to
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c3219b29b5ac..4831edbae2d5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -411,7 +411,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
411 */ 411 */
412int spi_register_master(struct spi_master *master) 412int spi_register_master(struct spi_master *master)
413{ 413{
414 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); 414 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<15) - 1);
415 struct device *dev = master->cdev.dev; 415 struct device *dev = master->cdev.dev;
416 int status = -ENODEV; 416 int status = -ENODEV;
417 int dynamic = 0; 417 int dynamic = 0;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6e1f1ea21b38..403dac787ebf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -755,7 +755,7 @@ config FB_LEO
755 755
756config FB_IGA 756config FB_IGA
757 bool "IGA 168x display support" 757 bool "IGA 168x display support"
758 depends on FB && SPARC32 758 depends on (FB = y) && SPARC32
759 select FB_CFB_FILLRECT 759 select FB_CFB_FILLRECT
760 select FB_CFB_COPYAREA 760 select FB_CFB_COPYAREA
761 select FB_CFB_IMAGEBLIT 761 select FB_CFB_IMAGEBLIT
@@ -765,7 +765,7 @@ config FB_IGA
765 765
766config FB_XVR500 766config FB_XVR500
767 bool "Sun XVR-500 3DLABS Wildcat support" 767 bool "Sun XVR-500 3DLABS Wildcat support"
768 depends on FB && PCI && SPARC64 768 depends on (FB = y) && PCI && SPARC64
769 select FB_CFB_FILLRECT 769 select FB_CFB_FILLRECT
770 select FB_CFB_COPYAREA 770 select FB_CFB_COPYAREA
771 select FB_CFB_IMAGEBLIT 771 select FB_CFB_IMAGEBLIT
@@ -778,7 +778,7 @@ config FB_XVR500
778 778
779config FB_XVR2500 779config FB_XVR2500
780 bool "Sun XVR-2500 3DLABS Wildcat support" 780 bool "Sun XVR-2500 3DLABS Wildcat support"
781 depends on FB && PCI && SPARC64 781 depends on (FB = y) && PCI && SPARC64
782 select FB_CFB_FILLRECT 782 select FB_CFB_FILLRECT
783 select FB_CFB_COPYAREA 783 select FB_CFB_COPYAREA
784 select FB_CFB_IMAGEBLIT 784 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 9b26dda18a38..ac46cc3f6a2a 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -47,7 +47,7 @@ targets := promcon_tbl.c
47quiet_cmd_conmakehash = CNMKHSH $@ 47quiet_cmd_conmakehash = CNMKHSH $@
48 cmd_conmakehash = scripts/conmakehash $< | \ 48 cmd_conmakehash = scripts/conmakehash $< | \
49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \ 49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
50 -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ 50 -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@
51 51
52$(obj)/promcon_tbl.c: $(src)/prom.uni 52$(obj)/promcon_tbl.c: $(src)/prom.uni
53 $(call cmd,conmakehash) 53 $(call cmd,conmakehash)
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 1d4e8354b561..3f6c98fad437 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -656,7 +656,7 @@ static int ffb_setcolreg(unsigned regno,
656{ 656{
657 u32 value; 657 u32 value;
658 658
659 if (regno >= 256) 659 if (regno >= 16)
660 return 1; 660 return 1;
661 661
662 red >>= 8; 662 red >>= 8;
@@ -903,7 +903,7 @@ ffb_init_fix(struct fb_info *info)
903struct all_info { 903struct all_info {
904 struct fb_info info; 904 struct fb_info info;
905 struct ffb_par par; 905 struct ffb_par par;
906 u32 pseudo_palette[256]; 906 u32 pseudo_palette[16];
907}; 907};
908 908
909static int ffb_init_one(struct of_device *op) 909static int ffb_init_one(struct of_device *op)
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 4316c7fe8e21..c3869a96ab58 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -28,7 +28,7 @@ struct s3d_info {
28 unsigned int depth; 28 unsigned int depth;
29 unsigned int fb_size; 29 unsigned int fb_size;
30 30
31 u32 pseudo_palette[256]; 31 u32 pseudo_palette[16];
32}; 32};
33 33
34static int __devinit s3d_get_props(struct s3d_info *sp) 34static int __devinit s3d_get_props(struct s3d_info *sp)
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno,
52{ 52{
53 u32 value; 53 u32 value;
54 54
55 if (regno >= 256) 55 if (regno < 16) {
56 return 1; 56 red >>= 8;
57 green >>= 8;
58 blue >>= 8;
57 59
58 red >>= 8; 60 value = (blue << 24) | (green << 16) | (red << 8);
59 green >>= 8; 61 ((u32 *)info->pseudo_palette)[regno] = value;
60 blue >>= 8; 62 }
61
62 value = (blue << 24) | (green << 16) | (red << 8);
63 ((u32 *)info->pseudo_palette)[regno] = value;
64 63
65 return 0; 64 return 0;
66} 65}
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index 08880a62bfa3..71bf3f1f00bc 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -50,7 +50,7 @@ struct e3d_info {
50 u32 fb8_0_off; 50 u32 fb8_0_off;
51 u32 fb8_1_off; 51 u32 fb8_1_off;
52 52
53 u32 pseudo_palette[256]; 53 u32 pseudo_palette[16];
54}; 54};
55 55
56static int __devinit e3d_get_props(struct e3d_info *ep) 56static int __devinit e3d_get_props(struct e3d_info *ep)
@@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno,
126 blue_8 = blue >> 8; 126 blue_8 = blue >> 8;
127 127
128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8); 128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
129 ((u32 *)info->pseudo_palette)[regno] = value; 129
130 if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16)
131 ((u32 *)info->pseudo_palette)[regno] = value;
130 132
131 133
132 red_10 = red >> 6; 134 red_10 = red >> 6;
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 479c1038ed4a..8c90cbc903fa 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -12,6 +12,7 @@
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/security.h> 13#include <linux/security.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/kallsyms.h>
15 16
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
17#include <asm/ioctls.h> 18#include <asm/ioctls.h>
@@ -20,6 +21,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
20 unsigned long arg) 21 unsigned long arg)
21{ 22{
22 int error = -ENOTTY; 23 int error = -ENOTTY;
24 void *f;
23 25
24 if (!filp->f_op) 26 if (!filp->f_op)
25 goto out; 27 goto out;
@@ -29,10 +31,16 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
29 if (error == -ENOIOCTLCMD) 31 if (error == -ENOIOCTLCMD)
30 error = -EINVAL; 32 error = -EINVAL;
31 goto out; 33 goto out;
32 } else if (filp->f_op->ioctl) { 34 } else if ((f = filp->f_op->ioctl)) {
33 lock_kernel(); 35 lock_kernel();
34 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, 36 if (!filp->f_op->ioctl) {
35 filp, cmd, arg); 37 printk("%s: ioctl %p disappeared\n", __FUNCTION__, f);
38 print_symbol("symbol: %s\n", (unsigned long)f);
39 dump_stack();
40 } else {
41 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
42 filp, cmd, arg);
43 }
36 unlock_kernel(); 44 unlock_kernel();
37 } 45 }
38 46
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 4884d5edfe65..12e83f67eee4 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -229,9 +229,16 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
229 check anyway. */ 229 check anyway. */
230 if (!tn->fn->size) { 230 if (!tn->fn->size) {
231 if (rii->mdata_tn) { 231 if (rii->mdata_tn) {
232 /* We had a candidate mdata node already */ 232 if (rii->mdata_tn->version < tn->version) {
233 dbg_readinode("kill old mdata with ver %d\n", rii->mdata_tn->version); 233 /* We had a candidate mdata node already */
234 jffs2_kill_tn(c, rii->mdata_tn); 234 dbg_readinode("kill old mdata with ver %d\n", rii->mdata_tn->version);
235 jffs2_kill_tn(c, rii->mdata_tn);
236 } else {
237 dbg_readinode("kill new mdata with ver %d (older than existing %d\n",
238 tn->version, rii->mdata_tn->version);
239 jffs2_kill_tn(c, tn);
240 return 0;
241 }
235 } 242 }
236 rii->mdata_tn = tn; 243 rii->mdata_tn = tn;
237 dbg_readinode("keep new mdata with ver %d\n", tn->version); 244 dbg_readinode("keep new mdata with ver %d\n", tn->version);
@@ -1044,7 +1051,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1044 1051
1045 case JFFS2_NODETYPE_DIRENT: 1052 case JFFS2_NODETYPE_DIRENT:
1046 1053
1047 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent)) { 1054 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent) &&
1055 len < sizeof(struct jffs2_raw_dirent)) {
1048 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf); 1056 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf);
1049 if (unlikely(err)) 1057 if (unlikely(err))
1050 goto free_out; 1058 goto free_out;
@@ -1058,7 +1066,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1058 1066
1059 case JFFS2_NODETYPE_INODE: 1067 case JFFS2_NODETYPE_INODE:
1060 1068
1061 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode)) { 1069 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode) &&
1070 len < sizeof(struct jffs2_raw_inode)) {
1062 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf); 1071 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf);
1063 if (unlikely(err)) 1072 if (unlikely(err))
1064 goto free_out; 1073 goto free_out;
@@ -1071,7 +1080,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1071 break; 1080 break;
1072 1081
1073 default: 1082 default:
1074 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node)) { 1083 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node) &&
1084 len < sizeof(struct jffs2_unknown_node)) {
1075 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf); 1085 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf);
1076 if (unlikely(err)) 1086 if (unlikely(err))
1077 goto free_out; 1087 goto free_out;
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 6488af43bc9b..e220d3bd610d 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -19,7 +19,7 @@
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/jffs2.h> 20#include <linux/jffs2.h>
21#include <linux/pagemap.h> 21#include <linux/pagemap.h>
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/super.h>
23#include <linux/ctype.h> 23#include <linux/ctype.h>
24#include <linux/namei.h> 24#include <linux/namei.h>
25#include "compr.h" 25#include "compr.h"
@@ -75,69 +75,27 @@ static const struct super_operations jffs2_super_operations =
75 .sync_fs = jffs2_sync_fs, 75 .sync_fs = jffs2_sync_fs,
76}; 76};
77 77
78static int jffs2_sb_compare(struct super_block *sb, void *data) 78/*
79{ 79 * fill in the superblock
80 struct jffs2_sb_info *p = data; 80 */
81 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 81static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
82
83 /* The superblocks are considered to be equivalent if the underlying MTD
84 device is the same one */
85 if (c->mtd == p->mtd) {
86 D1(printk(KERN_DEBUG "jffs2_sb_compare: match on device %d (\"%s\")\n", p->mtd->index, p->mtd->name));
87 return 1;
88 } else {
89 D1(printk(KERN_DEBUG "jffs2_sb_compare: No match, device %d (\"%s\"), device %d (\"%s\")\n",
90 c->mtd->index, c->mtd->name, p->mtd->index, p->mtd->name));
91 return 0;
92 }
93}
94
95static int jffs2_sb_set(struct super_block *sb, void *data)
96{
97 struct jffs2_sb_info *p = data;
98
99 /* For persistence of NFS exports etc. we use the same s_dev
100 each time we mount the device, don't just use an anonymous
101 device */
102 sb->s_fs_info = p;
103 p->os_priv = sb;
104 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, p->mtd->index);
105
106 return 0;
107}
108
109static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
110 int flags, const char *dev_name,
111 void *data, struct mtd_info *mtd,
112 struct vfsmount *mnt)
113{ 82{
114 struct super_block *sb;
115 struct jffs2_sb_info *c; 83 struct jffs2_sb_info *c;
116 int ret; 84
85 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():"
86 " New superblock for device %d (\"%s\")\n",
87 sb->s_mtd->index, sb->s_mtd->name));
117 88
118 c = kzalloc(sizeof(*c), GFP_KERNEL); 89 c = kzalloc(sizeof(*c), GFP_KERNEL);
119 if (!c) 90 if (!c)
120 return -ENOMEM; 91 return -ENOMEM;
121 c->mtd = mtd;
122
123 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c);
124
125 if (IS_ERR(sb))
126 goto out_error;
127
128 if (sb->s_root) {
129 /* New mountpoint for JFFS2 which is already mounted */
130 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n",
131 mtd->index, mtd->name));
132 ret = simple_set_mnt(mnt, sb);
133 goto out_put;
134 }
135 92
136 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): New superblock for device %d (\"%s\")\n", 93 c->mtd = sb->s_mtd;
137 mtd->index, mtd->name)); 94 c->os_priv = sb;
95 sb->s_fs_info = c;
138 96
139 /* Initialize JFFS2 superblock locks, the further initialization will be 97 /* Initialize JFFS2 superblock locks, the further initialization will
140 * done later */ 98 * be done later */
141 init_MUTEX(&c->alloc_sem); 99 init_MUTEX(&c->alloc_sem);
142 init_MUTEX(&c->erase_free_sem); 100 init_MUTEX(&c->erase_free_sem);
143 init_waitqueue_head(&c->erase_wait); 101 init_waitqueue_head(&c->erase_wait);
@@ -146,133 +104,20 @@ static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
146 spin_lock_init(&c->inocache_lock); 104 spin_lock_init(&c->inocache_lock);
147 105
148 sb->s_op = &jffs2_super_operations; 106 sb->s_op = &jffs2_super_operations;
149 sb->s_flags = flags | MS_NOATIME; 107 sb->s_flags = sb->s_flags | MS_NOATIME;
150 sb->s_xattr = jffs2_xattr_handlers; 108 sb->s_xattr = jffs2_xattr_handlers;
151#ifdef CONFIG_JFFS2_FS_POSIX_ACL 109#ifdef CONFIG_JFFS2_FS_POSIX_ACL
152 sb->s_flags |= MS_POSIXACL; 110 sb->s_flags |= MS_POSIXACL;
153#endif 111#endif
154 ret = jffs2_do_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 112 return jffs2_do_fill_super(sb, data, silent);
155
156 if (ret) {
157 /* Failure case... */
158 up_write(&sb->s_umount);
159 deactivate_super(sb);
160 return ret;
161 }
162
163 sb->s_flags |= MS_ACTIVE;
164 return simple_set_mnt(mnt, sb);
165
166out_error:
167 ret = PTR_ERR(sb);
168 out_put:
169 kfree(c);
170 put_mtd_device(mtd);
171
172 return ret;
173}
174
175static int jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
176 int flags, const char *dev_name,
177 void *data, int mtdnr,
178 struct vfsmount *mnt)
179{
180 struct mtd_info *mtd;
181
182 mtd = get_mtd_device(NULL, mtdnr);
183 if (IS_ERR(mtd)) {
184 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr));
185 return PTR_ERR(mtd);
186 }
187
188 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
189} 113}
190 114
191static int jffs2_get_sb(struct file_system_type *fs_type, 115static int jffs2_get_sb(struct file_system_type *fs_type,
192 int flags, const char *dev_name, 116 int flags, const char *dev_name,
193 void *data, struct vfsmount *mnt) 117 void *data, struct vfsmount *mnt)
194{ 118{
195 int err; 119 return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super,
196 struct nameidata nd; 120 mnt);
197 int mtdnr;
198
199 if (!dev_name)
200 return -EINVAL;
201
202 D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name));
203
204 /* The preferred way of mounting in future; especially when
205 CONFIG_BLK_DEV is implemented - we specify the underlying
206 MTD device by number or by name, so that we don't require
207 block device support to be present in the kernel. */
208
209 /* FIXME: How to do the root fs this way? */
210
211 if (dev_name[0] == 'm' && dev_name[1] == 't' && dev_name[2] == 'd') {
212 /* Probably mounting without the blkdev crap */
213 if (dev_name[3] == ':') {
214 struct mtd_info *mtd;
215
216 /* Mount by MTD device name */
217 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd:%%s, name \"%s\"\n", dev_name+4));
218 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
219 mtd = get_mtd_device(NULL, mtdnr);
220 if (!IS_ERR(mtd)) {
221 if (!strcmp(mtd->name, dev_name+4))
222 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
223 put_mtd_device(mtd);
224 }
225 }
226 printk(KERN_NOTICE "jffs2_get_sb(): MTD device with name \"%s\" not found.\n", dev_name+4);
227 } else if (isdigit(dev_name[3])) {
228 /* Mount by MTD device number name */
229 char *endptr;
230
231 mtdnr = simple_strtoul(dev_name+3, &endptr, 0);
232 if (!*endptr) {
233 /* It was a valid number */
234 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr));
235 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
236 }
237 }
238 }
239
240 /* Try the old way - the hack where we allowed users to mount
241 /dev/mtdblock$(n) but didn't actually _use_ the blkdev */
242
243 err = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
244
245 D1(printk(KERN_DEBUG "jffs2_get_sb(): path_lookup() returned %d, inode %p\n",
246 err, nd.dentry->d_inode));
247
248 if (err)
249 return err;
250
251 err = -EINVAL;
252
253 if (!S_ISBLK(nd.dentry->d_inode->i_mode))
254 goto out;
255
256 if (nd.mnt->mnt_flags & MNT_NODEV) {
257 err = -EACCES;
258 goto out;
259 }
260
261 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) {
262 if (!(flags & MS_SILENT))
263 printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n",
264 dev_name);
265 goto out;
266 }
267
268 mtdnr = iminor(nd.dentry->d_inode);
269 path_release(&nd);
270
271 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
272
273out:
274 path_release(&nd);
275 return err;
276} 121}
277 122
278static void jffs2_put_super (struct super_block *sb) 123static void jffs2_put_super (struct super_block *sb)
@@ -307,8 +152,7 @@ static void jffs2_kill_sb(struct super_block *sb)
307 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 152 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
308 if (!(sb->s_flags & MS_RDONLY)) 153 if (!(sb->s_flags & MS_RDONLY))
309 jffs2_stop_garbage_collect_thread(c); 154 jffs2_stop_garbage_collect_thread(c);
310 generic_shutdown_super(sb); 155 kill_mtd_super(sb);
311 put_mtd_device(c->mtd);
312 kfree(c); 156 kfree(c);
313} 157}
314 158
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 78fc08893a6c..e48665984cb3 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -754,6 +754,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
754 list_del(&xd->xindex); 754 list_del(&xd->xindex);
755 jffs2_free_xattr_datum(xd); 755 jffs2_free_xattr_datum(xd);
756 } 756 }
757 list_for_each_entry_safe(xd, _xd, &c->xattr_unchecked, xindex) {
758 list_del(&xd->xindex);
759 jffs2_free_xattr_datum(xd);
760 }
757} 761}
758 762
759#define XREF_TMPHASH_SIZE (128) 763#define XREF_TMPHASH_SIZE (128)
@@ -825,7 +829,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
825 ref->xd and ref->ic are not valid yet. */ 829 ref->xd and ref->ic are not valid yet. */
826 xd = jffs2_find_xattr_datum(c, ref->xid); 830 xd = jffs2_find_xattr_datum(c, ref->xid);
827 ic = jffs2_get_ino_cache(c, ref->ino); 831 ic = jffs2_get_ino_cache(c, ref->ino);
828 if (!xd || !ic) { 832 if (!xd || !ic || !ic->nlink) {
829 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", 833 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n",
830 ref->ino, ref->xid, ref->xseqno); 834 ref->ino, ref->xid, ref->xseqno);
831 ref->xseqno |= XREF_DELETE_MARKER; 835 ref->xseqno |= XREF_DELETE_MARKER;
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index b62cd36ff324..e2fcee2b340d 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -13,7 +13,7 @@
13 13
14extern int pxm_to_node(int); 14extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern int __cpuinit acpi_map_pxm_to_node(int); 16extern int acpi_map_pxm_to_node(int);
17extern void __cpuinit acpi_unmap_pxm_to_node(int); 17extern void __cpuinit acpi_unmap_pxm_to_node(int);
18 18
19#endif /* CONFIG_ACPI_NUMA */ 19#endif /* CONFIG_ACPI_NUMA */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5e07db0d46e9..ca882b8e7d10 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -78,7 +78,7 @@ struct acpi_signal_fatal_info {
78/* 78/*
79 * OSL Initialization and shutdown primitives 79 * OSL Initialization and shutdown primitives
80 */ 80 */
81acpi_status acpi_os_initialize(void); 81acpi_status __initdata acpi_os_initialize(void);
82 82
83acpi_status acpi_os_terminate(void); 83acpi_status acpi_os_terminate(void);
84 84
@@ -236,6 +236,7 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
236 * Miscellaneous 236 * Miscellaneous
237 */ 237 */
238acpi_status acpi_os_validate_interface(char *interface); 238acpi_status acpi_os_validate_interface(char *interface);
239acpi_status acpi_osi_invalidate(char* interface);
239 240
240acpi_status 241acpi_status
241acpi_os_validate_address(u8 space_id, 242acpi_os_validate_address(u8 space_id,
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e08f7df85a4f..b5cca5daa348 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -55,7 +55,7 @@ acpi_status
55acpi_initialize_tables(struct acpi_table_desc *initial_storage, 55acpi_initialize_tables(struct acpi_table_desc *initial_storage,
56 u32 initial_table_count, u8 allow_resize); 56 u32 initial_table_count, u8 allow_resize);
57 57
58acpi_status acpi_initialize_subsystem(void); 58acpi_status __init acpi_initialize_subsystem(void);
59 59
60acpi_status acpi_enable_subsystem(u32 flags); 60acpi_status acpi_enable_subsystem(u32 flags);
61 61
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 15a838862cd4..a87ef1c8d46b 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -390,6 +390,8 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object);
390 390
391u8 acpi_ut_valid_internal_object(void *object); 391u8 acpi_ut_valid_internal_object(void *object);
392 392
393union acpi_operand_object *acpi_ut_create_package_object(u32 count);
394
393union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); 395union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
394 396
395union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); 397union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index be303b3eef40..6931af525da3 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -12,6 +12,7 @@
12#ifndef _ASM_SYSTEM_H 12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H 13#define _ASM_SYSTEM_H
14 14
15#include <linux/types.h>
15#include <linux/linkage.h> 16#include <linux/linkage.h>
16 17
17struct thread_struct; 18struct thread_struct;
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
index 92e62ef711ed..c5f20df780e9 100644
--- a/include/asm-mips/asmmacro.h
+++ b/include/asm-mips/asmmacro.h
@@ -52,21 +52,6 @@
52 .endm 52 .endm
53#endif /* CONFIG_MIPS_MT_SMTC */ 53#endif /* CONFIG_MIPS_MT_SMTC */
54 54
55#ifdef CONFIG_CPU_SB1
56 .macro fpu_enable_hazard
57 .set push
58 .set noreorder
59 .set mips2
60 SSNOP
61 bnezl $0, .+4
62 SSNOP
63 .set pop
64 .endm
65#else
66 .macro fpu_enable_hazard
67 .endm
68#endif
69
70/* 55/*
71 * Temporary until all gas have MT ASE support 56 * Temporary until all gas have MT ASE support
72 */ 57 */
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h
index daaf9f98fc63..a9db576a9768 100644
--- a/include/asm-mips/mips-boards/prom.h
+++ b/include/asm-mips/mips-boards/prom.h
@@ -33,6 +33,7 @@ extern void prom_meminit(void);
33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); 33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
34extern void mips_display_message(const char *str); 34extern void mips_display_message(const char *str);
35extern void mips_display_word(unsigned int num); 35extern void mips_display_word(unsigned int num);
36extern void mips_scroll_message(void);
36extern int get_ethernet_addr(char *ethernet_addr); 37extern int get_ethernet_addr(char *ethernet_addr);
37 38
38/* Memory descriptor management. */ 39/* Memory descriptor management. */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 2f1087b3a202..91c306fcfb72 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -949,7 +949,6 @@
949#define __ARCH_WANT_SYS_UTIME 949#define __ARCH_WANT_SYS_UTIME
950#define __ARCH_WANT_SYS_WAITPID 950#define __ARCH_WANT_SYS_WAITPID
951#define __ARCH_WANT_SYS_SOCKETCALL 951#define __ARCH_WANT_SYS_SOCKETCALL
952#define __ARCH_WANT_SYS_FADVISE64
953#define __ARCH_WANT_SYS_GETPGRP 952#define __ARCH_WANT_SYS_GETPGRP
954#define __ARCH_WANT_SYS_LLSEEK 953#define __ARCH_WANT_SYS_LLSEEK
955#define __ARCH_WANT_SYS_NICE 954#define __ARCH_WANT_SYS_NICE
diff --git a/include/asm-powerpc/pgalloc-64.h b/include/asm-powerpc/pgalloc-64.h
index d9a3a8ca58a1..94d0294341d6 100644
--- a/include/asm-powerpc/pgalloc-64.h
+++ b/include/asm-powerpc/pgalloc-64.h
@@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
90static inline struct page *pte_alloc_one(struct mm_struct *mm, 90static inline struct page *pte_alloc_one(struct mm_struct *mm,
91 unsigned long address) 91 unsigned long address)
92{ 92{
93 return virt_to_page(pte_alloc_one_kernel(mm, address)); 93 pte_t *pte = pte_alloc_one_kernel(mm, address);
94 return pte ? virt_to_page(pte) : NULL;
94} 95}
95 96
96static inline void pte_free_kernel(pte_t *pte) 97static inline void pte_free_kernel(pte_t *pte)
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 0a17682663d8..66714042e438 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -38,6 +38,15 @@ extern void pte_free_finish(void);
38 38
39static inline void tlb_flush(struct mmu_gather *tlb) 39static inline void tlb_flush(struct mmu_gather *tlb)
40{ 40{
41 struct ppc64_tlb_batch *tlbbatch = &__get_cpu_var(ppc64_tlb_batch);
42
43 /* If there's a TLB batch pending, then we must flush it because the
44 * pages are going to be freed and we really don't want to have a CPU
45 * access a freed page because it has a stale TLB
46 */
47 if (tlbbatch->index)
48 __flush_tlb_pending(tlbbatch);
49
41 pte_free_finish(); 50 pte_free_finish();
42} 51}
43 52
diff --git a/include/asm-sh/se73180.h b/include/asm-sh/se73180.h
index 3a4acb3e38a1..907c062b4c9a 100644
--- a/include/asm-sh/se73180.h
+++ b/include/asm-sh/se73180.h
@@ -1,9 +1,7 @@
1#ifndef __ASM_SH_HITACHI_SE73180_H 1#ifndef __ASM_SH_SE73180_H
2#define __ASM_SH_HITACHI_SE73180_H 2#define __ASM_SH_SE73180_H
3 3
4/* 4/*
5 * include/asm-sh/se/se73180.h
6 *
7 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> 5 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
8 * 6 *
9 * SH-Mobile SolutionEngine 73180 support 7 * SH-Mobile SolutionEngine 73180 support
@@ -62,4 +60,7 @@
62#define __IO_PREFIX sh73180se 60#define __IO_PREFIX sh73180se
63#include <asm/io_generic.h> 61#include <asm/io_generic.h>
64 62
65#endif /* __ASM_SH_HITACHI_SE73180_H */ 63/* arch/sh/boards/se/73180/irq.c */
64int shmse_irq_demux(int irq);
65
66#endif /* __ASM_SH_SE73180_H */
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 03c385de7619..445026fbec35 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -31,7 +31,7 @@ typedef struct {
31 unsigned int ecache_size; 31 unsigned int ecache_size;
32 unsigned int ecache_line_size; 32 unsigned int ecache_line_size;
33 int core_id; 33 int core_id;
34 unsigned int __pad3; 34 int proc_id;
35} cpuinfo_sparc; 35} cpuinfo_sparc;
36 36
37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); 37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 9329429fb7f6..4e21c2f3065c 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -162,6 +162,22 @@ dma_mapping_error(dma_addr_t dma_addr)
162#else 162#else
163 163
164struct device; 164struct device;
165struct page;
166struct scatterlist;
167
168static inline int
169dma_supported(struct device *dev, u64 mask)
170{
171 BUG();
172 return 0;
173}
174
175static inline int
176dma_set_mask(struct device *dev, u64 dma_mask)
177{
178 BUG();
179 return 0;
180}
165 181
166static inline void *dma_alloc_coherent(struct device *dev, size_t size, 182static inline void *dma_alloc_coherent(struct device *dev, size_t size,
167 dma_addr_t *dma_handle, gfp_t flag) 183 dma_addr_t *dma_handle, gfp_t flag)
@@ -176,6 +192,52 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
176 BUG(); 192 BUG();
177} 193}
178 194
195static inline dma_addr_t
196dma_map_single(struct device *dev, void *cpu_addr, size_t size,
197 enum dma_data_direction direction)
198{
199 BUG();
200 return 0;
201}
202
203static inline void
204dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
205 enum dma_data_direction direction)
206{
207 BUG();
208}
209
210static inline dma_addr_t
211dma_map_page(struct device *dev, struct page *page,
212 unsigned long offset, size_t size,
213 enum dma_data_direction direction)
214{
215 BUG();
216 return 0;
217}
218
219static inline void
220dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
221 enum dma_data_direction direction)
222{
223 BUG();
224}
225
226static inline int
227dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
228 enum dma_data_direction direction)
229{
230 BUG();
231 return 0;
232}
233
234static inline void
235dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
236 enum dma_data_direction direction)
237{
238 BUG();
239}
240
179static inline void 241static inline void
180dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, 242dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
181 enum dma_data_direction direction) 243 enum dma_data_direction direction)
@@ -190,6 +252,27 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
190 BUG(); 252 BUG();
191} 253}
192 254
255static inline void
256dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
257 enum dma_data_direction direction)
258{
259 BUG();
260}
261
262static inline void
263dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
264 enum dma_data_direction direction)
265{
266 BUG();
267}
268
269static inline int
270dma_mapping_error(dma_addr_t dma_addr)
271{
272 BUG();
273 return 0;
274}
275
193#endif /* PCI */ 276#endif /* PCI */
194 277
195 278
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 4a43075a0619..5c2f9d4b9f06 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -2798,6 +2798,11 @@ struct hv_mmu_statistics {
2798 */ 2798 */
2799#define HV_FAST_MMUSTAT_INFO 0x103 2799#define HV_FAST_MMUSTAT_INFO 0x103
2800 2800
2801#ifndef __ASSEMBLY__
2802extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
2803extern unsigned long sun4v_mmustat_info(unsigned long *ra);
2804#endif
2805
2801/* NCS crypto services */ 2806/* NCS crypto services */
2802 2807
2803/* ncs_request() sub-function numbers */ 2808/* ncs_request() sub-function numbers */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index f76e1492add5..4fb8c4bfb848 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -33,6 +33,8 @@ extern cpumask_t phys_cpu_present_map;
33#define cpu_possible_map phys_cpu_present_map 33#define cpu_possible_map phys_cpu_present_map
34 34
35extern cpumask_t cpu_sibling_map[NR_CPUS]; 35extern cpumask_t cpu_sibling_map[NR_CPUS];
36extern cpumask_t cpu_core_map[NR_CPUS];
37extern int sparc64_multi_core;
36 38
37/* 39/*
38 * General functions that each host system must provide. 40 * General functions that each host system must provide.
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
index e0d450d600ec..290ac75f385b 100644
--- a/include/asm-sparc64/topology.h
+++ b/include/asm-sparc64/topology.h
@@ -1,12 +1,17 @@
1#ifndef _ASM_SPARC64_TOPOLOGY_H 1#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H 2#define _ASM_SPARC64_TOPOLOGY_H
3 3
4#include <asm/spitfire.h> 4#ifdef CONFIG_SMP
5#define smt_capable() (tlb_type == hypervisor) 5#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
6#define topology_core_id(cpu) (cpu_data(cpu).core_id)
7#define topology_core_siblings(cpu) (cpu_core_map[cpu])
8#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
9#define mc_capable() (sparc64_multi_core)
10#define smt_capable() (sparc64_multi_core)
11#endif /* CONFIG_SMP */
6 12
7#include <asm-generic/topology.h> 13#include <asm-generic/topology.h>
8 14
9#define topology_core_id(cpu) (cpu_data(cpu).core_id) 15#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
10#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
11 16
12#endif /* _ASM_SPARC64_TOPOLOGY_H */ 17#endif /* _ASM_SPARC64_TOPOLOGY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7cf0c54a46a7..b3ae77cccbb6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -938,6 +938,7 @@ struct super_block {
938 struct list_head s_files; 938 struct list_head s_files;
939 939
940 struct block_device *s_bdev; 940 struct block_device *s_bdev;
941 struct mtd_info *s_mtd;
941 struct list_head s_instances; 942 struct list_head s_instances;
942 struct quota_info s_dquot; /* Diskquota specific options */ 943 struct quota_info s_dquot; /* Diskquota specific options */
943 944
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 85f7b1bd1482..a6a3113120a4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -171,7 +171,6 @@ enum {
171 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 171 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
172 * Register FIS clearing BSY */ 172 * Register FIS clearing BSY */
173 ATA_FLAG_DEBUGMSG = (1 << 13), 173 ATA_FLAG_DEBUGMSG = (1 << 13),
174 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
175 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 174 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
176 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 175 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
177 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 176 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
diff --git a/include/linux/mtd/super.h b/include/linux/mtd/super.h
new file mode 100644
index 000000000000..4016dd6fe336
--- /dev/null
+++ b/include/linux/mtd/super.h
@@ -0,0 +1,30 @@
1/* MTD-based superblock handling
2 *
3 * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef __MTD_SUPER_H__
13#define __MTD_SUPER_H__
14
15#ifdef __KERNEL__
16
17#include <linux/mtd/mtd.h>
18#include <linux/fs.h>
19#include <linux/mount.h>
20
21extern int get_sb_mtd(struct file_system_type *fs_type, int flags,
22 const char *dev_name, void *data,
23 int (*fill_super)(struct super_block *, void *, int),
24 struct vfsmount *mnt);
25extern void kill_mtd_super(struct super_block *sb);
26
27
28#endif /* __KERNEL__ */
29
30#endif /* __MTD_SUPER_H__ */
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index c0398f5a8cb9..65f49fd7deff 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -62,13 +62,11 @@ struct unix_skb_parms {
62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
63#define UNIXSID(skb) (&UNIXCB((skb)).secid) 63#define UNIXSID(skb) (&UNIXCB((skb)).secid)
64 64
65#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) 65#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
66#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) 66#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
67#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) 67#define unix_state_lock_nested(s) \
68#define unix_state_wlock_nested(s) \
69 spin_lock_nested(&unix_sk(s)->lock, \ 68 spin_lock_nested(&unix_sk(s)->lock, \
70 SINGLE_DEPTH_NESTING) 69 SINGLE_DEPTH_NESTING)
71#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
72 70
73#ifdef __KERNEL__ 71#ifdef __KERNEL__
74/* The AF_UNIX socket */ 72/* The AF_UNIX socket */
diff --git a/kernel/signal.c b/kernel/signal.c
index acdfc0549c6f..fe590e00db8d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -105,7 +105,11 @@ static int recalc_sigpending_tsk(struct task_struct *t)
105 set_tsk_thread_flag(t, TIF_SIGPENDING); 105 set_tsk_thread_flag(t, TIF_SIGPENDING);
106 return 1; 106 return 1;
107 } 107 }
108 clear_tsk_thread_flag(t, TIF_SIGPENDING); 108 /*
109 * We must never clear the flag in another thread, or in current
110 * when it's possible the current syscall is returning -ERESTART*.
111 * So we don't clear it here, and only callers who know they should do.
112 */
109 return 0; 113 return 0;
110} 114}
111 115
@@ -121,7 +125,9 @@ void recalc_sigpending_and_wake(struct task_struct *t)
121 125
122void recalc_sigpending(void) 126void recalc_sigpending(void)
123{ 127{
124 recalc_sigpending_tsk(current); 128 if (!recalc_sigpending_tsk(current))
129 clear_thread_flag(TIF_SIGPENDING);
130
125} 131}
126 132
127/* Given the mask, find the first available signal that should be serviced. */ 133/* Given the mask, find the first available signal that should be serviced. */
@@ -385,7 +391,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
385 } 391 }
386 } 392 }
387 } 393 }
388 recalc_sigpending_tsk(tsk); 394 if (likely(tsk == current))
395 recalc_sigpending();
389 if (signr && unlikely(sig_kernel_stop(signr))) { 396 if (signr && unlikely(sig_kernel_stop(signr))) {
390 /* 397 /*
391 * Set a marker that we have dequeued a stop signal. Our 398 * Set a marker that we have dequeued a stop signal. Our
@@ -1580,8 +1587,9 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info)
1580 /* 1587 /*
1581 * Queued signals ignored us while we were stopped for tracing. 1588 * Queued signals ignored us while we were stopped for tracing.
1582 * So check for any that we should take before resuming user mode. 1589 * So check for any that we should take before resuming user mode.
1590 * This sets TIF_SIGPENDING, but never clears it.
1583 */ 1591 */
1584 recalc_sigpending(); 1592 recalc_sigpending_tsk(current);
1585} 1593}
1586 1594
1587void ptrace_notify(int exit_code) 1595void ptrace_notify(int exit_code)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index bd93c45778d4..de78c9dd713b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -240,10 +240,8 @@ static int unregister_vlan_dev(struct net_device *real_dev,
240 * interlock with HW accelerating devices or SW vlan 240 * interlock with HW accelerating devices or SW vlan
241 * input packet processing. 241 * input packet processing.
242 */ 242 */
243 if (real_dev->features & 243 if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
244 (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER)) {
245 real_dev->vlan_rx_kill_vid(real_dev, vlan_id); 244 real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
246 }
247 245
248 vlan_group_set_device(grp, vlan_id, NULL); 246 vlan_group_set_device(grp, vlan_id, NULL);
249 synchronize_net(); 247 synchronize_net();
@@ -409,16 +407,14 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
409 } 407 }
410 408
411 if ((real_dev->features & NETIF_F_HW_VLAN_RX) && 409 if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
412 (real_dev->vlan_rx_register == NULL || 410 !real_dev->vlan_rx_register) {
413 real_dev->vlan_rx_kill_vid == NULL)) {
414 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 411 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
415 __FUNCTION__, real_dev->name); 412 __FUNCTION__, real_dev->name);
416 goto out_put_dev; 413 goto out_put_dev;
417 } 414 }
418 415
419 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && 416 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
420 (real_dev->vlan_rx_add_vid == NULL || 417 (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) {
421 real_dev->vlan_rx_kill_vid == NULL)) {
422 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 418 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
423 __FUNCTION__, real_dev->name); 419 __FUNCTION__, real_dev->name);
424 goto out_put_dev; 420 goto out_put_dev;
@@ -740,8 +736,7 @@ static int vlan_ioctl_handler(void __user *arg)
740 case SET_VLAN_NAME_TYPE_CMD: 736 case SET_VLAN_NAME_TYPE_CMD:
741 if (!capable(CAP_NET_ADMIN)) 737 if (!capable(CAP_NET_ADMIN))
742 return -EPERM; 738 return -EPERM;
743 if ((args.u.name_type >= 0) && 739 if (args.u.name_type < VLAN_NAME_TYPE_HIGHEST) {
744 (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
745 vlan_name_type = args.u.name_type; 740 vlan_name_type = args.u.name_type;
746 err = 0; 741 err = 0;
747 } else { 742 } else {
diff --git a/net/core/sock.c b/net/core/sock.c
index 7e51d3a5e4f6..c14ce0198d25 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -998,7 +998,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
998 __sk_dst_set(sk, dst); 998 __sk_dst_set(sk, dst);
999 sk->sk_route_caps = dst->dev->features; 999 sk->sk_route_caps = dst->dev->features;
1000 if (sk->sk_route_caps & NETIF_F_GSO) 1000 if (sk->sk_route_caps & NETIF_F_GSO)
1001 sk->sk_route_caps |= NETIF_F_GSO_MASK; 1001 sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
1002 if (sk_can_gso(sk)) { 1002 if (sk_can_gso(sk)) {
1003 if (dst->header_len) 1003 if (dst->header_len)
1004 sk->sk_route_caps &= ~NETIF_F_GSO_MASK; 1004 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 1f5e3ba62065..43a3adb027e7 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -128,7 +128,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
128 int error = 0, cnt = 0; 128 int error = 0, cnt = 0;
129 unsigned char *tbuf; 129 unsigned char *tbuf;
130 130
131 if (!buf || len < 0) 131 if (!buf)
132 return -EINVAL; 132 return -EINVAL;
133 133
134 if (len == 0) 134 if (len == 0)
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index dd02a45d0f67..0301dd468cf4 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
50 RT_CONN_FLAGS(sk), oif, 50 RT_CONN_FLAGS(sk), oif,
51 sk->sk_protocol, 51 sk->sk_protocol,
52 inet->sport, usin->sin_port, sk, 1); 52 inet->sport, usin->sin_port, sk, 1);
53 if (err) 53 if (err) {
54 if (err == -ENETUNREACH)
55 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
54 return err; 56 return err;
57 }
58
55 if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { 59 if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) {
56 ip_rt_put(rt); 60 ip_rt_put(rt);
57 return -EACCES; 61 return -EACCES;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index e238b17f554c..02a899bec196 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -514,12 +514,15 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
514 514
515 saddr = iph->daddr; 515 saddr = iph->daddr;
516 if (!(rt->rt_flags & RTCF_LOCAL)) { 516 if (!(rt->rt_flags & RTCF_LOCAL)) {
517 /* This is broken, skb_in->dev points to the outgoing device 517 struct net_device *dev = NULL;
518 * after the packet passes through ip_output(). 518
519 */ 519 if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr)
520 if (skb_in->dev && sysctl_icmp_errors_use_inbound_ifaddr) 520 dev = dev_get_by_index(rt->fl.iif);
521 saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK); 521
522 else 522 if (dev) {
523 saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
524 dev_put(dev);
525 } else
523 saddr = 0; 526 saddr = 0;
524 } 527 }
525 528
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 43fb1600f1f0..fbe7714f21d0 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -31,10 +31,8 @@ EXPORT_SYMBOL(inet_csk_timer_bug_msg);
31 31
32/* 32/*
33 * This array holds the first and last local port number. 33 * This array holds the first and last local port number.
34 * For high-usage systems, use sysctl to change this to
35 * 32768-61000
36 */ 34 */
37int sysctl_local_port_range[2] = { 1024, 4999 }; 35int sysctl_local_port_range[2] = { 32768, 61000 };
38 36
39int inet_csk_bind_conflict(const struct sock *sk, 37int inet_csk_bind_conflict(const struct sock *sk,
40 const struct inet_bind_bucket *tb) 38 const struct inet_bind_bucket *tb)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 766314505c09..cd3c7e95de9e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2464,13 +2464,10 @@ void __init tcp_init(void)
2464 order++) 2464 order++)
2465 ; 2465 ;
2466 if (order >= 4) { 2466 if (order >= 4) {
2467 sysctl_local_port_range[0] = 32768;
2468 sysctl_local_port_range[1] = 61000;
2469 tcp_death_row.sysctl_max_tw_buckets = 180000; 2467 tcp_death_row.sysctl_max_tw_buckets = 180000;
2470 sysctl_tcp_max_orphans = 4096 << (order - 4); 2468 sysctl_tcp_max_orphans = 4096 << (order - 4);
2471 sysctl_max_syn_backlog = 1024; 2469 sysctl_max_syn_backlog = 1024;
2472 } else if (order < 3) { 2470 } else if (order < 3) {
2473 sysctl_local_port_range[0] = 1024 * (3 - order);
2474 tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); 2471 tcp_death_row.sysctl_max_tw_buckets >>= (3 - order);
2475 sysctl_tcp_max_orphans >>= (3 - order); 2472 sysctl_tcp_max_orphans >>= (3 - order);
2476 sysctl_max_syn_backlog = 128; 2473 sysctl_max_syn_backlog = 128;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 38cb25b48bf3..74683d81c3f1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2407,8 +2407,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2407 struct sk_buff *skb; 2407 struct sk_buff *skb;
2408 __u32 now = tcp_time_stamp; 2408 __u32 now = tcp_time_stamp;
2409 int acked = 0; 2409 int acked = 0;
2410 int prior_packets = tp->packets_out;
2410 __s32 seq_rtt = -1; 2411 __s32 seq_rtt = -1;
2411 u32 pkts_acked = 0;
2412 ktime_t last_ackt = ktime_set(0,0); 2412 ktime_t last_ackt = ktime_set(0,0);
2413 2413
2414 while ((skb = tcp_write_queue_head(sk)) && 2414 while ((skb = tcp_write_queue_head(sk)) &&
@@ -2437,7 +2437,6 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2437 */ 2437 */
2438 if (!(scb->flags & TCPCB_FLAG_SYN)) { 2438 if (!(scb->flags & TCPCB_FLAG_SYN)) {
2439 acked |= FLAG_DATA_ACKED; 2439 acked |= FLAG_DATA_ACKED;
2440 ++pkts_acked;
2441 } else { 2440 } else {
2442 acked |= FLAG_SYN_ACKED; 2441 acked |= FLAG_SYN_ACKED;
2443 tp->retrans_stamp = 0; 2442 tp->retrans_stamp = 0;
@@ -2481,6 +2480,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2481 } 2480 }
2482 2481
2483 if (acked&FLAG_ACKED) { 2482 if (acked&FLAG_ACKED) {
2483 u32 pkts_acked = prior_packets - tp->packets_out;
2484 const struct tcp_congestion_ops *ca_ops 2484 const struct tcp_congestion_ops *ca_ops
2485 = inet_csk(sk)->icsk_ca_ops; 2485 = inet_csk(sk)->icsk_ca_ops;
2486 2486
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 5a3e7f839fc5..47c61055eb60 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
192 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, 192 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
193 IPPROTO_TCP, 193 IPPROTO_TCP,
194 inet->sport, usin->sin_port, sk, 1); 194 inet->sport, usin->sin_port, sk, 1);
195 if (tmp < 0) 195 if (tmp < 0) {
196 if (tmp == -ENETUNREACH)
197 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
196 return tmp; 198 return tmp;
199 }
197 200
198 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { 201 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
199 ip_rt_put(rt); 202 ip_rt_put(rt);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 4c7e95fa090d..5da703e699da 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -722,8 +722,11 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
722 .dport = dport } } }; 722 .dport = dport } } };
723 security_sk_classify_flow(sk, &fl); 723 security_sk_classify_flow(sk, &fl);
724 err = ip_route_output_flow(&rt, &fl, sk, 1); 724 err = ip_route_output_flow(&rt, &fl, sk, 1);
725 if (err) 725 if (err) {
726 if (err == -ENETUNREACH)
727 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
726 goto out; 728 goto out;
729 }
727 730
728 err = -EACCES; 731 err = -EACCES;
729 if ((rt->rt_flags & RTCF_BROADCAST) && 732 if ((rt->rt_flags & RTCF_BROADCAST) &&
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 6d2a08205111..dc442fb791b0 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -177,8 +177,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
177 177
178 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum, 178 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
179 (*pskb)->len - extoff); 179 (*pskb)->len - extoff);
180 if (protoff < 0 || protoff > (*pskb)->len || 180 if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) {
181 pnum == NEXTHDR_FRAGMENT) {
182 DEBUGP("proto header not found\n"); 181 DEBUGP("proto header not found\n");
183 return NF_ACCEPT; 182 return NF_ACCEPT;
184 } 183 }
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 0be790d250f9..8814b95b2326 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -168,8 +168,7 @@ icmpv6_error_message(struct sk_buff *skb,
168 skb->len - inip6off 168 skb->len - inip6off
169 - sizeof(struct ipv6hdr)); 169 - sizeof(struct ipv6hdr));
170 170
171 if ((inprotoff < 0) || (inprotoff > skb->len) || 171 if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) {
172 (inprotonum == NEXTHDR_FRAGMENT)) {
173 DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n"); 172 DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n");
174 return -NF_ACCEPT; 173 return -NF_ACCEPT;
175 } 174 }
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 45b3cda86a21..6f8684b5617e 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -164,8 +164,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
164 printk("offset must be on 32 bit boundaries\n"); 164 printk("offset must be on 32 bit boundaries\n");
165 goto bad; 165 goto bad;
166 } 166 }
167 if (skb->len < 0 || 167 if (offset > 0 && offset > skb->len) {
168 (offset > 0 && offset > skb->len)) {
169 printk("offset %d cant exceed pkt length %d\n", 168 printk("offset %d cant exceed pkt length %d\n",
170 offset, skb->len); 169 offset, skb->len);
171 goto bad; 170 goto bad;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index cbefe225581e..f4d34480a093 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -224,7 +224,8 @@ void __netdev_watchdog_up(struct net_device *dev)
224 if (dev->tx_timeout) { 224 if (dev->tx_timeout) {
225 if (dev->watchdog_timeo <= 0) 225 if (dev->watchdog_timeo <= 0)
226 dev->watchdog_timeo = 5*HZ; 226 dev->watchdog_timeo = 5*HZ;
227 if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo)) 227 if (!mod_timer(&dev->watchdog_timer,
228 round_jiffies(jiffies + dev->watchdog_timeo)))
228 dev_hold(dev); 229 dev_hold(dev);
229 } 230 }
230} 231}
diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index e8c0f7435d7f..80f70aa53386 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -77,8 +77,6 @@ static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
77/* Lookup "chunk type" debug name. */ 77/* Lookup "chunk type" debug name. */
78const char *sctp_cname(const sctp_subtype_t cid) 78const char *sctp_cname(const sctp_subtype_t cid)
79{ 79{
80 if (cid.chunk < 0)
81 return "illegal chunk id";
82 if (cid.chunk <= SCTP_CID_BASE_MAX) 80 if (cid.chunk <= SCTP_CID_BASE_MAX)
83 return sctp_cid_tbl[cid.chunk]; 81 return sctp_cid_tbl[cid.chunk];
84 82
@@ -146,8 +144,6 @@ static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
146/* Lookup primitive debug name. */ 144/* Lookup primitive debug name. */
147const char *sctp_pname(const sctp_subtype_t id) 145const char *sctp_pname(const sctp_subtype_t id)
148{ 146{
149 if (id.primitive < 0)
150 return "illegal primitive";
151 if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX) 147 if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
152 return sctp_primitive_tbl[id.primitive]; 148 return sctp_primitive_tbl[id.primitive];
153 return "unknown_primitive"; 149 return "unknown_primitive";
@@ -161,8 +157,6 @@ static const char *sctp_other_tbl[] = {
161/* Lookup "other" debug name. */ 157/* Lookup "other" debug name. */
162const char *sctp_oname(const sctp_subtype_t id) 158const char *sctp_oname(const sctp_subtype_t id)
163{ 159{
164 if (id.other < 0)
165 return "illegal 'other' event";
166 if (id.other <= SCTP_EVENT_OTHER_MAX) 160 if (id.other <= SCTP_EVENT_OTHER_MAX)
167 return sctp_other_tbl[id.other]; 161 return sctp_other_tbl[id.other];
168 return "unknown 'other' event"; 162 return "unknown 'other' event";
@@ -184,8 +178,6 @@ static const char *sctp_timer_tbl[] = {
184/* Lookup timer debug name. */ 178/* Lookup timer debug name. */
185const char *sctp_tname(const sctp_subtype_t id) 179const char *sctp_tname(const sctp_subtype_t id)
186{ 180{
187 if (id.timeout < 0)
188 return "illegal 'timer' event";
189 if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX) 181 if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
190 return sctp_timer_tbl[id.timeout]; 182 return sctp_timer_tbl[id.timeout];
191 return "unknown_timer"; 183 return "unknown_timer";
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 523071c7902f..70a91ece3c49 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -960,7 +960,7 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
960 if (state > SCTP_STATE_MAX) 960 if (state > SCTP_STATE_MAX)
961 return &bug; 961 return &bug;
962 962
963 if (cid >= 0 && cid <= SCTP_CID_BASE_MAX) 963 if (cid <= SCTP_CID_BASE_MAX)
964 return &chunk_event_table[cid][state]; 964 return &chunk_event_table[cid][state];
965 965
966 if (sctp_prsctp_enable) { 966 if (sctp_prsctp_enable) {
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fc12ba51c1fc..87c794d8fa2d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -174,11 +174,11 @@ static struct sock *unix_peer_get(struct sock *s)
174{ 174{
175 struct sock *peer; 175 struct sock *peer;
176 176
177 unix_state_rlock(s); 177 unix_state_lock(s);
178 peer = unix_peer(s); 178 peer = unix_peer(s);
179 if (peer) 179 if (peer)
180 sock_hold(peer); 180 sock_hold(peer);
181 unix_state_runlock(s); 181 unix_state_unlock(s);
182 return peer; 182 return peer;
183} 183}
184 184
@@ -369,7 +369,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
369 unix_remove_socket(sk); 369 unix_remove_socket(sk);
370 370
371 /* Clear state */ 371 /* Clear state */
372 unix_state_wlock(sk); 372 unix_state_lock(sk);
373 sock_orphan(sk); 373 sock_orphan(sk);
374 sk->sk_shutdown = SHUTDOWN_MASK; 374 sk->sk_shutdown = SHUTDOWN_MASK;
375 dentry = u->dentry; 375 dentry = u->dentry;
@@ -378,7 +378,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
378 u->mnt = NULL; 378 u->mnt = NULL;
379 state = sk->sk_state; 379 state = sk->sk_state;
380 sk->sk_state = TCP_CLOSE; 380 sk->sk_state = TCP_CLOSE;
381 unix_state_wunlock(sk); 381 unix_state_unlock(sk);
382 382
383 wake_up_interruptible_all(&u->peer_wait); 383 wake_up_interruptible_all(&u->peer_wait);
384 384
@@ -386,12 +386,12 @@ static int unix_release_sock (struct sock *sk, int embrion)
386 386
387 if (skpair!=NULL) { 387 if (skpair!=NULL) {
388 if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { 388 if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
389 unix_state_wlock(skpair); 389 unix_state_lock(skpair);
390 /* No more writes */ 390 /* No more writes */
391 skpair->sk_shutdown = SHUTDOWN_MASK; 391 skpair->sk_shutdown = SHUTDOWN_MASK;
392 if (!skb_queue_empty(&sk->sk_receive_queue) || embrion) 392 if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
393 skpair->sk_err = ECONNRESET; 393 skpair->sk_err = ECONNRESET;
394 unix_state_wunlock(skpair); 394 unix_state_unlock(skpair);
395 skpair->sk_state_change(skpair); 395 skpair->sk_state_change(skpair);
396 read_lock(&skpair->sk_callback_lock); 396 read_lock(&skpair->sk_callback_lock);
397 sk_wake_async(skpair,1,POLL_HUP); 397 sk_wake_async(skpair,1,POLL_HUP);
@@ -448,7 +448,7 @@ static int unix_listen(struct socket *sock, int backlog)
448 err = -EINVAL; 448 err = -EINVAL;
449 if (!u->addr) 449 if (!u->addr)
450 goto out; /* No listens on an unbound socket */ 450 goto out; /* No listens on an unbound socket */
451 unix_state_wlock(sk); 451 unix_state_lock(sk);
452 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) 452 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
453 goto out_unlock; 453 goto out_unlock;
454 if (backlog > sk->sk_max_ack_backlog) 454 if (backlog > sk->sk_max_ack_backlog)
@@ -462,7 +462,7 @@ static int unix_listen(struct socket *sock, int backlog)
462 err = 0; 462 err = 0;
463 463
464out_unlock: 464out_unlock:
465 unix_state_wunlock(sk); 465 unix_state_unlock(sk);
466out: 466out:
467 return err; 467 return err;
468} 468}
@@ -858,6 +858,31 @@ out_mknod_parent:
858 goto out_up; 858 goto out_up;
859} 859}
860 860
861static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
862{
863 if (unlikely(sk1 == sk2) || !sk2) {
864 unix_state_lock(sk1);
865 return;
866 }
867 if (sk1 < sk2) {
868 unix_state_lock(sk1);
869 unix_state_lock_nested(sk2);
870 } else {
871 unix_state_lock(sk2);
872 unix_state_lock_nested(sk1);
873 }
874}
875
876static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
877{
878 if (unlikely(sk1 == sk2) || !sk2) {
879 unix_state_unlock(sk1);
880 return;
881 }
882 unix_state_unlock(sk1);
883 unix_state_unlock(sk2);
884}
885
861static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, 886static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
862 int alen, int flags) 887 int alen, int flags)
863{ 888{
@@ -877,11 +902,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
877 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0) 902 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0)
878 goto out; 903 goto out;
879 904
905restart:
880 other=unix_find_other(sunaddr, alen, sock->type, hash, &err); 906 other=unix_find_other(sunaddr, alen, sock->type, hash, &err);
881 if (!other) 907 if (!other)
882 goto out; 908 goto out;
883 909
884 unix_state_wlock(sk); 910 unix_state_double_lock(sk, other);
911
912 /* Apparently VFS overslept socket death. Retry. */
913 if (sock_flag(other, SOCK_DEAD)) {
914 unix_state_double_unlock(sk, other);
915 sock_put(other);
916 goto restart;
917 }
885 918
886 err = -EPERM; 919 err = -EPERM;
887 if (!unix_may_send(sk, other)) 920 if (!unix_may_send(sk, other))
@@ -896,7 +929,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
896 * 1003.1g breaking connected state with AF_UNSPEC 929 * 1003.1g breaking connected state with AF_UNSPEC
897 */ 930 */
898 other = NULL; 931 other = NULL;
899 unix_state_wlock(sk); 932 unix_state_double_lock(sk, other);
900 } 933 }
901 934
902 /* 935 /*
@@ -905,19 +938,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
905 if (unix_peer(sk)) { 938 if (unix_peer(sk)) {
906 struct sock *old_peer = unix_peer(sk); 939 struct sock *old_peer = unix_peer(sk);
907 unix_peer(sk)=other; 940 unix_peer(sk)=other;
908 unix_state_wunlock(sk); 941 unix_state_double_unlock(sk, other);
909 942
910 if (other != old_peer) 943 if (other != old_peer)
911 unix_dgram_disconnected(sk, old_peer); 944 unix_dgram_disconnected(sk, old_peer);
912 sock_put(old_peer); 945 sock_put(old_peer);
913 } else { 946 } else {
914 unix_peer(sk)=other; 947 unix_peer(sk)=other;
915 unix_state_wunlock(sk); 948 unix_state_double_unlock(sk, other);
916 } 949 }
917 return 0; 950 return 0;
918 951
919out_unlock: 952out_unlock:
920 unix_state_wunlock(sk); 953 unix_state_double_unlock(sk, other);
921 sock_put(other); 954 sock_put(other);
922out: 955out:
923 return err; 956 return err;
@@ -936,7 +969,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
936 (skb_queue_len(&other->sk_receive_queue) > 969 (skb_queue_len(&other->sk_receive_queue) >
937 other->sk_max_ack_backlog); 970 other->sk_max_ack_backlog);
938 971
939 unix_state_runlock(other); 972 unix_state_unlock(other);
940 973
941 if (sched) 974 if (sched)
942 timeo = schedule_timeout(timeo); 975 timeo = schedule_timeout(timeo);
@@ -994,11 +1027,11 @@ restart:
994 goto out; 1027 goto out;
995 1028
996 /* Latch state of peer */ 1029 /* Latch state of peer */
997 unix_state_rlock(other); 1030 unix_state_lock(other);
998 1031
999 /* Apparently VFS overslept socket death. Retry. */ 1032 /* Apparently VFS overslept socket death. Retry. */
1000 if (sock_flag(other, SOCK_DEAD)) { 1033 if (sock_flag(other, SOCK_DEAD)) {
1001 unix_state_runlock(other); 1034 unix_state_unlock(other);
1002 sock_put(other); 1035 sock_put(other);
1003 goto restart; 1036 goto restart;
1004 } 1037 }
@@ -1048,18 +1081,18 @@ restart:
1048 goto out_unlock; 1081 goto out_unlock;
1049 } 1082 }
1050 1083
1051 unix_state_wlock_nested(sk); 1084 unix_state_lock_nested(sk);
1052 1085
1053 if (sk->sk_state != st) { 1086 if (sk->sk_state != st) {
1054 unix_state_wunlock(sk); 1087 unix_state_unlock(sk);
1055 unix_state_runlock(other); 1088 unix_state_unlock(other);
1056 sock_put(other); 1089 sock_put(other);
1057 goto restart; 1090 goto restart;
1058 } 1091 }
1059 1092
1060 err = security_unix_stream_connect(sock, other->sk_socket, newsk); 1093 err = security_unix_stream_connect(sock, other->sk_socket, newsk);
1061 if (err) { 1094 if (err) {
1062 unix_state_wunlock(sk); 1095 unix_state_unlock(sk);
1063 goto out_unlock; 1096 goto out_unlock;
1064 } 1097 }
1065 1098
@@ -1096,7 +1129,7 @@ restart:
1096 smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */ 1129 smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */
1097 unix_peer(sk) = newsk; 1130 unix_peer(sk) = newsk;
1098 1131
1099 unix_state_wunlock(sk); 1132 unix_state_unlock(sk);
1100 1133
1101 /* take ten and and send info to listening sock */ 1134 /* take ten and and send info to listening sock */
1102 spin_lock(&other->sk_receive_queue.lock); 1135 spin_lock(&other->sk_receive_queue.lock);
@@ -1105,14 +1138,14 @@ restart:
1105 * is installed to listening socket. */ 1138 * is installed to listening socket. */
1106 atomic_inc(&newu->inflight); 1139 atomic_inc(&newu->inflight);
1107 spin_unlock(&other->sk_receive_queue.lock); 1140 spin_unlock(&other->sk_receive_queue.lock);
1108 unix_state_runlock(other); 1141 unix_state_unlock(other);
1109 other->sk_data_ready(other, 0); 1142 other->sk_data_ready(other, 0);
1110 sock_put(other); 1143 sock_put(other);
1111 return 0; 1144 return 0;
1112 1145
1113out_unlock: 1146out_unlock:
1114 if (other) 1147 if (other)
1115 unix_state_runlock(other); 1148 unix_state_unlock(other);
1116 1149
1117out: 1150out:
1118 if (skb) 1151 if (skb)
@@ -1178,10 +1211,10 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
1178 wake_up_interruptible(&unix_sk(sk)->peer_wait); 1211 wake_up_interruptible(&unix_sk(sk)->peer_wait);
1179 1212
1180 /* attach accepted sock to socket */ 1213 /* attach accepted sock to socket */
1181 unix_state_wlock(tsk); 1214 unix_state_lock(tsk);
1182 newsock->state = SS_CONNECTED; 1215 newsock->state = SS_CONNECTED;
1183 sock_graft(tsk, newsock); 1216 sock_graft(tsk, newsock);
1184 unix_state_wunlock(tsk); 1217 unix_state_unlock(tsk);
1185 return 0; 1218 return 0;
1186 1219
1187out: 1220out:
@@ -1208,7 +1241,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1208 } 1241 }
1209 1242
1210 u = unix_sk(sk); 1243 u = unix_sk(sk);
1211 unix_state_rlock(sk); 1244 unix_state_lock(sk);
1212 if (!u->addr) { 1245 if (!u->addr) {
1213 sunaddr->sun_family = AF_UNIX; 1246 sunaddr->sun_family = AF_UNIX;
1214 sunaddr->sun_path[0] = 0; 1247 sunaddr->sun_path[0] = 0;
@@ -1219,7 +1252,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1219 *uaddr_len = addr->len; 1252 *uaddr_len = addr->len;
1220 memcpy(sunaddr, addr->name, *uaddr_len); 1253 memcpy(sunaddr, addr->name, *uaddr_len);
1221 } 1254 }
1222 unix_state_runlock(sk); 1255 unix_state_unlock(sk);
1223 sock_put(sk); 1256 sock_put(sk);
1224out: 1257out:
1225 return err; 1258 return err;
@@ -1337,7 +1370,7 @@ restart:
1337 goto out_free; 1370 goto out_free;
1338 } 1371 }
1339 1372
1340 unix_state_rlock(other); 1373 unix_state_lock(other);
1341 err = -EPERM; 1374 err = -EPERM;
1342 if (!unix_may_send(sk, other)) 1375 if (!unix_may_send(sk, other))
1343 goto out_unlock; 1376 goto out_unlock;
@@ -1347,20 +1380,20 @@ restart:
1347 * Check with 1003.1g - what should 1380 * Check with 1003.1g - what should
1348 * datagram error 1381 * datagram error
1349 */ 1382 */
1350 unix_state_runlock(other); 1383 unix_state_unlock(other);
1351 sock_put(other); 1384 sock_put(other);
1352 1385
1353 err = 0; 1386 err = 0;
1354 unix_state_wlock(sk); 1387 unix_state_lock(sk);
1355 if (unix_peer(sk) == other) { 1388 if (unix_peer(sk) == other) {
1356 unix_peer(sk)=NULL; 1389 unix_peer(sk)=NULL;
1357 unix_state_wunlock(sk); 1390 unix_state_unlock(sk);
1358 1391
1359 unix_dgram_disconnected(sk, other); 1392 unix_dgram_disconnected(sk, other);
1360 sock_put(other); 1393 sock_put(other);
1361 err = -ECONNREFUSED; 1394 err = -ECONNREFUSED;
1362 } else { 1395 } else {
1363 unix_state_wunlock(sk); 1396 unix_state_unlock(sk);
1364 } 1397 }
1365 1398
1366 other = NULL; 1399 other = NULL;
@@ -1397,14 +1430,14 @@ restart:
1397 } 1430 }
1398 1431
1399 skb_queue_tail(&other->sk_receive_queue, skb); 1432 skb_queue_tail(&other->sk_receive_queue, skb);
1400 unix_state_runlock(other); 1433 unix_state_unlock(other);
1401 other->sk_data_ready(other, len); 1434 other->sk_data_ready(other, len);
1402 sock_put(other); 1435 sock_put(other);
1403 scm_destroy(siocb->scm); 1436 scm_destroy(siocb->scm);
1404 return len; 1437 return len;
1405 1438
1406out_unlock: 1439out_unlock:
1407 unix_state_runlock(other); 1440 unix_state_unlock(other);
1408out_free: 1441out_free:
1409 kfree_skb(skb); 1442 kfree_skb(skb);
1410out: 1443out:
@@ -1494,14 +1527,14 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1494 goto out_err; 1527 goto out_err;
1495 } 1528 }
1496 1529
1497 unix_state_rlock(other); 1530 unix_state_lock(other);
1498 1531
1499 if (sock_flag(other, SOCK_DEAD) || 1532 if (sock_flag(other, SOCK_DEAD) ||
1500 (other->sk_shutdown & RCV_SHUTDOWN)) 1533 (other->sk_shutdown & RCV_SHUTDOWN))
1501 goto pipe_err_free; 1534 goto pipe_err_free;
1502 1535
1503 skb_queue_tail(&other->sk_receive_queue, skb); 1536 skb_queue_tail(&other->sk_receive_queue, skb);
1504 unix_state_runlock(other); 1537 unix_state_unlock(other);
1505 other->sk_data_ready(other, size); 1538 other->sk_data_ready(other, size);
1506 sent+=size; 1539 sent+=size;
1507 } 1540 }
@@ -1512,7 +1545,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1512 return sent; 1545 return sent;
1513 1546
1514pipe_err_free: 1547pipe_err_free:
1515 unix_state_runlock(other); 1548 unix_state_unlock(other);
1516 kfree_skb(skb); 1549 kfree_skb(skb);
1517pipe_err: 1550pipe_err:
1518 if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL)) 1551 if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL))
@@ -1641,7 +1674,7 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
1641{ 1674{
1642 DEFINE_WAIT(wait); 1675 DEFINE_WAIT(wait);
1643 1676
1644 unix_state_rlock(sk); 1677 unix_state_lock(sk);
1645 1678
1646 for (;;) { 1679 for (;;) {
1647 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); 1680 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
@@ -1654,14 +1687,14 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
1654 break; 1687 break;
1655 1688
1656 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 1689 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1657 unix_state_runlock(sk); 1690 unix_state_unlock(sk);
1658 timeo = schedule_timeout(timeo); 1691 timeo = schedule_timeout(timeo);
1659 unix_state_rlock(sk); 1692 unix_state_lock(sk);
1660 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 1693 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1661 } 1694 }
1662 1695
1663 finish_wait(sk->sk_sleep, &wait); 1696 finish_wait(sk->sk_sleep, &wait);
1664 unix_state_runlock(sk); 1697 unix_state_unlock(sk);
1665 return timeo; 1698 return timeo;
1666} 1699}
1667 1700
@@ -1816,12 +1849,12 @@ static int unix_shutdown(struct socket *sock, int mode)
1816 mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN); 1849 mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN);
1817 1850
1818 if (mode) { 1851 if (mode) {
1819 unix_state_wlock(sk); 1852 unix_state_lock(sk);
1820 sk->sk_shutdown |= mode; 1853 sk->sk_shutdown |= mode;
1821 other=unix_peer(sk); 1854 other=unix_peer(sk);
1822 if (other) 1855 if (other)
1823 sock_hold(other); 1856 sock_hold(other);
1824 unix_state_wunlock(sk); 1857 unix_state_unlock(sk);
1825 sk->sk_state_change(sk); 1858 sk->sk_state_change(sk);
1826 1859
1827 if (other && 1860 if (other &&
@@ -1833,9 +1866,9 @@ static int unix_shutdown(struct socket *sock, int mode)
1833 peer_mode |= SEND_SHUTDOWN; 1866 peer_mode |= SEND_SHUTDOWN;
1834 if (mode&SEND_SHUTDOWN) 1867 if (mode&SEND_SHUTDOWN)
1835 peer_mode |= RCV_SHUTDOWN; 1868 peer_mode |= RCV_SHUTDOWN;
1836 unix_state_wlock(other); 1869 unix_state_lock(other);
1837 other->sk_shutdown |= peer_mode; 1870 other->sk_shutdown |= peer_mode;
1838 unix_state_wunlock(other); 1871 unix_state_unlock(other);
1839 other->sk_state_change(other); 1872 other->sk_state_change(other);
1840 read_lock(&other->sk_callback_lock); 1873 read_lock(&other->sk_callback_lock);
1841 if (peer_mode == SHUTDOWN_MASK) 1874 if (peer_mode == SHUTDOWN_MASK)
@@ -1973,7 +2006,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
1973 else { 2006 else {
1974 struct sock *s = v; 2007 struct sock *s = v;
1975 struct unix_sock *u = unix_sk(s); 2008 struct unix_sock *u = unix_sk(s);
1976 unix_state_rlock(s); 2009 unix_state_lock(s);
1977 2010
1978 seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu", 2011 seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu",
1979 s, 2012 s,
@@ -2001,7 +2034,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
2001 for ( ; i < len; i++) 2034 for ( ; i < len; i++)
2002 seq_putc(seq, u->addr->name->sun_path[i]); 2035 seq_putc(seq, u->addr->name->sun_path[i]);
2003 } 2036 }
2004 unix_state_runlock(s); 2037 unix_state_unlock(s);
2005 seq_putc(seq, '\n'); 2038 seq_putc(seq, '\n');
2006 } 2039 }
2007 2040
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 7a19e0ede289..849cc06bd914 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -454,7 +454,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
454 } 454 }
455 455
456 if (conf->data_size && conf->data) { 456 if (conf->data_size && conf->data) {
457 if (conf->data_size > 128000 || conf->data_size < 0) { 457 if (conf->data_size > 128000) {
458 printk(KERN_INFO 458 printk(KERN_INFO
459 "%s: ERROR, Invalid firmware data size %i !\n", 459 "%s: ERROR, Invalid firmware data size %i !\n",
460 wandev->name, conf->data_size); 460 wandev->name, conf->data_size);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e216d49624b7..e216d49624b7 100644..100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl