aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS7
-rw-r--r--Documentation/DocBook/Makefile4
-rw-r--r--Documentation/filesystems/fuse.txt4
-rw-r--r--Documentation/tty.txt111
-rw-r--r--MAINTAINERS132
-rw-r--r--Makefile4
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/gpmc.c21
-rw-r--r--arch/i386/boot/compressed/.gitignore1
-rw-r--r--arch/i386/boot/compressed/head.S2
-rw-r--r--arch/i386/defconfig2
-rw-r--r--arch/sparc/kernel/ioport.c5
-rw-r--r--arch/sparc64/defconfig36
-rw-r--r--arch/sparc64/kernel/isa.c20
-rw-r--r--arch/sparc64/kernel/of_device.c7
-rw-r--r--arch/sparc64/mm/init.c147
-rw-r--r--arch/x86_64/Kconfig5
-rw-r--r--arch/x86_64/defconfig2
-rw-r--r--block/cfq-iosched.c6
-rw-r--r--drivers/ata/libata-sff.c42
-rw-r--r--drivers/block/cciss.c3
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c11
-rw-r--r--drivers/char/isicom.c103
-rw-r--r--drivers/char/mxser.c1
-rw-r--r--drivers/char/mxser_new.c1
-rw-r--r--drivers/ide/pci/piix.c66
-rw-r--r--drivers/ide/pci/slc90e66.c20
-rw-r--r--drivers/ieee1394/sbp2.c83
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c3
-rw-r--r--drivers/input/serio/i8042-sparcio.h6
-rw-r--r--drivers/kvm/kvm.h18
-rw-r--r--drivers/kvm/kvm_main.c98
-rw-r--r--drivers/kvm/mmu.c26
-rw-r--r--drivers/kvm/paging_tmpl.h4
-rw-r--r--drivers/kvm/svm.c52
-rw-r--r--drivers/kvm/vmx.c75
-rw-r--r--drivers/kvm/vmx.h10
-rw-r--r--drivers/macintosh/via-pmu-backlight.c2
-rw-r--r--drivers/mtd/devices/m25p80.c4
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c2
-rw-r--r--drivers/pci/probe.c5
-rw-r--r--drivers/scsi/ibmvscsi/Makefile2
-rw-r--r--drivers/serial/sunsab.c11
-rw-r--r--drivers/serial/sunsu.c10
-rw-r--r--drivers/serial/sunzilog.c14
-rw-r--r--drivers/spi/spi_mpc83xx.c2
-rw-r--r--drivers/spi/spi_s3c24xx.c2
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c2
-rw-r--r--drivers/usb/input/Kconfig2
-rw-r--r--drivers/video/bw2.c18
-rw-r--r--drivers/video/cg14.c28
-rw-r--r--drivers/video/cg3.c22
-rw-r--r--drivers/video/cg6.c33
-rw-r--r--drivers/video/ffb.c25
-rw-r--r--drivers/video/leo.c29
-rw-r--r--drivers/video/p9100.c25
-rw-r--r--drivers/video/tcx.c33
-rw-r--r--fs/aio.c7
-rw-r--r--fs/ocfs2/aops.c24
-rw-r--r--fs/ocfs2/cluster/heartbeat.c17
-rw-r--r--fs/ocfs2/dlmglue.c10
-rw-r--r--fs/ocfs2/file.c13
-rw-r--r--fs/ramfs/file-mmu.c4
-rw-r--r--fs/ramfs/file-nommu.c4
-rw-r--r--include/asm-generic/bug.h2
-rw-r--r--include/asm-sparc/of_device.h2
-rw-r--r--include/asm-sparc64/of_device.h2
-rw-r--r--include/linux/cpuset.h2
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/spi/spi.h2
-rw-r--r--kernel/cpuset.c2
-rw-r--r--kernel/exit.c8
-rw-r--r--kernel/lockdep.c8
-rw-r--r--kernel/module.c4
-rw-r--r--kernel/rcutorture.c3
-rw-r--r--kernel/sched.c18
-rw-r--r--mm/oom_kill.c7
-rw-r--r--mm/rmap.c2
-rw-r--r--mm/slob.c11
-rw-r--r--mm/vmscan.c2
-rw-r--r--net/xfrm/xfrm_algo.c3
-rw-r--r--security/selinux/ss/services.c6
-rw-r--r--sound/pci/hda/patch_realtek.c2
84 files changed, 999 insertions, 579 deletions
diff --git a/CREDITS b/CREDITS
index 8218e790f43d..75c5ce82720c 100644
--- a/CREDITS
+++ b/CREDITS
@@ -516,9 +516,10 @@ S: Orlando, Florida
516S: USA 516S: USA
517 517
518N: Lennert Buytenhek 518N: Lennert Buytenhek
519E: buytenh@gnu.org 519E: kernel@wantstofly.org
520D: Rewrite of the ethernet bridging code 520D: Original (2.4) rewrite of the ethernet bridging code
521S: Ravenhorst 58B 521D: Various ARM bits and pieces
522S: Ravenhorst 58
522S: 2317 AK Leiden 523S: 2317 AK Leiden
523S: The Netherlands 524S: The Netherlands
524 525
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 36526a1e76d7..867608ab3ca0 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -53,8 +53,8 @@ installmandocs: mandocs
53 53
54### 54###
55#External programs used 55#External programs used
56KERNELDOC = scripts/kernel-doc 56KERNELDOC = $(srctree)/scripts/kernel-doc
57DOCPROC = scripts/basic/docproc 57DOCPROC = $(objtree)/scripts/basic/docproc
58 58
59XMLTOFLAGS = -m $(srctree)/Documentation/DocBook/stylesheet.xsl 59XMLTOFLAGS = -m $(srctree)/Documentation/DocBook/stylesheet.xsl
60#XMLTOFLAGS += --skip-validation 60#XMLTOFLAGS += --skip-validation
diff --git a/Documentation/filesystems/fuse.txt b/Documentation/filesystems/fuse.txt
index 345392c4caeb..397a41adb4c3 100644
--- a/Documentation/filesystems/fuse.txt
+++ b/Documentation/filesystems/fuse.txt
@@ -94,8 +94,8 @@ Mount options
94 filesystem is free to implement it's access policy or leave it to 94 filesystem is free to implement it's access policy or leave it to
95 the underlying file access mechanism (e.g. in case of network 95 the underlying file access mechanism (e.g. in case of network
96 filesystems). This option enables permission checking, restricting 96 filesystems). This option enables permission checking, restricting
97 access based on file mode. This is option is usually useful 97 access based on file mode. It is usually useful together with the
98 together with the 'allow_other' mount option. 98 'allow_other' mount option.
99 99
100'allow_other' 100'allow_other'
101 101
diff --git a/Documentation/tty.txt b/Documentation/tty.txt
index dab56604745d..5f799e612e03 100644
--- a/Documentation/tty.txt
+++ b/Documentation/tty.txt
@@ -39,28 +39,37 @@ Line Discipline Methods
39 39
40TTY side interfaces: 40TTY side interfaces:
41 41
42open() - Called when the line discipline is attached to
43 the terminal. No other call into the line
44 discipline for this tty will occur until it
45 completes successfully. Can sleep.
46
42close() - This is called on a terminal when the line 47close() - This is called on a terminal when the line
43 discipline is being unplugged. At the point of 48 discipline is being unplugged. At the point of
44 execution no further users will enter the 49 execution no further users will enter the
45 ldisc code for this tty. Can sleep. 50 ldisc code for this tty. Can sleep.
46 51
47open() - Called when the line discipline is attached to 52hangup() - Called when the tty line is hung up.
48 the terminal. No other call into the line 53 The line discipline should cease I/O to the tty.
49 discipline for this tty will occur until it 54 No further calls into the ldisc code will occur.
50 completes successfully. Can sleep. 55 Can sleep.
51 56
52write() - A process is writing data through the line 57write() - A process is writing data through the line
53 discipline. Multiple write calls are serialized 58 discipline. Multiple write calls are serialized
54 by the tty layer for the ldisc. May sleep. 59 by the tty layer for the ldisc. May sleep.
55 60
56flush_buffer() - May be called at any point between open and close. 61flush_buffer() - (optional) May be called at any point between
62 open and close, and instructs the line discipline
63 to empty its input buffer.
57 64
58chars_in_buffer() - Report the number of bytes in the buffer. 65chars_in_buffer() - (optional) Report the number of bytes in the input
66 buffer.
59 67
60set_termios() - Called on termios structure changes. The caller 68set_termios() - (optional) Called on termios structure changes.
61 passes the old termios data and the current data 69 The caller passes the old termios data and the
62 is in the tty. Called under the termios semaphore so 70 current data is in the tty. Called under the
63 allowed to sleep. Serialized against itself only. 71 termios semaphore so allowed to sleep. Serialized
72 against itself only.
64 73
65read() - Move data from the line discipline to the user. 74read() - Move data from the line discipline to the user.
66 Multiple read calls may occur in parallel and the 75 Multiple read calls may occur in parallel and the
@@ -92,6 +101,88 @@ write_wakeup() - May be called at any point between open and close.
92 this function. In such a situation defer it. 101 this function. In such a situation defer it.
93 102
94 103
104Driver Access
105
106Line discipline methods can call the following methods of the underlying
107hardware driver through the function pointers within the tty->driver
108structure:
109
110write() Write a block of characters to the tty device.
111 Returns the number of characters accepted.
112
113put_char() Queues a character for writing to the tty device.
114 If there is no room in the queue, the character is
115 ignored.
116
117flush_chars() (Optional) If defined, must be called after
118 queueing characters with put_char() in order to
119 start transmission.
120
121write_room() Returns the numbers of characters the tty driver
122 will accept for queueing to be written.
123
124ioctl() Invoke device specific ioctl.
125 Expects data pointers to refer to userspace.
126 Returns ENOIOCTLCMD for unrecognized ioctl numbers.
127
128set_termios() Notify the tty driver that the device's termios
129 settings have changed. New settings are in
130 tty->termios. Previous settings should be passed in
131 the "old" argument.
132
133throttle() Notify the tty driver that input buffers for the
134 line discipline are close to full, and it should
135 somehow signal that no more characters should be
136 sent to the tty.
137
138unthrottle() Notify the tty driver that characters can now be
139 sent to the tty without fear of overrunning the
140 input buffers of the line disciplines.
141
142stop() Ask the tty driver to stop outputting characters
143 to the tty device.
144
145start() Ask the tty driver to resume sending characters
146 to the tty device.
147
148hangup() Ask the tty driver to hang up the tty device.
149
150break_ctl() (Optional) Ask the tty driver to turn on or off
151 BREAK status on the RS-232 port. If state is -1,
152 then the BREAK status should be turned on; if
153 state is 0, then BREAK should be turned off.
154 If this routine is not implemented, use ioctls
155 TIOCSBRK / TIOCCBRK instead.
156
157wait_until_sent() Waits until the device has written out all of the
158 characters in its transmitter FIFO.
159
160send_xchar() Send a high-priority XON/XOFF character to the device.
161
162
163Flags
164
165Line discipline methods have access to tty->flags field containing the
166following interesting flags:
167
168TTY_THROTTLED Driver input is throttled. The ldisc should call
169 tty->driver->unthrottle() in order to resume
170 reception when it is ready to process more data.
171
172TTY_DO_WRITE_WAKEUP If set, causes the driver to call the ldisc's
173 write_wakeup() method in order to resume
174 transmission when it can accept more data
175 to transmit.
176
177TTY_IO_ERROR If set, causes all subsequent userspace read/write
178 calls on the tty to fail, returning -EIO.
179
180TTY_OTHER_CLOSED Device is a pty and the other side has closed.
181
182TTY_NO_WRITE_SPLIT Prevent driver from splitting up writes into
183 smaller chunks.
184
185
95Locking 186Locking
96 187
97Callers to the line discipline functions from the tty layer are required to 188Callers to the line discipline functions from the tty layer are required to
diff --git a/MAINTAINERS b/MAINTAINERS
index db090362d731..d5a97d3e23c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -355,6 +355,24 @@ P: Ian Molton
355M: spyro@f2s.com 355M: spyro@f2s.com
356S: Maintained 356S: Maintained
357 357
358ARM/ADI ROADRUNNER MACHINE SUPPORT
359P: Lennert Buytenhek
360M: kernel@wantstofly.org
361L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
362S: Maintained
363
364ARM/ADS SPHERE MACHINE SUPPORT
365P: Lennert Buytenhek
366M: kernel@wantstofly.org
367L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
368S: Maintained
369
370ARM/AJECO 1ARM MACHINE SUPPORT
371P: Lennert Buytenhek
372M: kernel@wantstofly.org
373L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
374S: Maintained
375
358ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 376ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
359P: Andrew Victor 377P: Andrew Victor
360M: andrew@sanpeople.com 378M: andrew@sanpeople.com
@@ -362,17 +380,89 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
362W: http://maxim.org.za/at91_26.html 380W: http://maxim.org.za/at91_26.html
363S: Maintained 381S: Maintained
364 382
383ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
384P: Lennert Buytenhek
385M: kernel@wantstofly.org
386L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
387S: Maintained
388
389ARM/CIRRUS LOGIC EDB9315A MACHINE SUPPORT
390P: Lennert Buytenhek
391M: kernel@wantstofly.org
392L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
393S: Maintained
394
365ARM/CORGI MACHINE SUPPORT 395ARM/CORGI MACHINE SUPPORT
366P: Richard Purdie 396P: Richard Purdie
367M: rpurdie@rpsys.net 397M: rpurdie@rpsys.net
368S: Maintained 398S: Maintained
369 399
400ARM/GLOMATION GESBC9312SX MACHINE SUPPORT
401P: Lennert Buytenhek
402M: kernel@wantstofly.org
403L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
404S: Maintained
405
370ARM/HP JORNADA 7XX MACHINE SUPPORT 406ARM/HP JORNADA 7XX MACHINE SUPPORT
371P: Kristoffer Ericson 407P: Kristoffer Ericson
372M: kristoffer_e1@hotmail.com 408M: kristoffer_e1@hotmail.com
373W: www.jlime.com 409W: www.jlime.com
374S: Maintained 410S: Maintained
375 411
412ARM/INTEL IOP32X ARM ARCHITECTURE
413P: Lennert Buytenhek
414M: kernel@wantstofly.org
415L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
416S: Maintained
417
418ARM/INTEL IOP13XX ARM ARCHITECTURE
419P: Lennert Buytenhek
420M: kernel@wantstofly.org
421L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
422S: Maintained
423
424ARM/INTEL IQ81342EX MACHINE SUPPORT
425P: Lennert Buytenhek
426M: kernel@wantstofly.org
427L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
428S: Maintained
429
430ARM/INTEL IXP2000 ARM ARCHITECTURE
431P: Lennert Buytenhek
432M: kernel@wantstofly.org
433L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
434S: Maintained
435
436ARM/INTEL IXDP2850 MACHINE SUPPORT
437P: Lennert Buytenhek
438M: kernel@wantstofly.org
439L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
440S: Maintained
441
442ARM/INTEL IXP23XX ARM ARCHITECTURE
443P: Lennert Buytenhek
444M: kernel@wantstofly.org
445L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
446S: Maintained
447
448ARM/INTEL XSC3 (MANZANO) ARM CORE
449P: Lennert Buytenhek
450M: kernel@wantstofly.org
451L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
452S: Maintained
453
454ARM/IP FABRICS DOUBLE ESPRESSO MACHINE SUPPORT
455P: Lennert Buytenhek
456M: kernel@wantstofly.org
457L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
458S: Maintained
459
460ARM/LOGICPD PXA270 MACHINE SUPPORT
461P: Lennert Buytenhek
462M: kernel@wantstofly.org
463L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
464S: Maintained
465
376ARM/TOSA MACHINE SUPPORT 466ARM/TOSA MACHINE SUPPORT
377P: Dirk Opfer 467P: Dirk Opfer
378M: dirk@opfer-online.de 468M: dirk@opfer-online.de
@@ -391,6 +481,12 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
391W: http://www.arm.linux.org.uk/ 481W: http://www.arm.linux.org.uk/
392S: Maintained 482S: Maintained
393 483
484ARM/RADISYS ENP2611 MACHINE SUPPORT
485P: Lennert Buytenhek
486M: kernel@wantstofly.org
487L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
488S: Maintained
489
394ARM/SHARK MACHINE SUPPORT 490ARM/SHARK MACHINE SUPPORT
395P: Alexander Schulz 491P: Alexander Schulz
396M: alex@shark-linux.de 492M: alex@shark-linux.de
@@ -418,6 +514,18 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
418W: http://www.fluff.org/ben/linux/ 514W: http://www.fluff.org/ben/linux/
419S: Maintained 515S: Maintained
420 516
517ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
518P: Lennert Buytenhek
519M: kernel@wantstofly.org
520L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
521S: Maintained
522
523ARM/THECUS N2100 MACHINE SUPPORT
524P: Lennert Buytenhek
525M: kernel@wantstofly.org
526L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
527S: Maintained
528
421ARPD SUPPORT 529ARPD SUPPORT
422P: Jonathan Layes 530P: Jonathan Layes
423L: netdev@vger.kernel.org 531L: netdev@vger.kernel.org
@@ -688,12 +796,24 @@ M: joel.becker@oracle.com
688L: linux-kernel@vger.kernel.org 796L: linux-kernel@vger.kernel.org
689S: Supported 797S: Supported
690 798
799CIRRUS LOGIC EP93XX ETHERNET DRIVER
800P: Lennert Buytenhek
801M: kernel@wantstofly.org
802L: netdev@vger.kernel.org
803S: Maintained
804
691CIRRUS LOGIC GENERIC FBDEV DRIVER 805CIRRUS LOGIC GENERIC FBDEV DRIVER
692P: Jeff Garzik 806P: Jeff Garzik
693M: jgarzik@pobox.com 807M: jgarzik@pobox.com
694L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 808L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
695S: Odd Fixes 809S: Odd Fixes
696 810
811CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER
812P: Lennert Buytenhek
813M: kernel@wantstofly.org
814L: linux-usb-devel@lists.sourceforge.net
815S: Maintained
816
697CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER 817CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER
698P: Cirrus Logic Corporation (kernel 2.2 driver) 818P: Cirrus Logic Corporation (kernel 2.2 driver)
699M: Cirrus Logic Corporation, Thomas Woller <twoller@crystal.cirrus.com> 819M: Cirrus Logic Corporation, Thomas Woller <twoller@crystal.cirrus.com>
@@ -1563,6 +1683,12 @@ P: Deepak Saxena
1563M: dsaxena@plexity.net 1683M: dsaxena@plexity.net
1564S: Maintained 1684S: Maintained
1565 1685
1686INTEL IXP2000 ETHERNET DRIVER
1687P: Lennert Buytenhek
1688M: kernel@wantstofly.org
1689L: netdev@vger.kernel.org
1690S: Maintained
1691
1566INTEL PRO/100 ETHERNET SUPPORT 1692INTEL PRO/100 ETHERNET SUPPORT
1567P: John Ronciak 1693P: John Ronciak
1568M: john.ronciak@intel.com 1694M: john.ronciak@intel.com
@@ -1931,9 +2057,9 @@ S: Maintained
1931 2057
1932LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) 2058LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
1933P: Eric Moore 2059P: Eric Moore
1934M: Eric.Moore@lsil.com 2060M: Eric.Moore@lsi.com
1935M: support@lsil.com 2061M: support@lsi.com
1936L: mpt_linux_developer@lsil.com 2062L: mpt_linux_developer@lsi.com
1937L: linux-scsi@vger.kernel.org 2063L: linux-scsi@vger.kernel.org
1938W: http://www.lsilogic.com/support 2064W: http://www.lsilogic.com/support
1939S: Supported 2065S: Supported
diff --git a/Makefile b/Makefile
index d6b64a08e28c..0e9eee768288 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 20 3SUBLEVEL = 20
4EXTRAVERSION =-rc2 4EXTRAVERSION =-rc3
5NAME = Homicidal Dwarf Hamster 5NAME = Homicidal Dwarf Hamster
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -1040,7 +1040,7 @@ CLEAN_FILES += vmlinux System.map \
1040# Directories & files removed with 'make mrproper' 1040# Directories & files removed with 'make mrproper'
1041MRPROPER_DIRS += include/config include2 usr/include 1041MRPROPER_DIRS += include/config include2 usr/include
1042MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 1042MRPROPER_FILES += .config .config.old include/asm .version .old_version \
1043 include/linux/autoconf.h generated-headers \ 1043 include/linux/autoconf.h include/linux/utsrelease.h include/linux/version.h \
1044 Module.symvers tags TAGS cscope* 1044 Module.symvers tags TAGS cscope*
1045 1045
1046# clean - Delete most, but leave enough to build external modules 1046# clean - Delete most, but leave enough to build external modules
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 03d6905ba490..878ff9181d0e 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -22,6 +22,7 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/mtd/onenand.h> 24#include <linux/mtd/onenand.h>
25#include <linux/irq.h>
25#include <linux/interrupt.h> 26#include <linux/interrupt.h>
26#include <linux/delay.h> 27#include <linux/delay.h>
27 28
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index f4f04d87df32..d8f57824423f 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -17,6 +17,7 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18 18
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/mach-types.h>
20#include <asm/arch/gpmc.h> 21#include <asm/arch/gpmc.h>
21 22
22#undef DEBUG 23#undef DEBUG
@@ -338,19 +339,13 @@ void __init gpmc_mem_init(void)
338 int cs; 339 int cs;
339 unsigned long boot_rom_space = 0; 340 unsigned long boot_rom_space = 0;
340 341
341 if (cpu_is_omap242x()) { 342 /* never allocate the first page, to facilitate bug detection;
342 u32 l; 343 * even if we didn't boot from ROM.
343 l = omap_readl(OMAP242X_CONTROL_STATUS); 344 */
344 /* In case of internal boot the 1st MB is redirected to the 345 boot_rom_space = BOOT_ROM_SPACE;
345 * boot ROM memory space. 346 /* In apollon the CS0 is mapped as 0x0000 0000 */
346 */ 347 if (machine_is_omap_apollon())
347 if (l & (1 << 3)) 348 boot_rom_space = 0;
348 boot_rom_space = BOOT_ROM_SPACE;
349 } else
350 /* We assume internal boot if the mode can't be
351 * determined.
352 */
353 boot_rom_space = BOOT_ROM_SPACE;
354 gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space; 349 gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space;
355 gpmc_mem_root.end = GPMC_MEM_END; 350 gpmc_mem_root.end = GPMC_MEM_END;
356 351
diff --git a/arch/i386/boot/compressed/.gitignore b/arch/i386/boot/compressed/.gitignore
new file mode 100644
index 000000000000..be0ed065249b
--- /dev/null
+++ b/arch/i386/boot/compressed/.gitignore
@@ -0,0 +1 @@
relocs
diff --git a/arch/i386/boot/compressed/head.S b/arch/i386/boot/compressed/head.S
index f395a4bb38bb..3517a32aaf41 100644
--- a/arch/i386/boot/compressed/head.S
+++ b/arch/i386/boot/compressed/head.S
@@ -28,7 +28,7 @@
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/boot.h> 29#include <asm/boot.h>
30 30
31.section ".text.head" 31.section ".text.head","ax",@progbits
32 .globl startup_32 32 .globl startup_32
33 33
34startup_32: 34startup_32:
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index e075ff05c46d..88b7c1cf65a2 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1167,7 +1167,7 @@ CONFIG_USB_STORAGE=y
1167# USB Input Devices 1167# USB Input Devices
1168# 1168#
1169CONFIG_USB_HID=y 1169CONFIG_USB_HID=y
1170# CONFIG_USB_HID_POWERBOOK is not set 1170# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1171# CONFIG_HID_FF is not set 1171# CONFIG_HID_FF is not set
1172# CONFIG_USB_HIDDEV is not set 1172# CONFIG_USB_HIDDEV is not set
1173# CONFIG_USB_AIPTEK is not set 1173# CONFIG_USB_AIPTEK is not set
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index cbbc98846b00..987ec6782f99 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -153,7 +153,7 @@ void __iomem *of_ioremap(struct resource *res, unsigned long offset,
153} 153}
154EXPORT_SYMBOL(of_ioremap); 154EXPORT_SYMBOL(of_ioremap);
155 155
156void of_iounmap(void __iomem *base, unsigned long size) 156void of_iounmap(struct resource *res, void __iomem *base, unsigned long size)
157{ 157{
158 iounmap(base); 158 iounmap(base);
159} 159}
@@ -726,7 +726,8 @@ int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
726 /* IIep is write-through, not flushing. */ 726 /* IIep is write-through, not flushing. */
727 for (n = 0; n < nents; n++) { 727 for (n = 0; n < nents; n++) {
728 BUG_ON(page_address(sg->page) == NULL); 728 BUG_ON(page_address(sg->page) == NULL);
729 sg->dvma_address = virt_to_phys(page_address(sg->page)); 729 sg->dvma_address =
730 virt_to_phys(page_address(sg->page)) + sg->offset;
730 sg->dvma_length = sg->length; 731 sg->dvma_length = sg->length;
731 sg++; 732 sg++;
732 } 733 }
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 0f0d38f6197c..5a9e68b13e60 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19 3# Linux kernel version: 2.6.20-rc2
4# Sat Dec 9 15:41:30 2006 4# Thu Dec 28 15:09:49 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -334,7 +334,7 @@ CONFIG_BLK_DEV_LOOP=m
334CONFIG_BLK_DEV_CRYPTOLOOP=m 334CONFIG_BLK_DEV_CRYPTOLOOP=m
335CONFIG_BLK_DEV_NBD=m 335CONFIG_BLK_DEV_NBD=m
336# CONFIG_BLK_DEV_SX8 is not set 336# CONFIG_BLK_DEV_SX8 is not set
337CONFIG_BLK_DEV_UB=m 337# CONFIG_BLK_DEV_UB is not set
338# CONFIG_BLK_DEV_RAM is not set 338# CONFIG_BLK_DEV_RAM is not set
339# CONFIG_BLK_DEV_INITRD is not set 339# CONFIG_BLK_DEV_INITRD is not set
340CONFIG_CDROM_PKTCDVD=m 340CONFIG_CDROM_PKTCDVD=m
@@ -840,6 +840,7 @@ CONFIG_HWMON=y
840# CONFIG_SENSORS_LM92 is not set 840# CONFIG_SENSORS_LM92 is not set
841# CONFIG_SENSORS_MAX1619 is not set 841# CONFIG_SENSORS_MAX1619 is not set
842# CONFIG_SENSORS_PC87360 is not set 842# CONFIG_SENSORS_PC87360 is not set
843# CONFIG_SENSORS_PC87427 is not set
843# CONFIG_SENSORS_SIS5595 is not set 844# CONFIG_SENSORS_SIS5595 is not set
844# CONFIG_SENSORS_SMSC47M1 is not set 845# CONFIG_SENSORS_SMSC47M1 is not set
845# CONFIG_SENSORS_SMSC47M192 is not set 846# CONFIG_SENSORS_SMSC47M192 is not set
@@ -850,6 +851,7 @@ CONFIG_HWMON=y
850# CONFIG_SENSORS_W83781D is not set 851# CONFIG_SENSORS_W83781D is not set
851# CONFIG_SENSORS_W83791D is not set 852# CONFIG_SENSORS_W83791D is not set
852# CONFIG_SENSORS_W83792D is not set 853# CONFIG_SENSORS_W83792D is not set
854# CONFIG_SENSORS_W83793 is not set
853# CONFIG_SENSORS_W83L785TS is not set 855# CONFIG_SENSORS_W83L785TS is not set
854# CONFIG_SENSORS_W83627HF is not set 856# CONFIG_SENSORS_W83627HF is not set
855# CONFIG_SENSORS_W83627EHF is not set 857# CONFIG_SENSORS_W83627EHF is not set
@@ -962,7 +964,6 @@ CONFIG_SND_VERBOSE_PROCFS=y
962# 964#
963CONFIG_SND_MPU401_UART=m 965CONFIG_SND_MPU401_UART=m
964CONFIG_SND_AC97_CODEC=m 966CONFIG_SND_AC97_CODEC=m
965CONFIG_SND_AC97_BUS=m
966CONFIG_SND_DUMMY=m 967CONFIG_SND_DUMMY=m
967CONFIG_SND_VIRMIDI=m 968CONFIG_SND_VIRMIDI=m
968CONFIG_SND_MTPAV=m 969CONFIG_SND_MTPAV=m
@@ -1045,6 +1046,7 @@ CONFIG_SND_SUN_CS4231=m
1045# Open Sound System 1046# Open Sound System
1046# 1047#
1047# CONFIG_SOUND_PRIME is not set 1048# CONFIG_SOUND_PRIME is not set
1049CONFIG_AC97_BUS=m
1048 1050
1049# 1051#
1050# HID Devices 1052# HID Devices
@@ -1096,14 +1098,26 @@ CONFIG_USB_UHCI_HCD=m
1096# 1098#
1097# may also be needed; see USB_STORAGE Help for more information 1099# may also be needed; see USB_STORAGE Help for more information
1098# 1100#
1099# CONFIG_USB_STORAGE is not set 1101CONFIG_USB_STORAGE=m
1102# CONFIG_USB_STORAGE_DEBUG is not set
1103# CONFIG_USB_STORAGE_DATAFAB is not set
1104# CONFIG_USB_STORAGE_FREECOM is not set
1105# CONFIG_USB_STORAGE_ISD200 is not set
1106# CONFIG_USB_STORAGE_DPCM is not set
1107# CONFIG_USB_STORAGE_USBAT is not set
1108# CONFIG_USB_STORAGE_SDDR09 is not set
1109# CONFIG_USB_STORAGE_SDDR55 is not set
1110# CONFIG_USB_STORAGE_JUMPSHOT is not set
1111# CONFIG_USB_STORAGE_ALAUDA is not set
1112# CONFIG_USB_STORAGE_ONETOUCH is not set
1113# CONFIG_USB_STORAGE_KARMA is not set
1100# CONFIG_USB_LIBUSUAL is not set 1114# CONFIG_USB_LIBUSUAL is not set
1101 1115
1102# 1116#
1103# USB Input Devices 1117# USB Input Devices
1104# 1118#
1105CONFIG_USB_HID=y 1119CONFIG_USB_HID=y
1106# CONFIG_USB_HID_POWERBOOK is not set 1120# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1107# CONFIG_HID_FF is not set 1121# CONFIG_HID_FF is not set
1108CONFIG_USB_HIDDEV=y 1122CONFIG_USB_HIDDEV=y
1109# CONFIG_USB_AIPTEK is not set 1123# CONFIG_USB_AIPTEK is not set
@@ -1222,6 +1236,10 @@ CONFIG_USB_HIDDEV=y
1222# 1236#
1223 1237
1224# 1238#
1239# Virtualization
1240#
1241
1242#
1225# Misc Linux/SPARC drivers 1243# Misc Linux/SPARC drivers
1226# 1244#
1227CONFIG_SUN_OPENPROMIO=m 1245CONFIG_SUN_OPENPROMIO=m
@@ -1397,6 +1415,8 @@ CONFIG_PRINTK_TIME=y
1397CONFIG_ENABLE_MUST_CHECK=y 1415CONFIG_ENABLE_MUST_CHECK=y
1398CONFIG_MAGIC_SYSRQ=y 1416CONFIG_MAGIC_SYSRQ=y
1399# CONFIG_UNUSED_SYMBOLS is not set 1417# CONFIG_UNUSED_SYMBOLS is not set
1418CONFIG_DEBUG_FS=y
1419# CONFIG_HEADERS_CHECK is not set
1400CONFIG_DEBUG_KERNEL=y 1420CONFIG_DEBUG_KERNEL=y
1401CONFIG_LOG_BUF_SHIFT=18 1421CONFIG_LOG_BUF_SHIFT=18
1402CONFIG_DETECT_SOFTLOCKUP=y 1422CONFIG_DETECT_SOFTLOCKUP=y
@@ -1414,12 +1434,9 @@ CONFIG_SCHEDSTATS=y
1414# CONFIG_DEBUG_KOBJECT is not set 1434# CONFIG_DEBUG_KOBJECT is not set
1415CONFIG_DEBUG_BUGVERBOSE=y 1435CONFIG_DEBUG_BUGVERBOSE=y
1416# CONFIG_DEBUG_INFO is not set 1436# CONFIG_DEBUG_INFO is not set
1417CONFIG_DEBUG_FS=y
1418# CONFIG_DEBUG_VM is not set 1437# CONFIG_DEBUG_VM is not set
1419# CONFIG_DEBUG_LIST is not set 1438# CONFIG_DEBUG_LIST is not set
1420# CONFIG_UNWIND_INFO is not set
1421CONFIG_FORCED_INLINING=y 1439CONFIG_FORCED_INLINING=y
1422# CONFIG_HEADERS_CHECK is not set
1423# CONFIG_RCU_TORTURE_TEST is not set 1440# CONFIG_RCU_TORTURE_TEST is not set
1424# CONFIG_LKDTM is not set 1441# CONFIG_LKDTM is not set
1425# CONFIG_DEBUG_STACK_USAGE is not set 1442# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1489,3 +1506,4 @@ CONFIG_LIBCRC32C=m
1489CONFIG_ZLIB_INFLATE=y 1506CONFIG_ZLIB_INFLATE=y
1490CONFIG_ZLIB_DEFLATE=y 1507CONFIG_ZLIB_DEFLATE=y
1491CONFIG_PLIST=y 1508CONFIG_PLIST=y
1509CONFIG_IOMAP_COPY=y
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c
index ad1c4f55420f..98721a8f8619 100644
--- a/arch/sparc64/kernel/isa.c
+++ b/arch/sparc64/kernel/isa.c
@@ -22,14 +22,15 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
22 printk(" [%s", isa_dev->prom_node->name); 22 printk(" [%s", isa_dev->prom_node->name);
23} 23}
24 24
25static struct linux_prom_registers * __init 25static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev)
26isa_dev_get_resource(struct sparc_isa_device *isa_dev)
27{ 26{
28 struct linux_prom_registers *pregs; 27 struct linux_prom_registers *pregs;
29 unsigned long base, len; 28 unsigned long base, len;
30 int prop_len; 29 int prop_len;
31 30
32 pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len); 31 pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len);
32 if (!pregs)
33 return;
33 34
34 /* Only the first one is interesting. */ 35 /* Only the first one is interesting. */
35 len = pregs[0].reg_size; 36 len = pregs[0].reg_size;
@@ -44,12 +45,9 @@ isa_dev_get_resource(struct sparc_isa_device *isa_dev)
44 45
45 request_resource(&isa_dev->bus->parent->io_space, 46 request_resource(&isa_dev->bus->parent->io_space,
46 &isa_dev->resource); 47 &isa_dev->resource);
47
48 return pregs;
49} 48}
50 49
51static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev, 50static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev)
52 struct linux_prom_registers *pregs)
53{ 51{
54 struct of_device *op = of_find_device_by_node(isa_dev->prom_node); 52 struct of_device *op = of_find_device_by_node(isa_dev->prom_node);
55 53
@@ -69,7 +67,6 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
69 67
70 printk(" ->"); 68 printk(" ->");
71 while (dp) { 69 while (dp) {
72 struct linux_prom_registers *regs;
73 struct sparc_isa_device *isa_dev; 70 struct sparc_isa_device *isa_dev;
74 71
75 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 72 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL);
@@ -85,8 +82,8 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
85 isa_dev->bus = parent_isa_dev->bus; 82 isa_dev->bus = parent_isa_dev->bus;
86 isa_dev->prom_node = dp; 83 isa_dev->prom_node = dp;
87 84
88 regs = isa_dev_get_resource(isa_dev); 85 isa_dev_get_resource(isa_dev);
89 isa_dev_get_irq(isa_dev, regs); 86 isa_dev_get_irq(isa_dev);
90 87
91 report_dev(isa_dev, 1); 88 report_dev(isa_dev, 1);
92 89
@@ -99,7 +96,6 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
99 struct device_node *dp = isa_br->prom_node->child; 96 struct device_node *dp = isa_br->prom_node->child;
100 97
101 while (dp) { 98 while (dp) {
102 struct linux_prom_registers *regs;
103 struct sparc_isa_device *isa_dev; 99 struct sparc_isa_device *isa_dev;
104 100
105 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 101 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL);
@@ -137,8 +133,8 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
137 isa_dev->bus = isa_br; 133 isa_dev->bus = isa_br;
138 isa_dev->prom_node = dp; 134 isa_dev->prom_node = dp;
139 135
140 regs = isa_dev_get_resource(isa_dev); 136 isa_dev_get_resource(isa_dev);
141 isa_dev_get_irq(isa_dev, regs); 137 isa_dev_get_irq(isa_dev);
142 138
143 report_dev(isa_dev, 0); 139 report_dev(isa_dev, 0);
144 140
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index cec0eceae552..b0f3e0082a0d 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -144,9 +144,12 @@ void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned lo
144} 144}
145EXPORT_SYMBOL(of_ioremap); 145EXPORT_SYMBOL(of_ioremap);
146 146
147void of_iounmap(void __iomem *base, unsigned long size) 147void of_iounmap(struct resource *res, void __iomem *base, unsigned long size)
148{ 148{
149 release_region((unsigned long) base, size); 149 if (res->flags & IORESOURCE_MEM)
150 release_mem_region((unsigned long) base, size);
151 else
152 release_region((unsigned long) base, size);
150} 153}
151EXPORT_SYMBOL(of_iounmap); 154EXPORT_SYMBOL(of_iounmap);
152 155
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index a8e8802eed4d..054822a3e05e 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -872,6 +872,115 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
872 prom_halt(); 872 prom_halt();
873} 873}
874 874
875static void __init trim_pavail(unsigned long *cur_size_p,
876 unsigned long *end_of_phys_p)
877{
878 unsigned long to_trim = *cur_size_p - cmdline_memory_size;
879 unsigned long avoid_start, avoid_end;
880 int i;
881
882 to_trim = PAGE_ALIGN(to_trim);
883
884 avoid_start = avoid_end = 0;
885#ifdef CONFIG_BLK_DEV_INITRD
886 avoid_start = initrd_start;
887 avoid_end = PAGE_ALIGN(initrd_end);
888#endif
889
890 /* Trim some pavail[] entries in order to satisfy the
891 * requested "mem=xxx" kernel command line specification.
892 *
893 * We must not trim off the kernel image area nor the
894 * initial ramdisk range (if any). Also, we must not trim
895 * any pavail[] entry down to zero in order to preserve
896 * the invariant that all pavail[] entries have a non-zero
897 * size which is assumed by all of the code in here.
898 */
899 for (i = 0; i < pavail_ents; i++) {
900 unsigned long start, end, kern_end;
901 unsigned long trim_low, trim_high, n;
902
903 kern_end = PAGE_ALIGN(kern_base + kern_size);
904
905 trim_low = start = pavail[i].phys_addr;
906 trim_high = end = start + pavail[i].reg_size;
907
908 if (kern_base >= start &&
909 kern_base < end) {
910 trim_low = kern_base;
911 if (kern_end >= end)
912 continue;
913 }
914 if (kern_end >= start &&
915 kern_end < end) {
916 trim_high = kern_end;
917 }
918 if (avoid_start &&
919 avoid_start >= start &&
920 avoid_start < end) {
921 if (trim_low > avoid_start)
922 trim_low = avoid_start;
923 if (avoid_end >= end)
924 continue;
925 }
926 if (avoid_end &&
927 avoid_end >= start &&
928 avoid_end < end) {
929 if (trim_high < avoid_end)
930 trim_high = avoid_end;
931 }
932
933 if (trim_high <= trim_low)
934 continue;
935
936 if (trim_low == start && trim_high == end) {
937 /* Whole chunk is available for trimming.
938 * Trim all except one page, in order to keep
939 * entry non-empty.
940 */
941 n = (end - start) - PAGE_SIZE;
942 if (n > to_trim)
943 n = to_trim;
944
945 if (n) {
946 pavail[i].phys_addr += n;
947 pavail[i].reg_size -= n;
948 to_trim -= n;
949 }
950 } else {
951 n = (trim_low - start);
952 if (n > to_trim)
953 n = to_trim;
954
955 if (n) {
956 pavail[i].phys_addr += n;
957 pavail[i].reg_size -= n;
958 to_trim -= n;
959 }
960 if (to_trim) {
961 n = end - trim_high;
962 if (n > to_trim)
963 n = to_trim;
964 if (n) {
965 pavail[i].reg_size -= n;
966 to_trim -= n;
967 }
968 }
969 }
970
971 if (!to_trim)
972 break;
973 }
974
975 /* Recalculate. */
976 *cur_size_p = 0UL;
977 for (i = 0; i < pavail_ents; i++) {
978 *end_of_phys_p = pavail[i].phys_addr +
979 pavail[i].reg_size;
980 *cur_size_p += pavail[i].reg_size;
981 }
982}
983
875static unsigned long __init bootmem_init(unsigned long *pages_avail, 984static unsigned long __init bootmem_init(unsigned long *pages_avail,
876 unsigned long phys_base) 985 unsigned long phys_base)
877{ 986{
@@ -889,31 +998,13 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
889 end_of_phys_memory = pavail[i].phys_addr + 998 end_of_phys_memory = pavail[i].phys_addr +
890 pavail[i].reg_size; 999 pavail[i].reg_size;
891 bytes_avail += pavail[i].reg_size; 1000 bytes_avail += pavail[i].reg_size;
892 if (cmdline_memory_size) {
893 if (bytes_avail > cmdline_memory_size) {
894 unsigned long slack = bytes_avail - cmdline_memory_size;
895
896 bytes_avail -= slack;
897 end_of_phys_memory -= slack;
898
899 pavail[i].reg_size -= slack;
900 if ((long)pavail[i].reg_size <= 0L) {
901 pavail[i].phys_addr = 0xdeadbeefUL;
902 pavail[i].reg_size = 0UL;
903 pavail_ents = i;
904 } else {
905 pavail[i+1].reg_size = 0Ul;
906 pavail[i+1].phys_addr = 0xdeadbeefUL;
907 pavail_ents = i + 1;
908 }
909 break;
910 }
911 }
912 } 1001 }
913 1002
914 *pages_avail = bytes_avail >> PAGE_SHIFT; 1003 /* Determine the location of the initial ramdisk before trying
915 1004 * to honor the "mem=xxx" command line argument. We must know
916 end_pfn = end_of_phys_memory >> PAGE_SHIFT; 1005 * where the kernel image and the ramdisk image are so that we
1006 * do not trim those two areas from the physical memory map.
1007 */
917 1008
918#ifdef CONFIG_BLK_DEV_INITRD 1009#ifdef CONFIG_BLK_DEV_INITRD
919 /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ 1010 /* Now have to check initial ramdisk, so that bootmap does not overwrite it */
@@ -932,6 +1023,16 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
932 } 1023 }
933 } 1024 }
934#endif 1025#endif
1026
1027 if (cmdline_memory_size &&
1028 bytes_avail > cmdline_memory_size)
1029 trim_pavail(&bytes_avail,
1030 &end_of_phys_memory);
1031
1032 *pages_avail = bytes_avail >> PAGE_SHIFT;
1033
1034 end_pfn = end_of_phys_memory >> PAGE_SHIFT;
1035
935 /* Initialize the boot-time allocator. */ 1036 /* Initialize the boot-time allocator. */
936 max_pfn = max_low_pfn = end_pfn; 1037 max_pfn = max_low_pfn = end_pfn;
937 min_low_pfn = (phys_base >> PAGE_SHIFT); 1038 min_low_pfn = (phys_base >> PAGE_SHIFT);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index ef6672455695..d4275537b25b 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -480,13 +480,14 @@ config CALGARY_IOMMU
480 480
481config CALGARY_IOMMU_ENABLED_BY_DEFAULT 481config CALGARY_IOMMU_ENABLED_BY_DEFAULT
482 bool "Should Calgary be enabled by default?" 482 bool "Should Calgary be enabled by default?"
483 default y
483 depends on CALGARY_IOMMU 484 depends on CALGARY_IOMMU
484 help 485 help
485 Should Calgary be enabled by default? If you choose 'y', Calgary 486 Should Calgary be enabled by default? if you choose 'y', Calgary
486 will be used (if it exists). If you choose 'n', Calgary will not be 487 will be used (if it exists). If you choose 'n', Calgary will not be
487 used even if it exists. If you choose 'n' and would like to use 488 used even if it exists. If you choose 'n' and would like to use
488 Calgary anyway, pass 'iommu=calgary' on the kernel command line. 489 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
489 If unsure, say N. 490 If unsure, say Y.
490 491
491# need this always selected by IOMMU for the VIA workaround 492# need this always selected by IOMMU for the VIA workaround
492config SWIOTLB 493config SWIOTLB
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index ac80b1209fc0..9cc7c21547a2 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1191,7 +1191,7 @@ CONFIG_USB_STORAGE=y
1191# USB Input Devices 1191# USB Input Devices
1192# 1192#
1193CONFIG_USB_HID=y 1193CONFIG_USB_HID=y
1194# CONFIG_USB_HID_POWERBOOK is not set 1194# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1195# CONFIG_HID_FF is not set 1195# CONFIG_HID_FF is not set
1196# CONFIG_USB_HIDDEV is not set 1196# CONFIG_USB_HIDDEV is not set
1197# CONFIG_USB_AIPTEK is not set 1197# CONFIG_USB_AIPTEK is not set
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4b4217d9be78..07b706243772 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -577,9 +577,9 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq,
577 pid_t key; 577 pid_t key;
578 578
579 /* 579 /*
580 * Disallow merge, if bio and rq aren't both sync or async 580 * Disallow merge of a sync bio into an async request.
581 */ 581 */
582 if (!!bio_sync(bio) != !!rq_is_sync(rq)) 582 if ((bio_data_dir(bio) == READ || bio_sync(bio)) && !rq_is_sync(rq))
583 return 0; 583 return 0;
584 584
585 /* 585 /*
@@ -592,7 +592,7 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq,
592 if (cfqq == RQ_CFQQ(rq)) 592 if (cfqq == RQ_CFQQ(rq))
593 return 1; 593 return 1;
594 594
595 return 1; 595 return 0;
596} 596}
597 597
598static inline void 598static inline void
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 10ee22ae5c15..623cec914c9b 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1027,13 +1027,15 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
1027#endif 1027#endif
1028 } 1028 }
1029 1029
1030 rc = pci_request_regions(pdev, DRV_NAME); 1030 if (!legacy_mode) {
1031 if (rc) { 1031 rc = pci_request_regions(pdev, DRV_NAME);
1032 disable_dev_on_err = 0; 1032 if (rc) {
1033 goto err_out; 1033 disable_dev_on_err = 0;
1034 } 1034 goto err_out;
1035 1035 }
1036 if (legacy_mode) { 1036 } else {
1037 /* Deal with combined mode hack. This side of the logic all
1038 goes away once the combined mode hack is killed in 2.6.21 */
1037 if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { 1039 if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {
1038 struct resource *conflict, res; 1040 struct resource *conflict, res;
1039 res.start = ATA_PRIMARY_CMD; 1041 res.start = ATA_PRIMARY_CMD;
@@ -1071,6 +1073,13 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
1071 } 1073 }
1072 } else 1074 } else
1073 legacy_mode |= ATA_PORT_SECONDARY; 1075 legacy_mode |= ATA_PORT_SECONDARY;
1076
1077 if (legacy_mode & ATA_PORT_PRIMARY)
1078 pci_request_region(pdev, 1, DRV_NAME);
1079 if (legacy_mode & ATA_PORT_SECONDARY)
1080 pci_request_region(pdev, 3, DRV_NAME);
1081 /* If there is a DMA resource, allocate it */
1082 pci_request_region(pdev, 4, DRV_NAME);
1074 } 1083 }
1075 1084
1076 /* we have legacy mode, but all ports are unavailable */ 1085 /* we have legacy mode, but all ports are unavailable */
@@ -1114,11 +1123,20 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
1114err_out_ent: 1123err_out_ent:
1115 kfree(probe_ent); 1124 kfree(probe_ent);
1116err_out_regions: 1125err_out_regions:
1117 if (legacy_mode & ATA_PORT_PRIMARY) 1126 /* All this conditional stuff is needed for the combined mode hack
1118 release_region(ATA_PRIMARY_CMD, 8); 1127 until 2.6.21 when it can go */
1119 if (legacy_mode & ATA_PORT_SECONDARY) 1128 if (legacy_mode) {
1120 release_region(ATA_SECONDARY_CMD, 8); 1129 pci_release_region(pdev, 4);
1121 pci_release_regions(pdev); 1130 if (legacy_mode & ATA_PORT_PRIMARY) {
1131 release_region(ATA_PRIMARY_CMD, 8);
1132 pci_release_region(pdev, 1);
1133 }
1134 if (legacy_mode & ATA_PORT_SECONDARY) {
1135 release_region(ATA_SECONDARY_CMD, 8);
1136 pci_release_region(pdev, 3);
1137 }
1138 } else
1139 pci_release_regions(pdev);
1122err_out: 1140err_out:
1123 if (disable_dev_on_err) 1141 if (disable_dev_on_err)
1124 pci_disable_device(pdev); 1142 pci_disable_device(pdev);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 9d2ddb209343..05dfe357527c 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -225,6 +225,8 @@ static inline CommandList_struct *removeQ(CommandList_struct **Qptr,
225 225
226#include "cciss_scsi.c" /* For SCSI tape support */ 226#include "cciss_scsi.c" /* For SCSI tape support */
227 227
228#define RAID_UNKNOWN 6
229
228#ifdef CONFIG_PROC_FS 230#ifdef CONFIG_PROC_FS
229 231
230/* 232/*
@@ -232,7 +234,6 @@ static inline CommandList_struct *removeQ(CommandList_struct **Qptr,
232 */ 234 */
233#define ENG_GIG 1000000000 235#define ENG_GIG 1000000000
234#define ENG_GIG_FACTOR (ENG_GIG/512) 236#define ENG_GIG_FACTOR (ENG_GIG/512)
235#define RAID_UNKNOWN 6
236static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG", 237static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
237 "UNKNOWN" 238 "UNKNOWN"
238}; 239};
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 78280380a905..6b634e8d9519 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -216,13 +216,13 @@ static int set_param_str(const char *val, struct kernel_param *kp)
216{ 216{
217 action_fn fn = (action_fn) kp->arg; 217 action_fn fn = (action_fn) kp->arg;
218 int rv = 0; 218 int rv = 0;
219 char *dup, *s; 219 char valcp[16];
220 char *s;
220 221
221 dup = kstrdup(val, GFP_KERNEL); 222 strncpy(valcp, val, 16);
222 if (!dup) 223 valcp[15] = '\0';
223 return -ENOMEM;
224 224
225 s = strstrip(dup); 225 s = strstrip(valcp);
226 226
227 down_read(&register_sem); 227 down_read(&register_sem);
228 rv = fn(s, NULL); 228 rv = fn(s, NULL);
@@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp)
235 235
236 out_unlock: 236 out_unlock:
237 up_read(&register_sem); 237 up_read(&register_sem);
238 kfree(dup);
239 return rv; 238 return rv;
240} 239}
241 240
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 5a747e685993..01084abffddf 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -230,6 +230,20 @@ static struct isi_port isi_ports[PORT_COUNT];
230 * it wants to talk. 230 * it wants to talk.
231 */ 231 */
232 232
233static inline int WaitTillCardIsFree(u16 base)
234{
235 unsigned int count = 0;
236 unsigned int a = in_atomic(); /* do we run under spinlock? */
237
238 while (!(inw(base + 0xe) & 0x1) && count++ < 100)
239 if (a)
240 mdelay(1);
241 else
242 msleep(1);
243
244 return !(inw(base + 0xe) & 0x1);
245}
246
233static int lock_card(struct isi_board *card) 247static int lock_card(struct isi_board *card)
234{ 248{
235 char retries; 249 char retries;
@@ -276,69 +290,71 @@ static void unlock_card(struct isi_board *card)
276 * ISI Card specific ops ... 290 * ISI Card specific ops ...
277 */ 291 */
278 292
293/* card->lock HAS to be held */
279static void raise_dtr(struct isi_port *port) 294static void raise_dtr(struct isi_port *port)
280{ 295{
281 struct isi_board *card = port->card; 296 struct isi_board *card = port->card;
282 unsigned long base = card->base; 297 unsigned long base = card->base;
283 u16 channel = port->channel; 298 u16 channel = port->channel;
284 299
285 if (!lock_card(card)) 300 if (WaitTillCardIsFree(base))
286 return; 301 return;
287 302
288 outw(0x8000 | (channel << card->shift_count) | 0x02, base); 303 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
289 outw(0x0504, base); 304 outw(0x0504, base);
290 InterruptTheCard(base); 305 InterruptTheCard(base);
291 port->status |= ISI_DTR; 306 port->status |= ISI_DTR;
292 unlock_card(card);
293} 307}
294 308
309/* card->lock HAS to be held */
295static inline void drop_dtr(struct isi_port *port) 310static inline void drop_dtr(struct isi_port *port)
296{ 311{
297 struct isi_board *card = port->card; 312 struct isi_board *card = port->card;
298 unsigned long base = card->base; 313 unsigned long base = card->base;
299 u16 channel = port->channel; 314 u16 channel = port->channel;
300 315
301 if (!lock_card(card)) 316 if (WaitTillCardIsFree(base))
302 return; 317 return;
303 318
304 outw(0x8000 | (channel << card->shift_count) | 0x02, base); 319 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
305 outw(0x0404, base); 320 outw(0x0404, base);
306 InterruptTheCard(base); 321 InterruptTheCard(base);
307 port->status &= ~ISI_DTR; 322 port->status &= ~ISI_DTR;
308 unlock_card(card);
309} 323}
310 324
325/* card->lock HAS to be held */
311static inline void raise_rts(struct isi_port *port) 326static inline void raise_rts(struct isi_port *port)
312{ 327{
313 struct isi_board *card = port->card; 328 struct isi_board *card = port->card;
314 unsigned long base = card->base; 329 unsigned long base = card->base;
315 u16 channel = port->channel; 330 u16 channel = port->channel;
316 331
317 if (!lock_card(card)) 332 if (WaitTillCardIsFree(base))
318 return; 333 return;
319 334
320 outw(0x8000 | (channel << card->shift_count) | 0x02, base); 335 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
321 outw(0x0a04, base); 336 outw(0x0a04, base);
322 InterruptTheCard(base); 337 InterruptTheCard(base);
323 port->status |= ISI_RTS; 338 port->status |= ISI_RTS;
324 unlock_card(card);
325} 339}
340
341/* card->lock HAS to be held */
326static inline void drop_rts(struct isi_port *port) 342static inline void drop_rts(struct isi_port *port)
327{ 343{
328 struct isi_board *card = port->card; 344 struct isi_board *card = port->card;
329 unsigned long base = card->base; 345 unsigned long base = card->base;
330 u16 channel = port->channel; 346 u16 channel = port->channel;
331 347
332 if (!lock_card(card)) 348 if (WaitTillCardIsFree(base))
333 return; 349 return;
334 350
335 outw(0x8000 | (channel << card->shift_count) | 0x02, base); 351 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
336 outw(0x0804, base); 352 outw(0x0804, base);
337 InterruptTheCard(base); 353 InterruptTheCard(base);
338 port->status &= ~ISI_RTS; 354 port->status &= ~ISI_RTS;
339 unlock_card(card);
340} 355}
341 356
357/* card->lock MUST NOT be held */
342static inline void raise_dtr_rts(struct isi_port *port) 358static inline void raise_dtr_rts(struct isi_port *port)
343{ 359{
344 struct isi_board *card = port->card; 360 struct isi_board *card = port->card;
@@ -355,35 +371,20 @@ static inline void raise_dtr_rts(struct isi_port *port)
355 unlock_card(card); 371 unlock_card(card);
356} 372}
357 373
374/* card->lock HAS to be held */
358static void drop_dtr_rts(struct isi_port *port) 375static void drop_dtr_rts(struct isi_port *port)
359{ 376{
360 struct isi_board *card = port->card; 377 struct isi_board *card = port->card;
361 unsigned long base = card->base; 378 unsigned long base = card->base;
362 u16 channel = port->channel; 379 u16 channel = port->channel;
363 380
364 if (!lock_card(card)) 381 if (WaitTillCardIsFree(base))
365 return; 382 return;
366 383
367 outw(0x8000 | (channel << card->shift_count) | 0x02, base); 384 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
368 outw(0x0c04, base); 385 outw(0x0c04, base);
369 InterruptTheCard(base); 386 InterruptTheCard(base);
370 port->status &= ~(ISI_RTS | ISI_DTR); 387 port->status &= ~(ISI_RTS | ISI_DTR);
371 unlock_card(card);
372}
373
374static inline void kill_queue(struct isi_port *port, short queue)
375{
376 struct isi_board *card = port->card;
377 unsigned long base = card->base;
378 u16 channel = port->channel;
379
380 if (!lock_card(card))
381 return;
382
383 outw(0x8000 | (channel << card->shift_count) | 0x02, base);
384 outw((queue << 8) | 0x06, base);
385 InterruptTheCard(base);
386 unlock_card(card);
387} 388}
388 389
389/* 390/*
@@ -744,7 +745,7 @@ static void isicom_config_port(struct isi_port *port)
744 else 745 else
745 raise_dtr(port); 746 raise_dtr(port);
746 747
747 if (lock_card(card)) { 748 if (WaitTillCardIsFree(base) == 0) {
748 outw(0x8000 | (channel << shift_count) |0x03, base); 749 outw(0x8000 | (channel << shift_count) |0x03, base);
749 outw(linuxb_to_isib[baud] << 8 | 0x03, base); 750 outw(linuxb_to_isib[baud] << 8 | 0x03, base);
750 channel_setup = 0; 751 channel_setup = 0;
@@ -772,7 +773,6 @@ static void isicom_config_port(struct isi_port *port)
772 } 773 }
773 outw(channel_setup, base); 774 outw(channel_setup, base);
774 InterruptTheCard(base); 775 InterruptTheCard(base);
775 unlock_card(card);
776 } 776 }
777 if (C_CLOCAL(tty)) 777 if (C_CLOCAL(tty))
778 port->flags &= ~ASYNC_CHECK_CD; 778 port->flags &= ~ASYNC_CHECK_CD;
@@ -791,12 +791,11 @@ static void isicom_config_port(struct isi_port *port)
791 if (I_IXOFF(tty)) 791 if (I_IXOFF(tty))
792 flow_ctrl |= ISICOM_INITIATE_XONXOFF; 792 flow_ctrl |= ISICOM_INITIATE_XONXOFF;
793 793
794 if (lock_card(card)) { 794 if (WaitTillCardIsFree(base) == 0) {
795 outw(0x8000 | (channel << shift_count) |0x04, base); 795 outw(0x8000 | (channel << shift_count) |0x04, base);
796 outw(flow_ctrl << 8 | 0x05, base); 796 outw(flow_ctrl << 8 | 0x05, base);
797 outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base); 797 outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base);
798 InterruptTheCard(base); 798 InterruptTheCard(base);
799 unlock_card(card);
800 } 799 }
801 800
802 /* rx enabled -> enable port for rx on the card */ 801 /* rx enabled -> enable port for rx on the card */
@@ -821,10 +820,9 @@ static inline void isicom_setup_board(struct isi_board *bp)
821 } 820 }
822 port = bp->ports; 821 port = bp->ports;
823 bp->status |= BOARD_ACTIVE; 822 bp->status |= BOARD_ACTIVE;
824 spin_unlock_irqrestore(&bp->card_lock, flags);
825 for (channel = 0; channel < bp->port_count; channel++, port++) 823 for (channel = 0; channel < bp->port_count; channel++, port++)
826 drop_dtr_rts(port); 824 drop_dtr_rts(port);
827 return; 825 spin_unlock_irqrestore(&bp->card_lock, flags);
828} 826}
829 827
830static int isicom_setup_port(struct isi_port *port) 828static int isicom_setup_port(struct isi_port *port)
@@ -857,7 +855,12 @@ static int isicom_setup_port(struct isi_port *port)
857 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 855 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
858 856
859 /* discard any residual data */ 857 /* discard any residual data */
860 kill_queue(port, ISICOM_KILLTX | ISICOM_KILLRX); 858 if (WaitTillCardIsFree(card->base) == 0) {
859 outw(0x8000 | (port->channel << card->shift_count) | 0x02,
860 card->base);
861 outw(((ISICOM_KILLTX | ISICOM_KILLRX) << 8) | 0x06, card->base);
862 InterruptTheCard(card->base);
863 }
861 864
862 isicom_config_port(port); 865 isicom_config_port(port);
863 port->flags |= ASYNC_INITIALIZED; 866 port->flags |= ASYNC_INITIALIZED;
@@ -983,28 +986,22 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
983 986
984static inline void isicom_shutdown_board(struct isi_board *bp) 987static inline void isicom_shutdown_board(struct isi_board *bp)
985{ 988{
986 unsigned long flags;
987
988 spin_lock_irqsave(&bp->card_lock, flags);
989 if (bp->status & BOARD_ACTIVE) { 989 if (bp->status & BOARD_ACTIVE) {
990 bp->status &= ~BOARD_ACTIVE; 990 bp->status &= ~BOARD_ACTIVE;
991 } 991 }
992 spin_unlock_irqrestore(&bp->card_lock, flags);
993} 992}
994 993
994/* card->lock HAS to be held */
995static void isicom_shutdown_port(struct isi_port *port) 995static void isicom_shutdown_port(struct isi_port *port)
996{ 996{
997 struct isi_board *card = port->card; 997 struct isi_board *card = port->card;
998 struct tty_struct *tty; 998 struct tty_struct *tty;
999 unsigned long flags;
1000 999
1001 tty = port->tty; 1000 tty = port->tty;
1002 1001
1003 spin_lock_irqsave(&card->card_lock, flags); 1002 if (!(port->flags & ASYNC_INITIALIZED))
1004 if (!(port->flags & ASYNC_INITIALIZED)) {
1005 spin_unlock_irqrestore(&card->card_lock, flags);
1006 return; 1003 return;
1007 } 1004
1008 if (port->xmit_buf) { 1005 if (port->xmit_buf) {
1009 free_page((unsigned long) port->xmit_buf); 1006 free_page((unsigned long) port->xmit_buf);
1010 port->xmit_buf = NULL; 1007 port->xmit_buf = NULL;
@@ -1012,7 +1009,6 @@ static void isicom_shutdown_port(struct isi_port *port)
1012 port->flags &= ~ASYNC_INITIALIZED; 1009 port->flags &= ~ASYNC_INITIALIZED;
1013 /* 3rd October 2000 : Vinayak P Risbud */ 1010 /* 3rd October 2000 : Vinayak P Risbud */
1014 port->tty = NULL; 1011 port->tty = NULL;
1015 spin_unlock_irqrestore(&card->card_lock, flags);
1016 1012
1017 /*Fix done by Anil .S on 30-04-2001 1013 /*Fix done by Anil .S on 30-04-2001
1018 remote login through isi port has dtr toggle problem 1014 remote login through isi port has dtr toggle problem
@@ -1258,10 +1254,12 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file,
1258 unsigned int set, unsigned int clear) 1254 unsigned int set, unsigned int clear)
1259{ 1255{
1260 struct isi_port *port = tty->driver_data; 1256 struct isi_port *port = tty->driver_data;
1257 unsigned long flags;
1261 1258
1262 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) 1259 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
1263 return -ENODEV; 1260 return -ENODEV;
1264 1261
1262 spin_lock_irqsave(&port->card->card_lock, flags);
1265 if (set & TIOCM_RTS) 1263 if (set & TIOCM_RTS)
1266 raise_rts(port); 1264 raise_rts(port);
1267 if (set & TIOCM_DTR) 1265 if (set & TIOCM_DTR)
@@ -1271,6 +1269,7 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file,
1271 drop_rts(port); 1269 drop_rts(port);
1272 if (clear & TIOCM_DTR) 1270 if (clear & TIOCM_DTR)
1273 drop_dtr(port); 1271 drop_dtr(port);
1272 spin_unlock_irqrestore(&port->card->card_lock, flags);
1274 1273
1275 return 0; 1274 return 0;
1276} 1275}
@@ -1303,7 +1302,10 @@ static int isicom_set_serial_info(struct isi_port *port,
1303 (newinfo.flags & ASYNC_FLAGS)); 1302 (newinfo.flags & ASYNC_FLAGS));
1304 } 1303 }
1305 if (reconfig_port) { 1304 if (reconfig_port) {
1305 unsigned long flags;
1306 spin_lock_irqsave(&port->card->card_lock, flags);
1306 isicom_config_port(port); 1307 isicom_config_port(port);
1308 spin_unlock_irqrestore(&port->card->card_lock, flags);
1307 } 1309 }
1308 return 0; 1310 return 0;
1309} 1311}
@@ -1384,6 +1386,7 @@ static void isicom_set_termios(struct tty_struct *tty,
1384 struct ktermios *old_termios) 1386 struct ktermios *old_termios)
1385{ 1387{
1386 struct isi_port *port = tty->driver_data; 1388 struct isi_port *port = tty->driver_data;
1389 unsigned long flags;
1387 1390
1388 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) 1391 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios"))
1389 return; 1392 return;
@@ -1392,7 +1395,9 @@ static void isicom_set_termios(struct tty_struct *tty,
1392 tty->termios->c_iflag == old_termios->c_iflag) 1395 tty->termios->c_iflag == old_termios->c_iflag)
1393 return; 1396 return;
1394 1397
1398 spin_lock_irqsave(&port->card->card_lock, flags);
1395 isicom_config_port(port); 1399 isicom_config_port(port);
1400 spin_unlock_irqrestore(&port->card->card_lock, flags);
1396 1401
1397 if ((old_termios->c_cflag & CRTSCTS) && 1402 if ((old_termios->c_cflag & CRTSCTS) &&
1398 !(tty->termios->c_cflag & CRTSCTS)) { 1403 !(tty->termios->c_cflag & CRTSCTS)) {
@@ -1469,11 +1474,15 @@ static void do_isicom_hangup(struct work_struct *work)
1469static void isicom_hangup(struct tty_struct *tty) 1474static void isicom_hangup(struct tty_struct *tty)
1470{ 1475{
1471 struct isi_port *port = tty->driver_data; 1476 struct isi_port *port = tty->driver_data;
1477 unsigned long flags;
1472 1478
1473 if (isicom_paranoia_check(port, tty->name, "isicom_hangup")) 1479 if (isicom_paranoia_check(port, tty->name, "isicom_hangup"))
1474 return; 1480 return;
1475 1481
1482 spin_lock_irqsave(&port->card->card_lock, flags);
1476 isicom_shutdown_port(port); 1483 isicom_shutdown_port(port);
1484 spin_unlock_irqrestore(&port->card->card_lock, flags);
1485
1477 port->count = 0; 1486 port->count = 0;
1478 port->flags &= ~ASYNC_NORMAL_ACTIVE; 1487 port->flags &= ~ASYNC_NORMAL_ACTIVE;
1479 port->tty = NULL; 1488 port->tty = NULL;
@@ -1578,16 +1587,6 @@ end:
1578 return retval; 1587 return retval;
1579} 1588}
1580 1589
1581static inline int WaitTillCardIsFree(u16 base)
1582{
1583 unsigned long count = 0;
1584
1585 while (!(inw(base + 0xe) & 0x1) && count++ < 100)
1586 msleep(5);
1587
1588 return !(inw(base + 0xe) & 0x1);
1589}
1590
1591static int __devinit load_firmware(struct pci_dev *pdev, 1590static int __devinit load_firmware(struct pci_dev *pdev,
1592 const unsigned int index, const unsigned int signature) 1591 const unsigned int index, const unsigned int signature)
1593{ 1592{
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index c063359baf78..83f604b19290 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -717,6 +717,7 @@ static int mxser_init(void)
717 717
718 /* Initialize the tty_driver structure */ 718 /* Initialize the tty_driver structure */
719 memset(mxvar_sdriver, 0, sizeof(struct tty_driver)); 719 memset(mxvar_sdriver, 0, sizeof(struct tty_driver));
720 mxvar_sdriver->owner = THIS_MODULE;
720 mxvar_sdriver->magic = TTY_DRIVER_MAGIC; 721 mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
721 mxvar_sdriver->name = "ttyMI"; 722 mxvar_sdriver->name = "ttyMI";
722 mxvar_sdriver->major = ttymajor; 723 mxvar_sdriver->major = ttymajor;
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index cd989dce7c53..1bb030b3a51a 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -2690,6 +2690,7 @@ static int __init mxser_module_init(void)
2690 MXSER_VERSION); 2690 MXSER_VERSION);
2691 2691
2692 /* Initialize the tty_driver structure */ 2692 /* Initialize the tty_driver structure */
2693 mxvar_sdriver->owner = THIS_MODULE;
2693 mxvar_sdriver->magic = TTY_DRIVER_MAGIC; 2694 mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
2694 mxvar_sdriver->name = "ttyMI"; 2695 mxvar_sdriver->name = "ttyMI";
2695 mxvar_sdriver->major = ttymajor; 2696 mxvar_sdriver->major = ttymajor;
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index b1e9a8eba6b6..edb37f3d558d 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -1,13 +1,14 @@
1/* 1/*
2 * linux/drivers/ide/pci/piix.c Version 0.44 March 20, 2003 2 * linux/drivers/ide/pci/piix.c Version 0.45 May 12, 2006
3 * 3 *
4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
6 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> 6 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com>
7 * Copyright (C) 2006 MontaVista Software, Inc. <source@mvista.com>
7 * 8 *
8 * May be copied or modified under the terms of the GNU General Public License 9 * May be copied or modified under the terms of the GNU General Public License
9 * 10 *
10 * PIO mode setting function for Intel chipsets. 11 * PIO mode setting function for Intel chipsets.
11 * For use instead of BIOS settings. 12 * For use instead of BIOS settings.
12 * 13 *
13 * 40-41 14 * 40-41
@@ -25,7 +26,7 @@
25 * sitre = word42 & 0x4000; secondary 26 * sitre = word42 & 0x4000; secondary
26 * 27 *
27 * 44 8421|8421 hdd|hdb 28 * 44 8421|8421 hdd|hdb
28 * 29 *
29 * 48 8421 hdd|hdc|hdb|hda udma enabled 30 * 48 8421 hdd|hdc|hdb|hda udma enabled
30 * 31 *
31 * 0001 hda 32 * 0001 hda
@@ -353,56 +354,24 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
353} 354}
354 355
355/** 356/**
356 * piix_faulty_dma0 - check for DMA0 errata
357 * @hwif: IDE interface to check
358 *
359 * If an ICH/ICH0/ICH2 interface is is operating in multi-word
360 * DMA mode with 600nS cycle time the IDE PIO prefetch buffer will
361 * inadvertently provide an extra piece of secondary data to the primary
362 * device resulting in data corruption.
363 *
364 * With such a device this test function returns true. This allows
365 * our tuning code to follow Intel recommendations and use PIO on
366 * such devices.
367 */
368
369static int piix_faulty_dma0(ide_hwif_t *hwif)
370{
371 switch(hwif->pci_dev->device)
372 {
373 case PCI_DEVICE_ID_INTEL_82801AA_1: /* ICH */
374 case PCI_DEVICE_ID_INTEL_82801AB_1: /* ICH0 */
375 case PCI_DEVICE_ID_INTEL_82801BA_8: /* ICH2 */
376 case PCI_DEVICE_ID_INTEL_82801BA_9: /* ICH2 */
377 return 1;
378 }
379 return 0;
380}
381
382/**
383 * piix_config_drive_for_dma - configure drive for DMA 357 * piix_config_drive_for_dma - configure drive for DMA
384 * @drive: IDE drive to configure 358 * @drive: IDE drive to configure
385 * 359 *
386 * Set up a PIIX interface channel for the best available speed. 360 * Set up a PIIX interface channel for the best available speed.
387 * We prefer UDMA if it is available and then MWDMA. If DMA is 361 * We prefer UDMA if it is available and then MWDMA. If DMA is
388 * not available we switch to PIO and return 0. 362 * not available we switch to PIO and return 0.
389 */ 363 */
390 364
391static int piix_config_drive_for_dma (ide_drive_t *drive) 365static int piix_config_drive_for_dma (ide_drive_t *drive)
392{ 366{
393 u8 speed = ide_dma_speed(drive, piix_ratemask(drive)); 367 u8 speed = ide_dma_speed(drive, piix_ratemask(drive));
394 368
395 /* Some ICH devices cannot support DMA mode 0 */ 369 /*
396 if(speed == XFER_MW_DMA_0 && piix_faulty_dma0(HWIF(drive))) 370 * If no DMA speed was available or the chipset has DMA bugs
397 speed = 0; 371 * then disable DMA and use PIO
398 372 */
399 /* If no DMA speed was available or the chipset has DMA bugs 373 if (!speed || no_piix_dma)
400 then disable DMA and use PIO */ 374 return 0;
401
402 if (!speed || no_piix_dma) {
403 u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
404 speed = piix_dma_2_pio(XFER_PIO_0 + tspeed);
405 }
406 375
407 (void) piix_tune_chipset(drive, speed); 376 (void) piix_tune_chipset(drive, speed);
408 return ide_dma_enable(drive); 377 return ide_dma_enable(drive);
@@ -425,17 +394,16 @@ static int piix_config_drive_xfer_rate (ide_drive_t *drive)
425 394
426 if ((id->capability & 1) && drive->autodma) { 395 if ((id->capability & 1) && drive->autodma) {
427 396
428 if (ide_use_dma(drive)) { 397 if (ide_use_dma(drive) && piix_config_drive_for_dma(drive))
429 if (piix_config_drive_for_dma(drive)) 398 return hwif->ide_dma_on(drive);
430 return hwif->ide_dma_on(drive);
431 }
432 399
433 goto fast_ata_pio; 400 goto fast_ata_pio;
434 401
435 } else if ((id->capability & 8) || (id->field_valid & 2)) { 402 } else if ((id->capability & 8) || (id->field_valid & 2)) {
436fast_ata_pio: 403fast_ata_pio:
437 /* Find best PIO mode. */ 404 /* Find best PIO mode. */
438 hwif->tuneproc(drive, 255); 405 (void) hwif->speedproc(drive, XFER_PIO_0 +
406 ide_get_best_pio_mode(drive, 255, 4, NULL));
439 return hwif->ide_dma_off_quietly(drive); 407 return hwif->ide_dma_off_quietly(drive);
440 } 408 }
441 /* IORDY not supported */ 409 /* IORDY not supported */
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 4a1853af3bbb..9be7e49cba0e 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * linux/drivers/ide/pci/slc90e66.c Version 0.11 September 11, 2002 2 * linux/drivers/ide/pci/slc90e66.c Version 0.12 May 12, 2006
3 * 3 *
4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006 MontaVista Software, Inc. <source@mvista.com>
5 * 6 *
6 * This a look-a-like variation of the ICH0 PIIX4 Ultra-66, 7 * This is a look-alike variation of the ICH0 PIIX4 Ultra-66,
7 * but this keeps the ISA-Bridge and slots alive. 8 * but this keeps the ISA-Bridge and slots alive.
8 * 9 *
9 */ 10 */
@@ -158,10 +159,8 @@ static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
158{ 159{
159 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive)); 160 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive));
160 161
161 if (!(speed)) { 162 if (!speed)
162 u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); 163 return 0;
163 speed = slc90e66_dma_2_pio(XFER_PIO_0 + tspeed);
164 }
165 164
166 (void) slc90e66_tune_chipset(drive, speed); 165 (void) slc90e66_tune_chipset(drive, speed);
167 return ide_dma_enable(drive); 166 return ide_dma_enable(drive);
@@ -176,16 +175,15 @@ static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)
176 175
177 if (id && (id->capability & 1) && drive->autodma) { 176 if (id && (id->capability & 1) && drive->autodma) {
178 177
179 if (ide_use_dma(drive)) { 178 if (ide_use_dma(drive) && slc90e66_config_drive_for_dma(drive))
180 if (slc90e66_config_drive_for_dma(drive)) 179 return hwif->ide_dma_on(drive);
181 return hwif->ide_dma_on(drive);
182 }
183 180
184 goto fast_ata_pio; 181 goto fast_ata_pio;
185 182
186 } else if ((id->capability & 8) || (id->field_valid & 2)) { 183 } else if ((id->capability & 8) || (id->field_valid & 2)) {
187fast_ata_pio: 184fast_ata_pio:
188 hwif->tuneproc(drive, 5); 185 (void) hwif->speedproc(drive, XFER_PIO_0 +
186 ide_get_best_pio_mode(drive, 255, 4, NULL));
189 return hwif->ide_dma_off_quietly(drive); 187 return hwif->ide_dma_off_quietly(drive);
190 } 188 }
191 /* IORDY not supported */ 189 /* IORDY not supported */
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index e68b80b7340d..2b5d7ab3adf7 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -490,11 +490,11 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu)
490 spin_unlock_irqrestore(&lu->cmd_orb_lock, flags); 490 spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
491 return -ENOMEM; 491 return -ENOMEM;
492 } 492 }
493 cmd->command_orb_dma = dma_map_single(&hi->host->device, 493 cmd->command_orb_dma = dma_map_single(hi->host->device.parent,
494 &cmd->command_orb, 494 &cmd->command_orb,
495 sizeof(struct sbp2_command_orb), 495 sizeof(struct sbp2_command_orb),
496 DMA_TO_DEVICE); 496 DMA_TO_DEVICE);
497 cmd->sge_dma = dma_map_single(&hi->host->device, 497 cmd->sge_dma = dma_map_single(hi->host->device.parent,
498 &cmd->scatter_gather_element, 498 &cmd->scatter_gather_element,
499 sizeof(cmd->scatter_gather_element), 499 sizeof(cmd->scatter_gather_element),
500 DMA_BIDIRECTIONAL); 500 DMA_BIDIRECTIONAL);
@@ -516,10 +516,11 @@ static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu)
516 if (!list_empty(&lu->cmd_orb_completed)) 516 if (!list_empty(&lu->cmd_orb_completed))
517 list_for_each_safe(lh, next, &lu->cmd_orb_completed) { 517 list_for_each_safe(lh, next, &lu->cmd_orb_completed) {
518 cmd = list_entry(lh, struct sbp2_command_info, list); 518 cmd = list_entry(lh, struct sbp2_command_info, list);
519 dma_unmap_single(&host->device, cmd->command_orb_dma, 519 dma_unmap_single(host->device.parent,
520 cmd->command_orb_dma,
520 sizeof(struct sbp2_command_orb), 521 sizeof(struct sbp2_command_orb),
521 DMA_TO_DEVICE); 522 DMA_TO_DEVICE);
522 dma_unmap_single(&host->device, cmd->sge_dma, 523 dma_unmap_single(host->device.parent, cmd->sge_dma,
523 sizeof(cmd->scatter_gather_element), 524 sizeof(cmd->scatter_gather_element),
524 DMA_BIDIRECTIONAL); 525 DMA_BIDIRECTIONAL);
525 kfree(cmd); 526 kfree(cmd);
@@ -601,17 +602,17 @@ static void sbp2util_mark_command_completed(struct sbp2_lu *lu,
601 602
602 if (cmd->cmd_dma) { 603 if (cmd->cmd_dma) {
603 if (cmd->dma_type == CMD_DMA_SINGLE) 604 if (cmd->dma_type == CMD_DMA_SINGLE)
604 dma_unmap_single(&host->device, cmd->cmd_dma, 605 dma_unmap_single(host->device.parent, cmd->cmd_dma,
605 cmd->dma_size, cmd->dma_dir); 606 cmd->dma_size, cmd->dma_dir);
606 else if (cmd->dma_type == CMD_DMA_PAGE) 607 else if (cmd->dma_type == CMD_DMA_PAGE)
607 dma_unmap_page(&host->device, cmd->cmd_dma, 608 dma_unmap_page(host->device.parent, cmd->cmd_dma,
608 cmd->dma_size, cmd->dma_dir); 609 cmd->dma_size, cmd->dma_dir);
609 /* XXX: Check for CMD_DMA_NONE bug */ 610 /* XXX: Check for CMD_DMA_NONE bug */
610 cmd->dma_type = CMD_DMA_NONE; 611 cmd->dma_type = CMD_DMA_NONE;
611 cmd->cmd_dma = 0; 612 cmd->cmd_dma = 0;
612 } 613 }
613 if (cmd->sge_buffer) { 614 if (cmd->sge_buffer) {
614 dma_unmap_sg(&host->device, cmd->sge_buffer, 615 dma_unmap_sg(host->device.parent, cmd->sge_buffer,
615 cmd->dma_size, cmd->dma_dir); 616 cmd->dma_size, cmd->dma_dir);
616 cmd->sge_buffer = NULL; 617 cmd->sge_buffer = NULL;
617 } 618 }
@@ -836,37 +837,37 @@ static int sbp2_start_device(struct sbp2_lu *lu)
836 struct sbp2_fwhost_info *hi = lu->hi; 837 struct sbp2_fwhost_info *hi = lu->hi;
837 int error; 838 int error;
838 839
839 lu->login_response = dma_alloc_coherent(&hi->host->device, 840 lu->login_response = dma_alloc_coherent(hi->host->device.parent,
840 sizeof(struct sbp2_login_response), 841 sizeof(struct sbp2_login_response),
841 &lu->login_response_dma, GFP_KERNEL); 842 &lu->login_response_dma, GFP_KERNEL);
842 if (!lu->login_response) 843 if (!lu->login_response)
843 goto alloc_fail; 844 goto alloc_fail;
844 845
845 lu->query_logins_orb = dma_alloc_coherent(&hi->host->device, 846 lu->query_logins_orb = dma_alloc_coherent(hi->host->device.parent,
846 sizeof(struct sbp2_query_logins_orb), 847 sizeof(struct sbp2_query_logins_orb),
847 &lu->query_logins_orb_dma, GFP_KERNEL); 848 &lu->query_logins_orb_dma, GFP_KERNEL);
848 if (!lu->query_logins_orb) 849 if (!lu->query_logins_orb)
849 goto alloc_fail; 850 goto alloc_fail;
850 851
851 lu->query_logins_response = dma_alloc_coherent(&hi->host->device, 852 lu->query_logins_response = dma_alloc_coherent(hi->host->device.parent,
852 sizeof(struct sbp2_query_logins_response), 853 sizeof(struct sbp2_query_logins_response),
853 &lu->query_logins_response_dma, GFP_KERNEL); 854 &lu->query_logins_response_dma, GFP_KERNEL);
854 if (!lu->query_logins_response) 855 if (!lu->query_logins_response)
855 goto alloc_fail; 856 goto alloc_fail;
856 857
857 lu->reconnect_orb = dma_alloc_coherent(&hi->host->device, 858 lu->reconnect_orb = dma_alloc_coherent(hi->host->device.parent,
858 sizeof(struct sbp2_reconnect_orb), 859 sizeof(struct sbp2_reconnect_orb),
859 &lu->reconnect_orb_dma, GFP_KERNEL); 860 &lu->reconnect_orb_dma, GFP_KERNEL);
860 if (!lu->reconnect_orb) 861 if (!lu->reconnect_orb)
861 goto alloc_fail; 862 goto alloc_fail;
862 863
863 lu->logout_orb = dma_alloc_coherent(&hi->host->device, 864 lu->logout_orb = dma_alloc_coherent(hi->host->device.parent,
864 sizeof(struct sbp2_logout_orb), 865 sizeof(struct sbp2_logout_orb),
865 &lu->logout_orb_dma, GFP_KERNEL); 866 &lu->logout_orb_dma, GFP_KERNEL);
866 if (!lu->logout_orb) 867 if (!lu->logout_orb)
867 goto alloc_fail; 868 goto alloc_fail;
868 869
869 lu->login_orb = dma_alloc_coherent(&hi->host->device, 870 lu->login_orb = dma_alloc_coherent(hi->host->device.parent,
870 sizeof(struct sbp2_login_orb), 871 sizeof(struct sbp2_login_orb),
871 &lu->login_orb_dma, GFP_KERNEL); 872 &lu->login_orb_dma, GFP_KERNEL);
872 if (!lu->login_orb) 873 if (!lu->login_orb)
@@ -929,32 +930,32 @@ static void sbp2_remove_device(struct sbp2_lu *lu)
929 list_del(&lu->lu_list); 930 list_del(&lu->lu_list);
930 931
931 if (lu->login_response) 932 if (lu->login_response)
932 dma_free_coherent(&hi->host->device, 933 dma_free_coherent(hi->host->device.parent,
933 sizeof(struct sbp2_login_response), 934 sizeof(struct sbp2_login_response),
934 lu->login_response, 935 lu->login_response,
935 lu->login_response_dma); 936 lu->login_response_dma);
936 if (lu->login_orb) 937 if (lu->login_orb)
937 dma_free_coherent(&hi->host->device, 938 dma_free_coherent(hi->host->device.parent,
938 sizeof(struct sbp2_login_orb), 939 sizeof(struct sbp2_login_orb),
939 lu->login_orb, 940 lu->login_orb,
940 lu->login_orb_dma); 941 lu->login_orb_dma);
941 if (lu->reconnect_orb) 942 if (lu->reconnect_orb)
942 dma_free_coherent(&hi->host->device, 943 dma_free_coherent(hi->host->device.parent,
943 sizeof(struct sbp2_reconnect_orb), 944 sizeof(struct sbp2_reconnect_orb),
944 lu->reconnect_orb, 945 lu->reconnect_orb,
945 lu->reconnect_orb_dma); 946 lu->reconnect_orb_dma);
946 if (lu->logout_orb) 947 if (lu->logout_orb)
947 dma_free_coherent(&hi->host->device, 948 dma_free_coherent(hi->host->device.parent,
948 sizeof(struct sbp2_logout_orb), 949 sizeof(struct sbp2_logout_orb),
949 lu->logout_orb, 950 lu->logout_orb,
950 lu->logout_orb_dma); 951 lu->logout_orb_dma);
951 if (lu->query_logins_orb) 952 if (lu->query_logins_orb)
952 dma_free_coherent(&hi->host->device, 953 dma_free_coherent(hi->host->device.parent,
953 sizeof(struct sbp2_query_logins_orb), 954 sizeof(struct sbp2_query_logins_orb),
954 lu->query_logins_orb, 955 lu->query_logins_orb,
955 lu->query_logins_orb_dma); 956 lu->query_logins_orb_dma);
956 if (lu->query_logins_response) 957 if (lu->query_logins_response)
957 dma_free_coherent(&hi->host->device, 958 dma_free_coherent(hi->host->device.parent,
958 sizeof(struct sbp2_query_logins_response), 959 sizeof(struct sbp2_query_logins_response),
959 lu->query_logins_response, 960 lu->query_logins_response,
960 lu->query_logins_response_dma); 961 lu->query_logins_response_dma);
@@ -1445,7 +1446,7 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1445 1446
1446 cmd->dma_size = sgpnt[0].length; 1447 cmd->dma_size = sgpnt[0].length;
1447 cmd->dma_type = CMD_DMA_PAGE; 1448 cmd->dma_type = CMD_DMA_PAGE;
1448 cmd->cmd_dma = dma_map_page(&hi->host->device, 1449 cmd->cmd_dma = dma_map_page(hi->host->device.parent,
1449 sgpnt[0].page, sgpnt[0].offset, 1450 sgpnt[0].page, sgpnt[0].offset,
1450 cmd->dma_size, cmd->dma_dir); 1451 cmd->dma_size, cmd->dma_dir);
1451 1452
@@ -1457,8 +1458,8 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1457 &cmd->scatter_gather_element[0]; 1458 &cmd->scatter_gather_element[0];
1458 u32 sg_count, sg_len; 1459 u32 sg_count, sg_len;
1459 dma_addr_t sg_addr; 1460 dma_addr_t sg_addr;
1460 int i, count = dma_map_sg(&hi->host->device, sgpnt, scsi_use_sg, 1461 int i, count = dma_map_sg(hi->host->device.parent, sgpnt,
1461 dma_dir); 1462 scsi_use_sg, dma_dir);
1462 1463
1463 cmd->dma_size = scsi_use_sg; 1464 cmd->dma_size = scsi_use_sg;
1464 cmd->sge_buffer = sgpnt; 1465 cmd->sge_buffer = sgpnt;
@@ -1508,7 +1509,8 @@ static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb,
1508 cmd->dma_dir = dma_dir; 1509 cmd->dma_dir = dma_dir;
1509 cmd->dma_size = scsi_request_bufflen; 1510 cmd->dma_size = scsi_request_bufflen;
1510 cmd->dma_type = CMD_DMA_SINGLE; 1511 cmd->dma_type = CMD_DMA_SINGLE;
1511 cmd->cmd_dma = dma_map_single(&hi->host->device, scsi_request_buffer, 1512 cmd->cmd_dma = dma_map_single(hi->host->device.parent,
1513 scsi_request_buffer,
1512 cmd->dma_size, cmd->dma_dir); 1514 cmd->dma_size, cmd->dma_dir);
1513 orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); 1515 orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id);
1514 orb->misc |= ORB_SET_DIRECTION(orb_direction); 1516 orb->misc |= ORB_SET_DIRECTION(orb_direction);
@@ -1626,10 +1628,11 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
1626 size_t length; 1628 size_t length;
1627 unsigned long flags; 1629 unsigned long flags;
1628 1630
1629 dma_sync_single_for_device(&hi->host->device, cmd->command_orb_dma, 1631 dma_sync_single_for_device(hi->host->device.parent,
1632 cmd->command_orb_dma,
1630 sizeof(struct sbp2_command_orb), 1633 sizeof(struct sbp2_command_orb),
1631 DMA_TO_DEVICE); 1634 DMA_TO_DEVICE);
1632 dma_sync_single_for_device(&hi->host->device, cmd->sge_dma, 1635 dma_sync_single_for_device(hi->host->device.parent, cmd->sge_dma,
1633 sizeof(cmd->scatter_gather_element), 1636 sizeof(cmd->scatter_gather_element),
1634 DMA_BIDIRECTIONAL); 1637 DMA_BIDIRECTIONAL);
1635 1638
@@ -1655,14 +1658,15 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
1655 * The target's fetch agent may or may not have read this 1658 * The target's fetch agent may or may not have read this
1656 * previous ORB yet. 1659 * previous ORB yet.
1657 */ 1660 */
1658 dma_sync_single_for_cpu(&hi->host->device, last_orb_dma, 1661 dma_sync_single_for_cpu(hi->host->device.parent, last_orb_dma,
1659 sizeof(struct sbp2_command_orb), 1662 sizeof(struct sbp2_command_orb),
1660 DMA_TO_DEVICE); 1663 DMA_TO_DEVICE);
1661 last_orb->next_ORB_lo = cpu_to_be32(cmd->command_orb_dma); 1664 last_orb->next_ORB_lo = cpu_to_be32(cmd->command_orb_dma);
1662 wmb(); 1665 wmb();
1663 /* Tells hardware that this pointer is valid */ 1666 /* Tells hardware that this pointer is valid */
1664 last_orb->next_ORB_hi = 0; 1667 last_orb->next_ORB_hi = 0;
1665 dma_sync_single_for_device(&hi->host->device, last_orb_dma, 1668 dma_sync_single_for_device(hi->host->device.parent,
1669 last_orb_dma,
1666 sizeof(struct sbp2_command_orb), 1670 sizeof(struct sbp2_command_orb),
1667 DMA_TO_DEVICE); 1671 DMA_TO_DEVICE);
1668 addr += SBP2_DOORBELL_OFFSET; 1672 addr += SBP2_DOORBELL_OFFSET;
@@ -1790,10 +1794,11 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
1790 else 1794 else
1791 cmd = sbp2util_find_command_for_orb(lu, sb->ORB_offset_lo); 1795 cmd = sbp2util_find_command_for_orb(lu, sb->ORB_offset_lo);
1792 if (cmd) { 1796 if (cmd) {
1793 dma_sync_single_for_cpu(&hi->host->device, cmd->command_orb_dma, 1797 dma_sync_single_for_cpu(hi->host->device.parent,
1798 cmd->command_orb_dma,
1794 sizeof(struct sbp2_command_orb), 1799 sizeof(struct sbp2_command_orb),
1795 DMA_TO_DEVICE); 1800 DMA_TO_DEVICE);
1796 dma_sync_single_for_cpu(&hi->host->device, cmd->sge_dma, 1801 dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma,
1797 sizeof(cmd->scatter_gather_element), 1802 sizeof(cmd->scatter_gather_element),
1798 DMA_BIDIRECTIONAL); 1803 DMA_BIDIRECTIONAL);
1799 /* Grab SCSI command pointers and check status. */ 1804 /* Grab SCSI command pointers and check status. */
@@ -1882,16 +1887,6 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
1882 if (unlikely(SCpnt->device->lun)) 1887 if (unlikely(SCpnt->device->lun))
1883 goto done; 1888 goto done;
1884 1889
1885 /* handle the request sense command here (auto-request sense) */
1886 if (SCpnt->cmnd[0] == REQUEST_SENSE) {
1887 memcpy(SCpnt->request_buffer, SCpnt->sense_buffer,
1888 SCpnt->request_bufflen);
1889 memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
1890 sbp2scsi_complete_command(lu, SBP2_SCSI_STATUS_GOOD, SCpnt,
1891 done);
1892 return 0;
1893 }
1894
1895 if (unlikely(!hpsb_node_entry_valid(lu->ne))) { 1890 if (unlikely(!hpsb_node_entry_valid(lu->ne))) {
1896 SBP2_ERR("Bus reset in progress - rejecting command"); 1891 SBP2_ERR("Bus reset in progress - rejecting command");
1897 result = DID_BUS_BUSY << 16; 1892 result = DID_BUS_BUSY << 16;
@@ -1931,10 +1926,11 @@ static void sbp2scsi_complete_all_commands(struct sbp2_lu *lu, u32 status)
1931 while (!list_empty(&lu->cmd_orb_inuse)) { 1926 while (!list_empty(&lu->cmd_orb_inuse)) {
1932 lh = lu->cmd_orb_inuse.next; 1927 lh = lu->cmd_orb_inuse.next;
1933 cmd = list_entry(lh, struct sbp2_command_info, list); 1928 cmd = list_entry(lh, struct sbp2_command_info, list);
1934 dma_sync_single_for_cpu(&hi->host->device, cmd->command_orb_dma, 1929 dma_sync_single_for_cpu(hi->host->device.parent,
1930 cmd->command_orb_dma,
1935 sizeof(struct sbp2_command_orb), 1931 sizeof(struct sbp2_command_orb),
1936 DMA_TO_DEVICE); 1932 DMA_TO_DEVICE);
1937 dma_sync_single_for_cpu(&hi->host->device, cmd->sge_dma, 1933 dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma,
1938 sizeof(cmd->scatter_gather_element), 1934 sizeof(cmd->scatter_gather_element),
1939 DMA_BIDIRECTIONAL); 1935 DMA_BIDIRECTIONAL);
1940 sbp2util_mark_command_completed(lu, cmd); 1936 sbp2util_mark_command_completed(lu, cmd);
@@ -2059,11 +2055,12 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2059 spin_lock_irqsave(&lu->cmd_orb_lock, flags); 2055 spin_lock_irqsave(&lu->cmd_orb_lock, flags);
2060 cmd = sbp2util_find_command_for_SCpnt(lu, SCpnt); 2056 cmd = sbp2util_find_command_for_SCpnt(lu, SCpnt);
2061 if (cmd) { 2057 if (cmd) {
2062 dma_sync_single_for_cpu(&hi->host->device, 2058 dma_sync_single_for_cpu(hi->host->device.parent,
2063 cmd->command_orb_dma, 2059 cmd->command_orb_dma,
2064 sizeof(struct sbp2_command_orb), 2060 sizeof(struct sbp2_command_orb),
2065 DMA_TO_DEVICE); 2061 DMA_TO_DEVICE);
2066 dma_sync_single_for_cpu(&hi->host->device, cmd->sge_dma, 2062 dma_sync_single_for_cpu(hi->host->device.parent,
2063 cmd->sge_dma,
2067 sizeof(cmd->scatter_gather_element), 2064 sizeof(cmd->scatter_gather_element),
2068 DMA_BIDIRECTIONAL); 2065 DMA_BIDIRECTIONAL);
2069 sbp2util_mark_command_completed(lu, cmd); 2066 sbp2util_mark_command_completed(lu, cmd);
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 7ec7c4b937f9..7b96751695ea 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1100,10 +1100,11 @@ static struct ib_fmr *mthca_alloc_fmr(struct ib_pd *pd, int mr_access_flags,
1100 struct mthca_fmr *fmr; 1100 struct mthca_fmr *fmr;
1101 int err; 1101 int err;
1102 1102
1103 fmr = kmemdup(fmr_attr, sizeof *fmr, GFP_KERNEL); 1103 fmr = kmalloc(sizeof *fmr, GFP_KERNEL);
1104 if (!fmr) 1104 if (!fmr)
1105 return ERR_PTR(-ENOMEM); 1105 return ERR_PTR(-ENOMEM);
1106 1106
1107 memcpy(&fmr->attr, fmr_attr, sizeof *fmr_attr);
1107 err = mthca_fmr_alloc(to_mdev(pd->device), to_mpd(pd)->pd_num, 1108 err = mthca_fmr_alloc(to_mdev(pd->device), to_mpd(pd)->pd_num,
1108 convert_access(mr_access_flags), fmr); 1109 convert_access(mr_access_flags), fmr);
1109 1110
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 54adba2d8ed5..d9ca55891cd7 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -16,6 +16,7 @@ static int i8042_aux_irq = -1;
16#define I8042_MUX_PHYS_DESC "sparcps2/serio%d" 16#define I8042_MUX_PHYS_DESC "sparcps2/serio%d"
17 17
18static void __iomem *kbd_iobase; 18static void __iomem *kbd_iobase;
19static struct resource *kbd_res;
19 20
20#define I8042_COMMAND_REG (kbd_iobase + 0x64UL) 21#define I8042_COMMAND_REG (kbd_iobase + 0x64UL)
21#define I8042_DATA_REG (kbd_iobase + 0x60UL) 22#define I8042_DATA_REG (kbd_iobase + 0x60UL)
@@ -60,6 +61,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev
60 i8042_kbd_irq = irq; 61 i8042_kbd_irq = irq;
61 kbd_iobase = of_ioremap(&kbd->resource[0], 62 kbd_iobase = of_ioremap(&kbd->resource[0],
62 0, 8, "kbd"); 63 0, 8, "kbd");
64 kbd_res = &kbd->resource[0];
63 } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || 65 } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) ||
64 !strcmp(dp->name, OBP_PS2MS_NAME2)) { 66 !strcmp(dp->name, OBP_PS2MS_NAME2)) {
65 struct of_device *ms = of_find_device_by_node(dp); 67 struct of_device *ms = of_find_device_by_node(dp);
@@ -77,7 +79,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev
77 79
78static int __devexit sparc_i8042_remove(struct of_device *op) 80static int __devexit sparc_i8042_remove(struct of_device *op)
79{ 81{
80 of_iounmap(kbd_iobase, 8); 82 of_iounmap(kbd_res, kbd_iobase, 8);
81 83
82 return 0; 84 return 0;
83} 85}
@@ -119,7 +121,7 @@ static int __init i8042_platform_init(void)
119 if (i8042_kbd_irq == -1 || 121 if (i8042_kbd_irq == -1 ||
120 i8042_aux_irq == -1) { 122 i8042_aux_irq == -1) {
121 if (kbd_iobase) { 123 if (kbd_iobase) {
122 of_iounmap(kbd_iobase, 8); 124 of_iounmap(kbd_res, kbd_iobase, 8);
123 kbd_iobase = (void __iomem *) NULL; 125 kbd_iobase = (void __iomem *) NULL;
124 } 126 }
125 return -ENODEV; 127 return -ENODEV;
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 930e04ce1af6..100df6f38d92 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -278,7 +278,6 @@ struct kvm_arch_ops {
278 struct kvm_segment *var, int seg); 278 struct kvm_segment *var, int seg);
279 void (*set_segment)(struct kvm_vcpu *vcpu, 279 void (*set_segment)(struct kvm_vcpu *vcpu,
280 struct kvm_segment *var, int seg); 280 struct kvm_segment *var, int seg);
281 int (*is_long_mode)(struct kvm_vcpu *vcpu);
282 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l); 281 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
283 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0); 282 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
284 void (*set_cr0_no_modeswitch)(struct kvm_vcpu *vcpu, 283 void (*set_cr0_no_modeswitch)(struct kvm_vcpu *vcpu,
@@ -320,7 +319,8 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module);
320void kvm_exit_arch(void); 319void kvm_exit_arch(void);
321 320
322void kvm_mmu_destroy(struct kvm_vcpu *vcpu); 321void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
323int kvm_mmu_init(struct kvm_vcpu *vcpu); 322int kvm_mmu_create(struct kvm_vcpu *vcpu);
323int kvm_mmu_setup(struct kvm_vcpu *vcpu);
324 324
325int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); 325int kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
326void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); 326void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot);
@@ -375,9 +375,8 @@ void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr0);
375void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr0); 375void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr0);
376void lmsw(struct kvm_vcpu *vcpu, unsigned long msw); 376void lmsw(struct kvm_vcpu *vcpu, unsigned long msw);
377 377
378#ifdef CONFIG_X86_64 378int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);
379void set_efer(struct kvm_vcpu *vcpu, u64 efer); 379int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data);
380#endif
381 380
382void fx_init(struct kvm_vcpu *vcpu); 381void fx_init(struct kvm_vcpu *vcpu);
383 382
@@ -403,6 +402,15 @@ static inline struct page *_gfn_to_page(struct kvm *kvm, gfn_t gfn)
403 return (slot) ? slot->phys_mem[gfn - slot->base_gfn] : NULL; 402 return (slot) ? slot->phys_mem[gfn - slot->base_gfn] : NULL;
404} 403}
405 404
405static inline int is_long_mode(struct kvm_vcpu *vcpu)
406{
407#ifdef CONFIG_X86_64
408 return vcpu->shadow_efer & EFER_LME;
409#else
410 return 0;
411#endif
412}
413
406static inline int is_pae(struct kvm_vcpu *vcpu) 414static inline int is_pae(struct kvm_vcpu *vcpu)
407{ 415{
408 return vcpu->cr4 & CR4_PAE_MASK; 416 return vcpu->cr4 & CR4_PAE_MASK;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 9f24f22e4cb2..ce7fe640f18d 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -245,7 +245,8 @@ static void kvm_free_physmem_slot(struct kvm_memory_slot *free,
245 if (!dont || free->phys_mem != dont->phys_mem) 245 if (!dont || free->phys_mem != dont->phys_mem)
246 if (free->phys_mem) { 246 if (free->phys_mem) {
247 for (i = 0; i < free->npages; ++i) 247 for (i = 0; i < free->npages; ++i)
248 __free_page(free->phys_mem[i]); 248 if (free->phys_mem[i])
249 __free_page(free->phys_mem[i]);
249 vfree(free->phys_mem); 250 vfree(free->phys_mem);
250 } 251 }
251 252
@@ -398,7 +399,7 @@ void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
398 return; 399 return;
399 } 400 }
400 401
401 if (kvm_arch_ops->is_long_mode(vcpu)) { 402 if (is_long_mode(vcpu)) {
402 if (!(cr4 & CR4_PAE_MASK)) { 403 if (!(cr4 & CR4_PAE_MASK)) {
403 printk(KERN_DEBUG "set_cr4: #GP, clearing PAE while " 404 printk(KERN_DEBUG "set_cr4: #GP, clearing PAE while "
404 "in long mode\n"); 405 "in long mode\n");
@@ -425,7 +426,7 @@ EXPORT_SYMBOL_GPL(set_cr4);
425 426
426void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 427void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
427{ 428{
428 if (kvm_arch_ops->is_long_mode(vcpu)) { 429 if (is_long_mode(vcpu)) {
429 if ( cr3 & CR3_L_MODE_RESEVED_BITS) { 430 if ( cr3 & CR3_L_MODE_RESEVED_BITS) {
430 printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); 431 printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n");
431 inject_gp(vcpu); 432 inject_gp(vcpu);
@@ -521,12 +522,14 @@ static int kvm_dev_ioctl_create_vcpu(struct kvm *kvm, int n)
521 if (r < 0) 522 if (r < 0)
522 goto out_free_vcpus; 523 goto out_free_vcpus;
523 524
524 kvm_arch_ops->vcpu_load(vcpu); 525 r = kvm_mmu_create(vcpu);
526 if (r < 0)
527 goto out_free_vcpus;
525 528
526 r = kvm_arch_ops->vcpu_setup(vcpu); 529 kvm_arch_ops->vcpu_load(vcpu);
530 r = kvm_mmu_setup(vcpu);
527 if (r >= 0) 531 if (r >= 0)
528 r = kvm_mmu_init(vcpu); 532 r = kvm_arch_ops->vcpu_setup(vcpu);
529
530 vcpu_put(vcpu); 533 vcpu_put(vcpu);
531 534
532 if (r < 0) 535 if (r < 0)
@@ -1103,6 +1106,51 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val,
1103 } 1106 }
1104} 1107}
1105 1108
1109int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1110{
1111 u64 data;
1112
1113 switch (msr) {
1114 case 0xc0010010: /* SYSCFG */
1115 case 0xc0010015: /* HWCR */
1116 case MSR_IA32_PLATFORM_ID:
1117 case MSR_IA32_P5_MC_ADDR:
1118 case MSR_IA32_P5_MC_TYPE:
1119 case MSR_IA32_MC0_CTL:
1120 case MSR_IA32_MCG_STATUS:
1121 case MSR_IA32_MCG_CAP:
1122 case MSR_IA32_MC0_MISC:
1123 case MSR_IA32_MC0_MISC+4:
1124 case MSR_IA32_MC0_MISC+8:
1125 case MSR_IA32_MC0_MISC+12:
1126 case MSR_IA32_MC0_MISC+16:
1127 case MSR_IA32_UCODE_REV:
1128 case MSR_IA32_PERF_STATUS:
1129 /* MTRR registers */
1130 case 0xfe:
1131 case 0x200 ... 0x2ff:
1132 data = 0;
1133 break;
1134 case 0xcd: /* fsb frequency */
1135 data = 3;
1136 break;
1137 case MSR_IA32_APICBASE:
1138 data = vcpu->apic_base;
1139 break;
1140#ifdef CONFIG_X86_64
1141 case MSR_EFER:
1142 data = vcpu->shadow_efer;
1143 break;
1144#endif
1145 default:
1146 printk(KERN_ERR "kvm: unhandled rdmsr: 0x%x\n", msr);
1147 return 1;
1148 }
1149 *pdata = data;
1150 return 0;
1151}
1152EXPORT_SYMBOL_GPL(kvm_get_msr_common);
1153
1106/* 1154/*
1107 * Reads an msr value (of 'msr_index') into 'pdata'. 1155 * Reads an msr value (of 'msr_index') into 'pdata'.
1108 * Returns 0 on success, non-0 otherwise. 1156 * Returns 0 on success, non-0 otherwise.
@@ -1115,7 +1163,7 @@ static int get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
1115 1163
1116#ifdef CONFIG_X86_64 1164#ifdef CONFIG_X86_64
1117 1165
1118void set_efer(struct kvm_vcpu *vcpu, u64 efer) 1166static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
1119{ 1167{
1120 if (efer & EFER_RESERVED_BITS) { 1168 if (efer & EFER_RESERVED_BITS) {
1121 printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n", 1169 printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n",
@@ -1138,10 +1186,36 @@ void set_efer(struct kvm_vcpu *vcpu, u64 efer)
1138 1186
1139 vcpu->shadow_efer = efer; 1187 vcpu->shadow_efer = efer;
1140} 1188}
1141EXPORT_SYMBOL_GPL(set_efer);
1142 1189
1143#endif 1190#endif
1144 1191
1192int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1193{
1194 switch (msr) {
1195#ifdef CONFIG_X86_64
1196 case MSR_EFER:
1197 set_efer(vcpu, data);
1198 break;
1199#endif
1200 case MSR_IA32_MC0_STATUS:
1201 printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n",
1202 __FUNCTION__, data);
1203 break;
1204 case MSR_IA32_UCODE_REV:
1205 case MSR_IA32_UCODE_WRITE:
1206 case 0x200 ... 0x2ff: /* MTRRs */
1207 break;
1208 case MSR_IA32_APICBASE:
1209 vcpu->apic_base = data;
1210 break;
1211 default:
1212 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr);
1213 return 1;
1214 }
1215 return 0;
1216}
1217EXPORT_SYMBOL_GPL(kvm_set_msr_common);
1218
1145/* 1219/*
1146 * Writes msr value into into the appropriate "register". 1220 * Writes msr value into into the appropriate "register".
1147 * Returns 0 on success, non-0 otherwise. 1221 * Returns 0 on success, non-0 otherwise.
@@ -1865,6 +1939,11 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
1865{ 1939{
1866 int r; 1940 int r;
1867 1941
1942 if (kvm_arch_ops) {
1943 printk(KERN_ERR "kvm: already loaded the other module\n");
1944 return -EEXIST;
1945 }
1946
1868 kvm_arch_ops = ops; 1947 kvm_arch_ops = ops;
1869 1948
1870 if (!kvm_arch_ops->cpu_has_kvm_support()) { 1949 if (!kvm_arch_ops->cpu_has_kvm_support()) {
@@ -1907,6 +1986,7 @@ void kvm_exit_arch(void)
1907 unregister_reboot_notifier(&kvm_reboot_notifier); 1986 unregister_reboot_notifier(&kvm_reboot_notifier);
1908 on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1); 1987 on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1);
1909 kvm_arch_ops->hardware_unsetup(); 1988 kvm_arch_ops->hardware_unsetup();
1989 kvm_arch_ops = NULL;
1910} 1990}
1911 1991
1912static __init int kvm_init(void) 1992static __init int kvm_init(void)
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index bdffe83b19e8..790423c5f23d 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -578,7 +578,7 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu)
578 578
579 if (!is_paging(vcpu)) 579 if (!is_paging(vcpu))
580 return nonpaging_init_context(vcpu); 580 return nonpaging_init_context(vcpu);
581 else if (kvm_arch_ops->is_long_mode(vcpu)) 581 else if (is_long_mode(vcpu))
582 return paging64_init_context(vcpu); 582 return paging64_init_context(vcpu);
583 else if (is_pae(vcpu)) 583 else if (is_pae(vcpu))
584 return paging32E_init_context(vcpu); 584 return paging32E_init_context(vcpu);
@@ -639,28 +639,22 @@ error_1:
639 return -ENOMEM; 639 return -ENOMEM;
640} 640}
641 641
642int kvm_mmu_init(struct kvm_vcpu *vcpu) 642int kvm_mmu_create(struct kvm_vcpu *vcpu)
643{ 643{
644 int r;
645
646 ASSERT(vcpu); 644 ASSERT(vcpu);
647 ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa)); 645 ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa));
648 ASSERT(list_empty(&vcpu->free_pages)); 646 ASSERT(list_empty(&vcpu->free_pages));
649 647
650 r = alloc_mmu_pages(vcpu); 648 return alloc_mmu_pages(vcpu);
651 if (r) 649}
652 goto out;
653
654 r = init_kvm_mmu(vcpu);
655 if (r)
656 goto out_free_pages;
657 650
658 return 0; 651int kvm_mmu_setup(struct kvm_vcpu *vcpu)
652{
653 ASSERT(vcpu);
654 ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa));
655 ASSERT(!list_empty(&vcpu->free_pages));
659 656
660out_free_pages: 657 return init_kvm_mmu(vcpu);
661 free_mmu_pages(vcpu);
662out:
663 return r;
664} 658}
665 659
666void kvm_mmu_destroy(struct kvm_vcpu *vcpu) 660void kvm_mmu_destroy(struct kvm_vcpu *vcpu)
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index a9771b4c5bb8..09bb9b4ed12d 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -68,7 +68,7 @@ static void FNAME(init_walker)(struct guest_walker *walker,
68 hpa = safe_gpa_to_hpa(vcpu, vcpu->cr3 & PT64_BASE_ADDR_MASK); 68 hpa = safe_gpa_to_hpa(vcpu, vcpu->cr3 & PT64_BASE_ADDR_MASK);
69 walker->table = kmap_atomic(pfn_to_page(hpa >> PAGE_SHIFT), KM_USER0); 69 walker->table = kmap_atomic(pfn_to_page(hpa >> PAGE_SHIFT), KM_USER0);
70 70
71 ASSERT((!kvm_arch_ops->is_long_mode(vcpu) && is_pae(vcpu)) || 71 ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) ||
72 (vcpu->cr3 & ~(PAGE_MASK | CR3_FLAGS_MASK)) == 0); 72 (vcpu->cr3 & ~(PAGE_MASK | CR3_FLAGS_MASK)) == 0);
73 73
74 walker->table = (pt_element_t *)( (unsigned long)walker->table | 74 walker->table = (pt_element_t *)( (unsigned long)walker->table |
@@ -131,7 +131,7 @@ static pt_element_t *FNAME(fetch_guest)(struct kvm_vcpu *vcpu,
131 (walker->table[index] & PT_PAGE_SIZE_MASK) && 131 (walker->table[index] & PT_PAGE_SIZE_MASK) &&
132 (PTTYPE == 64 || is_pse(vcpu)))) 132 (PTTYPE == 64 || is_pse(vcpu))))
133 return &walker->table[index]; 133 return &walker->table[index];
134 if (walker->level != 3 || kvm_arch_ops->is_long_mode(vcpu)) 134 if (walker->level != 3 || is_long_mode(vcpu))
135 walker->inherited_ar &= walker->table[index]; 135 walker->inherited_ar &= walker->table[index];
136 paddr = safe_gpa_to_hpa(vcpu, walker->table[index] & PT_BASE_ADDR_MASK); 136 paddr = safe_gpa_to_hpa(vcpu, walker->table[index] & PT_BASE_ADDR_MASK);
137 kunmap_atomic(walker->table, KM_USER0); 137 kunmap_atomic(walker->table, KM_USER0);
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 9ec87636ded6..fa0428735717 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -166,11 +166,6 @@ static inline void write_dr7(unsigned long val)
166 asm volatile ("mov %0, %%dr7" :: "r" (val)); 166 asm volatile ("mov %0, %%dr7" :: "r" (val));
167} 167}
168 168
169static inline int svm_is_long_mode(struct kvm_vcpu *vcpu)
170{
171 return vcpu->svm->vmcb->save.efer & KVM_EFER_LMA;
172}
173
174static inline void force_new_asid(struct kvm_vcpu *vcpu) 169static inline void force_new_asid(struct kvm_vcpu *vcpu)
175{ 170{
176 vcpu->svm->asid_generation--; 171 vcpu->svm->asid_generation--;
@@ -246,7 +241,7 @@ static int has_svm(void)
246{ 241{
247 uint32_t eax, ebx, ecx, edx; 242 uint32_t eax, ebx, ecx, edx;
248 243
249 if (current_cpu_data.x86_vendor != X86_VENDOR_AMD) { 244 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
250 printk(KERN_INFO "has_svm: not amd\n"); 245 printk(KERN_INFO "has_svm: not amd\n");
251 return 0; 246 return 0;
252 } 247 }
@@ -1073,22 +1068,6 @@ static int emulate_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_ru
1073static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) 1068static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
1074{ 1069{
1075 switch (ecx) { 1070 switch (ecx) {
1076 case MSR_IA32_P5_MC_ADDR:
1077 case MSR_IA32_P5_MC_TYPE:
1078 case MSR_IA32_MC0_CTL:
1079 case MSR_IA32_MCG_STATUS:
1080 case MSR_IA32_MCG_CAP:
1081 case MSR_IA32_MC0_MISC:
1082 case MSR_IA32_MC0_MISC+4:
1083 case MSR_IA32_MC0_MISC+8:
1084 case MSR_IA32_MC0_MISC+12:
1085 case MSR_IA32_MC0_MISC+16:
1086 case MSR_IA32_UCODE_REV:
1087 /* MTRR registers */
1088 case 0xfe:
1089 case 0x200 ... 0x2ff:
1090 *data = 0;
1091 break;
1092 case MSR_IA32_TIME_STAMP_COUNTER: { 1071 case MSR_IA32_TIME_STAMP_COUNTER: {
1093 u64 tsc; 1072 u64 tsc;
1094 1073
@@ -1096,12 +1075,6 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
1096 *data = vcpu->svm->vmcb->control.tsc_offset + tsc; 1075 *data = vcpu->svm->vmcb->control.tsc_offset + tsc;
1097 break; 1076 break;
1098 } 1077 }
1099 case MSR_EFER:
1100 *data = vcpu->shadow_efer;
1101 break;
1102 case MSR_IA32_APICBASE:
1103 *data = vcpu->apic_base;
1104 break;
1105 case MSR_K6_STAR: 1078 case MSR_K6_STAR:
1106 *data = vcpu->svm->vmcb->save.star; 1079 *data = vcpu->svm->vmcb->save.star;
1107 break; 1080 break;
@@ -1129,8 +1102,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
1129 *data = vcpu->svm->vmcb->save.sysenter_esp; 1102 *data = vcpu->svm->vmcb->save.sysenter_esp;
1130 break; 1103 break;
1131 default: 1104 default:
1132 printk(KERN_ERR "kvm: unhandled rdmsr: 0x%x\n", ecx); 1105 return kvm_get_msr_common(vcpu, ecx, data);
1133 return 1;
1134 } 1106 }
1135 return 0; 1107 return 0;
1136} 1108}
@@ -1154,15 +1126,6 @@ static int rdmsr_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1154static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) 1126static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
1155{ 1127{
1156 switch (ecx) { 1128 switch (ecx) {
1157#ifdef CONFIG_X86_64
1158 case MSR_EFER:
1159 set_efer(vcpu, data);
1160 break;
1161#endif
1162 case MSR_IA32_MC0_STATUS:
1163 printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n"
1164 , __FUNCTION__, data);
1165 break;
1166 case MSR_IA32_TIME_STAMP_COUNTER: { 1129 case MSR_IA32_TIME_STAMP_COUNTER: {
1167 u64 tsc; 1130 u64 tsc;
1168 1131
@@ -1170,13 +1133,6 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
1170 vcpu->svm->vmcb->control.tsc_offset = data - tsc; 1133 vcpu->svm->vmcb->control.tsc_offset = data - tsc;
1171 break; 1134 break;
1172 } 1135 }
1173 case MSR_IA32_UCODE_REV:
1174 case MSR_IA32_UCODE_WRITE:
1175 case 0x200 ... 0x2ff: /* MTRRs */
1176 break;
1177 case MSR_IA32_APICBASE:
1178 vcpu->apic_base = data;
1179 break;
1180 case MSR_K6_STAR: 1136 case MSR_K6_STAR:
1181 vcpu->svm->vmcb->save.star = data; 1137 vcpu->svm->vmcb->save.star = data;
1182 break; 1138 break;
@@ -1204,8 +1160,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
1204 vcpu->svm->vmcb->save.sysenter_esp = data; 1160 vcpu->svm->vmcb->save.sysenter_esp = data;
1205 break; 1161 break;
1206 default: 1162 default:
1207 printk(KERN_ERR "kvm: unhandled wrmsr: %x\n", ecx); 1163 return kvm_set_msr_common(vcpu, ecx, data);
1208 return 1;
1209 } 1164 }
1210 return 0; 1165 return 0;
1211} 1166}
@@ -1609,7 +1564,6 @@ static struct kvm_arch_ops svm_arch_ops = {
1609 .get_segment_base = svm_get_segment_base, 1564 .get_segment_base = svm_get_segment_base,
1610 .get_segment = svm_get_segment, 1565 .get_segment = svm_get_segment,
1611 .set_segment = svm_set_segment, 1566 .set_segment = svm_set_segment,
1612 .is_long_mode = svm_is_long_mode,
1613 .get_cs_db_l_bits = svm_get_cs_db_l_bits, 1567 .get_cs_db_l_bits = svm_get_cs_db_l_bits,
1614 .set_cr0 = svm_set_cr0, 1568 .set_cr0 = svm_set_cr0,
1615 .set_cr0_no_modeswitch = svm_set_cr0, 1569 .set_cr0_no_modeswitch = svm_set_cr0,
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 983a15b1977c..d0a2c2d5342a 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -26,7 +26,6 @@
26 26
27#include "segment_descriptor.h" 27#include "segment_descriptor.h"
28 28
29#define MSR_IA32_FEATURE_CONTROL 0x03a
30 29
31MODULE_AUTHOR("Qumranet"); 30MODULE_AUTHOR("Qumranet");
32MODULE_LICENSE("GPL"); 31MODULE_LICENSE("GPL");
@@ -344,8 +343,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
344 data = vmcs_readl(GUEST_GS_BASE); 343 data = vmcs_readl(GUEST_GS_BASE);
345 break; 344 break;
346 case MSR_EFER: 345 case MSR_EFER:
347 data = vcpu->shadow_efer; 346 return kvm_get_msr_common(vcpu, msr_index, pdata);
348 break;
349#endif 347#endif
350 case MSR_IA32_TIME_STAMP_COUNTER: 348 case MSR_IA32_TIME_STAMP_COUNTER:
351 data = guest_read_tsc(); 349 data = guest_read_tsc();
@@ -359,33 +357,13 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
359 case MSR_IA32_SYSENTER_ESP: 357 case MSR_IA32_SYSENTER_ESP:
360 data = vmcs_read32(GUEST_SYSENTER_ESP); 358 data = vmcs_read32(GUEST_SYSENTER_ESP);
361 break; 359 break;
362 case MSR_IA32_P5_MC_ADDR:
363 case MSR_IA32_P5_MC_TYPE:
364 case MSR_IA32_MC0_CTL:
365 case MSR_IA32_MCG_STATUS:
366 case MSR_IA32_MCG_CAP:
367 case MSR_IA32_MC0_MISC:
368 case MSR_IA32_MC0_MISC+4:
369 case MSR_IA32_MC0_MISC+8:
370 case MSR_IA32_MC0_MISC+12:
371 case MSR_IA32_MC0_MISC+16:
372 case MSR_IA32_UCODE_REV:
373 /* MTRR registers */
374 case 0xfe:
375 case 0x200 ... 0x2ff:
376 data = 0;
377 break;
378 case MSR_IA32_APICBASE:
379 data = vcpu->apic_base;
380 break;
381 default: 360 default:
382 msr = find_msr_entry(vcpu, msr_index); 361 msr = find_msr_entry(vcpu, msr_index);
383 if (!msr) { 362 if (msr) {
384 printk(KERN_ERR "kvm: unhandled rdmsr: %x\n", msr_index); 363 data = msr->data;
385 return 1; 364 break;
386 } 365 }
387 data = msr->data; 366 return kvm_get_msr_common(vcpu, msr_index, pdata);
388 break;
389 } 367 }
390 368
391 *pdata = data; 369 *pdata = data;
@@ -402,6 +380,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
402 struct vmx_msr_entry *msr; 380 struct vmx_msr_entry *msr;
403 switch (msr_index) { 381 switch (msr_index) {
404#ifdef CONFIG_X86_64 382#ifdef CONFIG_X86_64
383 case MSR_EFER:
384 return kvm_set_msr_common(vcpu, msr_index, data);
405 case MSR_FS_BASE: 385 case MSR_FS_BASE:
406 vmcs_writel(GUEST_FS_BASE, data); 386 vmcs_writel(GUEST_FS_BASE, data);
407 break; 387 break;
@@ -418,32 +398,17 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
418 case MSR_IA32_SYSENTER_ESP: 398 case MSR_IA32_SYSENTER_ESP:
419 vmcs_write32(GUEST_SYSENTER_ESP, data); 399 vmcs_write32(GUEST_SYSENTER_ESP, data);
420 break; 400 break;
421#ifdef __x86_64
422 case MSR_EFER:
423 set_efer(vcpu, data);
424 break;
425 case MSR_IA32_MC0_STATUS:
426 printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n"
427 , __FUNCTION__, data);
428 break;
429#endif
430 case MSR_IA32_TIME_STAMP_COUNTER: { 401 case MSR_IA32_TIME_STAMP_COUNTER: {
431 guest_write_tsc(data); 402 guest_write_tsc(data);
432 break; 403 break;
433 } 404 }
434 case MSR_IA32_UCODE_REV:
435 case MSR_IA32_UCODE_WRITE:
436 case 0x200 ... 0x2ff: /* MTRRs */
437 break;
438 case MSR_IA32_APICBASE:
439 vcpu->apic_base = data;
440 break;
441 default: 405 default:
442 msr = find_msr_entry(vcpu, msr_index); 406 msr = find_msr_entry(vcpu, msr_index);
443 if (!msr) { 407 if (msr) {
444 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr_index); 408 msr->data = data;
445 return 1; 409 break;
446 } 410 }
411 return kvm_set_msr_common(vcpu, msr_index, data);
447 msr->data = data; 412 msr->data = data;
448 break; 413 break;
449 } 414 }
@@ -553,11 +518,11 @@ static __init void setup_vmcs_descriptor(void)
553{ 518{
554 u32 vmx_msr_low, vmx_msr_high; 519 u32 vmx_msr_low, vmx_msr_high;
555 520
556 rdmsr(MSR_IA32_VMX_BASIC_MSR, vmx_msr_low, vmx_msr_high); 521 rdmsr(MSR_IA32_VMX_BASIC, vmx_msr_low, vmx_msr_high);
557 vmcs_descriptor.size = vmx_msr_high & 0x1fff; 522 vmcs_descriptor.size = vmx_msr_high & 0x1fff;
558 vmcs_descriptor.order = get_order(vmcs_descriptor.size); 523 vmcs_descriptor.order = get_order(vmcs_descriptor.size);
559 vmcs_descriptor.revision_id = vmx_msr_low; 524 vmcs_descriptor.revision_id = vmx_msr_low;
560}; 525}
561 526
562static struct vmcs *alloc_vmcs_cpu(int cpu) 527static struct vmcs *alloc_vmcs_cpu(int cpu)
563{ 528{
@@ -900,11 +865,6 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
900 vmcs_write32(sf->ar_bytes, ar); 865 vmcs_write32(sf->ar_bytes, ar);
901} 866}
902 867
903static int vmx_is_long_mode(struct kvm_vcpu *vcpu)
904{
905 return vmcs_read32(VM_ENTRY_CONTROLS) & VM_ENTRY_CONTROLS_IA32E_MASK;
906}
907
908static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) 868static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
909{ 869{
910 u32 ar = vmcs_read32(GUEST_CS_AR_BYTES); 870 u32 ar = vmcs_read32(GUEST_CS_AR_BYTES);
@@ -1078,12 +1038,12 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1078 vmcs_write64(GUEST_IA32_DEBUGCTL, 0); 1038 vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
1079 1039
1080 /* Control */ 1040 /* Control */
1081 vmcs_write32_fixedbits(MSR_IA32_VMX_PINBASED_CTLS_MSR, 1041 vmcs_write32_fixedbits(MSR_IA32_VMX_PINBASED_CTLS,
1082 PIN_BASED_VM_EXEC_CONTROL, 1042 PIN_BASED_VM_EXEC_CONTROL,
1083 PIN_BASED_EXT_INTR_MASK /* 20.6.1 */ 1043 PIN_BASED_EXT_INTR_MASK /* 20.6.1 */
1084 | PIN_BASED_NMI_EXITING /* 20.6.1 */ 1044 | PIN_BASED_NMI_EXITING /* 20.6.1 */
1085 ); 1045 );
1086 vmcs_write32_fixedbits(MSR_IA32_VMX_PROCBASED_CTLS_MSR, 1046 vmcs_write32_fixedbits(MSR_IA32_VMX_PROCBASED_CTLS,
1087 CPU_BASED_VM_EXEC_CONTROL, 1047 CPU_BASED_VM_EXEC_CONTROL,
1088 CPU_BASED_HLT_EXITING /* 20.6.2 */ 1048 CPU_BASED_HLT_EXITING /* 20.6.2 */
1089 | CPU_BASED_CR8_LOAD_EXITING /* 20.6.2 */ 1049 | CPU_BASED_CR8_LOAD_EXITING /* 20.6.2 */
@@ -1166,7 +1126,7 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1166 virt_to_phys(vcpu->guest_msrs + NR_BAD_MSRS)); 1126 virt_to_phys(vcpu->guest_msrs + NR_BAD_MSRS));
1167 vmcs_writel(VM_EXIT_MSR_LOAD_ADDR, 1127 vmcs_writel(VM_EXIT_MSR_LOAD_ADDR,
1168 virt_to_phys(vcpu->host_msrs + NR_BAD_MSRS)); 1128 virt_to_phys(vcpu->host_msrs + NR_BAD_MSRS));
1169 vmcs_write32_fixedbits(MSR_IA32_VMX_EXIT_CTLS_MSR, VM_EXIT_CONTROLS, 1129 vmcs_write32_fixedbits(MSR_IA32_VMX_EXIT_CTLS, VM_EXIT_CONTROLS,
1170 (HOST_IS_64 << 9)); /* 22.2,1, 20.7.1 */ 1130 (HOST_IS_64 << 9)); /* 22.2,1, 20.7.1 */
1171 vmcs_write32(VM_EXIT_MSR_STORE_COUNT, nr_good_msrs); /* 22.2.2 */ 1131 vmcs_write32(VM_EXIT_MSR_STORE_COUNT, nr_good_msrs); /* 22.2.2 */
1172 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */ 1132 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */
@@ -1174,7 +1134,7 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1174 1134
1175 1135
1176 /* 22.2.1, 20.8.1 */ 1136 /* 22.2.1, 20.8.1 */
1177 vmcs_write32_fixedbits(MSR_IA32_VMX_ENTRY_CTLS_MSR, 1137 vmcs_write32_fixedbits(MSR_IA32_VMX_ENTRY_CTLS,
1178 VM_ENTRY_CONTROLS, 0); 1138 VM_ENTRY_CONTROLS, 0);
1179 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); /* 22.2.1 */ 1139 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); /* 22.2.1 */
1180 1140
@@ -1975,7 +1935,6 @@ static struct kvm_arch_ops vmx_arch_ops = {
1975 .get_segment_base = vmx_get_segment_base, 1935 .get_segment_base = vmx_get_segment_base,
1976 .get_segment = vmx_get_segment, 1936 .get_segment = vmx_get_segment,
1977 .set_segment = vmx_set_segment, 1937 .set_segment = vmx_set_segment,
1978 .is_long_mode = vmx_is_long_mode,
1979 .get_cs_db_l_bits = vmx_get_cs_db_l_bits, 1938 .get_cs_db_l_bits = vmx_get_cs_db_l_bits,
1980 .set_cr0 = vmx_set_cr0, 1939 .set_cr0 = vmx_set_cr0,
1981 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch, 1940 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch,
diff --git a/drivers/kvm/vmx.h b/drivers/kvm/vmx.h
index 797278341581..4c0ab151836a 100644
--- a/drivers/kvm/vmx.h
+++ b/drivers/kvm/vmx.h
@@ -286,11 +286,11 @@ enum vmcs_field {
286 286
287#define CR4_VMXE 0x2000 287#define CR4_VMXE 0x2000
288 288
289#define MSR_IA32_VMX_BASIC_MSR 0x480 289#define MSR_IA32_VMX_BASIC 0x480
290#define MSR_IA32_FEATURE_CONTROL 0x03a 290#define MSR_IA32_FEATURE_CONTROL 0x03a
291#define MSR_IA32_VMX_PINBASED_CTLS_MSR 0x481 291#define MSR_IA32_VMX_PINBASED_CTLS 0x481
292#define MSR_IA32_VMX_PROCBASED_CTLS_MSR 0x482 292#define MSR_IA32_VMX_PROCBASED_CTLS 0x482
293#define MSR_IA32_VMX_EXIT_CTLS_MSR 0x483 293#define MSR_IA32_VMX_EXIT_CTLS 0x483
294#define MSR_IA32_VMX_ENTRY_CTLS_MSR 0x484 294#define MSR_IA32_VMX_ENTRY_CTLS 0x484
295 295
296#endif 296#endif
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index 6c29fe727c0f..801a974342f9 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -147,7 +147,7 @@ void __init pmu_backlight_init()
147 147
148 snprintf(name, sizeof(name), "pmubl"); 148 snprintf(name, sizeof(name), "pmubl");
149 149
150 bd = backlight_device_register(name, NULL, &pmu_backlight_data); 150 bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data);
151 if (IS_ERR(bd)) { 151 if (IS_ERR(bd)) {
152 printk("pmubl: Backlight registration failed\n"); 152 printk("pmubl: Backlight registration failed\n");
153 goto error; 153 goto error;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 334e078ffaff..78c2511ae9e0 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -437,7 +437,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
437 * or JEDEC get-id commands. Try them ... 437 * or JEDEC get-id commands. Try them ...
438 */ 438 */
439 DEBUG(MTD_DEBUG_LEVEL1, "%s: no chip id\n", 439 DEBUG(MTD_DEBUG_LEVEL1, "%s: no chip id\n",
440 flash->spi->dev.bus_id); 440 spi->dev.bus_id);
441 return -ENODEV; 441 return -ENODEV;
442 } 442 }
443 443
@@ -447,7 +447,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
447 } 447 }
448 if (i == ARRAY_SIZE(m25p_data)) { 448 if (i == ARRAY_SIZE(m25p_data)) {
449 DEBUG(MTD_DEBUG_LEVEL1, "%s: unrecognized id %s\n", 449 DEBUG(MTD_DEBUG_LEVEL1, "%s: unrecognized id %s\n",
450 flash->spi->dev.bus_id, data->type); 450 spi->dev.bus_id, data->type);
451 return -ENODEV; 451 return -ENODEV;
452 } 452 }
453 453
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 0a7e86859bf1..910e4061dfd2 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -536,7 +536,7 @@ static int __devinit dataflash_probe(struct spi_device *spi)
536 if (status <= 0 || status == 0xff) { 536 if (status <= 0 || status == 0xff) {
537 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n", 537 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n",
538 spi->dev.bus_id, status); 538 spi->dev.bus_id, status);
539 if (status == 0xff) 539 if (status == 0 || status == 0xff)
540 status = -ENODEV; 540 status = -ENODEV;
541 return status; 541 return status;
542 } 542 }
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 1ae9c3f50ffa..0e0401dd02cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -639,6 +639,8 @@ static void pci_read_irq(struct pci_dev *dev)
639 dev->irq = irq; 639 dev->irq = irq;
640} 640}
641 641
642#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
643
642/** 644/**
643 * pci_setup_device - fill in class and map information of a device 645 * pci_setup_device - fill in class and map information of a device
644 * @dev: the device structure to fill 646 * @dev: the device structure to fill
@@ -649,9 +651,6 @@ static void pci_read_irq(struct pci_dev *dev)
649 * Returns 0 on success and -1 if unknown type of device (not normal, bridge 651 * Returns 0 on success and -1 if unknown type of device (not normal, bridge
650 * or CardBus). 652 * or CardBus).
651 */ 653 */
652
653#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
654
655static int pci_setup_device(struct pci_dev * dev) 654static int pci_setup_device(struct pci_dev * dev)
656{ 655{
657 u32 class; 656 u32 class;
diff --git a/drivers/scsi/ibmvscsi/Makefile b/drivers/scsi/ibmvscsi/Makefile
index 6ac0633d5452..f67d9efc7a99 100644
--- a/drivers/scsi/ibmvscsi/Makefile
+++ b/drivers/scsi/ibmvscsi/Makefile
@@ -1,7 +1,9 @@
1obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsic.o 1obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsic.o
2 2
3ibmvscsic-y += ibmvscsi.o 3ibmvscsic-y += ibmvscsi.o
4ifndef CONFIG_PPC_PSERIES
4ibmvscsic-$(CONFIG_PPC_ISERIES) += iseries_vscsi.o 5ibmvscsic-$(CONFIG_PPC_ISERIES) += iseries_vscsi.o
6endif
5ibmvscsic-$(CONFIG_PPC_PSERIES) += rpa_vscsi.o 7ibmvscsic-$(CONFIG_PPC_PSERIES) += rpa_vscsi.o
6 8
7obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvstgt.o 9obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvstgt.o
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 493d5bbb661b..145d6236954b 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -1037,7 +1037,8 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,
1037 err = request_irq(up->port.irq, sunsab_interrupt, 1037 err = request_irq(up->port.irq, sunsab_interrupt,
1038 IRQF_SHARED, "sab", up); 1038 IRQF_SHARED, "sab", up);
1039 if (err) { 1039 if (err) {
1040 of_iounmap(up->port.membase, 1040 of_iounmap(&op->resource[0],
1041 up->port.membase,
1041 sizeof(union sab82532_async_regs)); 1042 sizeof(union sab82532_async_regs));
1042 return err; 1043 return err;
1043 } 1044 }
@@ -1064,7 +1065,8 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
1064 sizeof(union sab82532_async_regs), 1065 sizeof(union sab82532_async_regs),
1065 (inst * 2) + 1); 1066 (inst * 2) + 1);
1066 if (err) { 1067 if (err) {
1067 of_iounmap(up[0].port.membase, 1068 of_iounmap(&op->resource[0],
1069 up[0].port.membase,
1068 sizeof(union sab82532_async_regs)); 1070 sizeof(union sab82532_async_regs));
1069 free_irq(up[0].port.irq, &up[0]); 1071 free_irq(up[0].port.irq, &up[0]);
1070 return err; 1072 return err;
@@ -1082,10 +1084,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
1082 1084
1083static void __devexit sab_remove_one(struct uart_sunsab_port *up) 1085static void __devexit sab_remove_one(struct uart_sunsab_port *up)
1084{ 1086{
1087 struct of_device *op = to_of_device(up->port.dev);
1088
1085 uart_remove_one_port(&sunsab_reg, &up->port); 1089 uart_remove_one_port(&sunsab_reg, &up->port);
1086 if (!(up->port.line & 1)) 1090 if (!(up->port.line & 1))
1087 free_irq(up->port.irq, up); 1091 free_irq(up->port.irq, up);
1088 of_iounmap(up->port.membase, 1092 of_iounmap(&op->resource[0],
1093 up->port.membase,
1089 sizeof(union sab82532_async_regs)); 1094 sizeof(union sab82532_async_regs));
1090} 1095}
1091 1096
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 564592b2b2ba..3ec3df21816b 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1480,13 +1480,13 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m
1480 return 0; 1480 return 0;
1481 1481
1482out_unmap: 1482out_unmap:
1483 of_iounmap(up->port.membase, up->reg_size); 1483 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1484 return err; 1484 return err;
1485} 1485}
1486 1486
1487static int __devexit su_remove(struct of_device *dev) 1487static int __devexit su_remove(struct of_device *op)
1488{ 1488{
1489 struct uart_sunsu_port *up = dev_get_drvdata(&dev->dev);; 1489 struct uart_sunsu_port *up = dev_get_drvdata(&op->dev);
1490 1490
1491 if (up->su_type == SU_PORT_MS || 1491 if (up->su_type == SU_PORT_MS ||
1492 up->su_type == SU_PORT_KBD) { 1492 up->su_type == SU_PORT_KBD) {
@@ -1499,9 +1499,9 @@ static int __devexit su_remove(struct of_device *dev)
1499 } 1499 }
1500 1500
1501 if (up->port.membase) 1501 if (up->port.membase)
1502 of_iounmap(up->port.membase, up->reg_size); 1502 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1503 1503
1504 dev_set_drvdata(&dev->dev, NULL); 1504 dev_set_drvdata(&op->dev, NULL);
1505 1505
1506 return 0; 1506 return 0;
1507} 1507}
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 75de919a9471..244f796dc625 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1379,13 +1379,15 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m
1379 if (!keyboard_mouse) { 1379 if (!keyboard_mouse) {
1380 err = uart_add_one_port(&sunzilog_reg, &up[0].port); 1380 err = uart_add_one_port(&sunzilog_reg, &up[0].port);
1381 if (err) { 1381 if (err) {
1382 of_iounmap(rp, sizeof(struct zilog_layout)); 1382 of_iounmap(&op->resource[0],
1383 rp, sizeof(struct zilog_layout));
1383 return err; 1384 return err;
1384 } 1385 }
1385 err = uart_add_one_port(&sunzilog_reg, &up[1].port); 1386 err = uart_add_one_port(&sunzilog_reg, &up[1].port);
1386 if (err) { 1387 if (err) {
1387 uart_remove_one_port(&sunzilog_reg, &up[0].port); 1388 uart_remove_one_port(&sunzilog_reg, &up[0].port);
1388 of_iounmap(rp, sizeof(struct zilog_layout)); 1389 of_iounmap(&op->resource[0],
1390 rp, sizeof(struct zilog_layout));
1389 return err; 1391 return err;
1390 } 1392 }
1391 } else { 1393 } else {
@@ -1414,18 +1416,18 @@ static void __devexit zs_remove_one(struct uart_sunzilog_port *up)
1414 uart_remove_one_port(&sunzilog_reg, &up->port); 1416 uart_remove_one_port(&sunzilog_reg, &up->port);
1415} 1417}
1416 1418
1417static int __devexit zs_remove(struct of_device *dev) 1419static int __devexit zs_remove(struct of_device *op)
1418{ 1420{
1419 struct uart_sunzilog_port *up = dev_get_drvdata(&dev->dev); 1421 struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev);
1420 struct zilog_layout __iomem *regs; 1422 struct zilog_layout __iomem *regs;
1421 1423
1422 zs_remove_one(&up[0]); 1424 zs_remove_one(&up[0]);
1423 zs_remove_one(&up[1]); 1425 zs_remove_one(&up[1]);
1424 1426
1425 regs = sunzilog_chip_regs[up[0].port.line / 2]; 1427 regs = sunzilog_chip_regs[up[0].port.line / 2];
1426 of_iounmap(regs, sizeof(struct zilog_layout)); 1428 of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout));
1427 1429
1428 dev_set_drvdata(&dev->dev, NULL); 1430 dev_set_drvdata(&op->dev, NULL);
1429 1431
1430 return 0; 1432 return 0;
1431} 1433}
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index ff0b04895db0..e9798bf7b8c6 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -112,6 +112,8 @@ u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \
112{ \ 112{ \
113 u32 data; \ 113 u32 data; \
114 const type * tx = mpc83xx_spi->tx; \ 114 const type * tx = mpc83xx_spi->tx; \
115 if (!tx) \
116 return 0; \
115 data = *tx++; \ 117 data = *tx++; \
116 mpc83xx_spi->tx = tx; \ 118 mpc83xx_spi->tx = tx; \
117 return data; \ 119 return data; \
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 2ebe1fc4c398..8ca08713528e 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -174,7 +174,7 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
174 174
175static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) 175static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
176{ 176{
177 return hw->tx ? hw->tx[count] : 0xff; 177 return hw->tx ? hw->tx[count] : 0;
178} 178}
179 179
180static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) 180static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index bcaf4bd18eb9..eda53ed04cbc 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -23,7 +23,7 @@
23 23
24#include <asm/arch/regs-gpio.h> 24#include <asm/arch/regs-gpio.h>
25#include <asm/arch/spi-gpio.h> 25#include <asm/arch/spi-gpio.h>
26#include <asm/arch/hardware.h> 26#include <asm/hardware.h>
27 27
28struct s3c2410_spigpio { 28struct s3c2410_spigpio {
29 struct spi_bitbang bitbang; 29 struct spi_bitbang bitbang;
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
index e308f6dc2b87..f877cd4f317a 100644
--- a/drivers/usb/input/Kconfig
+++ b/drivers/usb/input/Kconfig
@@ -29,7 +29,7 @@ config USB_HID
29comment "Input core support is needed for USB HID input layer or HIDBP support" 29comment "Input core support is needed for USB HID input layer or HIDBP support"
30 depends on USB_HID && INPUT=n 30 depends on USB_HID && INPUT=n
31 31
32config USB_HID_POWERBOOK 32config USB_HIDINPUT_POWERBOOK
33 bool "Enable support for iBook/PowerBook special keys" 33 bool "Enable support for iBook/PowerBook special keys"
34 default n 34 default n
35 depends on USB_HID 35 depends on USB_HID
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index c66e3d52cbf3..9bb6257d6918 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -320,7 +320,7 @@ static int __devinit bw2_init_one(struct of_device *op)
320 all->info.fbops = &bw2_ops; 320 all->info.fbops = &bw2_ops;
321 321
322 all->info.screen_base = 322 all->info.screen_base =
323 sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); 323 of_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram");
324 all->info.par = &all->par; 324 all->info.par = &all->par;
325 325
326 bw2_blank(0, &all->info); 326 bw2_blank(0, &all->info);
@@ -329,8 +329,10 @@ static int __devinit bw2_init_one(struct of_device *op)
329 329
330 err= register_framebuffer(&all->info); 330 err= register_framebuffer(&all->info);
331 if (err < 0) { 331 if (err < 0) {
332 of_iounmap(all->par.regs, sizeof(struct bw2_regs)); 332 of_iounmap(&op->resource[0],
333 of_iounmap(all->info.screen_base, all->par.fbsize); 333 all->par.regs, sizeof(struct bw2_regs));
334 of_iounmap(&op->resource[0],
335 all->info.screen_base, all->par.fbsize);
334 kfree(all); 336 kfree(all);
335 return err; 337 return err;
336 } 338 }
@@ -351,18 +353,18 @@ static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id
351 return bw2_init_one(op); 353 return bw2_init_one(op);
352} 354}
353 355
354static int __devexit bw2_remove(struct of_device *dev) 356static int __devexit bw2_remove(struct of_device *op)
355{ 357{
356 struct all_info *all = dev_get_drvdata(&dev->dev); 358 struct all_info *all = dev_get_drvdata(&op->dev);
357 359
358 unregister_framebuffer(&all->info); 360 unregister_framebuffer(&all->info);
359 361
360 of_iounmap(all->par.regs, sizeof(struct bw2_regs)); 362 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct bw2_regs));
361 of_iounmap(all->info.screen_base, all->par.fbsize); 363 of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
362 364
363 kfree(all); 365 kfree(all);
364 366
365 dev_set_drvdata(&dev->dev, NULL); 367 dev_set_drvdata(&op->dev, NULL);
366 368
367 return 0; 369 return 0;
368} 370}
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 7f926c619b61..ec6a51a5822d 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -452,16 +452,20 @@ struct all_info {
452 struct cg14_par par; 452 struct cg14_par par;
453}; 453};
454 454
455static void cg14_unmap_regs(struct all_info *all) 455static void cg14_unmap_regs(struct of_device *op, struct all_info *all)
456{ 456{
457 if (all->par.regs) 457 if (all->par.regs)
458 of_iounmap(all->par.regs, sizeof(struct cg14_regs)); 458 of_iounmap(&op->resource[0],
459 all->par.regs, sizeof(struct cg14_regs));
459 if (all->par.clut) 460 if (all->par.clut)
460 of_iounmap(all->par.clut, sizeof(struct cg14_clut)); 461 of_iounmap(&op->resource[0],
462 all->par.clut, sizeof(struct cg14_clut));
461 if (all->par.cursor) 463 if (all->par.cursor)
462 of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); 464 of_iounmap(&op->resource[0],
465 all->par.cursor, sizeof(struct cg14_cursor));
463 if (all->info.screen_base) 466 if (all->info.screen_base)
464 of_iounmap(all->info.screen_base, all->par.fbsize); 467 of_iounmap(&op->resource[1],
468 all->info.screen_base, all->par.fbsize);
465} 469}
466 470
467static int __devinit cg14_init_one(struct of_device *op) 471static int __devinit cg14_init_one(struct of_device *op)
@@ -506,7 +510,7 @@ static int __devinit cg14_init_one(struct of_device *op)
506 510
507 if (!all->par.regs || !all->par.clut || !all->par.cursor || 511 if (!all->par.regs || !all->par.clut || !all->par.cursor ||
508 !all->info.screen_base) 512 !all->info.screen_base)
509 cg14_unmap_regs(all); 513 cg14_unmap_regs(op, all);
510 514
511 is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == 515 is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
512 (8 * 1024 * 1024)); 516 (8 * 1024 * 1024));
@@ -541,7 +545,7 @@ static int __devinit cg14_init_one(struct of_device *op)
541 __cg14_reset(&all->par); 545 __cg14_reset(&all->par);
542 546
543 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 547 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
544 cg14_unmap_regs(all); 548 cg14_unmap_regs(op, all);
545 kfree(all); 549 kfree(all);
546 return -ENOMEM; 550 return -ENOMEM;
547 } 551 }
@@ -552,7 +556,7 @@ static int __devinit cg14_init_one(struct of_device *op)
552 err = register_framebuffer(&all->info); 556 err = register_framebuffer(&all->info);
553 if (err < 0) { 557 if (err < 0) {
554 fb_dealloc_cmap(&all->info.cmap); 558 fb_dealloc_cmap(&all->info.cmap);
555 cg14_unmap_regs(all); 559 cg14_unmap_regs(op, all);
556 kfree(all); 560 kfree(all);
557 return err; 561 return err;
558 } 562 }
@@ -574,18 +578,18 @@ static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id
574 return cg14_init_one(op); 578 return cg14_init_one(op);
575} 579}
576 580
577static int __devexit cg14_remove(struct of_device *dev) 581static int __devexit cg14_remove(struct of_device *op)
578{ 582{
579 struct all_info *all = dev_get_drvdata(&dev->dev); 583 struct all_info *all = dev_get_drvdata(&op->dev);
580 584
581 unregister_framebuffer(&all->info); 585 unregister_framebuffer(&all->info);
582 fb_dealloc_cmap(&all->info.cmap); 586 fb_dealloc_cmap(&all->info.cmap);
583 587
584 cg14_unmap_regs(all); 588 cg14_unmap_regs(op, all);
585 589
586 kfree(all); 590 kfree(all);
587 591
588 dev_set_drvdata(&dev->dev, NULL); 592 dev_set_drvdata(&op->dev, NULL);
589 593
590 return 0; 594 return 0;
591} 595}
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 9c8c753ef454..ada6f7e3a891 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -403,8 +403,10 @@ static int __devinit cg3_init_one(struct of_device *op)
403 cg3_do_default_mode(&all->par); 403 cg3_do_default_mode(&all->par);
404 404
405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
406 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 406 of_iounmap(&op->resource[0],
407 of_iounmap(all->info.screen_base, all->par.fbsize); 407 all->par.regs, sizeof(struct cg3_regs));
408 of_iounmap(&op->resource[0],
409 all->info.screen_base, all->par.fbsize);
408 kfree(all); 410 kfree(all);
409 return -ENOMEM; 411 return -ENOMEM;
410 } 412 }
@@ -415,8 +417,10 @@ static int __devinit cg3_init_one(struct of_device *op)
415 err = register_framebuffer(&all->info); 417 err = register_framebuffer(&all->info);
416 if (err < 0) { 418 if (err < 0) {
417 fb_dealloc_cmap(&all->info.cmap); 419 fb_dealloc_cmap(&all->info.cmap);
418 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 420 of_iounmap(&op->resource[0],
419 of_iounmap(all->info.screen_base, all->par.fbsize); 421 all->par.regs, sizeof(struct cg3_regs));
422 of_iounmap(&op->resource[0],
423 all->info.screen_base, all->par.fbsize);
420 kfree(all); 424 kfree(all);
421 return err; 425 return err;
422 } 426 }
@@ -436,19 +440,19 @@ static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id
436 return cg3_init_one(op); 440 return cg3_init_one(op);
437} 441}
438 442
439static int __devexit cg3_remove(struct of_device *dev) 443static int __devexit cg3_remove(struct of_device *op)
440{ 444{
441 struct all_info *all = dev_get_drvdata(&dev->dev); 445 struct all_info *all = dev_get_drvdata(&op->dev);
442 446
443 unregister_framebuffer(&all->info); 447 unregister_framebuffer(&all->info);
444 fb_dealloc_cmap(&all->info.cmap); 448 fb_dealloc_cmap(&all->info.cmap);
445 449
446 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 450 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs));
447 of_iounmap(all->info.screen_base, all->par.fbsize); 451 of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
448 452
449 kfree(all); 453 kfree(all);
450 454
451 dev_set_drvdata(&dev->dev, NULL); 455 dev_set_drvdata(&op->dev, NULL);
452 456
453 return 0; 457 return 0;
454} 458}
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 64146be2eeb0..4dad23a28f58 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -658,21 +658,26 @@ struct all_info {
658 struct cg6_par par; 658 struct cg6_par par;
659}; 659};
660 660
661static void cg6_unmap_regs(struct all_info *all) 661static void cg6_unmap_regs(struct of_device *op, struct all_info *all)
662{ 662{
663 if (all->par.fbc) 663 if (all->par.fbc)
664 of_iounmap(all->par.fbc, 4096); 664 of_iounmap(&op->resource[0], all->par.fbc, 4096);
665 if (all->par.tec) 665 if (all->par.tec)
666 of_iounmap(all->par.tec, sizeof(struct cg6_tec)); 666 of_iounmap(&op->resource[0],
667 all->par.tec, sizeof(struct cg6_tec));
667 if (all->par.thc) 668 if (all->par.thc)
668 of_iounmap(all->par.thc, sizeof(struct cg6_thc)); 669 of_iounmap(&op->resource[0],
670 all->par.thc, sizeof(struct cg6_thc));
669 if (all->par.bt) 671 if (all->par.bt)
670 of_iounmap(all->par.bt, sizeof(struct bt_regs)); 672 of_iounmap(&op->resource[0],
673 all->par.bt, sizeof(struct bt_regs));
671 if (all->par.fhc) 674 if (all->par.fhc)
672 of_iounmap(all->par.fhc, sizeof(u32)); 675 of_iounmap(&op->resource[0],
676 all->par.fhc, sizeof(u32));
673 677
674 if (all->info.screen_base) 678 if (all->info.screen_base)
675 of_iounmap(all->info.screen_base, all->par.fbsize); 679 of_iounmap(&op->resource[0],
680 all->info.screen_base, all->par.fbsize);
676} 681}
677 682
678static int __devinit cg6_init_one(struct of_device *op) 683static int __devinit cg6_init_one(struct of_device *op)
@@ -720,7 +725,7 @@ static int __devinit cg6_init_one(struct of_device *op)
720 all->par.fbsize, "cgsix ram"); 725 all->par.fbsize, "cgsix ram");
721 if (!all->par.fbc || !all->par.tec || !all->par.thc || 726 if (!all->par.fbc || !all->par.tec || !all->par.thc ||
722 !all->par.bt || !all->par.fhc || !all->info.screen_base) { 727 !all->par.bt || !all->par.fhc || !all->info.screen_base) {
723 cg6_unmap_regs(all); 728 cg6_unmap_regs(op, all);
724 kfree(all); 729 kfree(all);
725 return -ENOMEM; 730 return -ENOMEM;
726 } 731 }
@@ -734,7 +739,7 @@ static int __devinit cg6_init_one(struct of_device *op)
734 cg6_blank(0, &all->info); 739 cg6_blank(0, &all->info);
735 740
736 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 741 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
737 cg6_unmap_regs(all); 742 cg6_unmap_regs(op, all);
738 kfree(all); 743 kfree(all);
739 return -ENOMEM; 744 return -ENOMEM;
740 } 745 }
@@ -744,7 +749,7 @@ static int __devinit cg6_init_one(struct of_device *op)
744 749
745 err = register_framebuffer(&all->info); 750 err = register_framebuffer(&all->info);
746 if (err < 0) { 751 if (err < 0) {
747 cg6_unmap_regs(all); 752 cg6_unmap_regs(op, all);
748 fb_dealloc_cmap(&all->info.cmap); 753 fb_dealloc_cmap(&all->info.cmap);
749 kfree(all); 754 kfree(all);
750 return err; 755 return err;
@@ -767,18 +772,18 @@ static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id
767 return cg6_init_one(op); 772 return cg6_init_one(op);
768} 773}
769 774
770static int __devexit cg6_remove(struct of_device *dev) 775static int __devexit cg6_remove(struct of_device *op)
771{ 776{
772 struct all_info *all = dev_get_drvdata(&dev->dev); 777 struct all_info *all = dev_get_drvdata(&op->dev);
773 778
774 unregister_framebuffer(&all->info); 779 unregister_framebuffer(&all->info);
775 fb_dealloc_cmap(&all->info.cmap); 780 fb_dealloc_cmap(&all->info.cmap);
776 781
777 cg6_unmap_regs(all); 782 cg6_unmap_regs(op, all);
778 783
779 kfree(all); 784 kfree(all);
780 785
781 dev_set_drvdata(&dev->dev, NULL); 786 dev_set_drvdata(&op->dev, NULL);
782 787
783 return 0; 788 return 0;
784} 789}
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 949141bd44d4..15854aec3180 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -910,7 +910,8 @@ static int ffb_init_one(struct of_device *op)
910 all->par.dac = of_ioremap(&op->resource[1], 0, 910 all->par.dac = of_ioremap(&op->resource[1], 0,
911 sizeof(struct ffb_dac), "ffb dac"); 911 sizeof(struct ffb_dac), "ffb dac");
912 if (!all->par.dac) { 912 if (!all->par.dac) {
913 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 913 of_iounmap(&op->resource[2],
914 all->par.fbc, sizeof(struct ffb_fbc));
914 kfree(all); 915 kfree(all);
915 return -ENOMEM; 916 return -ENOMEM;
916 } 917 }
@@ -968,8 +969,10 @@ static int ffb_init_one(struct of_device *op)
968 969
969 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 970 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
970 printk(KERN_ERR "ffb: Could not allocate color map.\n"); 971 printk(KERN_ERR "ffb: Could not allocate color map.\n");
971 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 972 of_iounmap(&op->resource[2],
972 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 973 all->par.fbc, sizeof(struct ffb_fbc));
974 of_iounmap(&op->resource[1],
975 all->par.dac, sizeof(struct ffb_dac));
973 kfree(all); 976 kfree(all);
974 return -ENOMEM; 977 return -ENOMEM;
975 } 978 }
@@ -980,8 +983,10 @@ static int ffb_init_one(struct of_device *op)
980 if (err < 0) { 983 if (err < 0) {
981 printk(KERN_ERR "ffb: Could not register framebuffer.\n"); 984 printk(KERN_ERR "ffb: Could not register framebuffer.\n");
982 fb_dealloc_cmap(&all->info.cmap); 985 fb_dealloc_cmap(&all->info.cmap);
983 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 986 of_iounmap(&op->resource[2],
984 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 987 all->par.fbc, sizeof(struct ffb_fbc));
988 of_iounmap(&op->resource[1],
989 all->par.dac, sizeof(struct ffb_dac));
985 kfree(all); 990 kfree(all);
986 return err; 991 return err;
987 } 992 }
@@ -1003,19 +1008,19 @@ static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id
1003 return ffb_init_one(op); 1008 return ffb_init_one(op);
1004} 1009}
1005 1010
1006static int __devexit ffb_remove(struct of_device *dev) 1011static int __devexit ffb_remove(struct of_device *op)
1007{ 1012{
1008 struct all_info *all = dev_get_drvdata(&dev->dev); 1013 struct all_info *all = dev_get_drvdata(&op->dev);
1009 1014
1010 unregister_framebuffer(&all->info); 1015 unregister_framebuffer(&all->info);
1011 fb_dealloc_cmap(&all->info.cmap); 1016 fb_dealloc_cmap(&all->info.cmap);
1012 1017
1013 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 1018 of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc));
1014 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 1019 of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac));
1015 1020
1016 kfree(all); 1021 kfree(all);
1017 1022
1018 dev_set_drvdata(&dev->dev, NULL); 1023 dev_set_drvdata(&op->dev, NULL);
1019 1024
1020 return 0; 1025 return 0;
1021} 1026}
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index f3a24338d9ac..a038aa5a9e1c 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -530,20 +530,21 @@ struct all_info {
530 struct leo_par par; 530 struct leo_par par;
531}; 531};
532 532
533static void leo_unmap_regs(struct all_info *all) 533static void leo_unmap_regs(struct of_device *op, struct all_info *all)
534{ 534{
535 if (all->par.lc_ss0_usr) 535 if (all->par.lc_ss0_usr)
536 of_iounmap(all->par.lc_ss0_usr, 0x1000); 536 of_iounmap(&op->resource[0], all->par.lc_ss0_usr, 0x1000);
537 if (all->par.ld_ss0) 537 if (all->par.ld_ss0)
538 of_iounmap(all->par.ld_ss0, 0x1000); 538 of_iounmap(&op->resource[0], all->par.ld_ss0, 0x1000);
539 if (all->par.ld_ss1) 539 if (all->par.ld_ss1)
540 of_iounmap(all->par.ld_ss1, 0x1000); 540 of_iounmap(&op->resource[0], all->par.ld_ss1, 0x1000);
541 if (all->par.lx_krn) 541 if (all->par.lx_krn)
542 of_iounmap(all->par.lx_krn, 0x1000); 542 of_iounmap(&op->resource[0], all->par.lx_krn, 0x1000);
543 if (all->par.cursor) 543 if (all->par.cursor)
544 of_iounmap(all->par.cursor, sizeof(struct leo_cursor)); 544 of_iounmap(&op->resource[0],
545 all->par.cursor, sizeof(struct leo_cursor));
545 if (all->info.screen_base) 546 if (all->info.screen_base)
546 of_iounmap(all->info.screen_base, 0x800000); 547 of_iounmap(&op->resource[0], all->info.screen_base, 0x800000);
547} 548}
548 549
549static int __devinit leo_init_one(struct of_device *op) 550static int __devinit leo_init_one(struct of_device *op)
@@ -592,7 +593,7 @@ static int __devinit leo_init_one(struct of_device *op)
592 !all->par.lx_krn || 593 !all->par.lx_krn ||
593 !all->par.cursor || 594 !all->par.cursor ||
594 !all->info.screen_base) { 595 !all->info.screen_base) {
595 leo_unmap_regs(all); 596 leo_unmap_regs(op, all);
596 kfree(all); 597 kfree(all);
597 return -ENOMEM; 598 return -ENOMEM;
598 } 599 }
@@ -607,7 +608,7 @@ static int __devinit leo_init_one(struct of_device *op)
607 leo_blank(0, &all->info); 608 leo_blank(0, &all->info);
608 609
609 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 610 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
610 leo_unmap_regs(all); 611 leo_unmap_regs(op, all);
611 kfree(all); 612 kfree(all);
612 return -ENOMEM;; 613 return -ENOMEM;;
613 } 614 }
@@ -617,7 +618,7 @@ static int __devinit leo_init_one(struct of_device *op)
617 err = register_framebuffer(&all->info); 618 err = register_framebuffer(&all->info);
618 if (err < 0) { 619 if (err < 0) {
619 fb_dealloc_cmap(&all->info.cmap); 620 fb_dealloc_cmap(&all->info.cmap);
620 leo_unmap_regs(all); 621 leo_unmap_regs(op, all);
621 kfree(all); 622 kfree(all);
622 return err; 623 return err;
623 } 624 }
@@ -638,18 +639,18 @@ static int __devinit leo_probe(struct of_device *dev, const struct of_device_id
638 return leo_init_one(op); 639 return leo_init_one(op);
639} 640}
640 641
641static int __devexit leo_remove(struct of_device *dev) 642static int __devexit leo_remove(struct of_device *op)
642{ 643{
643 struct all_info *all = dev_get_drvdata(&dev->dev); 644 struct all_info *all = dev_get_drvdata(&op->dev);
644 645
645 unregister_framebuffer(&all->info); 646 unregister_framebuffer(&all->info);
646 fb_dealloc_cmap(&all->info.cmap); 647 fb_dealloc_cmap(&all->info.cmap);
647 648
648 leo_unmap_regs(all); 649 leo_unmap_regs(op, all);
649 650
650 kfree(all); 651 kfree(all);
651 652
652 dev_set_drvdata(&dev->dev, NULL); 653 dev_set_drvdata(&op->dev, NULL);
653 654
654 return 0; 655 return 0;
655} 656}
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index 56ac51d6a7f3..637b78bb4bf7 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -297,7 +297,8 @@ static int __devinit p9100_init_one(struct of_device *op)
297 all->info.screen_base = of_ioremap(&op->resource[2], 0, 297 all->info.screen_base = of_ioremap(&op->resource[2], 0,
298 all->par.fbsize, "p9100 ram"); 298 all->par.fbsize, "p9100 ram");
299 if (!all->info.screen_base) { 299 if (!all->info.screen_base) {
300 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 300 of_iounmap(&op->resource[0],
301 all->par.regs, sizeof(struct p9100_regs));
301 kfree(all); 302 kfree(all);
302 return -ENOMEM; 303 return -ENOMEM;
303 } 304 }
@@ -306,8 +307,10 @@ static int __devinit p9100_init_one(struct of_device *op)
306 p9100_blank(0, &all->info); 307 p9100_blank(0, &all->info);
307 308
308 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 309 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
309 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 310 of_iounmap(&op->resource[0],
310 of_iounmap(all->info.screen_base, all->par.fbsize); 311 all->par.regs, sizeof(struct p9100_regs));
312 of_iounmap(&op->resource[2],
313 all->info.screen_base, all->par.fbsize);
311 kfree(all); 314 kfree(all);
312 return -ENOMEM; 315 return -ENOMEM;
313 } 316 }
@@ -317,8 +320,10 @@ static int __devinit p9100_init_one(struct of_device *op)
317 err = register_framebuffer(&all->info); 320 err = register_framebuffer(&all->info);
318 if (err < 0) { 321 if (err < 0) {
319 fb_dealloc_cmap(&all->info.cmap); 322 fb_dealloc_cmap(&all->info.cmap);
320 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 323 of_iounmap(&op->resource[0],
321 of_iounmap(all->info.screen_base, all->par.fbsize); 324 all->par.regs, sizeof(struct p9100_regs));
325 of_iounmap(&op->resource[2],
326 all->info.screen_base, all->par.fbsize);
322 kfree(all); 327 kfree(all);
323 return err; 328 return err;
324 } 329 }
@@ -340,19 +345,19 @@ static int __devinit p9100_probe(struct of_device *dev, const struct of_device_i
340 return p9100_init_one(op); 345 return p9100_init_one(op);
341} 346}
342 347
343static int __devexit p9100_remove(struct of_device *dev) 348static int __devexit p9100_remove(struct of_device *op)
344{ 349{
345 struct all_info *all = dev_get_drvdata(&dev->dev); 350 struct all_info *all = dev_get_drvdata(&op->dev);
346 351
347 unregister_framebuffer(&all->info); 352 unregister_framebuffer(&all->info);
348 fb_dealloc_cmap(&all->info.cmap); 353 fb_dealloc_cmap(&all->info.cmap);
349 354
350 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 355 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct p9100_regs));
351 of_iounmap(all->info.screen_base, all->par.fbsize); 356 of_iounmap(&op->resource[2], all->info.screen_base, all->par.fbsize);
352 357
353 kfree(all); 358 kfree(all);
354 359
355 dev_set_drvdata(&dev->dev, NULL); 360 dev_set_drvdata(&op->dev, NULL);
356 361
357 return 0; 362 return 0;
358} 363}
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index 6990ab11cd06..5a99669232ce 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -350,18 +350,23 @@ struct all_info {
350 struct tcx_par par; 350 struct tcx_par par;
351}; 351};
352 352
353static void tcx_unmap_regs(struct all_info *all) 353static void tcx_unmap_regs(struct of_device *op, struct all_info *all)
354{ 354{
355 if (all->par.tec) 355 if (all->par.tec)
356 of_iounmap(all->par.tec, sizeof(struct tcx_tec)); 356 of_iounmap(&op->resource[7],
357 all->par.tec, sizeof(struct tcx_tec));
357 if (all->par.thc) 358 if (all->par.thc)
358 of_iounmap(all->par.thc, sizeof(struct tcx_thc)); 359 of_iounmap(&op->resource[9],
360 all->par.thc, sizeof(struct tcx_thc));
359 if (all->par.bt) 361 if (all->par.bt)
360 of_iounmap(all->par.bt, sizeof(struct bt_regs)); 362 of_iounmap(&op->resource[8],
363 all->par.bt, sizeof(struct bt_regs));
361 if (all->par.cplane) 364 if (all->par.cplane)
362 of_iounmap(all->par.cplane, all->par.fbsize * sizeof(u32)); 365 of_iounmap(&op->resource[4],
366 all->par.cplane, all->par.fbsize * sizeof(u32));
363 if (all->info.screen_base) 367 if (all->info.screen_base)
364 of_iounmap(all->info.screen_base, all->par.fbsize); 368 of_iounmap(&op->resource[0],
369 all->info.screen_base, all->par.fbsize);
365} 370}
366 371
367static int __devinit tcx_init_one(struct of_device *op) 372static int __devinit tcx_init_one(struct of_device *op)
@@ -398,7 +403,7 @@ static int __devinit tcx_init_one(struct of_device *op)
398 all->par.fbsize, "tcx ram"); 403 all->par.fbsize, "tcx ram");
399 if (!all->par.tec || !all->par.thc || 404 if (!all->par.tec || !all->par.thc ||
400 !all->par.bt || !all->info.screen_base) { 405 !all->par.bt || !all->info.screen_base) {
401 tcx_unmap_regs(all); 406 tcx_unmap_regs(op, all);
402 kfree(all); 407 kfree(all);
403 return -ENOMEM; 408 return -ENOMEM;
404 } 409 }
@@ -409,7 +414,7 @@ static int __devinit tcx_init_one(struct of_device *op)
409 all->par.fbsize * sizeof(u32), 414 all->par.fbsize * sizeof(u32),
410 "tcx cplane"); 415 "tcx cplane");
411 if (!all->par.cplane) { 416 if (!all->par.cplane) {
412 tcx_unmap_regs(all); 417 tcx_unmap_regs(op, all);
413 kfree(all); 418 kfree(all);
414 return -ENOMEM; 419 return -ENOMEM;
415 } 420 }
@@ -461,7 +466,7 @@ static int __devinit tcx_init_one(struct of_device *op)
461 tcx_blank(FB_BLANK_UNBLANK, &all->info); 466 tcx_blank(FB_BLANK_UNBLANK, &all->info);
462 467
463 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 468 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
464 tcx_unmap_regs(all); 469 tcx_unmap_regs(op, all);
465 kfree(all); 470 kfree(all);
466 return -ENOMEM; 471 return -ENOMEM;
467 } 472 }
@@ -472,7 +477,7 @@ static int __devinit tcx_init_one(struct of_device *op)
472 err = register_framebuffer(&all->info); 477 err = register_framebuffer(&all->info);
473 if (err < 0) { 478 if (err < 0) {
474 fb_dealloc_cmap(&all->info.cmap); 479 fb_dealloc_cmap(&all->info.cmap);
475 tcx_unmap_regs(all); 480 tcx_unmap_regs(op, all);
476 kfree(all); 481 kfree(all);
477 return err; 482 return err;
478 } 483 }
@@ -495,18 +500,18 @@ static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id
495 return tcx_init_one(op); 500 return tcx_init_one(op);
496} 501}
497 502
498static int __devexit tcx_remove(struct of_device *dev) 503static int __devexit tcx_remove(struct of_device *op)
499{ 504{
500 struct all_info *all = dev_get_drvdata(&dev->dev); 505 struct all_info *all = dev_get_drvdata(&op->dev);
501 506
502 unregister_framebuffer(&all->info); 507 unregister_framebuffer(&all->info);
503 fb_dealloc_cmap(&all->info.cmap); 508 fb_dealloc_cmap(&all->info.cmap);
504 509
505 tcx_unmap_regs(all); 510 tcx_unmap_regs(op, all);
506 511
507 kfree(all); 512 kfree(all);
508 513
509 dev_set_drvdata(&dev->dev, NULL); 514 dev_set_drvdata(&op->dev, NULL);
510 515
511 return 0; 516 return 0;
512} 517}
diff --git a/fs/aio.c b/fs/aio.c
index 5f577a63bdf0..ee20fc4240e0 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -599,9 +599,6 @@ static void use_mm(struct mm_struct *mm)
599 * by the calling kernel thread 599 * by the calling kernel thread
600 * (Note: this routine is intended to be called only 600 * (Note: this routine is intended to be called only
601 * from a kernel thread context) 601 * from a kernel thread context)
602 *
603 * Comments: Called with ctx->ctx_lock held. This nests
604 * task_lock instead ctx_lock.
605 */ 602 */
606static void unuse_mm(struct mm_struct *mm) 603static void unuse_mm(struct mm_struct *mm)
607{ 604{
@@ -850,14 +847,16 @@ static void aio_kick_handler(struct work_struct *work)
850{ 847{
851 struct kioctx *ctx = container_of(work, struct kioctx, wq.work); 848 struct kioctx *ctx = container_of(work, struct kioctx, wq.work);
852 mm_segment_t oldfs = get_fs(); 849 mm_segment_t oldfs = get_fs();
850 struct mm_struct *mm;
853 int requeue; 851 int requeue;
854 852
855 set_fs(USER_DS); 853 set_fs(USER_DS);
856 use_mm(ctx->mm); 854 use_mm(ctx->mm);
857 spin_lock_irq(&ctx->ctx_lock); 855 spin_lock_irq(&ctx->ctx_lock);
858 requeue =__aio_run_iocbs(ctx); 856 requeue =__aio_run_iocbs(ctx);
859 unuse_mm(ctx->mm); 857 mm = ctx->mm;
860 spin_unlock_irq(&ctx->ctx_lock); 858 spin_unlock_irq(&ctx->ctx_lock);
859 unuse_mm(mm);
861 set_fs(oldfs); 860 set_fs(oldfs);
862 /* 861 /*
863 * we're in a worker thread already, don't use queue_delayed_work, 862 * we're in a worker thread already, don't use queue_delayed_work,
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index ef6cd30108a9..93628b02ef5d 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -540,8 +540,7 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
540 struct buffer_head *bh_result, int create) 540 struct buffer_head *bh_result, int create)
541{ 541{
542 int ret; 542 int ret;
543 u64 vbo_max; /* file offset, max_blocks from iblock */ 543 u64 p_blkno, inode_blocks;
544 u64 p_blkno;
545 int contig_blocks; 544 int contig_blocks;
546 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; 545 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
547 unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits; 546 unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
@@ -550,12 +549,23 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
550 * nicely aligned and of the right size, so there's no need 549 * nicely aligned and of the right size, so there's no need
551 * for us to check any of that. */ 550 * for us to check any of that. */
552 551
553 vbo_max = ((u64)iblock + max_blocks) << blocksize_bits;
554
555 spin_lock(&OCFS2_I(inode)->ip_lock); 552 spin_lock(&OCFS2_I(inode)->ip_lock);
556 if ((iblock + max_blocks) > 553 inode_blocks = ocfs2_clusters_to_blocks(inode->i_sb,
557 ocfs2_clusters_to_blocks(inode->i_sb, 554 OCFS2_I(inode)->ip_clusters);
558 OCFS2_I(inode)->ip_clusters)) { 555
556 /*
557 * For a read which begins past the end of file, we return a hole.
558 */
559 if (!create && (iblock >= inode_blocks)) {
560 spin_unlock(&OCFS2_I(inode)->ip_lock);
561 ret = 0;
562 goto bail;
563 }
564
565 /*
566 * Any write past EOF is not allowed because we'd be extending.
567 */
568 if (create && (iblock + max_blocks) > inode_blocks) {
559 spin_unlock(&OCFS2_I(inode)->ip_lock); 569 spin_unlock(&OCFS2_I(inode)->ip_lock);
560 ret = -EIO; 570 ret = -EIO;
561 goto bail; 571 goto bail;
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index a25ef5a50386..277ca67a2ad6 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1447,6 +1447,15 @@ out:
1447 return ret; 1447 return ret;
1448} 1448}
1449 1449
1450static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
1451 char *page)
1452{
1453 if (!reg->hr_task)
1454 return 0;
1455
1456 return sprintf(page, "%u\n", reg->hr_task->pid);
1457}
1458
1450struct o2hb_region_attribute { 1459struct o2hb_region_attribute {
1451 struct configfs_attribute attr; 1460 struct configfs_attribute attr;
1452 ssize_t (*show)(struct o2hb_region *, char *); 1461 ssize_t (*show)(struct o2hb_region *, char *);
@@ -1485,11 +1494,19 @@ static struct o2hb_region_attribute o2hb_region_attr_dev = {
1485 .store = o2hb_region_dev_write, 1494 .store = o2hb_region_dev_write,
1486}; 1495};
1487 1496
1497static struct o2hb_region_attribute o2hb_region_attr_pid = {
1498 .attr = { .ca_owner = THIS_MODULE,
1499 .ca_name = "pid",
1500 .ca_mode = S_IRUGO | S_IRUSR },
1501 .show = o2hb_region_pid_read,
1502};
1503
1488static struct configfs_attribute *o2hb_region_attrs[] = { 1504static struct configfs_attribute *o2hb_region_attrs[] = {
1489 &o2hb_region_attr_block_bytes.attr, 1505 &o2hb_region_attr_block_bytes.attr,
1490 &o2hb_region_attr_start_block.attr, 1506 &o2hb_region_attr_start_block.attr,
1491 &o2hb_region_attr_blocks.attr, 1507 &o2hb_region_attr_blocks.attr,
1492 &o2hb_region_attr_dev.attr, 1508 &o2hb_region_attr_dev.attr,
1509 &o2hb_region_attr_pid.attr,
1493 NULL, 1510 NULL,
1494}; 1511};
1495 1512
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index e6220137bf69..e335541727f9 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2718,6 +2718,15 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
2718 inode = ocfs2_lock_res_inode(lockres); 2718 inode = ocfs2_lock_res_inode(lockres);
2719 mapping = inode->i_mapping; 2719 mapping = inode->i_mapping;
2720 2720
2721 /*
2722 * We need this before the filemap_fdatawrite() so that it can
2723 * transfer the dirty bit from the PTE to the
2724 * page. Unfortunately this means that even for EX->PR
2725 * downconverts, we'll lose our mappings and have to build
2726 * them up again.
2727 */
2728 unmap_mapping_range(mapping, 0, 0, 0);
2729
2721 if (filemap_fdatawrite(mapping)) { 2730 if (filemap_fdatawrite(mapping)) {
2722 mlog(ML_ERROR, "Could not sync inode %llu for downconvert!", 2731 mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
2723 (unsigned long long)OCFS2_I(inode)->ip_blkno); 2732 (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -2725,7 +2734,6 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
2725 sync_mapping_buffers(mapping); 2734 sync_mapping_buffers(mapping);
2726 if (blocking == LKM_EXMODE) { 2735 if (blocking == LKM_EXMODE) {
2727 truncate_inode_pages(mapping, 0); 2736 truncate_inode_pages(mapping, 0);
2728 unmap_mapping_range(mapping, 0, 0, 0);
2729 } else { 2737 } else {
2730 /* We only need to wait on the I/O if we're not also 2738 /* We only need to wait on the I/O if we're not also
2731 * truncating pages because truncate_inode_pages waits 2739 * truncating pages because truncate_inode_pages waits
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 9fd590b9bde3..10953a508f2f 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -149,6 +149,17 @@ int ocfs2_should_update_atime(struct inode *inode,
149 ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))) 149 ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)))
150 return 0; 150 return 0;
151 151
152 /*
153 * We can be called with no vfsmnt structure - NFSD will
154 * sometimes do this.
155 *
156 * Note that our action here is different than touch_atime() -
157 * if we can't tell whether this is a noatime mount, then we
158 * don't know whether to trust the value of s_atime_quantum.
159 */
160 if (vfsmnt == NULL)
161 return 0;
162
152 if ((vfsmnt->mnt_flags & MNT_NOATIME) || 163 if ((vfsmnt->mnt_flags & MNT_NOATIME) ||
153 ((vfsmnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))) 164 ((vfsmnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))
154 return 0; 165 return 0;
@@ -966,8 +977,6 @@ int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
966 } 977 }
967 978
968 ret = generic_permission(inode, mask, NULL); 979 ret = generic_permission(inode, mask, NULL);
969 if (ret)
970 mlog_errno(ret);
971 980
972 ocfs2_meta_unlock(inode, 0); 981 ocfs2_meta_unlock(inode, 0);
973out: 982out:
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 0947fb57dcf3..54ebbc84207f 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -25,11 +25,13 @@
25 */ 25 */
26 26
27#include <linux/fs.h> 27#include <linux/fs.h>
28#include <linux/mm.h>
28 29
29const struct address_space_operations ramfs_aops = { 30const struct address_space_operations ramfs_aops = {
30 .readpage = simple_readpage, 31 .readpage = simple_readpage,
31 .prepare_write = simple_prepare_write, 32 .prepare_write = simple_prepare_write,
32 .commit_write = simple_commit_write 33 .commit_write = simple_commit_write,
34 .set_page_dirty = __set_page_dirty_nobuffers,
33}; 35};
34 36
35const struct file_operations ramfs_file_operations = { 37const struct file_operations ramfs_file_operations = {
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 61cbe1ef06b9..e9d6c4733282 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/mm.h>
14#include <linux/pagemap.h> 15#include <linux/pagemap.h>
15#include <linux/highmem.h> 16#include <linux/highmem.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -30,7 +31,8 @@ static int ramfs_nommu_setattr(struct dentry *, struct iattr *);
30const struct address_space_operations ramfs_aops = { 31const struct address_space_operations ramfs_aops = {
31 .readpage = simple_readpage, 32 .readpage = simple_readpage,
32 .prepare_write = simple_prepare_write, 33 .prepare_write = simple_prepare_write,
33 .commit_write = simple_commit_write 34 .commit_write = simple_commit_write,
35 .set_page_dirty = __set_page_dirty_nobuffers,
34}; 36};
35 37
36const struct file_operations ramfs_file_operations = { 38const struct file_operations ramfs_file_operations = {
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index a06eecd48292..14fae1fa87df 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -35,7 +35,7 @@ struct bug_entry {
35#define WARN_ON(condition) ({ \ 35#define WARN_ON(condition) ({ \
36 typeof(condition) __ret_warn_on = (condition); \ 36 typeof(condition) __ret_warn_on = (condition); \
37 if (unlikely(__ret_warn_on)) { \ 37 if (unlikely(__ret_warn_on)) { \
38 printk("WARNING at %s:%d %s()\n", __FILE__, \ 38 printk("BUG: at %s:%d %s()\n", __FILE__, \
39 __LINE__, __FUNCTION__); \ 39 __LINE__, __FUNCTION__); \
40 dump_stack(); \ 40 dump_stack(); \
41 } \ 41 } \
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index 80ea31f6e17f..7cb00c1b09c6 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -33,7 +33,7 @@ struct of_device
33#define to_of_device(d) container_of(d, struct of_device, dev) 33#define to_of_device(d) container_of(d, struct of_device, dev)
34 34
35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
36extern void of_iounmap(void __iomem *base, unsigned long size); 36extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
37 37
38extern struct of_device *of_find_device_by_node(struct device_node *); 38extern struct of_device *of_find_device_by_node(struct device_node *);
39 39
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index a62c7b997d66..60e9173c9acb 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -34,7 +34,7 @@ struct of_device
34#define to_of_device(d) container_of(d, struct of_device, dev) 34#define to_of_device(d) container_of(d, struct of_device, dev)
35 35
36extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 36extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
37extern void of_iounmap(void __iomem *base, unsigned long size); 37extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
38 38
39extern struct of_device *of_find_device_by_node(struct device_node *); 39extern struct of_device *of_find_device_by_node(struct device_node *);
40 40
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 826b15e914e2..fd404416f31c 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -55,7 +55,7 @@ extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
55extern int cpuset_memory_pressure_enabled; 55extern int cpuset_memory_pressure_enabled;
56extern void __cpuset_memory_pressure_bump(void); 56extern void __cpuset_memory_pressure_bump(void);
57 57
58extern const struct file_operations proc_cpuset_operations; 58extern struct file_operations proc_cpuset_operations;
59extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 59extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
60 60
61extern void cpuset_lock(void); 61extern void cpuset_lock(void);
diff --git a/include/linux/net.h b/include/linux/net.h
index 6f0dfeba509a..f28d8a2e2c91 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,7 +19,6 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/random.h>
23#include <asm/socket.h> 22#include <asm/socket.h>
24 23
25struct poll_table_struct; 24struct poll_table_struct;
@@ -57,6 +56,7 @@ typedef enum {
57 56
58#ifdef __KERNEL__ 57#ifdef __KERNEL__
59#include <linux/stringify.h> 58#include <linux/stringify.h>
59#include <linux/random.h>
60 60
61#define SOCK_ASYNC_NOSPACE 0 61#define SOCK_ASYNC_NOSPACE 0
62#define SOCK_ASYNC_WAITDATA 1 62#define SOCK_ASYNC_WAITDATA 1
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6be767c76b37..fea0d9db6846 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -906,6 +906,7 @@ static inline void netif_poll_disable(struct net_device *dev)
906 906
907static inline void netif_poll_enable(struct net_device *dev) 907static inline void netif_poll_enable(struct net_device *dev)
908{ 908{
909 smp_mb__before_clear_bit();
909 clear_bit(__LINK_STATE_RX_SCHED, &dev->state); 910 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
910} 911}
911 912
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c8bb68099eb9..176f6e36dbfa 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -289,7 +289,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
289 * the data being transferred; that may reduce overhead, when the 289 * the data being transferred; that may reduce overhead, when the
290 * underlying driver uses dma. 290 * underlying driver uses dma.
291 * 291 *
292 * If the transmit buffer is null, undefined data will be shifted out 292 * If the transmit buffer is null, zeroes will be shifted out
293 * while filling rx_buf. If the receive buffer is null, the data 293 * while filling rx_buf. If the receive buffer is null, the data
294 * shifted in will be discarded. Only "len" bytes shift out (or in). 294 * shifted in will be discarded. Only "len" bytes shift out (or in).
295 * It's an error to try to shift out a partial word. (For example, by 295 * It's an error to try to shift out a partial word. (For example, by
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 232aed2b10f9..6b05dc69c959 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2656,7 +2656,7 @@ static int cpuset_open(struct inode *inode, struct file *file)
2656 return single_open(file, proc_cpuset_show, pid); 2656 return single_open(file, proc_cpuset_show, pid);
2657} 2657}
2658 2658
2659const struct file_operations proc_cpuset_operations = { 2659struct file_operations proc_cpuset_operations = {
2660 .open = cpuset_open, 2660 .open = cpuset_open,
2661 .read = seq_read, 2661 .read = seq_read,
2662 .llseek = seq_lseek, 2662 .llseek = seq_lseek,
diff --git a/kernel/exit.c b/kernel/exit.c
index 46cf6b681460..35401720635b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -597,6 +597,10 @@ choose_new_parent(struct task_struct *p, struct task_struct *reaper)
597static void 597static void
598reparent_thread(struct task_struct *p, struct task_struct *father, int traced) 598reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
599{ 599{
600 if (p->pdeath_signal)
601 /* We already hold the tasklist_lock here. */
602 group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
603
600 /* Move the child from its dying parent to the new one. */ 604 /* Move the child from its dying parent to the new one. */
601 if (unlikely(traced)) { 605 if (unlikely(traced)) {
602 /* Preserve ptrace links if someone else is tracing this child. */ 606 /* Preserve ptrace links if someone else is tracing this child. */
@@ -631,10 +635,6 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
631 /* We don't want people slaying init. */ 635 /* We don't want people slaying init. */
632 if (p->exit_signal != -1) 636 if (p->exit_signal != -1)
633 p->exit_signal = SIGCHLD; 637 p->exit_signal = SIGCHLD;
634
635 if (p->pdeath_signal)
636 /* We already hold the tasklist_lock here. */
637 group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
638 638
639 /* If we'd notified the old parent about this child's death, 639 /* If we'd notified the old parent about this child's death,
640 * also notify the new parent. 640 * also notify the new parent.
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 01e750559034..509efd49540f 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1318,12 +1318,16 @@ static inline int lookup_chain_cache(u64 chain_key, struct lock_class *class)
1318cache_hit: 1318cache_hit:
1319 debug_atomic_inc(&chain_lookup_hits); 1319 debug_atomic_inc(&chain_lookup_hits);
1320 if (very_verbose(class)) 1320 if (very_verbose(class))
1321 printk("\nhash chain already cached, key: %016Lx tail class: [%p] %s\n", chain_key, class->key, class->name); 1321 printk("\nhash chain already cached, key: "
1322 "%016Lx tail class: [%p] %s\n",
1323 (unsigned long long)chain_key,
1324 class->key, class->name);
1322 return 0; 1325 return 0;
1323 } 1326 }
1324 } 1327 }
1325 if (very_verbose(class)) 1328 if (very_verbose(class))
1326 printk("\nnew hash chain, key: %016Lx tail class: [%p] %s\n", chain_key, class->key, class->name); 1329 printk("\nnew hash chain, key: %016Lx tail class: [%p] %s\n",
1330 (unsigned long long)chain_key, class->key, class->name);
1327 /* 1331 /*
1328 * Allocate a new chain entry from the static array, and add 1332 * Allocate a new chain entry from the static array, and add
1329 * it to the hash: 1333 * it to the hash:
diff --git a/kernel/module.c b/kernel/module.c
index b565eaeff7e6..dbce132b354c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1132,8 +1132,10 @@ static int mod_sysfs_setup(struct module *mod,
1132 goto out; 1132 goto out;
1133 1133
1134 mod->drivers_dir = kobject_add_dir(&mod->mkobj.kobj, "drivers"); 1134 mod->drivers_dir = kobject_add_dir(&mod->mkobj.kobj, "drivers");
1135 if (!mod->drivers_dir) 1135 if (!mod->drivers_dir) {
1136 err = -ENOMEM;
1136 goto out_unreg; 1137 goto out_unreg;
1138 }
1137 1139
1138 err = module_param_sysfs_setup(mod, kparam, num_params); 1140 err = module_param_sysfs_setup(mod, kparam, num_params);
1139 if (err) 1141 if (err)
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index c52f981ea008..482b11ff65cb 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -522,6 +522,7 @@ rcu_torture_writer(void *arg)
522 522
523 VERBOSE_PRINTK_STRING("rcu_torture_writer task started"); 523 VERBOSE_PRINTK_STRING("rcu_torture_writer task started");
524 set_user_nice(current, 19); 524 set_user_nice(current, 19);
525 current->flags |= PF_NOFREEZE;
525 526
526 do { 527 do {
527 schedule_timeout_uninterruptible(1); 528 schedule_timeout_uninterruptible(1);
@@ -561,6 +562,7 @@ rcu_torture_fakewriter(void *arg)
561 562
562 VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task started"); 563 VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task started");
563 set_user_nice(current, 19); 564 set_user_nice(current, 19);
565 current->flags |= PF_NOFREEZE;
564 566
565 do { 567 do {
566 schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10); 568 schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10);
@@ -591,6 +593,7 @@ rcu_torture_reader(void *arg)
591 593
592 VERBOSE_PRINTK_STRING("rcu_torture_reader task started"); 594 VERBOSE_PRINTK_STRING("rcu_torture_reader task started");
593 set_user_nice(current, 19); 595 set_user_nice(current, 19);
596 current->flags |= PF_NOFREEZE;
594 597
595 do { 598 do {
596 idx = cur_ops->readlock(); 599 idx = cur_ops->readlock();
diff --git a/kernel/sched.c b/kernel/sched.c
index b515e3caad7f..3df33da0dafc 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4617,17 +4617,6 @@ asmlinkage long sys_sched_yield(void)
4617 return 0; 4617 return 0;
4618} 4618}
4619 4619
4620static inline int __resched_legal(int expected_preempt_count)
4621{
4622#ifdef CONFIG_PREEMPT
4623 if (unlikely(preempt_count() != expected_preempt_count))
4624 return 0;
4625#endif
4626 if (unlikely(system_state != SYSTEM_RUNNING))
4627 return 0;
4628 return 1;
4629}
4630
4631static void __cond_resched(void) 4620static void __cond_resched(void)
4632{ 4621{
4633#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 4622#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
@@ -4647,7 +4636,8 @@ static void __cond_resched(void)
4647 4636
4648int __sched cond_resched(void) 4637int __sched cond_resched(void)
4649{ 4638{
4650 if (need_resched() && __resched_legal(0)) { 4639 if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) &&
4640 system_state == SYSTEM_RUNNING) {
4651 __cond_resched(); 4641 __cond_resched();
4652 return 1; 4642 return 1;
4653 } 4643 }
@@ -4673,7 +4663,7 @@ int cond_resched_lock(spinlock_t *lock)
4673 ret = 1; 4663 ret = 1;
4674 spin_lock(lock); 4664 spin_lock(lock);
4675 } 4665 }
4676 if (need_resched() && __resched_legal(1)) { 4666 if (need_resched() && system_state == SYSTEM_RUNNING) {
4677 spin_release(&lock->dep_map, 1, _THIS_IP_); 4667 spin_release(&lock->dep_map, 1, _THIS_IP_);
4678 _raw_spin_unlock(lock); 4668 _raw_spin_unlock(lock);
4679 preempt_enable_no_resched(); 4669 preempt_enable_no_resched();
@@ -4689,7 +4679,7 @@ int __sched cond_resched_softirq(void)
4689{ 4679{
4690 BUG_ON(!in_softirq()); 4680 BUG_ON(!in_softirq());
4691 4681
4692 if (need_resched() && __resched_legal(0)) { 4682 if (need_resched() && system_state == SYSTEM_RUNNING) {
4693 raw_local_irq_disable(); 4683 raw_local_irq_disable();
4694 _local_bh_enable(); 4684 _local_bh_enable();
4695 raw_local_irq_enable(); 4685 raw_local_irq_enable();
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 64cf3c214634..6969cfb33901 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -174,7 +174,12 @@ static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)
174{ 174{
175#ifdef CONFIG_NUMA 175#ifdef CONFIG_NUMA
176 struct zone **z; 176 struct zone **z;
177 nodemask_t nodes = node_online_map; 177 nodemask_t nodes;
178 int node;
179 /* node has memory ? */
180 for_each_online_node(node)
181 if (NODE_DATA(node)->node_present_pages)
182 node_set(node, nodes);
178 183
179 for (z = zonelist->zones; *z; z++) 184 for (z = zonelist->zones; *z; z++)
180 if (cpuset_zone_allowed_softwall(*z, gfp_mask)) 185 if (cpuset_zone_allowed_softwall(*z, gfp_mask))
diff --git a/mm/rmap.c b/mm/rmap.c
index 57306fa0114d..669acb22b572 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -452,7 +452,7 @@ static int page_mkclean_one(struct page *page, struct vm_area_struct *vma)
452 entry = ptep_clear_flush(vma, address, pte); 452 entry = ptep_clear_flush(vma, address, pte);
453 entry = pte_wrprotect(entry); 453 entry = pte_wrprotect(entry);
454 entry = pte_mkclean(entry); 454 entry = pte_mkclean(entry);
455 set_pte_at(vma, address, pte, entry); 455 set_pte_at(mm, address, pte, entry);
456 lazy_mmu_prot_update(entry); 456 lazy_mmu_prot_update(entry);
457 ret = 1; 457 ret = 1;
458 } 458 }
diff --git a/mm/slob.c b/mm/slob.c
index 2e9236e10ed1..5adc29cb58dd 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -60,6 +60,8 @@ static DEFINE_SPINLOCK(slob_lock);
60static DEFINE_SPINLOCK(block_lock); 60static DEFINE_SPINLOCK(block_lock);
61 61
62static void slob_free(void *b, int size); 62static void slob_free(void *b, int size);
63static void slob_timer_cbk(void);
64
63 65
64static void *slob_alloc(size_t size, gfp_t gfp, int align) 66static void *slob_alloc(size_t size, gfp_t gfp, int align)
65{ 67{
@@ -326,7 +328,7 @@ const char *kmem_cache_name(struct kmem_cache *c)
326EXPORT_SYMBOL(kmem_cache_name); 328EXPORT_SYMBOL(kmem_cache_name);
327 329
328static struct timer_list slob_timer = TIMER_INITIALIZER( 330static struct timer_list slob_timer = TIMER_INITIALIZER(
329 (void (*)(unsigned long))kmem_cache_init, 0, 0); 331 (void (*)(unsigned long))slob_timer_cbk, 0, 0);
330 332
331int kmem_cache_shrink(struct kmem_cache *d) 333int kmem_cache_shrink(struct kmem_cache *d)
332{ 334{
@@ -339,7 +341,12 @@ int kmem_ptr_validate(struct kmem_cache *a, const void *b)
339 return 0; 341 return 0;
340} 342}
341 343
342void kmem_cache_init(void) 344void __init kmem_cache_init(void)
345{
346 slob_timer_cbk();
347}
348
349static void slob_timer_cbk(void)
343{ 350{
344 void *p = slob_alloc(PAGE_SIZE, 0, PAGE_SIZE-1); 351 void *p = slob_alloc(PAGE_SIZE, 0, PAGE_SIZE-1);
345 352
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 63eb9ab0032b..40fea4918390 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -692,7 +692,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
692 __count_vm_events(KSWAPD_STEAL, nr_freed); 692 __count_vm_events(KSWAPD_STEAL, nr_freed);
693 } else 693 } else
694 __count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scan); 694 __count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scan);
695 __count_vm_events(PGACTIVATE, nr_freed); 695 __count_zone_vm_events(PGSTEAL, zone, nr_freed);
696 696
697 if (nr_taken == 0) 697 if (nr_taken == 0)
698 goto done; 698 goto done;
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 6b381fc0383d..f1cf3402e75c 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -399,7 +399,8 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list,
399 if (!probe) 399 if (!probe)
400 break; 400 break;
401 401
402 status = crypto_has_alg(name, type, mask | CRYPTO_ALG_ASYNC); 402 status = crypto_has_alg(list[i].name, type,
403 mask | CRYPTO_ALG_ASYNC);
403 if (!status) 404 if (!status)
404 break; 405 break;
405 406
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index bdb7070dd3dc..ee0581557966 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2660,9 +2660,11 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)
2660 rcu_read_unlock(); 2660 rcu_read_unlock();
2661 return 0; 2661 return 0;
2662 } 2662 }
2663 lock_sock(sock->sk); 2663 local_bh_disable();
2664 bh_lock_sock_nested(sock->sk);
2664 rc = selinux_netlbl_socket_setsid(sock, sksec->sid); 2665 rc = selinux_netlbl_socket_setsid(sock, sksec->sid);
2665 release_sock(sock->sk); 2666 bh_unlock_sock(sock->sk);
2667 local_bh_enable();
2666 rcu_read_unlock(); 2668 rcu_read_unlock();
2667 2669
2668 return rc; 2670 return rc;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 29e4c48151bc..4e0c3c1b908b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5070,6 +5070,8 @@ static struct hda_board_config alc883_cfg_tbl[] = {
5070 { .modelname = "6stack-dig", .config = ALC883_6ST_DIG }, 5070 { .modelname = "6stack-dig", .config = ALC883_6ST_DIG },
5071 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, 5071 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668,
5072 .config = ALC883_6ST_DIG }, /* MSI */ 5072 .config = ALC883_6ST_DIG }, /* MSI */
5073 { .pci_subvendor = 0x1462, .pci_subdevice = 0x7280,
5074 .config = ALC883_6ST_DIG }, /* MSI K9A Platinum (MS-7280) */
5073 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, 5075 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668,
5074 .config = ALC883_6ST_DIG }, /* Foxconn */ 5076 .config = ALC883_6ST_DIG }, /* Foxconn */
5075 { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD }, 5077 { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD },