aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/kernel-api.tmpl6
-rw-r--r--Documentation/arm/VFP/release-notes.txt2
-rw-r--r--Documentation/dvb/faq.txt1
-rw-r--r--Documentation/filesystems/affs.txt2
-rw-r--r--Documentation/filesystems/ext2.txt3
-rw-r--r--Documentation/floppy.txt10
-rw-r--r--Documentation/ioctl-number.txt2
-rw-r--r--Documentation/kernel-docs.txt60
-rw-r--r--Documentation/mca.txt2
-rw-r--r--Documentation/networking/driver.txt5
-rw-r--r--Documentation/networking/ifenslave.c9
-rw-r--r--Documentation/networking/iphase.txt2
-rw-r--r--Documentation/networking/irda.txt8
-rw-r--r--Documentation/networking/ray_cs.txt3
-rw-r--r--Documentation/networking/vortex.txt28
-rw-r--r--Documentation/power/pci.txt2
-rw-r--r--Documentation/scsi/ibmmca.txt4
-rw-r--r--Documentation/usb/ibmcam.txt4
-rw-r--r--Documentation/usb/ov511.txt4
-rw-r--r--Documentation/usb/rio.txt6
-rw-r--r--Documentation/video4linux/zr36120.txt7
-rw-r--r--MAINTAINERS25
-rw-r--r--Makefile2
-rw-r--r--arch/arm/configs/corgi_defconfig83
-rw-r--r--arch/arm/configs/poodle_defconfig1015
-rw-r--r--arch/arm/configs/spitz_defconfig81
-rw-r--r--arch/arm/kernel/head.S11
-rw-r--r--arch/arm/mach-clps7500/core.c2
-rw-r--r--arch/arm/mach-pxa/Kconfig4
-rw-r--r--arch/arm/mach-pxa/tosa.c2
-rw-r--r--arch/arm/mach-realview/core.c1
-rw-r--r--arch/arm/mach-sa1100/assabet.c3
-rw-r--r--arch/arm/mm/consistent.c13
-rw-r--r--arch/arm/tools/mach-types14
-rw-r--r--arch/frv/kernel/semaphore.c2
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c2
-rw-r--r--arch/frv/mm/init.c2
-rw-r--r--arch/frv/mm/pgalloc.c6
-rw-r--r--arch/i386/kernel/acpi/boot.c4
-rw-r--r--arch/i386/kernel/mpparse.c5
-rw-r--r--arch/i386/kernel/process.c7
-rw-r--r--arch/i386/pci/common.c4
-rw-r--r--arch/i386/pci/direct.c2
-rw-r--r--arch/i386/pci/i386.c7
-rw-r--r--arch/ia64/kernel/process.c7
-rw-r--r--arch/ia64/sn/kernel/bte.c1
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c3
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c3
-rw-r--r--arch/m32r/kernel/io_mappi3.c54
-rw-r--r--arch/m32r/kernel/setup_mappi3.c20
-rw-r--r--arch/m32r/kernel/sys_m32r.c6
-rw-r--r--arch/powerpc/Makefile16
-rw-r--r--arch/powerpc/kernel/process.c1
-rw-r--r--arch/powerpc/kernel/vdso.c9
-rw-r--r--arch/powerpc/mm/4xx_mmu.c4
-rw-r--r--arch/powerpc/mm/hugetlbpage.c10
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/tlb_32.c6
-rw-r--r--arch/powerpc/mm/tlb_64.c4
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c2
-rw-r--r--arch/powerpc/sysdev/dart.h2
-rw-r--r--arch/powerpc/sysdev/u3_iommu.c4
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/mm/generic.c10
-rw-r--r--arch/sparc64/kernel/sbus.c2
-rw-r--r--arch/sparc64/mm/generic.c15
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/include/sysdep-i386/stub.h9
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h12
-rw-r--r--arch/um/kernel/skas/clone.c21
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--arch/um/sys-i386/ldt.c35
-rw-r--r--arch/um/sys-i386/stub_segv.c11
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/um/sys-x86_64/stub_segv.c20
-rw-r--r--arch/x86_64/kernel/process.c7
-rw-r--r--block/as-iosched.c4
-rw-r--r--drivers/base/bus.c21
-rw-r--r--drivers/base/dd.c8
-rw-r--r--drivers/block/floppy.c6
-rw-r--r--drivers/char/agp/amd64-agp.c4
-rw-r--r--drivers/char/agp/backend.c2
-rw-r--r--drivers/char/agp/via-agp.c6
-rw-r--r--drivers/char/drm/drm_lock.c16
-rw-r--r--drivers/char/drm/drm_memory.c2
-rw-r--r--drivers/char/drm/drm_memory_debug.h2
-rw-r--r--drivers/char/drm/mga_drv.c2
-rw-r--r--drivers/char/drm/radeon_drv.h3
-rw-r--r--drivers/cpufreq/cpufreq.c14
-rw-r--r--drivers/firmware/Kconfig1
-rw-r--r--drivers/hwmon/hdaps.c2
-rw-r--r--drivers/hwmon/it87.c7
-rw-r--r--drivers/hwmon/lm78.c2
-rw-r--r--drivers/hwmon/w83627hf.c8
-rw-r--r--drivers/ieee1394/sbp2.c6
-rw-r--r--drivers/infiniband/core/mad.c4
-rw-r--r--drivers/input/gameport/gameport.c12
-rw-r--r--drivers/input/input.c63
-rw-r--r--drivers/input/keyboard/atkbd.c99
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/uinput.c325
-rw-r--r--drivers/input/misc/wistron_btns.c561
-rw-r--r--drivers/input/serio/serio.c12
-rw-r--r--drivers/md/dm-bio-list.h3
-rw-r--r--drivers/md/dm-ioctl.c3
-rw-r--r--drivers/md/dm-log.c4
-rw-r--r--drivers/md/dm-mpath.c13
-rw-r--r--drivers/md/dm-raid1.c20
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/md/raid1.c8
-rw-r--r--drivers/md/raid10.c6
-rw-r--r--drivers/md/raid5.c2
-rw-r--r--drivers/md/raid6main.c27
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c2
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/cx88/Kconfig20
-rw-r--r--drivers/media/video/cx88/Makefile27
-rw-r--r--drivers/media/video/ir-kbd-gpio.c5
-rw-r--r--drivers/media/video/saa7134/Kconfig12
-rw-r--r--drivers/media/video/saa7134/Makefile19
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c2
-rw-r--r--drivers/message/i2o/pci.c2
-rw-r--r--drivers/mmc/mmc.c2
-rw-r--r--drivers/net/dgrs.c2
-rw-r--r--drivers/pci/hotplug/pciehp.h1
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c15
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c10
-rw-r--r--drivers/pci/pci-acpi.c1
-rw-r--r--drivers/pcmcia/m32r_cfc.c3
-rw-r--r--drivers/sbus/char/aurora.c12
-rw-r--r--drivers/scsi/dpt_i2o.c9
-rw-r--r--drivers/scsi/scsi.c2
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/8250_pci.c2
-rw-r--r--drivers/serial/imx.c2
-rw-r--r--drivers/serial/serial_core.c2
-rw-r--r--drivers/serial/serial_cs.c6
-rw-r--r--drivers/usb/core/hcd-pci.c38
-rw-r--r--drivers/usb/core/hub.c1
-rw-r--r--drivers/usb/host/ehci-hcd.c160
-rw-r--r--drivers/usb/host/ehci-hub.c7
-rw-r--r--drivers/usb/host/ehci-pci.c359
-rw-r--r--drivers/usb/host/ohci-pci.c36
-rw-r--r--drivers/usb/media/sn9c102_core.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h7
-rw-r--r--drivers/usb/serial/ipw.c1
-rw-r--r--drivers/usb/storage/unusual_devs.h9
-rw-r--r--drivers/video/console/fbcon_ccw.c2
-rw-r--r--drivers/video/console/fbcon_rotate.h17
-rw-r--r--drivers/video/console/vgacon.c1
-rw-r--r--drivers/video/fbmem.c6
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/cifs/CHANGES2
-rw-r--r--fs/cifs/cifs_unicode.c13
-rw-r--r--fs/cifs/cifs_unicode.h6
-rw-r--r--fs/cifs/cifsencrypt.c2
-rw-r--r--fs/cifs/cifsfs.c107
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/cifspdu.h10
-rw-r--r--fs/cifs/cifssmb.c43
-rw-r--r--fs/cifs/connect.c91
-rw-r--r--fs/cifs/dir.c32
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/cifs/inode.c202
-rw-r--r--fs/cifs/misc.c2
-rw-r--r--fs/cifs/readdir.c43
-rw-r--r--fs/cifs/transport.c4
-rw-r--r--fs/compat.c23
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--fs/dquot.c6
-rw-r--r--fs/exec.c8
-rw-r--r--fs/ext3/resize.c1
-rw-r--r--fs/fuse/dir.c37
-rw-r--r--fs/hugetlbfs/inode.c12
-rw-r--r--fs/jffs2/debug.h8
-rw-r--r--fs/nfs/inode.c26
-rw-r--r--fs/nfs/nfs4proc.c6
-rw-r--r--fs/nfs/nfs4state.c20
-rw-r--r--fs/proc/task_mmu.c7
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c13
-rw-r--r--fs/xfs/xfs_attr_leaf.c11
-rw-r--r--fs/xfs/xfs_fsops.c2
-rw-r--r--fs/xfs/xfs_iomap.h2
-rw-r--r--fs/xfs/xfs_log_priv.h36
-rw-r--r--fs/xfs/xfs_vnodeops.c5
-rw-r--r--include/asm-alpha/atomic.h7
-rw-r--r--include/asm-arm/arch-ebsa110/io.h2
-rw-r--r--include/asm-arm/arch-iop3xx/timex.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h1
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h239
-rw-r--r--include/asm-arm/arch-sa1100/io.h2
-rw-r--r--include/asm-arm/numnodes.h2
-rw-r--r--include/asm-frv/hardirq.h1
-rw-r--r--include/asm-frv/ide.h8
-rw-r--r--include/asm-frv/page.h4
-rw-r--r--include/asm-frv/semaphore.h2
-rw-r--r--include/asm-frv/thread_info.h2
-rw-r--r--include/asm-ia64/sn/sn_sal.h34
-rw-r--r--include/asm-ia64/sn/tioce.h26
-rw-r--r--include/asm-ia64/sn/tioce_provider.h17
-rw-r--r--include/asm-m32r/atomic.h21
-rw-r--r--include/asm-m32r/ide.h13
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h2
-rw-r--r--include/asm-m32r/system.h64
-rw-r--r--include/asm-powerpc/iommu.h2
-rw-r--r--include/asm-powerpc/page_64.h23
-rw-r--r--include/asm-powerpc/tce.h2
-rw-r--r--include/asm-sparc64/atomic.h1
-rw-r--r--include/asm-sparc64/pgtable.h10
-rw-r--r--include/asm-um/ldt-i386.h2
-rw-r--r--include/asm-um/ldt-x86_64.h (renamed from include/asm-um/ldt.h)7
-rw-r--r--include/asm-x86_64/atomic.h51
-rw-r--r--include/asm-x86_64/msr.h2
-rw-r--r--include/linux/cpu.h7
-rw-r--r--include/linux/gfp.h9
-rw-r--r--include/linux/jbd.h17
-rw-r--r--include/linux/memory.h1
-rw-r--r--include/linux/mm.h27
-rw-r--r--include/linux/mmc/protocol.h4
-rw-r--r--include/linux/mmzone.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_sctp.h12
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/rmap.h4
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/swap.h6
-rw-r--r--include/linux/uinput.h13
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/route.h3
-rw-r--r--kernel/cpu.c83
-rw-r--r--kernel/fork.c7
-rw-r--r--kernel/futex.c15
-rw-r--r--kernel/irq/manage.c15
-rw-r--r--kernel/posix-cpu-timers.c2
-rw-r--r--kernel/printk.c2
-rw-r--r--kernel/workqueue.c12
-rw-r--r--lib/genalloc.c14
-rw-r--r--mm/Kconfig6
-rw-r--r--mm/fremap.c28
-rw-r--r--mm/hugetlb.c6
-rw-r--r--mm/madvise.c2
-rw-r--r--mm/memory.c213
-rw-r--r--mm/mempolicy.c12
-rw-r--r--mm/mmap.c11
-rw-r--r--mm/mprotect.c8
-rw-r--r--mm/msync.c12
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/page_alloc.c75
-rw-r--r--mm/rmap.c58
-rw-r--r--mm/swap.c3
-rw-r--r--mm/thrash.c10
-rw-r--r--mm/truncate.c6
-rw-r--r--mm/vmscan.c29
-rw-r--r--net/bridge/br_if.c1
-rw-r--r--net/core/filter.c6
-rw-r--r--net/dccp/proto.c1
-rw-r--r--net/ipv4/devinet.c40
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/netfilter/Kconfig10
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c25
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/exthdrs.c22
-rw-r--r--net/ipv6/ip6_flowlabel.c16
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/sched/sch_netem.c2
-rw-r--r--net/sunrpc/rpc_pipe.c26
-rw-r--r--scripts/kconfig/Makefile68
-rw-r--r--sound/core/memalloc.c2
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c1
280 files changed, 3370 insertions, 2869 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 096aed62c326..767433bdbc40 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -237,8 +237,10 @@ X!Ilib/string.c
237 <sect1><title>Driver Support</title> 237 <sect1><title>Driver Support</title>
238!Enet/core/dev.c 238!Enet/core/dev.c
239!Enet/ethernet/eth.c 239!Enet/ethernet/eth.c
240!Einclude/linux/etherdevice.h 240!Iinclude/linux/etherdevice.h
241!Enet/core/wireless.c 241<!-- FIXME: Removed for now since no structured comments in source
242X!Enet/core/wireless.c
243-->
242 </sect1> 244 </sect1>
243 <sect1><title>Synchronous PPP</title> 245 <sect1><title>Synchronous PPP</title>
244!Edrivers/net/wan/syncppp.c 246!Edrivers/net/wan/syncppp.c
diff --git a/Documentation/arm/VFP/release-notes.txt b/Documentation/arm/VFP/release-notes.txt
index f28e0222f5e5..28a2795705ca 100644
--- a/Documentation/arm/VFP/release-notes.txt
+++ b/Documentation/arm/VFP/release-notes.txt
@@ -12,7 +12,7 @@ This release has been validated against the SoftFloat-2b library by
12John R. Hauser using the TestFloat-2a test suite. Details of this 12John R. Hauser using the TestFloat-2a test suite. Details of this
13library and test suite can be found at: 13library and test suite can be found at:
14 14
15 http://www.cs.berkeley.edu/~jhauser/arithmetic/SoftFloat.html 15 http://www.jhauser.us/arithmetic/SoftFloat.html
16 16
17The operations which have been tested with this package are: 17The operations which have been tested with this package are:
18 18
diff --git a/Documentation/dvb/faq.txt b/Documentation/dvb/faq.txt
index 3bf51e45c972..a42132d60dc8 100644
--- a/Documentation/dvb/faq.txt
+++ b/Documentation/dvb/faq.txt
@@ -60,7 +60,6 @@ Some very frequently asked questions about linuxtv-dvb
60 Metzler Bros. DVB development; alternate drivers and 60 Metzler Bros. DVB development; alternate drivers and
61 DVB utilities, include dvb-mpegtools and tuxzap. 61 DVB utilities, include dvb-mpegtools and tuxzap.
62 62
63 http://www.linuxstb.org/
64 http://sourceforge.net/projects/dvbtools/ 63 http://sourceforge.net/projects/dvbtools/
65 Dave Chapman's dvbtools package, including 64 Dave Chapman's dvbtools package, including
66 dvbstream and dvbtune 65 dvbstream and dvbtune
diff --git a/Documentation/filesystems/affs.txt b/Documentation/filesystems/affs.txt
index 30c9738590f4..2d1524469c25 100644
--- a/Documentation/filesystems/affs.txt
+++ b/Documentation/filesystems/affs.txt
@@ -216,4 +216,4 @@ due to an incompatibility with the Amiga floppy controller.
216 216
217If you are interested in an Amiga Emulator for Linux, look at 217If you are interested in an Amiga Emulator for Linux, look at
218 218
219http://www-users.informatik.rwth-aachen.de/~crux/uae.html 219http://www.freiburg.linux.de/~uae/
diff --git a/Documentation/filesystems/ext2.txt b/Documentation/filesystems/ext2.txt
index a8edb376b041..3dd2872416a1 100644
--- a/Documentation/filesystems/ext2.txt
+++ b/Documentation/filesystems/ext2.txt
@@ -369,9 +369,8 @@ The kernel source file:/usr/src/linux/fs/ext2/
369e2fsprogs (e2fsck) http://e2fsprogs.sourceforge.net/ 369e2fsprogs (e2fsck) http://e2fsprogs.sourceforge.net/
370Design & Implementation http://e2fsprogs.sourceforge.net/ext2intro.html 370Design & Implementation http://e2fsprogs.sourceforge.net/ext2intro.html
371Journaling (ext3) ftp://ftp.uk.linux.org/pub/linux/sct/fs/jfs/ 371Journaling (ext3) ftp://ftp.uk.linux.org/pub/linux/sct/fs/jfs/
372Hashed Directories http://kernelnewbies.org/~phillips/htree/
373Filesystem Resizing http://ext2resize.sourceforge.net/ 372Filesystem Resizing http://ext2resize.sourceforge.net/
374Compression (*) http://www.netspace.net.au/~reiter/e2compr/ 373Compression (*) http://e2compr.sourceforge.net/
375 374
376Implementations for: 375Implementations for:
377Windows 95/98/NT/2000 http://uranus.it.swin.edu.au/~jn/linux/Explore2fs.htm 376Windows 95/98/NT/2000 http://uranus.it.swin.edu.au/~jn/linux/Explore2fs.htm
diff --git a/Documentation/floppy.txt b/Documentation/floppy.txt
index 6fb10fcd82fb..6ccab88705cb 100644
--- a/Documentation/floppy.txt
+++ b/Documentation/floppy.txt
@@ -4,7 +4,7 @@ FAQ list:
4========= 4=========
5 5
6 A FAQ list may be found in the fdutils package (see below), and also 6 A FAQ list may be found in the fdutils package (see below), and also
7at http://fdutils.linux.lu/FAQ.html 7at <http://fdutils.linux.lu/faq.html>.
8 8
9 9
10LILO configuration options (Thinkpad users, read this) 10LILO configuration options (Thinkpad users, read this)
@@ -217,10 +217,10 @@ It also contains additional documentation about the floppy driver.
217The latest version can be found at fdutils homepage: 217The latest version can be found at fdutils homepage:
218 http://fdutils.linux.lu 218 http://fdutils.linux.lu
219 219
220The fdutils-5.4 release can be found at: 220The fdutils releases can be found at:
221 http://fdutils.linux.lu/fdutils-5.4.src.tar.gz 221 http://fdutils.linux.lu/download.html
222 http://www.tux.org/pub/knaff/fdutils/fdutils-5.4.src.tar.gz 222 http://www.tux.org/pub/knaff/fdutils/
223 ftp://metalab.unc.edu/pub/Linux/utils/disk-management/fdutils-5.4.src.tar.gz 223 ftp://metalab.unc.edu/pub/Linux/utils/disk-management/
224 224
225Reporting problems about the floppy driver 225Reporting problems about the floppy driver
226========================================== 226==========================================
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt
index 87f4d052e39c..aa7ba00ec082 100644
--- a/Documentation/ioctl-number.txt
+++ b/Documentation/ioctl-number.txt
@@ -133,7 +133,7 @@ Code Seq# Include File Comments
133'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system 133'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system
134 <http://mikonos.dia.unisa.it/tcfs> 134 <http://mikonos.dia.unisa.it/tcfs>
135'l' 40-7F linux/udf_fs_i.h in development: 135'l' 40-7F linux/udf_fs_i.h in development:
136 <http://www.trylinux.com/projects/udf/> 136 <http://sourceforge.net/projects/linux-udf/>
137'm' all linux/mtio.h conflict! 137'm' all linux/mtio.h conflict!
138'm' all linux/soundcard.h conflict! 138'm' all linux/soundcard.h conflict!
139'm' all linux/synclink.h conflict! 139'm' all linux/synclink.h conflict!
diff --git a/Documentation/kernel-docs.txt b/Documentation/kernel-docs.txt
index cb89fb3b61ef..99d24f2943ee 100644
--- a/Documentation/kernel-docs.txt
+++ b/Documentation/kernel-docs.txt
@@ -196,7 +196,7 @@
196 196
197 * Title: "Writing Linux Device Drivers" 197 * Title: "Writing Linux Device Drivers"
198 Author: Michael K. Johnson. 198 Author: Michael K. Johnson.
199 URL: http://people.redhat.com/johnsonm/devices.html 199 URL: http://users.evitech.fi/~tk/rtos/writing_linux_device_d.html
200 Keywords: files, VFS, file operations, kernel interface, character 200 Keywords: files, VFS, file operations, kernel interface, character
201 vs block devices, I/O access, hardware interrupts, DMA, access to 201 vs block devices, I/O access, hardware interrupts, DMA, access to
202 user memory, memory allocation, timers. 202 user memory, memory allocation, timers.
@@ -284,7 +284,7 @@
284 284
285 * Title: "Linux Kernel Module Programming Guide" 285 * Title: "Linux Kernel Module Programming Guide"
286 Author: Ori Pomerantz. 286 Author: Ori Pomerantz.
287 URL: http://www.tldp.org/LDP/lkmpg/mpg.html 287 URL: http://tldp.org/LDP/lkmpg/2.6/html/index.html
288 Keywords: modules, GPL book, /proc, ioctls, system calls, 288 Keywords: modules, GPL book, /proc, ioctls, system calls,
289 interrupt handlers . 289 interrupt handlers .
290 Description: Very nice 92 pages GPL book on the topic of modules 290 Description: Very nice 92 pages GPL book on the topic of modules
@@ -292,7 +292,7 @@
292 292
293 * Title: "Device File System (devfs) Overview" 293 * Title: "Device File System (devfs) Overview"
294 Author: Richard Gooch. 294 Author: Richard Gooch.
295 URL: http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.txt 295 URL: http://www.atnf.csiro.au/people/rgooch/linux/docs/devfs.html
296 Keywords: filesystem, /dev, devfs, dynamic devices, major/minor 296 Keywords: filesystem, /dev, devfs, dynamic devices, major/minor
297 allocation, device management. 297 allocation, device management.
298 Description: Document describing Richard Gooch's controversial 298 Description: Document describing Richard Gooch's controversial
@@ -316,9 +316,8 @@
316 316
317 * Title: "The Kernel Hacking HOWTO" 317 * Title: "The Kernel Hacking HOWTO"
318 Author: Various Talented People, and Rusty. 318 Author: Various Talented People, and Rusty.
319 URL: 319 Location: in kernel tree, Documentation/DocBook/kernel-hacking/
320 http://www.lisoleg.net/doc/Kernel-Hacking-HOWTO/kernel-hacking-HOW 320 (must be built as "make {htmldocs | psdocs | pdfdocs})
321 TO.html
322 Keywords: HOWTO, kernel contexts, deadlock, locking, modules, 321 Keywords: HOWTO, kernel contexts, deadlock, locking, modules,
323 symbols, return conventions. 322 symbols, return conventions.
324 Description: From the Introduction: "Please understand that I 323 Description: From the Introduction: "Please understand that I
@@ -332,13 +331,13 @@
332 originally written for the 2.3 kernels, but nearly all of it 331 originally written for the 2.3 kernels, but nearly all of it
333 applies to 2.2 too; 2.0 is slightly different". 332 applies to 2.2 too; 2.0 is slightly different".
334 333
335 * Title: "ALSA 0.5.0 Developer documentation" 334 * Title: "Writing an ALSA Driver"
336 Author: Stephan 'Jumpy' Bartels . 335 Author: Takashi Iwai <tiwai@suse.de>
337 URL: http://www.math.TU-Berlin.de/~sbartels/alsa/ 336 URL: http://www.alsa-project.org/~iwai/writing-an-alsa-driver/index.html
338 Keywords: ALSA, sound, soundcard, driver, lowlevel, hardware. 337 Keywords: ALSA, sound, soundcard, driver, lowlevel, hardware.
339 Description: Advanced Linux Sound Architecture for developers, 338 Description: Advanced Linux Sound Architecture for developers,
340 both at kernel and user-level sides. Work in progress. ALSA is 339 both at kernel and user-level sides. ALSA is the Linux kernel
341 supposed to be Linux's next generation sound architecture. 340 sound architecture in the 2.6 kernel version.
342 341
343 * Title: "Programming Guide for Linux USB Device Drivers" 342 * Title: "Programming Guide for Linux USB Device Drivers"
344 Author: Detlef Fliegl. 343 Author: Detlef Fliegl.
@@ -369,8 +368,8 @@
369 filesystems, IPC and Networking Code. 368 filesystems, IPC and Networking Code.
370 369
371 * Title: "Linux Kernel Mailing List Glossary" 370 * Title: "Linux Kernel Mailing List Glossary"
372 Author: John Levon. 371 Author: various
373 URL: http://www.movement.uklinux.net/glossary.html 372 URL: http://kernelnewbies.org/glossary/
374 Keywords: glossary, terms, linux-kernel. 373 Keywords: glossary, terms, linux-kernel.
375 Description: From the introduction: "This glossary is intended as 374 Description: From the introduction: "This glossary is intended as
376 a brief description of some of the acronyms and terms you may hear 375 a brief description of some of the acronyms and terms you may hear
@@ -378,9 +377,8 @@
378 377
379 * Title: "Linux Kernel Locking HOWTO" 378 * Title: "Linux Kernel Locking HOWTO"
380 Author: Various Talented People, and Rusty. 379 Author: Various Talented People, and Rusty.
381 URL: 380 Location: in kernel tree, Documentation/DocBook/kernel-locking/
382 http://netfilter.kernelnotes.org/unreliable-guides/kernel-locking- 381 (must be built as "make {htmldocs | psdocs | pdfdocs})
383 HOWTO.html
384 Keywords: locks, locking, spinlock, semaphore, atomic, race 382 Keywords: locks, locking, spinlock, semaphore, atomic, race
385 condition, bottom halves, tasklets, softirqs. 383 condition, bottom halves, tasklets, softirqs.
386 Description: The title says it all: document describing the 384 Description: The title says it all: document describing the
@@ -490,7 +488,7 @@
490 488
491 * Title: "Get those boards talking under Linux." 489 * Title: "Get those boards talking under Linux."
492 Author: Alex Ivchenko. 490 Author: Alex Ivchenko.
493 URL: http://www.ednmag.com/ednmag/reg/2000/06222000/13df2.htm 491 URL: http://www.edn.com/article/CA46968.html
494 Keywords: data-acquisition boards, drivers, modules, interrupts, 492 Keywords: data-acquisition boards, drivers, modules, interrupts,
495 memory allocation. 493 memory allocation.
496 Description: Article written for people wishing to make their data 494 Description: Article written for people wishing to make their data
@@ -498,7 +496,7 @@
498 overview on writing drivers, from the naming of functions to 496 overview on writing drivers, from the naming of functions to
499 interrupt handling. 497 interrupt handling.
500 Notes: Two-parts article. Part II is at 498 Notes: Two-parts article. Part II is at
501 http://www.ednmag.com/ednmag/reg/2000/07062000/14df.htm 499 URL: http://www.edn.com/article/CA46998.html
502 500
503 * Title: "Linux PCMCIA Programmer's Guide" 501 * Title: "Linux PCMCIA Programmer's Guide"
504 Author: David Hinds. 502 Author: David Hinds.
@@ -529,7 +527,7 @@
529 definitive guide for hackers, virus coders and system 527 definitive guide for hackers, virus coders and system
530 administrators." 528 administrators."
531 Author: pragmatic/THC. 529 Author: pragmatic/THC.
532 URL: http://packetstorm.securify.com/groups/thc/LKM_HACKING.html 530 URL: http://packetstormsecurity.org/docs/hack/LKM_HACKING.html
533 Keywords: syscalls, intercept, hide, abuse, symbol table. 531 Keywords: syscalls, intercept, hide, abuse, symbol table.
534 Description: Interesting paper on how to abuse the Linux kernel in 532 Description: Interesting paper on how to abuse the Linux kernel in
535 order to intercept and modify syscalls, make 533 order to intercept and modify syscalls, make
@@ -537,8 +535,7 @@
537 write kernel modules based virus... and solutions for admins to 535 write kernel modules based virus... and solutions for admins to
538 avoid all those abuses. 536 avoid all those abuses.
539 Notes: For 2.0.x kernels. Gives guidances to port it to 2.2.x 537 Notes: For 2.0.x kernels. Gives guidances to port it to 2.2.x
540 kernels. Also available in txt format at 538 kernels.
541 http://www.blacknemesis.org/hacking/txt/cllkm.txt
542 539
543 BOOKS: (Not on-line) 540 BOOKS: (Not on-line)
544 541
@@ -557,7 +554,17 @@
557 ISBN: 0-59600-008-1 554 ISBN: 0-59600-008-1
558 Notes: Further information in 555 Notes: Further information in
559 http://www.oreilly.com/catalog/linuxdrive2/ 556 http://www.oreilly.com/catalog/linuxdrive2/
560 557
558 * Title: "Linux Device Drivers, 3nd Edition"
559 Authors: Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman
560 Publisher: O'Reilly & Associates.
561 Date: 2005.
562 Pages: 636.
563 ISBN: 0-596-00590-3
564 Notes: Further information in
565 http://www.oreilly.com/catalog/linuxdrive3/
566 PDF format, URL: http://lwn.net/Kernel/LDD3/
567
561 * Title: "Linux Kernel Internals" 568 * Title: "Linux Kernel Internals"
562 Author: Michael Beck. 569 Author: Michael Beck.
563 Publisher: Addison-Wesley. 570 Publisher: Addison-Wesley.
@@ -766,12 +773,15 @@
766 documents, FAQs... 773 documents, FAQs...
767 774
768 * Name: "linux-kernel mailing list archives and search engines" 775 * Name: "linux-kernel mailing list archives and search engines"
776 URL: http://vger.kernel.org/vger-lists.html
769 URL: http://www.uwsg.indiana.edu/hypermail/linux/kernel/index.html 777 URL: http://www.uwsg.indiana.edu/hypermail/linux/kernel/index.html
770 URL: http://www.kernelnotes.org/lnxlists/linux-kernel/ 778 URL: http://marc.theaimsgroup.com/?l=linux-kernel
771 URL: http://www.geocrawler.com 779 URL: http://groups.google.com/group/mlist.linux.kernel
780 URL: http://www.cs.helsinki.fi/linux/linux-kernel/
781 URL: http://www.lib.uaa.alaska.edu/linux-kernel/
772 Keywords: linux-kernel, archives, search. 782 Keywords: linux-kernel, archives, search.
773 Description: Some of the linux-kernel mailing list archivers. If 783 Description: Some of the linux-kernel mailing list archivers. If
774 you have a better/another one, please let me know. 784 you have a better/another one, please let me know.
775 _________________________________________________________________ 785 _________________________________________________________________
776 786
777 Document last updated on Thu Jun 28 15:09:39 CEST 2001 787 Document last updated on Sat 2005-NOV-19
diff --git a/Documentation/mca.txt b/Documentation/mca.txt
index 6e32c305c65a..60913354cb7d 100644
--- a/Documentation/mca.txt
+++ b/Documentation/mca.txt
@@ -252,7 +252,7 @@ their names here, but I don't have a list handy. Check the MCA Linux
252home page (URL below) for a perpetually out-of-date list. 252home page (URL below) for a perpetually out-of-date list.
253 253
254===================================================================== 254=====================================================================
255MCA Linux Home Page: http://glycerine.itsmm.uni.edu/mca/ 255MCA Linux Home Page: http://www.dgmicro.com/mca/
256 256
257Christophe Beauregard 257Christophe Beauregard
258chrisb@truespectra.com 258chrisb@truespectra.com
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt
index 11fd0ef5ff57..a9ad58b49cc5 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -1,7 +1,4 @@
1Documents about softnet driver issues in general can be found 1Document about softnet driver issues
2at:
3
4 http://www.firstfloor.org/~andi/softnet/
5 2
6Transmit path guidelines: 3Transmit path guidelines:
7 4
diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c
index f315d20d3867..545447ac503a 100644
--- a/Documentation/networking/ifenslave.c
+++ b/Documentation/networking/ifenslave.c
@@ -693,13 +693,7 @@ static int enslave(char *master_ifname, char *slave_ifname)
693 /* Older bonding versions would panic if the slave has no IP 693 /* Older bonding versions would panic if the slave has no IP
694 * address, so get the IP setting from the master. 694 * address, so get the IP setting from the master.
695 */ 695 */
696 res = set_if_addr(master_ifname, slave_ifname); 696 set_if_addr(master_ifname, slave_ifname);
697 if (res) {
698 fprintf(stderr,
699 "Slave '%s': Error: set address failed\n",
700 slave_ifname);
701 return res;
702 }
703 } else { 697 } else {
704 res = clear_if_addr(slave_ifname); 698 res = clear_if_addr(slave_ifname);
705 if (res) { 699 if (res) {
@@ -1085,7 +1079,6 @@ static int set_if_addr(char *master_ifname, char *slave_ifname)
1085 slave_ifname, ifra[i].req_name, 1079 slave_ifname, ifra[i].req_name,
1086 strerror(saved_errno)); 1080 strerror(saved_errno));
1087 1081
1088 return res;
1089 } 1082 }
1090 1083
1091 ipaddr = ifr.ifr_addr.sa_data; 1084 ipaddr = ifr.ifr_addr.sa_data;
diff --git a/Documentation/networking/iphase.txt b/Documentation/networking/iphase.txt
index 39ccb8595bf1..493203a080a8 100644
--- a/Documentation/networking/iphase.txt
+++ b/Documentation/networking/iphase.txt
@@ -22,7 +22,7 @@ The features and limitations of this driver are as follows:
22 - All variants of Interphase ATM PCI (i)Chip adapter cards are supported, 22 - All variants of Interphase ATM PCI (i)Chip adapter cards are supported,
23 including x575 (OC3, control memory 128K , 512K and packet memory 128K, 23 including x575 (OC3, control memory 128K , 512K and packet memory 128K,
24 512K and 1M), x525 (UTP25) and x531 (DS3 and E3). See 24 512K and 1M), x525 (UTP25) and x531 (DS3 and E3). See
25 http://www.iphase.com/products/ClassSheet.cfm?ClassID=ATM 25 http://www.iphase.com/site/iphase-web/?epi_menuItemID=e196f04b4b3b40502f150882e21046a0
26 for details. 26 for details.
27 - Only x86 platforms are supported. 27 - Only x86 platforms are supported.
28 - SMP is supported. 28 - SMP is supported.
diff --git a/Documentation/networking/irda.txt b/Documentation/networking/irda.txt
index 9e5b8e66d6a5..bff26c138be6 100644
--- a/Documentation/networking/irda.txt
+++ b/Documentation/networking/irda.txt
@@ -3,12 +3,8 @@ of the IrDA Utilities. More detailed information about these and associated
3programs can be found on http://irda.sourceforge.net/ 3programs can be found on http://irda.sourceforge.net/
4 4
5For more information about how to use the IrDA protocol stack, see the 5For more information about how to use the IrDA protocol stack, see the
6Linux Infared HOWTO (http://www.tuxmobil.org/Infrared-HOWTO/Infrared-HOWTO.html) 6Linux Infrared HOWTO by Werner Heuser <wehe@tuxmobil.org>:
7by Werner Heuser <wehe@tuxmobil.org> 7<http://www.tuxmobil.org/Infrared-HOWTO/Infrared-HOWTO.html>
8 8
9There is an active mailing list for discussing Linux-IrDA matters called 9There is an active mailing list for discussing Linux-IrDA matters called
10 irda-users@lists.sourceforge.net 10 irda-users@lists.sourceforge.net
11
12
13
14
diff --git a/Documentation/networking/ray_cs.txt b/Documentation/networking/ray_cs.txt
index b1def00bc4a3..5427f8c7df95 100644
--- a/Documentation/networking/ray_cs.txt
+++ b/Documentation/networking/ray_cs.txt
@@ -29,8 +29,7 @@ with nondefault parameters, they can be edited in
29will find them all. 29will find them all.
30 30
31Information on card services is available at: 31Information on card services is available at:
32 ftp://hyper.stanford.edu/pub/pcmcia/doc 32 http://pcmcia-cs.sourceforge.net/
33 http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html
34 33
35 34
36Card services user programs are still required for PCMCIA devices. 35Card services user programs are still required for PCMCIA devices.
diff --git a/Documentation/networking/vortex.txt b/Documentation/networking/vortex.txt
index 80e1cb19609f..3759acf95b29 100644
--- a/Documentation/networking/vortex.txt
+++ b/Documentation/networking/vortex.txt
@@ -11,7 +11,7 @@ The driver was written by Donald Becker <becker@scyld.com>
11Don is no longer the prime maintainer of this version of the driver. 11Don is no longer the prime maintainer of this version of the driver.
12Please report problems to one or more of: 12Please report problems to one or more of:
13 13
14 Andrew Morton <andrewm@uow.edu.au> 14 Andrew Morton <akpm@osdl.org>
15 Netdev mailing list <netdev@vger.kernel.org> 15 Netdev mailing list <netdev@vger.kernel.org>
16 Linux kernel mailing list <linux-kernel@vger.kernel.org> 16 Linux kernel mailing list <linux-kernel@vger.kernel.org>
17 17
@@ -274,24 +274,24 @@ Details of the device driver implementation are at the top of the source file.
274 274
275Additional documentation is available at Don Becker's Linux Drivers site: 275Additional documentation is available at Don Becker's Linux Drivers site:
276 276
277 http://www.scyld.com/network/vortex.html 277 http://www.scyld.com/vortex.html
278 278
279Donald Becker's driver development site: 279Donald Becker's driver development site:
280 280
281 http://www.scyld.com/network 281 http://www.scyld.com/network.html
282 282
283Donald's vortex-diag program is useful for inspecting the NIC's state: 283Donald's vortex-diag program is useful for inspecting the NIC's state:
284 284
285 http://www.scyld.com/diag/#pci-diags 285 http://www.scyld.com/ethercard_diag.html
286 286
287Donald's mii-diag program may be used for inspecting and manipulating 287Donald's mii-diag program may be used for inspecting and manipulating
288the NIC's Media Independent Interface subsystem: 288the NIC's Media Independent Interface subsystem:
289 289
290 http://www.scyld.com/diag/#mii-diag 290 http://www.scyld.com/ethercard_diag.html#mii-diag
291 291
292Donald's wake-on-LAN page: 292Donald's wake-on-LAN page:
293 293
294 http://www.scyld.com/expert/wake-on-lan.html 294 http://www.scyld.com/wakeonlan.html
295 295
2963Com's documentation for many NICs, including the ones supported by 2963Com's documentation for many NICs, including the ones supported by
297this driver is available at 297this driver is available at
@@ -305,7 +305,7 @@ this driver is available at
305Driver updates and a detailed changelog for the modifications which 305Driver updates and a detailed changelog for the modifications which
306were made for the 2.3/2,4 series kernel is available at 306were made for the 2.3/2,4 series kernel is available at
307 307
308 http://www.uow.edu.au/~andrewm/linux/#3c59x-2.3 308 http://www.zip.com.au/~akpm/linux/#3c59x-bc
309 309
310 310
311Autonegotiation notes 311Autonegotiation notes
@@ -434,8 +434,8 @@ steps you should take:
434 send all logs to the maintainer. 434 send all logs to the maintainer.
435 435
436 3) Download you card's diagnostic tool from Donald 436 3) Download you card's diagnostic tool from Donald
437 Backer's website http://www.scyld.com/diag. Download 437 Becker's website <http://www.scyld.com/ethercard_diag.html>.
438 mii-diag.c as well. Build these. 438 Download mii-diag.c as well. Build these.
439 439
440 a) Run 'vortex-diag -aaee' and 'mii-diag -v' when the card is 440 a) Run 'vortex-diag -aaee' and 'mii-diag -v' when the card is
441 working correctly. Save the output. 441 working correctly. Save the output.
@@ -443,8 +443,8 @@ steps you should take:
443 b) Run the above commands when the card is malfunctioning. Send 443 b) Run the above commands when the card is malfunctioning. Send
444 both sets of output. 444 both sets of output.
445 445
446Finally, please be patient and be prepared to do some work. You may end up working on 446Finally, please be patient and be prepared to do some work. You may
447this problem for a week or more as the maintainer asks more questions, asks for more 447end up working on this problem for a week or more as the maintainer
448tests, asks for patches to be applied, etc. At the end of it all, the problem may even 448asks more questions, asks for more tests, asks for patches to be
449remain unresolved. 449applied, etc. At the end of it all, the problem may even remain
450 450unresolved.
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index 6fc9d511fc39..73fc87e5dc38 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -335,5 +335,5 @@ this on the whole.
335PCI Local Bus Specification 335PCI Local Bus Specification
336PCI Bus Power Management Interface Specification 336PCI Bus Power Management Interface Specification
337 337
338 http://pcisig.org 338 http://www.pcisig.com
339 339
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt
index 2ffb3ae0ef4d..d16ce5b540f4 100644
--- a/Documentation/scsi/ibmmca.txt
+++ b/Documentation/scsi/ibmmca.txt
@@ -1108,7 +1108,7 @@
1108 A: You have to activate MCA bus support, first. 1108 A: You have to activate MCA bus support, first.
1109 Q: Where can I find the latest info about this driver? 1109 Q: Where can I find the latest info about this driver?
1110 A: See the file MAINTAINERS for the current WWW-address, which offers 1110 A: See the file MAINTAINERS for the current WWW-address, which offers
1111 updates, info and Q/A lists. At this files' origin, the webaddress 1111 updates, info and Q/A lists. At this file's origin, the webaddress
1112 was: http://www.uni-mainz.de/~langm000/linux.html 1112 was: http://www.uni-mainz.de/~langm000/linux.html
1113 Q: My SCSI-adapter is not recognized by the driver, what can I do? 1113 Q: My SCSI-adapter is not recognized by the driver, what can I do?
1114 A: Just force it to be recognized by kernel parameters. See section 5.1. 1114 A: Just force it to be recognized by kernel parameters. See section 5.1.
@@ -1248,7 +1248,7 @@
1248 -------------------- 1248 --------------------
1249 The address of the IBM SCSI-subsystem supporting WWW-page is: 1249 The address of the IBM SCSI-subsystem supporting WWW-page is:
1250 1250
1251 http://www.uni-mainz.de/~langm000/linux.html 1251 http://www.staff.uni-mainz.de/mlang/linux.html
1252 1252
1253 Here you can find info about the background of this driver, patches, 1253 Here you can find info about the background of this driver, patches,
1254 troubleshooting support, news and a bugreport form. Please check that 1254 troubleshooting support, news and a bugreport form. Please check that
diff --git a/Documentation/usb/ibmcam.txt b/Documentation/usb/ibmcam.txt
index ce2f21a3eac4..c25003644131 100644
--- a/Documentation/usb/ibmcam.txt
+++ b/Documentation/usb/ibmcam.txt
@@ -28,8 +28,8 @@ SUPPORTED CAMERAS:
28Xirlink "C-It" camera, also known as "IBM PC Camera". 28Xirlink "C-It" camera, also known as "IBM PC Camera".
29The device uses proprietary ASIC (and compression method); 29The device uses proprietary ASIC (and compression method);
30it is manufactured by Xirlink. See http://www.xirlink.com/ 30it is manufactured by Xirlink. See http://www.xirlink.com/
31http://www.ibmpccamera.com or http://www.c-itnow.com/ for 31(renamed to http://www.veo.com), http://www.ibmpccamera.com,
32details and pictures. 32or http://www.c-itnow.com/ for details and pictures.
33 33
34This very chipset ("X Chip", as marked at the factory) 34This very chipset ("X Chip", as marked at the factory)
35is used in several other cameras, and they are supported 35is used in several other cameras, and they are supported
diff --git a/Documentation/usb/ov511.txt b/Documentation/usb/ov511.txt
index e1974ec8217e..a7fc0432bff1 100644
--- a/Documentation/usb/ov511.txt
+++ b/Documentation/usb/ov511.txt
@@ -22,8 +22,8 @@ WHAT YOU NEED:
22 http://www.ovt.com/omniusbp.html 22 http://www.ovt.com/omniusbp.html
23 23
24- A Video4Linux compatible frame grabber program (I recommend vidcat and xawtv) 24- A Video4Linux compatible frame grabber program (I recommend vidcat and xawtv)
25 vidcat is part of the w3cam package: http://www.hdk-berlin.de/~rasca/w3cam/ 25 vidcat is part of the w3cam package: http://mpx.freeshell.net/
26 xawtv is available at: http://www.in-berlin.de/User/kraxel/xawtv.html 26 xawtv is available at: http://linux.bytesex.org/xawtv/
27 27
28HOW TO USE IT: 28HOW TO USE IT:
29 29
diff --git a/Documentation/usb/rio.txt b/Documentation/usb/rio.txt
index 0aa79ab0088c..ab21db454694 100644
--- a/Documentation/usb/rio.txt
+++ b/Documentation/usb/rio.txt
@@ -46,9 +46,9 @@ Contact information:
46-------------------- 46--------------------
47 47
48 The main page for the project is hosted at sourceforge.net in the following 48 The main page for the project is hosted at sourceforge.net in the following
49 address: http://rio500.sourceforge.net You can also go to the sourceforge 49 URL: <http://rio500.sourceforge.net>. You can also go to the project's
50 project page at: http://sourceforge.net/project/?group_id=1944 There is 50 sourceforge home page at: <http://sourceforge.net/projects/rio500/>.
51 also a mailing list: rio500-users@lists.sourceforge.net 51 There is also a mailing list: rio500-users@lists.sourceforge.net
52 52
53Authors: 53Authors:
54------- 54-------
diff --git a/Documentation/video4linux/zr36120.txt b/Documentation/video4linux/zr36120.txt
index 4af6c52595eb..5d6357eefde4 100644
--- a/Documentation/video4linux/zr36120.txt
+++ b/Documentation/video4linux/zr36120.txt
@@ -76,8 +76,11 @@ activates the GRAB bit. A few ms later the VSYNC (re-)rises and
76the zoran starts to work on a new and freshly broadcasted frame.... 76the zoran starts to work on a new and freshly broadcasted frame....
77 77
78For pointers I used the specs of both chips. Below are the URLs: 78For pointers I used the specs of both chips. Below are the URLs:
79 http://www.zoran.com/ftp/download/devices/pci/ZR36120/36120data.pdf 79 http://www.zoran.com/ftp/download/devices/pci/ZR36120/36120data.pdf
80 http://www-us.semiconductor.philips.com/acrobat/datasheets/SAA_7110_A_1.pdf 80 http://www-us.semiconductor.philips.com/acrobat/datasheets/SAA_7110_A_1.pdf
81Some alternatives for the Philips SAA 7110 datasheet are:
82 http://www.datasheetcatalog.com/datasheets_pdf/S/A/A/7/SAA7110.shtml
83 http://www.datasheetarchive.com/search.php?search=SAA7110&sType=part
81 84
82The documentation has very little on absolute numbers or timings 85The documentation has very little on absolute numbers or timings
83needed for the various modes/resolutions, but there are other 86needed for the various modes/resolutions, but there are other
diff --git a/MAINTAINERS b/MAINTAINERS
index f239ac4762dd..a74a0c726134 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -58,7 +58,7 @@ P: Person
58M: Mail patches to 58M: Mail patches to
59L: Mailing list that is relevant to this area 59L: Mailing list that is relevant to this area
60W: Web-page with status/info 60W: Web-page with status/info
61T: SCM tree type and URL. Type is one of: git, hg, quilt. 61T: SCM tree type and location. Type is one of: git, hg, quilt.
62S: Status, one of the following: 62S: Status, one of the following:
63 63
64 Supported: Someone is actually paid to look after this. 64 Supported: Someone is actually paid to look after this.
@@ -227,6 +227,7 @@ AGPGART DRIVER
227P: Dave Jones 227P: Dave Jones
228M: davej@codemonkey.org.uk 228M: davej@codemonkey.org.uk
229W: http://www.codemonkey.org.uk/projects/agp/ 229W: http://www.codemonkey.org.uk/projects/agp/
230T: git kernel.org:/pub/scm/linux/kernel/git/davej/agpgart.git
230S: Maintained 231S: Maintained
231 232
232AHA152X SCSI DRIVER 233AHA152X SCSI DRIVER
@@ -384,6 +385,7 @@ P: David Woodhouse
384M: dwmw2@infradead.org 385M: dwmw2@infradead.org
385L: linux-audit@redhat.com 386L: linux-audit@redhat.com
386W: http://people.redhat.com/sgrubb/audit/ 387W: http://people.redhat.com/sgrubb/audit/
388T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
387S: Maintained 389S: Maintained
388 390
389AX.25 NETWORK LAYER 391AX.25 NETWORK LAYER
@@ -432,6 +434,7 @@ L: bluez-devel@lists.sf.net
432W: http://bluez.sf.net 434W: http://bluez.sf.net
433W: http://www.bluez.org 435W: http://www.bluez.org
434W: http://www.holtmann.org/linux/bluetooth/ 436W: http://www.holtmann.org/linux/bluetooth/
437T: git kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git
435S: Maintained 438S: Maintained
436 439
437BLUETOOTH RFCOMM LAYER 440BLUETOOTH RFCOMM LAYER
@@ -547,6 +550,7 @@ P: Steve French
547M: sfrench@samba.org 550M: sfrench@samba.org
548L: samba-technical@lists.samba.org 551L: samba-technical@lists.samba.org
549W: http://us1.samba.org/samba/Linux_CIFS_client.html 552W: http://us1.samba.org/samba/Linux_CIFS_client.html
553T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git
550S: Supported 554S: Supported
551 555
552CIRRUS LOGIC GENERIC FBDEV DRIVER 556CIRRUS LOGIC GENERIC FBDEV DRIVER
@@ -608,6 +612,7 @@ P: Dave Jones
608M: davej@codemonkey.org.uk 612M: davej@codemonkey.org.uk
609L: cpufreq@lists.linux.org.uk 613L: cpufreq@lists.linux.org.uk
610W: http://www.codemonkey.org.uk/projects/cpufreq/ 614W: http://www.codemonkey.org.uk/projects/cpufreq/
615T: git kernel.org/pub/scm/linux/kernel/davej/cpufreq.git
611S: Maintained 616S: Maintained
612 617
613CPUID/MSR DRIVER 618CPUID/MSR DRIVER
@@ -641,6 +646,7 @@ M: herbert@gondor.apana.org.au
641P: David S. Miller 646P: David S. Miller
642M: davem@davemloft.net 647M: davem@davemloft.net
643L: linux-crypto@vger.kernel.org 648L: linux-crypto@vger.kernel.org
649T: git kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
644S: Maintained 650S: Maintained
645 651
646CYBERPRO FB DRIVER 652CYBERPRO FB DRIVER
@@ -1185,6 +1191,7 @@ P: Bartlomiej Zolnierkiewicz
1185M: B.Zolnierkiewicz@elka.pw.edu.pl 1191M: B.Zolnierkiewicz@elka.pw.edu.pl
1186L: linux-kernel@vger.kernel.org 1192L: linux-kernel@vger.kernel.org
1187L: linux-ide@vger.kernel.org 1193L: linux-ide@vger.kernel.org
1194T: git kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git
1188S: Maintained 1195S: Maintained
1189 1196
1190IDE/ATAPI CDROM DRIVER 1197IDE/ATAPI CDROM DRIVER
@@ -1279,6 +1286,7 @@ P: Vojtech Pavlik
1279M: vojtech@suse.cz 1286M: vojtech@suse.cz
1280L: linux-input@atrey.karlin.mff.cuni.cz 1287L: linux-input@atrey.karlin.mff.cuni.cz
1281L: linux-joystick@atrey.karlin.mff.cuni.cz 1288L: linux-joystick@atrey.karlin.mff.cuni.cz
1289T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
1282S: Maintained 1290S: Maintained
1283 1291
1284INOTIFY 1292INOTIFY
@@ -1392,6 +1400,7 @@ P: Kai Germaschewski
1392M: kai.germaschewski@gmx.de 1400M: kai.germaschewski@gmx.de
1393L: isdn4linux@listserv.isdn4linux.de 1401L: isdn4linux@listserv.isdn4linux.de
1394W: http://www.isdn4linux.de 1402W: http://www.isdn4linux.de
1403T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git
1395S: Maintained 1404S: Maintained
1396 1405
1397ISDN SUBSYSTEM (Eicon active card driver) 1406ISDN SUBSYSTEM (Eicon active card driver)
@@ -1420,6 +1429,7 @@ P: Dave Kleikamp
1420M: shaggy@austin.ibm.com 1429M: shaggy@austin.ibm.com
1421L: jfs-discussion@lists.sourceforge.net 1430L: jfs-discussion@lists.sourceforge.net
1422W: http://jfs.sourceforge.net/ 1431W: http://jfs.sourceforge.net/
1432T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git
1423S: Supported 1433S: Supported
1424 1434
1425KCONFIG 1435KCONFIG
@@ -1534,6 +1544,7 @@ P: Paul Mackerras
1534M: paulus@samba.org 1544M: paulus@samba.org
1535W: http://www.penguinppc.org/ 1545W: http://www.penguinppc.org/
1536L: linuxppc-dev@ozlabs.org 1546L: linuxppc-dev@ozlabs.org
1547T: git kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc.git
1537S: Supported 1548S: Supported
1538 1549
1539LINUX FOR POWER MACINTOSH 1550LINUX FOR POWER MACINTOSH
@@ -1601,6 +1612,7 @@ P: Chris Wright
1601M: chrisw@osdl.org 1612M: chrisw@osdl.org
1602L: linux-security-module@wirex.com 1613L: linux-security-module@wirex.com
1603W: http://lsm.immunix.org 1614W: http://lsm.immunix.org
1615T: git kernel.org:/pub/scm/linux/kernel/git/chrisw/lsm-2.6.git
1604S: Supported 1616S: Supported
1605 1617
1606LM83 HARDWARE MONITOR DRIVER 1618LM83 HARDWARE MONITOR DRIVER
@@ -1695,6 +1707,7 @@ P: David Woodhouse
1695M: dwmw2@infradead.org 1707M: dwmw2@infradead.org
1696W: http://www.linux-mtd.infradead.org/ 1708W: http://www.linux-mtd.infradead.org/
1697L: linux-mtd@lists.infradead.org 1709L: linux-mtd@lists.infradead.org
1710T: git kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6.git
1698S: Maintained 1711S: Maintained
1699 1712
1700MICROTEK X6 SCANNER 1713MICROTEK X6 SCANNER
@@ -1815,6 +1828,7 @@ M: yoshfuji@linux-ipv6.org
1815P: Patrick McHardy 1828P: Patrick McHardy
1816M: kaber@coreworks.de 1829M: kaber@coreworks.de
1817L: netdev@vger.kernel.org 1830L: netdev@vger.kernel.org
1831T: git kernel.org:/pub/scm/linux/kernel/davem/net-2.6.git
1818S: Maintained 1832S: Maintained
1819 1833
1820IPVS 1834IPVS
@@ -1866,6 +1880,7 @@ M: aia21@cantab.net
1866L: linux-ntfs-dev@lists.sourceforge.net 1880L: linux-ntfs-dev@lists.sourceforge.net
1867L: linux-kernel@vger.kernel.org 1881L: linux-kernel@vger.kernel.org
1868W: http://linux-ntfs.sf.net/ 1882W: http://linux-ntfs.sf.net/
1883T: git kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git
1869S: Maintained 1884S: Maintained
1870 1885
1871NVIDIA (RIVA) FRAMEBUFFER DRIVER 1886NVIDIA (RIVA) FRAMEBUFFER DRIVER
@@ -2389,6 +2404,7 @@ P: Anton Blanchard
2389M: anton@samba.org 2404M: anton@samba.org
2390L: sparclinux@vger.kernel.org 2405L: sparclinux@vger.kernel.org
2391L: ultralinux@vger.kernel.org 2406L: ultralinux@vger.kernel.org
2407T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
2392S: Maintained 2408S: Maintained
2393 2409
2394SHARP LH SUPPORT (LH7952X & LH7A40X) 2410SHARP LH SUPPORT (LH7952X & LH7A40X)
@@ -2527,6 +2543,7 @@ P: Adrian Bunk
2527M: trivial@kernel.org 2543M: trivial@kernel.org
2528L: linux-kernel@vger.kernel.org 2544L: linux-kernel@vger.kernel.org
2529W: http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/ 2545W: http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/
2546T: git kernel.org:/pub/scm/linux/kernel/git/bunk/trivial.git
2530S: Maintained 2547S: Maintained
2531 2548
2532TMS380 TOKEN-RING NETWORK DRIVER 2549TMS380 TOKEN-RING NETWORK DRIVER
@@ -2860,6 +2877,7 @@ P: Latchesar Ionkov
2860M: lucho@ionkov.net 2877M: lucho@ionkov.net
2861L: v9fs-developer@lists.sourceforge.net 2878L: v9fs-developer@lists.sourceforge.net
2862W: http://v9fs.sf.net 2879W: http://v9fs.sf.net
2880T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs-devel.git
2863S: Maintained 2881S: Maintained
2864 2882
2865VIDEO FOR LINUX 2883VIDEO FOR LINUX
@@ -2907,6 +2925,11 @@ M: zaga@fly.cc.fer.hr
2907L: linux-scsi@vger.kernel.org 2925L: linux-scsi@vger.kernel.org
2908S: Maintained 2926S: Maintained
2909 2927
2928WISTRON LAPTOP BUTTON DRIVER
2929P: Miloslav Trmac
2930M: mitr@volny.cz
2931S: Maintained
2932
2910WL3501 WIRELESS PCMCIA CARD DRIVER 2933WL3501 WIRELESS PCMCIA CARD DRIVER
2911P: Arnaldo Carvalho de Melo 2934P: Arnaldo Carvalho de Melo
2912M: acme@conectiva.com.br 2935M: acme@conectiva.com.br
diff --git a/Makefile b/Makefile
index e7a0443c867c..5187fee78080 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 15 3SUBLEVEL = 15
4EXTRAVERSION =-rc2 4EXTRAVERSION =-rc3
5NAME=Affluent Albatross 5NAME=Affluent Albatross
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index 24987c89609a..06229026f78b 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_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.14-rc3 3# Linux kernel version: 2.6.15-rc2
4# Sun Oct 9 15:46:42 2005 4# Mon Nov 28 10:30:09 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -64,6 +64,23 @@ CONFIG_OBSOLETE_MODPARM=y
64CONFIG_KMOD=y 64CONFIG_KMOD=y
65 65
66# 66#
67# Block layer
68#
69
70#
71# IO Schedulers
72#
73CONFIG_IOSCHED_NOOP=y
74CONFIG_IOSCHED_AS=y
75CONFIG_IOSCHED_DEADLINE=y
76CONFIG_IOSCHED_CFQ=y
77CONFIG_DEFAULT_AS=y
78# CONFIG_DEFAULT_DEADLINE is not set
79# CONFIG_DEFAULT_CFQ is not set
80# CONFIG_DEFAULT_NOOP is not set
81CONFIG_DEFAULT_IOSCHED="anticipatory"
82
83#
67# System Type 84# System Type
68# 85#
69# CONFIG_ARCH_CLPS7500 is not set 86# CONFIG_ARCH_CLPS7500 is not set
@@ -85,6 +102,7 @@ CONFIG_ARCH_PXA=y
85# CONFIG_ARCH_LH7A40X is not set 102# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set 103# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set 104# CONFIG_ARCH_VERSATILE is not set
105# CONFIG_ARCH_REALVIEW is not set
88# CONFIG_ARCH_IMX is not set 106# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set 107# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set 108# CONFIG_ARCH_AAEC2000 is not set
@@ -98,12 +116,14 @@ CONFIG_ARCH_PXA=y
98CONFIG_PXA_SHARPSL=y 116CONFIG_PXA_SHARPSL=y
99CONFIG_PXA_SHARPSL_25x=y 117CONFIG_PXA_SHARPSL_25x=y
100# CONFIG_PXA_SHARPSL_27x is not set 118# CONFIG_PXA_SHARPSL_27x is not set
101# CONFIG_MACH_POODLE is not set 119CONFIG_MACH_POODLE=y
102CONFIG_MACH_CORGI=y 120CONFIG_MACH_CORGI=y
103CONFIG_MACH_SHEPHERD=y 121CONFIG_MACH_SHEPHERD=y
104CONFIG_MACH_HUSKY=y 122CONFIG_MACH_HUSKY=y
123CONFIG_MACH_TOSA=y
105CONFIG_PXA25x=y 124CONFIG_PXA25x=y
106CONFIG_PXA_SHARP_C7xx=y 125CONFIG_PXA_SHARP_C7xx=y
126CONFIG_PXA_SSP=y
107 127
108# 128#
109# Processor Type 129# Processor Type
@@ -155,6 +175,7 @@ CONFIG_FLATMEM_MANUAL=y
155CONFIG_FLATMEM=y 175CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y 176CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set 177# CONFIG_SPARSEMEM_STATIC is not set
178CONFIG_SPLIT_PTLOCK_CPUS=4096
158CONFIG_ALIGNMENT_TRAP=y 179CONFIG_ALIGNMENT_TRAP=y
159 180
160# 181#
@@ -235,6 +256,10 @@ CONFIG_INET6_TUNNEL=m
235CONFIG_IPV6_TUNNEL=m 256CONFIG_IPV6_TUNNEL=m
236CONFIG_NETFILTER=y 257CONFIG_NETFILTER=y
237# CONFIG_NETFILTER_DEBUG is not set 258# CONFIG_NETFILTER_DEBUG is not set
259
260#
261# Core Netfilter Configuration
262#
238# CONFIG_NETFILTER_NETLINK is not set 263# CONFIG_NETFILTER_NETLINK is not set
239 264
240# 265#
@@ -356,6 +381,10 @@ CONFIG_IP6_NF_RAW=m
356# CONFIG_NET_DIVERT is not set 381# CONFIG_NET_DIVERT is not set
357# CONFIG_ECONET is not set 382# CONFIG_ECONET is not set
358# CONFIG_WAN_ROUTER is not set 383# CONFIG_WAN_ROUTER is not set
384
385#
386# QoS and/or fair queueing
387#
359# CONFIG_NET_SCHED is not set 388# CONFIG_NET_SCHED is not set
360CONFIG_NET_CLS_ROUTE=y 389CONFIG_NET_CLS_ROUTE=y
361 390
@@ -413,6 +442,7 @@ CONFIG_IRCOMM=m
413# CONFIG_SMC_IRCC_FIR is not set 442# CONFIG_SMC_IRCC_FIR is not set
414# CONFIG_ALI_FIR is not set 443# CONFIG_ALI_FIR is not set
415# CONFIG_VIA_FIR is not set 444# CONFIG_VIA_FIR is not set
445CONFIG_PXA_FICP=m
416CONFIG_BT=m 446CONFIG_BT=m
417CONFIG_BT_L2CAP=m 447CONFIG_BT_L2CAP=m
418CONFIG_BT_SCO=m 448CONFIG_BT_SCO=m
@@ -431,7 +461,6 @@ CONFIG_BT_HCIUSB=m
431CONFIG_BT_HCIUART=m 461CONFIG_BT_HCIUART=m
432CONFIG_BT_HCIUART_H4=y 462CONFIG_BT_HCIUART_H4=y
433CONFIG_BT_HCIUART_BCSP=y 463CONFIG_BT_HCIUART_BCSP=y
434CONFIG_BT_HCIUART_BCSP_TXCRC=y
435CONFIG_BT_HCIBCM203X=m 464CONFIG_BT_HCIBCM203X=m
436CONFIG_BT_HCIBPA10X=m 465CONFIG_BT_HCIBPA10X=m
437CONFIG_BT_HCIBFUSB=m 466CONFIG_BT_HCIBFUSB=m
@@ -459,6 +488,11 @@ CONFIG_FW_LOADER=y
459# CONFIG_DEBUG_DRIVER is not set 488# CONFIG_DEBUG_DRIVER is not set
460 489
461# 490#
491# Connector - unified userspace <-> kernelspace linker
492#
493# CONFIG_CONNECTOR is not set
494
495#
462# Memory Technology Devices (MTD) 496# Memory Technology Devices (MTD)
463# 497#
464CONFIG_MTD=y 498CONFIG_MTD=y
@@ -477,6 +511,7 @@ CONFIG_MTD_BLOCK=y
477# CONFIG_FTL is not set 511# CONFIG_FTL is not set
478# CONFIG_NFTL is not set 512# CONFIG_NFTL is not set
479# CONFIG_INFTL is not set 513# CONFIG_INFTL is not set
514# CONFIG_RFD_FTL is not set
480 515
481# 516#
482# RAM/ROM/Flash chip drivers 517# RAM/ROM/Flash chip drivers
@@ -532,6 +567,11 @@ CONFIG_MTD_NAND_SHARPSL=y
532# CONFIG_MTD_NAND_NANDSIM is not set 567# CONFIG_MTD_NAND_NANDSIM is not set
533 568
534# 569#
570# OneNAND Flash Device Drivers
571#
572# CONFIG_MTD_ONENAND is not set
573
574#
535# Parallel port support 575# Parallel port support
536# 576#
537# CONFIG_PARPORT is not set 577# CONFIG_PARPORT is not set
@@ -551,14 +591,6 @@ CONFIG_BLK_DEV_LOOP=y
551# CONFIG_BLK_DEV_RAM is not set 591# CONFIG_BLK_DEV_RAM is not set
552CONFIG_BLK_DEV_RAM_COUNT=16 592CONFIG_BLK_DEV_RAM_COUNT=16
553# CONFIG_CDROM_PKTCDVD is not set 593# CONFIG_CDROM_PKTCDVD is not set
554
555#
556# IO Schedulers
557#
558CONFIG_IOSCHED_NOOP=y
559CONFIG_IOSCHED_AS=y
560CONFIG_IOSCHED_DEADLINE=y
561CONFIG_IOSCHED_CFQ=y
562# CONFIG_ATA_OVER_ETH is not set 594# CONFIG_ATA_OVER_ETH is not set
563 595
564# 596#
@@ -625,6 +657,7 @@ CONFIG_SCSI_MULTI_LUN=y
625# 657#
626# SCSI low-level drivers 658# SCSI low-level drivers
627# 659#
660# CONFIG_ISCSI_TCP is not set
628# CONFIG_SCSI_SATA is not set 661# CONFIG_SCSI_SATA is not set
629# CONFIG_SCSI_DEBUG is not set 662# CONFIG_SCSI_DEBUG is not set
630 663
@@ -748,6 +781,7 @@ CONFIG_PPP_ASYNC=m
748# CONFIG_PPP_SYNC_TTY is not set 781# CONFIG_PPP_SYNC_TTY is not set
749# CONFIG_PPP_DEFLATE is not set 782# CONFIG_PPP_DEFLATE is not set
750CONFIG_PPP_BSDCOMP=m 783CONFIG_PPP_BSDCOMP=m
784# CONFIG_PPP_MPPE is not set
751# CONFIG_PPPOE is not set 785# CONFIG_PPPOE is not set
752# CONFIG_SLIP is not set 786# CONFIG_SLIP is not set
753# CONFIG_SHAPER is not set 787# CONFIG_SHAPER is not set
@@ -850,11 +884,15 @@ CONFIG_UNIX98_PTYS=y
850# PCMCIA character devices 884# PCMCIA character devices
851# 885#
852# CONFIG_SYNCLINK_CS is not set 886# CONFIG_SYNCLINK_CS is not set
887# CONFIG_CARDMAN_4000 is not set
888# CONFIG_CARDMAN_4040 is not set
853# CONFIG_RAW_DRIVER is not set 889# CONFIG_RAW_DRIVER is not set
854 890
855# 891#
856# TPM devices 892# TPM devices
857# 893#
894# CONFIG_TCG_TPM is not set
895# CONFIG_TELCLOCK is not set
858 896
859# 897#
860# I2C support 898# I2C support
@@ -889,6 +927,7 @@ CONFIG_I2C_PXA=y
889# CONFIG_SENSORS_PCF8591 is not set 927# CONFIG_SENSORS_PCF8591 is not set
890# CONFIG_SENSORS_RTC8564 is not set 928# CONFIG_SENSORS_RTC8564 is not set
891# CONFIG_SENSORS_MAX6875 is not set 929# CONFIG_SENSORS_MAX6875 is not set
930# CONFIG_RTC_X1205_I2C is not set
892# CONFIG_I2C_DEBUG_CORE is not set 931# CONFIG_I2C_DEBUG_CORE is not set
893# CONFIG_I2C_DEBUG_ALGO is not set 932# CONFIG_I2C_DEBUG_ALGO is not set
894# CONFIG_I2C_DEBUG_BUS is not set 933# CONFIG_I2C_DEBUG_BUS is not set
@@ -957,7 +996,10 @@ CONFIG_VIDEO_DEV=m
957# CONFIG_VIDEO_SAA5246A is not set 996# CONFIG_VIDEO_SAA5246A is not set
958# CONFIG_VIDEO_SAA5249 is not set 997# CONFIG_VIDEO_SAA5249 is not set
959# CONFIG_TUNER_3036 is not set 998# CONFIG_TUNER_3036 is not set
999# CONFIG_VIDEO_EM28XX is not set
960# CONFIG_VIDEO_OVCAMCHIP is not set 1000# CONFIG_VIDEO_OVCAMCHIP is not set
1001# CONFIG_VIDEO_AUDIO_DECODER is not set
1002# CONFIG_VIDEO_DECODER is not set
961 1003
962# 1004#
963# Radio Adapters 1005# Radio Adapters
@@ -976,13 +1018,12 @@ CONFIG_FB=y
976CONFIG_FB_CFB_FILLRECT=y 1018CONFIG_FB_CFB_FILLRECT=y
977CONFIG_FB_CFB_COPYAREA=y 1019CONFIG_FB_CFB_COPYAREA=y
978CONFIG_FB_CFB_IMAGEBLIT=y 1020CONFIG_FB_CFB_IMAGEBLIT=y
979CONFIG_FB_SOFT_CURSOR=y
980# CONFIG_FB_MACMODES is not set 1021# CONFIG_FB_MACMODES is not set
981# CONFIG_FB_MODE_HELPERS is not set 1022# CONFIG_FB_MODE_HELPERS is not set
982# CONFIG_FB_TILEBLITTING is not set 1023# CONFIG_FB_TILEBLITTING is not set
1024# CONFIG_FB_S1D13XXX is not set
983# CONFIG_FB_PXA is not set 1025# CONFIG_FB_PXA is not set
984CONFIG_FB_W100=y 1026CONFIG_FB_W100=y
985# CONFIG_FB_S1D13XXX is not set
986# CONFIG_FB_VIRTUAL is not set 1027# CONFIG_FB_VIRTUAL is not set
987 1028
988# 1029#
@@ -991,6 +1032,7 @@ CONFIG_FB_W100=y
991# CONFIG_VGA_CONSOLE is not set 1032# CONFIG_VGA_CONSOLE is not set
992CONFIG_DUMMY_CONSOLE=y 1033CONFIG_DUMMY_CONSOLE=y
993CONFIG_FRAMEBUFFER_CONSOLE=y 1034CONFIG_FRAMEBUFFER_CONSOLE=y
1035# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
994CONFIG_FONTS=y 1036CONFIG_FONTS=y
995CONFIG_FONT_8x8=y 1037CONFIG_FONT_8x8=y
996CONFIG_FONT_8x16=y 1038CONFIG_FONT_8x16=y
@@ -1087,15 +1129,15 @@ CONFIG_USB_SL811_CS=m
1087# USB Device Class drivers 1129# USB Device Class drivers
1088# 1130#
1089# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set 1131# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1132CONFIG_USB_ACM=m
1133CONFIG_USB_PRINTER=m
1090 1134
1091# 1135#
1092# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem 1136# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1093# 1137#
1094CONFIG_USB_ACM=m
1095CONFIG_USB_PRINTER=m
1096 1138
1097# 1139#
1098# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 1140# may also be needed; see USB_STORAGE Help for more information
1099# 1141#
1100CONFIG_USB_STORAGE=m 1142CONFIG_USB_STORAGE=m
1101# CONFIG_USB_STORAGE_DEBUG is not set 1143# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1107,7 +1149,6 @@ CONFIG_USB_STORAGE=m
1107# CONFIG_USB_STORAGE_SDDR09 is not set 1149# CONFIG_USB_STORAGE_SDDR09 is not set
1108# CONFIG_USB_STORAGE_SDDR55 is not set 1150# CONFIG_USB_STORAGE_SDDR55 is not set
1109# CONFIG_USB_STORAGE_JUMPSHOT is not set 1151# CONFIG_USB_STORAGE_JUMPSHOT is not set
1110# CONFIG_USB_STORAGE_ONETOUCH is not set
1111 1152
1112# 1153#
1113# USB Input Devices 1154# USB Input Devices
@@ -1185,6 +1226,7 @@ CONFIG_USB_MON=y
1185CONFIG_USB_SERIAL=m 1226CONFIG_USB_SERIAL=m
1186CONFIG_USB_SERIAL_GENERIC=y 1227CONFIG_USB_SERIAL_GENERIC=y
1187# CONFIG_USB_SERIAL_AIRPRIME is not set 1228# CONFIG_USB_SERIAL_AIRPRIME is not set
1229# CONFIG_USB_SERIAL_ANYDATA is not set
1188CONFIG_USB_SERIAL_BELKIN=m 1230CONFIG_USB_SERIAL_BELKIN=m
1189# CONFIG_USB_SERIAL_WHITEHEAT is not set 1231# CONFIG_USB_SERIAL_WHITEHEAT is not set
1190CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m 1232CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
@@ -1340,6 +1382,7 @@ CONFIG_RAMFS=y
1340CONFIG_JFFS2_FS=y 1382CONFIG_JFFS2_FS=y
1341CONFIG_JFFS2_FS_DEBUG=0 1383CONFIG_JFFS2_FS_DEBUG=0
1342CONFIG_JFFS2_FS_WRITEBUFFER=y 1384CONFIG_JFFS2_FS_WRITEBUFFER=y
1385CONFIG_JFFS2_SUMMARY=y
1343CONFIG_JFFS2_COMPRESSION_OPTIONS=y 1386CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1344CONFIG_JFFS2_ZLIB=y 1387CONFIG_JFFS2_ZLIB=y
1345CONFIG_JFFS2_RTIME=y 1388CONFIG_JFFS2_RTIME=y
@@ -1466,7 +1509,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1466CONFIG_DEBUG_BUGVERBOSE=y 1509CONFIG_DEBUG_BUGVERBOSE=y
1467# CONFIG_DEBUG_INFO is not set 1510# CONFIG_DEBUG_INFO is not set
1468# CONFIG_DEBUG_FS is not set 1511# CONFIG_DEBUG_FS is not set
1512# CONFIG_DEBUG_VM is not set
1469CONFIG_FRAME_POINTER=y 1513CONFIG_FRAME_POINTER=y
1514# CONFIG_RCU_TORTURE_TEST is not set
1470# CONFIG_DEBUG_USER is not set 1515# CONFIG_DEBUG_USER is not set
1471# CONFIG_DEBUG_WAITQ is not set 1516# CONFIG_DEBUG_WAITQ is not set
1472CONFIG_DEBUG_ERRORS=y 1517CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/configs/poodle_defconfig b/arch/arm/configs/poodle_defconfig
deleted file mode 100644
index 72822907759f..000000000000
--- a/arch/arm/configs/poodle_defconfig
+++ /dev/null
@@ -1,1015 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3
4# Sun Oct 9 17:04:29 2005
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29CONFIG_BSD_PROCESS_ACCT=y
30# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31CONFIG_SYSCTL=y
32# CONFIG_AUDIT is not set
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_INITRAMFS_SOURCE=""
37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45CONFIG_EPOLL=y
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60CONFIG_MODULE_FORCE_UNLOAD=y
61CONFIG_OBSOLETE_MODPARM=y
62CONFIG_MODVERSIONS=y
63# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y
65
66#
67# System Type
68#
69# CONFIG_ARCH_CLPS7500 is not set
70# CONFIG_ARCH_CLPS711X is not set
71# CONFIG_ARCH_CO285 is not set
72# CONFIG_ARCH_EBSA110 is not set
73# CONFIG_ARCH_CAMELOT is not set
74# CONFIG_ARCH_FOOTBRIDGE is not set
75# CONFIG_ARCH_INTEGRATOR is not set
76# CONFIG_ARCH_IOP3XX is not set
77# CONFIG_ARCH_IXP4XX is not set
78# CONFIG_ARCH_IXP2000 is not set
79# CONFIG_ARCH_L7200 is not set
80CONFIG_ARCH_PXA=y
81# CONFIG_ARCH_RPC is not set
82# CONFIG_ARCH_SA1100 is not set
83# CONFIG_ARCH_S3C2410 is not set
84# CONFIG_ARCH_SHARK is not set
85# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set
88# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set
91
92#
93# Intel PXA2xx Implementations
94#
95# CONFIG_ARCH_LUBBOCK is not set
96# CONFIG_MACH_MAINSTONE is not set
97# CONFIG_ARCH_PXA_IDP is not set
98CONFIG_PXA_SHARPSL=y
99CONFIG_PXA_SHARPSL_25x=y
100# CONFIG_PXA_SHARPSL_27x is not set
101CONFIG_MACH_POODLE=y
102# CONFIG_MACH_CORGI is not set
103# CONFIG_MACH_SHEPHERD is not set
104# CONFIG_MACH_HUSKY is not set
105CONFIG_PXA25x=y
106
107#
108# Processor Type
109#
110CONFIG_CPU_32=y
111CONFIG_CPU_XSCALE=y
112CONFIG_CPU_32v5=y
113CONFIG_CPU_ABRT_EV5T=y
114CONFIG_CPU_CACHE_VIVT=y
115CONFIG_CPU_TLB_V4WBI=y
116
117#
118# Processor Features
119#
120CONFIG_ARM_THUMB=y
121CONFIG_XSCALE_PMU=y
122CONFIG_SHARP_LOCOMO=y
123CONFIG_SHARP_PARAM=y
124CONFIG_SHARP_SCOOP=y
125
126#
127# Bus support
128#
129CONFIG_ISA_DMA_API=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134CONFIG_PCCARD=y
135# CONFIG_PCMCIA_DEBUG is not set
136CONFIG_PCMCIA=y
137CONFIG_PCMCIA_LOAD_CIS=y
138CONFIG_PCMCIA_IOCTL=y
139
140#
141# PC-card bridges
142#
143CONFIG_PCMCIA_PXA2XX=y
144
145#
146# Kernel Features
147#
148CONFIG_PREEMPT=y
149# CONFIG_NO_IDLE_HZ is not set
150# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
151CONFIG_SELECT_MEMORY_MODEL=y
152CONFIG_FLATMEM_MANUAL=y
153# CONFIG_DISCONTIGMEM_MANUAL is not set
154# CONFIG_SPARSEMEM_MANUAL is not set
155CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set
158CONFIG_ALIGNMENT_TRAP=y
159
160#
161# Boot options
162#
163CONFIG_ZBOOT_ROM_TEXT=0x0
164CONFIG_ZBOOT_ROM_BSS=0x0
165CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
166# CONFIG_XIP_KERNEL is not set
167
168#
169# Floating point emulation
170#
171
172#
173# At least one emulation must be selected
174#
175CONFIG_FPE_NWFPE=y
176# CONFIG_FPE_NWFPE_XP is not set
177# CONFIG_FPE_FASTFPE is not set
178
179#
180# Userspace binary formats
181#
182CONFIG_BINFMT_ELF=y
183CONFIG_BINFMT_AOUT=m
184CONFIG_BINFMT_MISC=m
185# CONFIG_ARTHUR is not set
186
187#
188# Power management options
189#
190CONFIG_PM=y
191CONFIG_APM=y
192
193#
194# Networking
195#
196CONFIG_NET=y
197
198#
199# Networking options
200#
201CONFIG_PACKET=y
202CONFIG_PACKET_MMAP=y
203CONFIG_UNIX=y
204# CONFIG_NET_KEY is not set
205CONFIG_INET=y
206# CONFIG_IP_MULTICAST is not set
207# CONFIG_IP_ADVANCED_ROUTER is not set
208CONFIG_IP_FIB_HASH=y
209# CONFIG_IP_PNP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_ARPD is not set
213CONFIG_SYN_COOKIES=y
214# CONFIG_INET_AH is not set
215# CONFIG_INET_ESP is not set
216# CONFIG_INET_IPCOMP is not set
217# CONFIG_INET_TUNNEL is not set
218CONFIG_INET_DIAG=y
219CONFIG_INET_TCP_DIAG=y
220# CONFIG_TCP_CONG_ADVANCED is not set
221CONFIG_TCP_CONG_BIC=y
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# DCCP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_DCCP is not set
229
230#
231# SCTP Configuration (EXPERIMENTAL)
232#
233# CONFIG_IP_SCTP is not set
234# CONFIG_ATM is not set
235# CONFIG_BRIDGE is not set
236# CONFIG_VLAN_8021Q is not set
237# CONFIG_DECNET is not set
238# CONFIG_LLC2 is not set
239# CONFIG_IPX is not set
240# CONFIG_ATALK is not set
241# CONFIG_X25 is not set
242# CONFIG_LAPB is not set
243# CONFIG_NET_DIVERT is not set
244# CONFIG_ECONET is not set
245# CONFIG_WAN_ROUTER is not set
246# CONFIG_NET_SCHED is not set
247# CONFIG_NET_CLS_ROUTE is not set
248
249#
250# Network testing
251#
252# CONFIG_NET_PKTGEN is not set
253# CONFIG_HAMRADIO is not set
254# CONFIG_IRDA is not set
255# CONFIG_BT is not set
256# CONFIG_IEEE80211 is not set
257
258#
259# Device Drivers
260#
261
262#
263# Generic Driver Options
264#
265CONFIG_STANDALONE=y
266CONFIG_PREVENT_FIRMWARE_BUILD=y
267CONFIG_FW_LOADER=y
268# CONFIG_DEBUG_DRIVER is not set
269
270#
271# Memory Technology Devices (MTD)
272#
273CONFIG_MTD=y
274# CONFIG_MTD_DEBUG is not set
275# CONFIG_MTD_CONCAT is not set
276CONFIG_MTD_PARTITIONS=y
277# CONFIG_MTD_REDBOOT_PARTS is not set
278# CONFIG_MTD_CMDLINE_PARTS is not set
279# CONFIG_MTD_AFS_PARTS is not set
280
281#
282# User Modules And Translation Layers
283#
284CONFIG_MTD_CHAR=y
285CONFIG_MTD_BLOCK=y
286# CONFIG_FTL is not set
287# CONFIG_NFTL is not set
288# CONFIG_INFTL is not set
289
290#
291# RAM/ROM/Flash chip drivers
292#
293# CONFIG_MTD_CFI is not set
294# CONFIG_MTD_JEDECPROBE is not set
295CONFIG_MTD_MAP_BANK_WIDTH_1=y
296CONFIG_MTD_MAP_BANK_WIDTH_2=y
297CONFIG_MTD_MAP_BANK_WIDTH_4=y
298# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
299# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
300# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
301CONFIG_MTD_CFI_I1=y
302CONFIG_MTD_CFI_I2=y
303# CONFIG_MTD_CFI_I4 is not set
304# CONFIG_MTD_CFI_I8 is not set
305# CONFIG_MTD_RAM is not set
306# CONFIG_MTD_ROM is not set
307# CONFIG_MTD_ABSENT is not set
308
309#
310# Mapping drivers for chip access
311#
312CONFIG_MTD_COMPLEX_MAPPINGS=y
313CONFIG_MTD_SHARP_SL=y
314# CONFIG_MTD_PLATRAM is not set
315
316#
317# Self-contained MTD device drivers
318#
319# CONFIG_MTD_SLRAM is not set
320# CONFIG_MTD_PHRAM is not set
321# CONFIG_MTD_MTDRAM is not set
322# CONFIG_MTD_BLKMTD is not set
323# CONFIG_MTD_BLOCK2MTD is not set
324
325#
326# Disk-On-Chip Device Drivers
327#
328# CONFIG_MTD_DOC2000 is not set
329# CONFIG_MTD_DOC2001 is not set
330# CONFIG_MTD_DOC2001PLUS is not set
331
332#
333# NAND Flash Device Drivers
334#
335CONFIG_MTD_NAND=y
336CONFIG_MTD_NAND_VERIFY_WRITE=y
337# CONFIG_MTD_NAND_H1900 is not set
338CONFIG_MTD_NAND_IDS=y
339# CONFIG_MTD_NAND_DISKONCHIP is not set
340CONFIG_MTD_NAND_SHARPSL=y
341# CONFIG_MTD_NAND_NANDSIM is not set
342
343#
344# Parallel port support
345#
346# CONFIG_PARPORT is not set
347
348#
349# Plug and Play support
350#
351
352#
353# Block devices
354#
355# CONFIG_BLK_DEV_COW_COMMON is not set
356CONFIG_BLK_DEV_LOOP=y
357# CONFIG_BLK_DEV_CRYPTOLOOP is not set
358# CONFIG_BLK_DEV_NBD is not set
359# CONFIG_BLK_DEV_RAM is not set
360CONFIG_BLK_DEV_RAM_COUNT=16
361# CONFIG_CDROM_PKTCDVD is not set
362
363#
364# IO Schedulers
365#
366CONFIG_IOSCHED_NOOP=y
367CONFIG_IOSCHED_AS=y
368CONFIG_IOSCHED_DEADLINE=y
369CONFIG_IOSCHED_CFQ=y
370# CONFIG_ATA_OVER_ETH is not set
371
372#
373# ATA/ATAPI/MFM/RLL support
374#
375CONFIG_IDE=y
376CONFIG_BLK_DEV_IDE=y
377
378#
379# Please see Documentation/ide.txt for help/info on IDE drives
380#
381# CONFIG_BLK_DEV_IDE_SATA is not set
382CONFIG_BLK_DEV_IDEDISK=y
383# CONFIG_IDEDISK_MULTI_MODE is not set
384CONFIG_BLK_DEV_IDECS=y
385# CONFIG_BLK_DEV_IDECD is not set
386# CONFIG_BLK_DEV_IDETAPE is not set
387# CONFIG_BLK_DEV_IDEFLOPPY is not set
388# CONFIG_IDE_TASK_IOCTL is not set
389
390#
391# IDE chipset support/bugfixes
392#
393CONFIG_IDE_GENERIC=y
394# CONFIG_IDE_ARM is not set
395# CONFIG_BLK_DEV_IDEDMA is not set
396# CONFIG_IDEDMA_AUTO is not set
397# CONFIG_BLK_DEV_HD is not set
398
399#
400# SCSI device support
401#
402# CONFIG_RAID_ATTRS is not set
403# CONFIG_SCSI is not set
404
405#
406# Multi-device support (RAID and LVM)
407#
408# CONFIG_MD is not set
409
410#
411# Fusion MPT device support
412#
413# CONFIG_FUSION is not set
414
415#
416# IEEE 1394 (FireWire) support
417#
418
419#
420# I2O device support
421#
422
423#
424# Network device support
425#
426CONFIG_NETDEVICES=y
427# CONFIG_DUMMY is not set
428# CONFIG_BONDING is not set
429# CONFIG_EQUALIZER is not set
430# CONFIG_TUN is not set
431
432#
433# PHY device support
434#
435# CONFIG_PHYLIB is not set
436
437#
438# Ethernet (10 or 100Mbit)
439#
440CONFIG_NET_ETHERNET=y
441# CONFIG_MII is not set
442# CONFIG_SMC91X is not set
443# CONFIG_DM9000 is not set
444
445#
446# Ethernet (1000 Mbit)
447#
448
449#
450# Ethernet (10000 Mbit)
451#
452
453#
454# Token Ring devices
455#
456
457#
458# Wireless LAN (non-hamradio)
459#
460CONFIG_NET_RADIO=y
461
462#
463# Obsolete Wireless cards support (pre-802.11)
464#
465# CONFIG_STRIP is not set
466# CONFIG_PCMCIA_WAVELAN is not set
467# CONFIG_PCMCIA_NETWAVE is not set
468
469#
470# Wireless 802.11 Frequency Hopping cards support
471#
472# CONFIG_PCMCIA_RAYCS is not set
473
474#
475# Wireless 802.11b ISA/PCI cards support
476#
477# CONFIG_HERMES is not set
478# CONFIG_ATMEL is not set
479
480#
481# Wireless 802.11b Pcmcia/Cardbus cards support
482#
483# CONFIG_AIRO_CS is not set
484# CONFIG_PCMCIA_WL3501 is not set
485# CONFIG_HOSTAP is not set
486CONFIG_NET_WIRELESS=y
487
488#
489# PCMCIA network device support
490#
491CONFIG_NET_PCMCIA=y
492# CONFIG_PCMCIA_3C589 is not set
493# CONFIG_PCMCIA_3C574 is not set
494# CONFIG_PCMCIA_FMVJ18X is not set
495CONFIG_PCMCIA_PCNET=y
496# CONFIG_PCMCIA_NMCLAN is not set
497# CONFIG_PCMCIA_SMC91C92 is not set
498# CONFIG_PCMCIA_XIRC2PS is not set
499# CONFIG_PCMCIA_AXNET is not set
500
501#
502# Wan interfaces
503#
504# CONFIG_WAN is not set
505CONFIG_PPP=m
506# CONFIG_PPP_MULTILINK is not set
507# CONFIG_PPP_FILTER is not set
508CONFIG_PPP_ASYNC=m
509# CONFIG_PPP_SYNC_TTY is not set
510# CONFIG_PPP_DEFLATE is not set
511CONFIG_PPP_BSDCOMP=m
512# CONFIG_PPPOE is not set
513# CONFIG_SLIP is not set
514# CONFIG_SHAPER is not set
515# CONFIG_NETCONSOLE is not set
516# CONFIG_NETPOLL is not set
517# CONFIG_NET_POLL_CONTROLLER is not set
518
519#
520# ISDN subsystem
521#
522# CONFIG_ISDN is not set
523
524#
525# Input device support
526#
527CONFIG_INPUT=y
528
529#
530# Userland interfaces
531#
532# CONFIG_INPUT_MOUSEDEV is not set
533# CONFIG_INPUT_JOYDEV is not set
534CONFIG_INPUT_TSDEV=y
535CONFIG_INPUT_TSDEV_SCREEN_X=240
536CONFIG_INPUT_TSDEV_SCREEN_Y=320
537CONFIG_INPUT_EVDEV=y
538CONFIG_INPUT_EVBUG=y
539
540#
541# Input Device Drivers
542#
543CONFIG_INPUT_KEYBOARD=y
544# CONFIG_KEYBOARD_ATKBD is not set
545# CONFIG_KEYBOARD_SUNKBD is not set
546# CONFIG_KEYBOARD_LKKBD is not set
547CONFIG_KEYBOARD_LOCOMO=y
548# CONFIG_KEYBOARD_XTKBD is not set
549# CONFIG_KEYBOARD_NEWTON is not set
550# CONFIG_KEYBOARD_CORGI is not set
551CONFIG_KEYBOARD_SPITZ=y
552# CONFIG_INPUT_MOUSE is not set
553# CONFIG_INPUT_JOYSTICK is not set
554# CONFIG_INPUT_TOUCHSCREEN is not set
555# CONFIG_INPUT_MISC is not set
556
557#
558# Hardware I/O ports
559#
560# CONFIG_SERIO is not set
561# CONFIG_GAMEPORT is not set
562
563#
564# Character devices
565#
566CONFIG_VT=y
567CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y
569# CONFIG_SERIAL_NONSTANDARD is not set
570
571#
572# Serial drivers
573#
574# CONFIG_SERIAL_8250 is not set
575
576#
577# Non-8250 serial port support
578#
579CONFIG_SERIAL_PXA=y
580CONFIG_SERIAL_PXA_CONSOLE=y
581CONFIG_SERIAL_CORE=y
582CONFIG_SERIAL_CORE_CONSOLE=y
583CONFIG_UNIX98_PTYS=y
584# CONFIG_LEGACY_PTYS is not set
585
586#
587# IPMI
588#
589# CONFIG_IPMI_HANDLER is not set
590
591#
592# Watchdog Cards
593#
594# CONFIG_WATCHDOG is not set
595# CONFIG_NVRAM is not set
596# CONFIG_RTC is not set
597# CONFIG_DTLK is not set
598# CONFIG_R3964 is not set
599
600#
601# Ftape, the floppy tape device driver
602#
603
604#
605# PCMCIA character devices
606#
607# CONFIG_SYNCLINK_CS is not set
608# CONFIG_RAW_DRIVER is not set
609
610#
611# TPM devices
612#
613
614#
615# I2C support
616#
617CONFIG_I2C=y
618# CONFIG_I2C_CHARDEV is not set
619
620#
621# I2C Algorithms
622#
623CONFIG_I2C_ALGOBIT=y
624# CONFIG_I2C_ALGOPCF is not set
625# CONFIG_I2C_ALGOPCA is not set
626
627#
628# I2C Hardware Bus support
629#
630# CONFIG_I2C_PXA is not set
631# CONFIG_I2C_PARPORT_LIGHT is not set
632# CONFIG_I2C_STUB is not set
633# CONFIG_I2C_PCA_ISA is not set
634
635#
636# Miscellaneous I2C Chip support
637#
638# CONFIG_SENSORS_DS1337 is not set
639# CONFIG_SENSORS_DS1374 is not set
640# CONFIG_SENSORS_EEPROM is not set
641# CONFIG_SENSORS_PCF8574 is not set
642# CONFIG_SENSORS_PCA9539 is not set
643# CONFIG_SENSORS_PCF8591 is not set
644# CONFIG_SENSORS_RTC8564 is not set
645# CONFIG_SENSORS_MAX6875 is not set
646CONFIG_I2C_DEBUG_CORE=y
647CONFIG_I2C_DEBUG_ALGO=y
648CONFIG_I2C_DEBUG_BUS=y
649# CONFIG_I2C_DEBUG_CHIP is not set
650
651#
652# Hardware Monitoring support
653#
654CONFIG_HWMON=y
655# CONFIG_HWMON_VID is not set
656# CONFIG_SENSORS_ADM1021 is not set
657# CONFIG_SENSORS_ADM1025 is not set
658# CONFIG_SENSORS_ADM1026 is not set
659# CONFIG_SENSORS_ADM1031 is not set
660# CONFIG_SENSORS_ADM9240 is not set
661# CONFIG_SENSORS_ASB100 is not set
662# CONFIG_SENSORS_ATXP1 is not set
663# CONFIG_SENSORS_DS1621 is not set
664# CONFIG_SENSORS_FSCHER is not set
665# CONFIG_SENSORS_FSCPOS is not set
666# CONFIG_SENSORS_GL518SM is not set
667# CONFIG_SENSORS_GL520SM is not set
668# CONFIG_SENSORS_IT87 is not set
669# CONFIG_SENSORS_LM63 is not set
670# CONFIG_SENSORS_LM75 is not set
671# CONFIG_SENSORS_LM77 is not set
672# CONFIG_SENSORS_LM78 is not set
673# CONFIG_SENSORS_LM80 is not set
674# CONFIG_SENSORS_LM83 is not set
675# CONFIG_SENSORS_LM85 is not set
676# CONFIG_SENSORS_LM87 is not set
677# CONFIG_SENSORS_LM90 is not set
678# CONFIG_SENSORS_LM92 is not set
679# CONFIG_SENSORS_MAX1619 is not set
680# CONFIG_SENSORS_PC87360 is not set
681# CONFIG_SENSORS_SMSC47M1 is not set
682# CONFIG_SENSORS_SMSC47B397 is not set
683# CONFIG_SENSORS_W83781D is not set
684# CONFIG_SENSORS_W83792D is not set
685# CONFIG_SENSORS_W83L785TS is not set
686# CONFIG_SENSORS_W83627HF is not set
687# CONFIG_SENSORS_W83627EHF is not set
688# CONFIG_HWMON_DEBUG_CHIP is not set
689
690#
691# Misc devices
692#
693
694#
695# Multimedia Capabilities Port drivers
696#
697
698#
699# Multimedia devices
700#
701CONFIG_VIDEO_DEV=m
702
703#
704# Video For Linux
705#
706
707#
708# Video Adapters
709#
710# CONFIG_VIDEO_CPIA is not set
711# CONFIG_VIDEO_SAA5246A is not set
712# CONFIG_VIDEO_SAA5249 is not set
713# CONFIG_TUNER_3036 is not set
714# CONFIG_VIDEO_OVCAMCHIP is not set
715
716#
717# Radio Adapters
718#
719# CONFIG_RADIO_MAESTRO is not set
720
721#
722# Digital Video Broadcasting Devices
723#
724# CONFIG_DVB is not set
725
726#
727# Graphics support
728#
729CONFIG_FB=y
730CONFIG_FB_CFB_FILLRECT=y
731CONFIG_FB_CFB_COPYAREA=y
732CONFIG_FB_CFB_IMAGEBLIT=y
733CONFIG_FB_SOFT_CURSOR=y
734# CONFIG_FB_MACMODES is not set
735CONFIG_FB_MODE_HELPERS=y
736# CONFIG_FB_TILEBLITTING is not set
737CONFIG_FB_PXA=y
738# CONFIG_FB_W100 is not set
739# CONFIG_FB_PXA_PARAMETERS is not set
740# CONFIG_FB_S1D13XXX is not set
741# CONFIG_FB_VIRTUAL is not set
742
743#
744# Console display driver support
745#
746# CONFIG_VGA_CONSOLE is not set
747CONFIG_DUMMY_CONSOLE=y
748CONFIG_FRAMEBUFFER_CONSOLE=y
749CONFIG_FONTS=y
750CONFIG_FONT_8x8=y
751# CONFIG_FONT_8x16 is not set
752# CONFIG_FONT_6x11 is not set
753# CONFIG_FONT_7x14 is not set
754# CONFIG_FONT_PEARL_8x8 is not set
755# CONFIG_FONT_ACORN_8x8 is not set
756# CONFIG_FONT_MINI_4x6 is not set
757# CONFIG_FONT_SUN8x16 is not set
758# CONFIG_FONT_SUN12x22 is not set
759# CONFIG_FONT_10x18 is not set
760
761#
762# Logo configuration
763#
764# CONFIG_LOGO is not set
765# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
766
767#
768# Sound
769#
770# CONFIG_SOUND is not set
771
772#
773# USB support
774#
775CONFIG_USB_ARCH_HAS_HCD=y
776# CONFIG_USB_ARCH_HAS_OHCI is not set
777# CONFIG_USB is not set
778
779#
780# USB Gadget Support
781#
782CONFIG_USB_GADGET=y
783# CONFIG_USB_GADGET_DEBUG_FILES is not set
784CONFIG_USB_GADGET_SELECTED=y
785# CONFIG_USB_GADGET_NET2280 is not set
786CONFIG_USB_GADGET_PXA2XX=y
787CONFIG_USB_PXA2XX=y
788# CONFIG_USB_PXA2XX_SMALL is not set
789# CONFIG_USB_GADGET_GOKU is not set
790# CONFIG_USB_GADGET_LH7A40X is not set
791# CONFIG_USB_GADGET_OMAP is not set
792# CONFIG_USB_GADGET_DUMMY_HCD is not set
793# CONFIG_USB_GADGET_DUALSPEED is not set
794# CONFIG_USB_ZERO is not set
795CONFIG_USB_ETH=y
796CONFIG_USB_ETH_RNDIS=y
797# CONFIG_USB_GADGETFS is not set
798# CONFIG_USB_FILE_STORAGE is not set
799# CONFIG_USB_G_SERIAL is not set
800
801#
802# MMC/SD Card support
803#
804CONFIG_MMC=y
805CONFIG_MMC_DEBUG=y
806CONFIG_MMC_BLOCK=y
807CONFIG_MMC_PXA=y
808# CONFIG_MMC_WBSD is not set
809
810#
811# File systems
812#
813CONFIG_EXT2_FS=y
814CONFIG_EXT2_FS_XATTR=y
815CONFIG_EXT2_FS_POSIX_ACL=y
816CONFIG_EXT2_FS_SECURITY=y
817# CONFIG_EXT2_FS_XIP is not set
818# CONFIG_EXT3_FS is not set
819# CONFIG_JBD is not set
820CONFIG_FS_MBCACHE=y
821# CONFIG_REISERFS_FS is not set
822# CONFIG_JFS_FS is not set
823CONFIG_FS_POSIX_ACL=y
824# CONFIG_XFS_FS is not set
825# CONFIG_MINIX_FS is not set
826# CONFIG_ROMFS_FS is not set
827CONFIG_INOTIFY=y
828# CONFIG_QUOTA is not set
829CONFIG_DNOTIFY=y
830# CONFIG_AUTOFS_FS is not set
831# CONFIG_AUTOFS4_FS is not set
832# CONFIG_FUSE_FS is not set
833
834#
835# CD-ROM/DVD Filesystems
836#
837# CONFIG_ISO9660_FS is not set
838# CONFIG_UDF_FS is not set
839
840#
841# DOS/FAT/NT Filesystems
842#
843CONFIG_FAT_FS=y
844CONFIG_MSDOS_FS=y
845CONFIG_VFAT_FS=y
846CONFIG_FAT_DEFAULT_CODEPAGE=437
847CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
848# CONFIG_NTFS_FS is not set
849
850#
851# Pseudo filesystems
852#
853CONFIG_PROC_FS=y
854CONFIG_SYSFS=y
855CONFIG_TMPFS=y
856# CONFIG_HUGETLB_PAGE is not set
857CONFIG_RAMFS=y
858# CONFIG_RELAYFS_FS is not set
859
860#
861# Miscellaneous filesystems
862#
863# CONFIG_ADFS_FS is not set
864# CONFIG_AFFS_FS is not set
865# CONFIG_HFS_FS is not set
866# CONFIG_HFSPLUS_FS is not set
867# CONFIG_BEFS_FS is not set
868# CONFIG_BFS_FS is not set
869# CONFIG_EFS_FS is not set
870# CONFIG_JFFS_FS is not set
871CONFIG_JFFS2_FS=y
872CONFIG_JFFS2_FS_DEBUG=0
873CONFIG_JFFS2_FS_WRITEBUFFER=y
874CONFIG_JFFS2_COMPRESSION_OPTIONS=y
875CONFIG_JFFS2_ZLIB=y
876CONFIG_JFFS2_RTIME=y
877CONFIG_JFFS2_RUBIN=y
878# CONFIG_JFFS2_CMODE_NONE is not set
879CONFIG_JFFS2_CMODE_PRIORITY=y
880# CONFIG_JFFS2_CMODE_SIZE is not set
881CONFIG_CRAMFS=m
882# CONFIG_VXFS_FS is not set
883# CONFIG_HPFS_FS is not set
884# CONFIG_QNX4FS_FS is not set
885# CONFIG_SYSV_FS is not set
886# CONFIG_UFS_FS is not set
887
888#
889# Network File Systems
890#
891# CONFIG_NFS_FS is not set
892# CONFIG_NFSD is not set
893# CONFIG_SMB_FS is not set
894# CONFIG_CIFS is not set
895# CONFIG_NCP_FS is not set
896# CONFIG_CODA_FS is not set
897# CONFIG_AFS_FS is not set
898# CONFIG_9P_FS is not set
899
900#
901# Partition Types
902#
903CONFIG_PARTITION_ADVANCED=y
904# CONFIG_ACORN_PARTITION is not set
905# CONFIG_OSF_PARTITION is not set
906# CONFIG_AMIGA_PARTITION is not set
907# CONFIG_ATARI_PARTITION is not set
908# CONFIG_MAC_PARTITION is not set
909CONFIG_MSDOS_PARTITION=y
910# CONFIG_BSD_DISKLABEL is not set
911# CONFIG_MINIX_SUBPARTITION is not set
912# CONFIG_SOLARIS_X86_PARTITION is not set
913# CONFIG_UNIXWARE_DISKLABEL is not set
914# CONFIG_LDM_PARTITION is not set
915# CONFIG_SGI_PARTITION is not set
916# CONFIG_ULTRIX_PARTITION is not set
917# CONFIG_SUN_PARTITION is not set
918# CONFIG_EFI_PARTITION is not set
919
920#
921# Native Language Support
922#
923CONFIG_NLS=y
924CONFIG_NLS_DEFAULT="cp437"
925CONFIG_NLS_CODEPAGE_437=y
926# CONFIG_NLS_CODEPAGE_737 is not set
927# CONFIG_NLS_CODEPAGE_775 is not set
928# CONFIG_NLS_CODEPAGE_850 is not set
929# CONFIG_NLS_CODEPAGE_852 is not set
930# CONFIG_NLS_CODEPAGE_855 is not set
931# CONFIG_NLS_CODEPAGE_857 is not set
932# CONFIG_NLS_CODEPAGE_860 is not set
933# CONFIG_NLS_CODEPAGE_861 is not set
934# CONFIG_NLS_CODEPAGE_862 is not set
935# CONFIG_NLS_CODEPAGE_863 is not set
936# CONFIG_NLS_CODEPAGE_864 is not set
937# CONFIG_NLS_CODEPAGE_865 is not set
938# CONFIG_NLS_CODEPAGE_866 is not set
939# CONFIG_NLS_CODEPAGE_869 is not set
940# CONFIG_NLS_CODEPAGE_936 is not set
941# CONFIG_NLS_CODEPAGE_950 is not set
942# CONFIG_NLS_CODEPAGE_932 is not set
943# CONFIG_NLS_CODEPAGE_949 is not set
944# CONFIG_NLS_CODEPAGE_874 is not set
945# CONFIG_NLS_ISO8859_8 is not set
946# CONFIG_NLS_CODEPAGE_1250 is not set
947# CONFIG_NLS_CODEPAGE_1251 is not set
948CONFIG_NLS_ASCII=y
949CONFIG_NLS_ISO8859_1=y
950# CONFIG_NLS_ISO8859_2 is not set
951# CONFIG_NLS_ISO8859_3 is not set
952# CONFIG_NLS_ISO8859_4 is not set
953# CONFIG_NLS_ISO8859_5 is not set
954# CONFIG_NLS_ISO8859_6 is not set
955# CONFIG_NLS_ISO8859_7 is not set
956# CONFIG_NLS_ISO8859_9 is not set
957# CONFIG_NLS_ISO8859_13 is not set
958# CONFIG_NLS_ISO8859_14 is not set
959# CONFIG_NLS_ISO8859_15 is not set
960# CONFIG_NLS_KOI8_R is not set
961# CONFIG_NLS_KOI8_U is not set
962CONFIG_NLS_UTF8=y
963
964#
965# Profiling support
966#
967# CONFIG_PROFILING is not set
968
969#
970# Kernel hacking
971#
972# CONFIG_PRINTK_TIME is not set
973CONFIG_DEBUG_KERNEL=y
974CONFIG_MAGIC_SYSRQ=y
975CONFIG_LOG_BUF_SHIFT=14
976CONFIG_DETECT_SOFTLOCKUP=y
977# CONFIG_SCHEDSTATS is not set
978# CONFIG_DEBUG_SLAB is not set
979CONFIG_DEBUG_PREEMPT=y
980# CONFIG_DEBUG_SPINLOCK is not set
981# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
982# CONFIG_DEBUG_KOBJECT is not set
983# CONFIG_DEBUG_BUGVERBOSE is not set
984# CONFIG_DEBUG_INFO is not set
985# CONFIG_DEBUG_FS is not set
986CONFIG_FRAME_POINTER=y
987# CONFIG_DEBUG_USER is not set
988# CONFIG_DEBUG_WAITQ is not set
989CONFIG_DEBUG_ERRORS=y
990# CONFIG_DEBUG_LL is not set
991
992#
993# Security options
994#
995# CONFIG_KEYS is not set
996# CONFIG_SECURITY is not set
997
998#
999# Cryptographic options
1000#
1001# CONFIG_CRYPTO is not set
1002
1003#
1004# Hardware crypto devices
1005#
1006
1007#
1008# Library routines
1009#
1010CONFIG_CRC_CCITT=y
1011# CONFIG_CRC16 is not set
1012CONFIG_CRC32=y
1013# CONFIG_LIBCRC32C is not set
1014CONFIG_ZLIB_INFLATE=y
1015CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index 900e04f8e38c..18e9beaec465 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_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.14-rc3 3# Linux kernel version: 2.6.15-rc2
4# Sun Oct 9 17:11:19 2005 4# Mon Nov 28 10:26:52 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -64,6 +64,23 @@ CONFIG_OBSOLETE_MODPARM=y
64CONFIG_KMOD=y 64CONFIG_KMOD=y
65 65
66# 66#
67# Block layer
68#
69
70#
71# IO Schedulers
72#
73CONFIG_IOSCHED_NOOP=y
74CONFIG_IOSCHED_AS=y
75CONFIG_IOSCHED_DEADLINE=y
76CONFIG_IOSCHED_CFQ=y
77CONFIG_DEFAULT_AS=y
78# CONFIG_DEFAULT_DEADLINE is not set
79# CONFIG_DEFAULT_CFQ is not set
80# CONFIG_DEFAULT_NOOP is not set
81CONFIG_DEFAULT_IOSCHED="anticipatory"
82
83#
67# System Type 84# System Type
68# 85#
69# CONFIG_ARCH_CLPS7500 is not set 86# CONFIG_ARCH_CLPS7500 is not set
@@ -85,6 +102,7 @@ CONFIG_ARCH_PXA=y
85# CONFIG_ARCH_LH7A40X is not set 102# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set 103# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set 104# CONFIG_ARCH_VERSATILE is not set
105# CONFIG_ARCH_REALVIEW is not set
88# CONFIG_ARCH_IMX is not set 106# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set 107# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set 108# CONFIG_ARCH_AAEC2000 is not set
@@ -98,10 +116,13 @@ CONFIG_ARCH_PXA=y
98CONFIG_PXA_SHARPSL=y 116CONFIG_PXA_SHARPSL=y
99# CONFIG_PXA_SHARPSL_25x is not set 117# CONFIG_PXA_SHARPSL_25x is not set
100CONFIG_PXA_SHARPSL_27x=y 118CONFIG_PXA_SHARPSL_27x=y
119CONFIG_MACH_AKITA=y
101CONFIG_MACH_SPITZ=y 120CONFIG_MACH_SPITZ=y
102CONFIG_MACH_BORZOI=y 121CONFIG_MACH_BORZOI=y
103CONFIG_PXA27x=y 122CONFIG_PXA27x=y
123CONFIG_IWMMXT=y
104CONFIG_PXA_SHARP_Cxx00=y 124CONFIG_PXA_SHARP_Cxx00=y
125CONFIG_PXA_SSP=y
105 126
106# 127#
107# Processor Type 128# Processor Type
@@ -153,6 +174,7 @@ CONFIG_FLATMEM_MANUAL=y
153CONFIG_FLATMEM=y 174CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y 175CONFIG_FLAT_NODE_MEM_MAP=y
155# CONFIG_SPARSEMEM_STATIC is not set 176# CONFIG_SPARSEMEM_STATIC is not set
177CONFIG_SPLIT_PTLOCK_CPUS=4096
156CONFIG_ALIGNMENT_TRAP=y 178CONFIG_ALIGNMENT_TRAP=y
157 179
158# 180#
@@ -233,6 +255,10 @@ CONFIG_INET6_TUNNEL=m
233CONFIG_IPV6_TUNNEL=m 255CONFIG_IPV6_TUNNEL=m
234CONFIG_NETFILTER=y 256CONFIG_NETFILTER=y
235# CONFIG_NETFILTER_DEBUG is not set 257# CONFIG_NETFILTER_DEBUG is not set
258
259#
260# Core Netfilter Configuration
261#
236# CONFIG_NETFILTER_NETLINK is not set 262# CONFIG_NETFILTER_NETLINK is not set
237 263
238# 264#
@@ -354,6 +380,10 @@ CONFIG_IP6_NF_RAW=m
354# CONFIG_NET_DIVERT is not set 380# CONFIG_NET_DIVERT is not set
355# CONFIG_ECONET is not set 381# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set 382# CONFIG_WAN_ROUTER is not set
383
384#
385# QoS and/or fair queueing
386#
357# CONFIG_NET_SCHED is not set 387# CONFIG_NET_SCHED is not set
358CONFIG_NET_CLS_ROUTE=y 388CONFIG_NET_CLS_ROUTE=y
359 389
@@ -411,6 +441,7 @@ CONFIG_IRCOMM=m
411# CONFIG_SMC_IRCC_FIR is not set 441# CONFIG_SMC_IRCC_FIR is not set
412# CONFIG_ALI_FIR is not set 442# CONFIG_ALI_FIR is not set
413# CONFIG_VIA_FIR is not set 443# CONFIG_VIA_FIR is not set
444CONFIG_PXA_FICP=m
414CONFIG_BT=m 445CONFIG_BT=m
415CONFIG_BT_L2CAP=m 446CONFIG_BT_L2CAP=m
416CONFIG_BT_SCO=m 447CONFIG_BT_SCO=m
@@ -429,7 +460,6 @@ CONFIG_BT_HCIUSB=m
429CONFIG_BT_HCIUART=m 460CONFIG_BT_HCIUART=m
430CONFIG_BT_HCIUART_H4=y 461CONFIG_BT_HCIUART_H4=y
431CONFIG_BT_HCIUART_BCSP=y 462CONFIG_BT_HCIUART_BCSP=y
432CONFIG_BT_HCIUART_BCSP_TXCRC=y
433CONFIG_BT_HCIBCM203X=m 463CONFIG_BT_HCIBCM203X=m
434CONFIG_BT_HCIBPA10X=m 464CONFIG_BT_HCIBPA10X=m
435CONFIG_BT_HCIBFUSB=m 465CONFIG_BT_HCIBFUSB=m
@@ -457,6 +487,11 @@ CONFIG_FW_LOADER=y
457# CONFIG_DEBUG_DRIVER is not set 487# CONFIG_DEBUG_DRIVER is not set
458 488
459# 489#
490# Connector - unified userspace <-> kernelspace linker
491#
492# CONFIG_CONNECTOR is not set
493
494#
460# Memory Technology Devices (MTD) 495# Memory Technology Devices (MTD)
461# 496#
462CONFIG_MTD=y 497CONFIG_MTD=y
@@ -475,6 +510,7 @@ CONFIG_MTD_BLOCK=y
475# CONFIG_FTL is not set 510# CONFIG_FTL is not set
476# CONFIG_NFTL is not set 511# CONFIG_NFTL is not set
477# CONFIG_INFTL is not set 512# CONFIG_INFTL is not set
513# CONFIG_RFD_FTL is not set
478 514
479# 515#
480# RAM/ROM/Flash chip drivers 516# RAM/ROM/Flash chip drivers
@@ -530,6 +566,11 @@ CONFIG_MTD_NAND_SHARPSL=y
530# CONFIG_MTD_NAND_NANDSIM is not set 566# CONFIG_MTD_NAND_NANDSIM is not set
531 567
532# 568#
569# OneNAND Flash Device Drivers
570#
571# CONFIG_MTD_ONENAND is not set
572
573#
533# Parallel port support 574# Parallel port support
534# 575#
535# CONFIG_PARPORT is not set 576# CONFIG_PARPORT is not set
@@ -549,14 +590,6 @@ CONFIG_BLK_DEV_LOOP=y
549# CONFIG_BLK_DEV_RAM is not set 590# CONFIG_BLK_DEV_RAM is not set
550CONFIG_BLK_DEV_RAM_COUNT=16 591CONFIG_BLK_DEV_RAM_COUNT=16
551# CONFIG_CDROM_PKTCDVD is not set 592# CONFIG_CDROM_PKTCDVD is not set
552
553#
554# IO Schedulers
555#
556CONFIG_IOSCHED_NOOP=y
557CONFIG_IOSCHED_AS=y
558CONFIG_IOSCHED_DEADLINE=y
559CONFIG_IOSCHED_CFQ=y
560# CONFIG_ATA_OVER_ETH is not set 593# CONFIG_ATA_OVER_ETH is not set
561 594
562# 595#
@@ -623,6 +656,7 @@ CONFIG_SCSI_MULTI_LUN=y
623# 656#
624# SCSI low-level drivers 657# SCSI low-level drivers
625# 658#
659# CONFIG_ISCSI_TCP is not set
626# CONFIG_SCSI_SATA is not set 660# CONFIG_SCSI_SATA is not set
627# CONFIG_SCSI_DEBUG is not set 661# CONFIG_SCSI_DEBUG is not set
628 662
@@ -746,6 +780,7 @@ CONFIG_PPP_ASYNC=m
746# CONFIG_PPP_SYNC_TTY is not set 780# CONFIG_PPP_SYNC_TTY is not set
747# CONFIG_PPP_DEFLATE is not set 781# CONFIG_PPP_DEFLATE is not set
748CONFIG_PPP_BSDCOMP=m 782CONFIG_PPP_BSDCOMP=m
783# CONFIG_PPP_MPPE is not set
749# CONFIG_PPPOE is not set 784# CONFIG_PPPOE is not set
750# CONFIG_SLIP is not set 785# CONFIG_SLIP is not set
751# CONFIG_SHAPER is not set 786# CONFIG_SHAPER is not set
@@ -771,6 +806,7 @@ CONFIG_INPUT=y
771# CONFIG_INPUT_TSDEV is not set 806# CONFIG_INPUT_TSDEV is not set
772CONFIG_INPUT_EVDEV=y 807CONFIG_INPUT_EVDEV=y
773# CONFIG_INPUT_EVBUG is not set 808# CONFIG_INPUT_EVBUG is not set
809# CONFIG_INPUT_POWER is not set
774 810
775# 811#
776# Input Device Drivers 812# Input Device Drivers
@@ -848,11 +884,15 @@ CONFIG_UNIX98_PTYS=y
848# PCMCIA character devices 884# PCMCIA character devices
849# 885#
850# CONFIG_SYNCLINK_CS is not set 886# CONFIG_SYNCLINK_CS is not set
887# CONFIG_CARDMAN_4000 is not set
888# CONFIG_CARDMAN_4040 is not set
851# CONFIG_RAW_DRIVER is not set 889# CONFIG_RAW_DRIVER is not set
852 890
853# 891#
854# TPM devices 892# TPM devices
855# 893#
894# CONFIG_TCG_TPM is not set
895# CONFIG_TELCLOCK is not set
856 896
857# 897#
858# I2C support 898# I2C support
@@ -891,14 +931,13 @@ CONFIG_FB=y
891CONFIG_FB_CFB_FILLRECT=y 931CONFIG_FB_CFB_FILLRECT=y
892CONFIG_FB_CFB_COPYAREA=y 932CONFIG_FB_CFB_COPYAREA=y
893CONFIG_FB_CFB_IMAGEBLIT=y 933CONFIG_FB_CFB_IMAGEBLIT=y
894CONFIG_FB_SOFT_CURSOR=y
895# CONFIG_FB_MACMODES is not set 934# CONFIG_FB_MACMODES is not set
896# CONFIG_FB_MODE_HELPERS is not set 935# CONFIG_FB_MODE_HELPERS is not set
897# CONFIG_FB_TILEBLITTING is not set 936# CONFIG_FB_TILEBLITTING is not set
937# CONFIG_FB_S1D13XXX is not set
898CONFIG_FB_PXA=y 938CONFIG_FB_PXA=y
899# CONFIG_FB_W100 is not set
900# CONFIG_FB_PXA_PARAMETERS is not set 939# CONFIG_FB_PXA_PARAMETERS is not set
901# CONFIG_FB_S1D13XXX is not set 940# CONFIG_FB_W100 is not set
902# CONFIG_FB_VIRTUAL is not set 941# CONFIG_FB_VIRTUAL is not set
903 942
904# 943#
@@ -907,6 +946,7 @@ CONFIG_FB_PXA=y
907# CONFIG_VGA_CONSOLE is not set 946# CONFIG_VGA_CONSOLE is not set
908CONFIG_DUMMY_CONSOLE=y 947CONFIG_DUMMY_CONSOLE=y
909CONFIG_FRAMEBUFFER_CONSOLE=y 948CONFIG_FRAMEBUFFER_CONSOLE=y
949CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
910CONFIG_FONTS=y 950CONFIG_FONTS=y
911CONFIG_FONT_8x8=y 951CONFIG_FONT_8x8=y
912CONFIG_FONT_8x16=y 952CONFIG_FONT_8x16=y
@@ -965,15 +1005,15 @@ CONFIG_USB_SL811_CS=m
965# 1005#
966# USB Device Class drivers 1006# USB Device Class drivers
967# 1007#
1008CONFIG_USB_ACM=m
1009CONFIG_USB_PRINTER=m
968 1010
969# 1011#
970# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem 1012# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
971# 1013#
972CONFIG_USB_ACM=m
973CONFIG_USB_PRINTER=m
974 1014
975# 1015#
976# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 1016# may also be needed; see USB_STORAGE Help for more information
977# 1017#
978CONFIG_USB_STORAGE=m 1018CONFIG_USB_STORAGE=m
979# CONFIG_USB_STORAGE_DEBUG is not set 1019# CONFIG_USB_STORAGE_DEBUG is not set
@@ -985,7 +1025,6 @@ CONFIG_USB_STORAGE=m
985# CONFIG_USB_STORAGE_SDDR09 is not set 1025# CONFIG_USB_STORAGE_SDDR09 is not set
986# CONFIG_USB_STORAGE_SDDR55 is not set 1026# CONFIG_USB_STORAGE_SDDR55 is not set
987# CONFIG_USB_STORAGE_JUMPSHOT is not set 1027# CONFIG_USB_STORAGE_JUMPSHOT is not set
988# CONFIG_USB_STORAGE_ONETOUCH is not set
989 1028
990# 1029#
991# USB Input Devices 1030# USB Input Devices
@@ -1058,6 +1097,7 @@ CONFIG_USB_MON=y
1058CONFIG_USB_SERIAL=m 1097CONFIG_USB_SERIAL=m
1059CONFIG_USB_SERIAL_GENERIC=y 1098CONFIG_USB_SERIAL_GENERIC=y
1060# CONFIG_USB_SERIAL_AIRPRIME is not set 1099# CONFIG_USB_SERIAL_AIRPRIME is not set
1100# CONFIG_USB_SERIAL_ANYDATA is not set
1061CONFIG_USB_SERIAL_BELKIN=m 1101CONFIG_USB_SERIAL_BELKIN=m
1062# CONFIG_USB_SERIAL_WHITEHEAT is not set 1102# CONFIG_USB_SERIAL_WHITEHEAT is not set
1063CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m 1103CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
@@ -1218,6 +1258,7 @@ CONFIG_RAMFS=y
1218CONFIG_JFFS2_FS=y 1258CONFIG_JFFS2_FS=y
1219CONFIG_JFFS2_FS_DEBUG=0 1259CONFIG_JFFS2_FS_DEBUG=0
1220CONFIG_JFFS2_FS_WRITEBUFFER=y 1260CONFIG_JFFS2_FS_WRITEBUFFER=y
1261CONFIG_JFFS2_SUMMARY=y
1221CONFIG_JFFS2_COMPRESSION_OPTIONS=y 1262CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1222CONFIG_JFFS2_ZLIB=y 1263CONFIG_JFFS2_ZLIB=y
1223CONFIG_JFFS2_RTIME=y 1264CONFIG_JFFS2_RTIME=y
@@ -1344,7 +1385,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1344CONFIG_DEBUG_BUGVERBOSE=y 1385CONFIG_DEBUG_BUGVERBOSE=y
1345# CONFIG_DEBUG_INFO is not set 1386# CONFIG_DEBUG_INFO is not set
1346# CONFIG_DEBUG_FS is not set 1387# CONFIG_DEBUG_FS is not set
1388# CONFIG_DEBUG_VM is not set
1347CONFIG_FRAME_POINTER=y 1389CONFIG_FRAME_POINTER=y
1390# CONFIG_RCU_TORTURE_TEST is not set
1348# CONFIG_DEBUG_USER is not set 1391# CONFIG_DEBUG_USER is not set
1349# CONFIG_DEBUG_WAITQ is not set 1392# CONFIG_DEBUG_WAITQ is not set
1350CONFIG_DEBUG_ERRORS=y 1393CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 8d8748407cbe..d7d69fd7039f 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -17,7 +17,6 @@
17 17
18#include <asm/assembler.h> 18#include <asm/assembler.h>
19#include <asm/domain.h> 19#include <asm/domain.h>
20#include <asm/mach-types.h>
21#include <asm/procinfo.h> 20#include <asm/procinfo.h>
22#include <asm/ptrace.h> 21#include <asm/ptrace.h>
23#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
@@ -83,7 +82,7 @@ ENTRY(stext)
83 @ and irqs disabled 82 @ and irqs disabled
84 bl __lookup_processor_type @ r5=procinfo r9=cpuid 83 bl __lookup_processor_type @ r5=procinfo r9=cpuid
85 movs r10, r5 @ invalid processor (r5=0)? 84 movs r10, r5 @ invalid processor (r5=0)?
86 beq __error_p @ yes, error 'p' 85 beq __error_p @ yes, error 'p'
87 bl __lookup_machine_type @ r5=machinfo 86 bl __lookup_machine_type @ r5=machinfo
88 movs r8, r5 @ invalid machine (r5=0)? 87 movs r8, r5 @ invalid machine (r5=0)?
89 beq __error_a @ yes, error 'a' 88 beq __error_a @ yes, error 'a'
@@ -343,16 +342,12 @@ __create_page_tables:
343 bne 1b 342 bne 1b
344#if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS) 343#if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS)
345 /* 344 /*
346 * If we're using the NetWinder, we need to map in 345 * If we're using the NetWinder or CATS, we also need to map
347 * the 16550-type serial port for the debug messages 346 * in the 16550-type serial port for the debug messages
348 */ 347 */
349 teq r1, #MACH_TYPE_NETWINDER
350 teqne r1, #MACH_TYPE_CATS
351 bne 1f
352 add r0, r4, #0xff000000 >> 18 348 add r0, r4, #0xff000000 >> 18
353 orr r3, r7, #0x7c000000 349 orr r3, r7, #0x7c000000
354 str r3, [r0] 350 str r3, [r0]
3551:
356#endif 351#endif
357#ifdef CONFIG_ARCH_RPC 352#ifdef CONFIG_ARCH_RPC
358 /* 353 /*
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index 0364ba4b539e..d869af0023f8 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -260,7 +260,7 @@ static void __init clps7500_init_irq(void)
260 260
261static struct map_desc cl7500_io_desc[] __initdata = { 261static struct map_desc cl7500_io_desc[] __initdata = {
262 { /* IO space */ 262 { /* IO space */
263 .virtual = IO_BASE, 263 .virtual = (unsigned long)IO_BASE,
264 .pfn = __phys_to_pfn(IO_START), 264 .pfn = __phys_to_pfn(IO_START),
265 .length = IO_SIZE, 265 .length = IO_SIZE,
266 .type = MT_DEVICE 266 .type = MT_DEVICE
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index cd506646801a..526acbc32067 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -44,6 +44,7 @@ config PXA_SHARPSL_25x
44config PXA_SHARPSL_27x 44config PXA_SHARPSL_27x
45 bool "Sharp PXA270 models (SL-Cxx00)" 45 bool "Sharp PXA270 models (SL-Cxx00)"
46 select PXA27x 46 select PXA27x
47 select IWMMXT
47 48
48endchoice 49endchoice
49 50
@@ -60,7 +61,6 @@ config MACH_CORGI
60 bool "Enable Sharp SL-C700 (Corgi) Support" 61 bool "Enable Sharp SL-C700 (Corgi) Support"
61 depends PXA_SHARPSL_25x 62 depends PXA_SHARPSL_25x
62 select PXA_SHARP_C7xx 63 select PXA_SHARP_C7xx
63 select PXA_SSP
64 64
65config MACH_SHEPHERD 65config MACH_SHEPHERD
66 bool "Enable Sharp SL-C750 (Shepherd) Support" 66 bool "Enable Sharp SL-C750 (Shepherd) Support"
@@ -90,7 +90,7 @@ config MACH_BORZOI
90 90
91config MACH_TOSA 91config MACH_TOSA
92 bool "Enable Sharp SL-6000x (Tosa) Support" 92 bool "Enable Sharp SL-6000x (Tosa) Support"
93 depends PXA_SHARPSL 93 depends PXA_SHARPSL_25x
94 94
95config PXA25x 95config PXA25x
96 bool 96 bool
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index c312054dfb88..e4f92efc616e 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/device.h> 17#include <linux/platform_device.h>
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index e2c6fa23d3cd..af6580f1ceb8 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -30,7 +30,6 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h> 32#include <asm/leds.h>
33#include <asm/mach-types.h>
34#include <asm/hardware/amba.h> 33#include <asm/hardware/amba.h>
35#include <asm/hardware/amba_clcd.h> 34#include <asm/hardware/amba_clcd.h>
36#include <asm/hardware/arm_timer.h> 35#include <asm/hardware/arm_timer.h>
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 75efb5da5b6d..a66ac61233a2 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -293,7 +293,8 @@ static void __init get_assabet_scr(void)
293 GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */ 293 GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */
294 GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */ 294 GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */
295 GPDR &= ~(0x3fc); /* Configure GPIO 9:2 as inputs */ 295 GPDR &= ~(0x3fc); /* Configure GPIO 9:2 as inputs */
296 for(i = 100; i--; scr = GPLR); /* Read GPIO 9:2 */ 296 for(i = 100; i--; ) /* Read GPIO 9:2 */
297 scr = GPLR;
297 GPDR |= 0x3fc; /* restore correct pin direction */ 298 GPDR |= 0x3fc; /* restore correct pin direction */
298 scr &= 0x3fc; /* save as system configuration byte. */ 299 scr &= 0x3fc; /* save as system configuration byte. */
299 SCR_value = scr; 300 SCR_value = scr;
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index 47b0b767f080..dbfe9e891f01 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -66,6 +66,7 @@ struct vm_region {
66 unsigned long vm_start; 66 unsigned long vm_start;
67 unsigned long vm_end; 67 unsigned long vm_end;
68 struct page *vm_pages; 68 struct page *vm_pages;
69 int vm_active;
69}; 70};
70 71
71static struct vm_region consistent_head = { 72static struct vm_region consistent_head = {
@@ -104,6 +105,7 @@ vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp)
104 list_add_tail(&new->vm_list, &c->vm_list); 105 list_add_tail(&new->vm_list, &c->vm_list);
105 new->vm_start = addr; 106 new->vm_start = addr;
106 new->vm_end = addr + size; 107 new->vm_end = addr + size;
108 new->vm_active = 1;
107 109
108 spin_unlock_irqrestore(&consistent_lock, flags); 110 spin_unlock_irqrestore(&consistent_lock, flags);
109 return new; 111 return new;
@@ -120,7 +122,7 @@ static struct vm_region *vm_region_find(struct vm_region *head, unsigned long ad
120 struct vm_region *c; 122 struct vm_region *c;
121 123
122 list_for_each_entry(c, &head->vm_list, vm_list) { 124 list_for_each_entry(c, &head->vm_list, vm_list) {
123 if (c->vm_start == addr) 125 if (c->vm_active && c->vm_start == addr)
124 goto out; 126 goto out;
125 } 127 }
126 c = NULL; 128 c = NULL;
@@ -319,6 +321,7 @@ EXPORT_SYMBOL(dma_mmap_writecombine);
319 321
320/* 322/*
321 * free a page as defined by the above mapping. 323 * free a page as defined by the above mapping.
324 * Must not be called with IRQs disabled.
322 */ 325 */
323void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle) 326void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
324{ 327{
@@ -326,14 +329,18 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
326 unsigned long flags, addr; 329 unsigned long flags, addr;
327 pte_t *ptep; 330 pte_t *ptep;
328 331
332 WARN_ON(irqs_disabled());
333
329 size = PAGE_ALIGN(size); 334 size = PAGE_ALIGN(size);
330 335
331 spin_lock_irqsave(&consistent_lock, flags); 336 spin_lock_irqsave(&consistent_lock, flags);
332
333 c = vm_region_find(&consistent_head, (unsigned long)cpu_addr); 337 c = vm_region_find(&consistent_head, (unsigned long)cpu_addr);
334 if (!c) 338 if (!c)
335 goto no_area; 339 goto no_area;
336 340
341 c->vm_active = 0;
342 spin_unlock_irqrestore(&consistent_lock, flags);
343
337 if ((c->vm_end - c->vm_start) != size) { 344 if ((c->vm_end - c->vm_start) != size) {
338 printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n", 345 printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n",
339 __func__, c->vm_end - c->vm_start, size); 346 __func__, c->vm_end - c->vm_start, size);
@@ -372,8 +379,8 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
372 379
373 flush_tlb_kernel_range(c->vm_start, c->vm_end); 380 flush_tlb_kernel_range(c->vm_start, c->vm_end);
374 381
382 spin_lock_irqsave(&consistent_lock, flags);
375 list_del(&c->vm_list); 383 list_del(&c->vm_list);
376
377 spin_unlock_irqrestore(&consistent_lock, flags); 384 spin_unlock_irqrestore(&consistent_lock, flags);
378 385
379 kfree(c); 386 kfree(c);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 048c9c19aa4f..465487470d0e 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Fri Nov 11 21:55:04 2005 15# Last update: Fri Nov 25 14:43:04 2005
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -857,12 +857,12 @@ osiris MACH_OSIRIS OSIRIS 842
857maestro MACH_MAESTRO MAESTRO 843 857maestro MACH_MAESTRO MAESTRO 843
858tunge2 MACH_TUNGE2 TUNGE2 844 858tunge2 MACH_TUNGE2 TUNGE2 844
859ixbbm MACH_IXBBM IXBBM 845 859ixbbm MACH_IXBBM IXBBM 845
860mx27 MACH_MX27 MX27 846 860mx27ads MACH_MX27 MX27 846
861ax8004 MACH_AX8004 AX8004 847 861ax8004 MACH_AX8004 AX8004 847
862at91sam9261ek MACH_AT91SAM9261EK AT91SAM9261EK 848 862at91sam9261ek MACH_AT91SAM9261EK AT91SAM9261EK 848
863loft MACH_LOFT LOFT 849 863loft MACH_LOFT LOFT 849
864magpie MACH_MAGPIE MAGPIE 850 864magpie MACH_MAGPIE MAGPIE 850
865mx21 MACH_MX21 MX21 851 865mx21ads MACH_MX21 MX21 851
866mb87m3400 MACH_MB87M3400 MB87M3400 852 866mb87m3400 MACH_MB87M3400 MB87M3400 852
867mguard_delta MACH_MGUARD_DELTA MGUARD_DELTA 853 867mguard_delta MACH_MGUARD_DELTA MGUARD_DELTA 853
868davinci_dvdp MACH_DAVINCI_DVDP DAVINCI_DVDP 854 868davinci_dvdp MACH_DAVINCI_DVDP DAVINCI_DVDP 854
@@ -897,10 +897,16 @@ omi_board MACH_OMI_BOARD OMI_BOARD 882
897mx21civ MACH_MX21CIV MX21CIV 883 897mx21civ MACH_MX21CIV MX21CIV 883
898mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884 898mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884
899xscale_palmtx MACH_XSCALE_PALMTX XSCALE_PALMTX 885 899xscale_palmtx MACH_XSCALE_PALMTX XSCALE_PALMTX 885
900arch_s3c2413 MACH_ARCH_S3C2413 ARCH_S3C2413 886
901s3c2413 MACH_S3C2413 S3C2413 887 900s3c2413 MACH_S3C2413 S3C2413 887
902samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888 901samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888
903wg302v1 MACH_WG302V1 WG302V1 889 902wg302v1 MACH_WG302V1 WG302V1 889
904wg302v2 MACH_WG302V2 WG302V2 890 903wg302v2 MACH_WG302V2 WG302V2 890
905eb42x MACH_EB42X EB42X 891 904eb42x MACH_EB42X EB42X 891
906iq331es MACH_IQ331ES IQ331ES 892 905iq331es MACH_IQ331ES IQ331ES 892
906cosydsp MACH_COSYDSP COSYDSP 893
907uplat7d MACH_UPLAT7D UPLAT7D 894
908ptdavinci MACH_PTDAVINCI PTDAVINCI 895
909mbus MACH_MBUS MBUS 896
910nadia2vb MACH_NADIA2VB NADIA2VB 897
911r1000 MACH_R1000 R1000 898
912hw90250 MACH_HW90250 HW90250 899
diff --git a/arch/frv/kernel/semaphore.c b/arch/frv/kernel/semaphore.c
index 5cba9c1f2b3d..7971d680ae29 100644
--- a/arch/frv/kernel/semaphore.c
+++ b/arch/frv/kernel/semaphore.c
@@ -20,7 +20,7 @@ struct sem_waiter {
20 struct task_struct *task; 20 struct task_struct *task;
21}; 21};
22 22
23#if SEM_DEBUG 23#if SEMAPHORE_DEBUG
24void semtrace(struct semaphore *sem, const char *str) 24void semtrace(struct semaphore *sem, const char *str)
25{ 25{
26 if (sem->debug) 26 if (sem->debug)
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index af981bda015c..24622d89b1ca 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -60,7 +60,7 @@ void __init pcibios_fixup_irqs(void)
60 } 60 }
61} 61}
62 62
63void __init pcibios_penalize_isa_irq(int irq, int active) 63void __init pcibios_penalize_isa_irq(int irq)
64{ 64{
65} 65}
66 66
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 79433159b5f0..765088ea8a50 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -108,7 +108,7 @@ void __init paging_init(void)
108 108
109 memset((void *) empty_zero_page, 0, PAGE_SIZE); 109 memset((void *) empty_zero_page, 0, PAGE_SIZE);
110 110
111#if CONFIG_HIGHMEM 111#ifdef CONFIG_HIGHMEM
112 if (num_physpages - num_mappedpages) { 112 if (num_physpages - num_mappedpages) {
113 pgd_t *pge; 113 pgd_t *pge;
114 pud_t *pue; 114 pud_t *pue;
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c
index 2c67dfe5a6b3..f76dd03ddd99 100644
--- a/arch/frv/mm/pgalloc.c
+++ b/arch/frv/mm/pgalloc.c
@@ -85,7 +85,7 @@ static inline void pgd_list_add(pgd_t *pgd)
85 struct page *page = virt_to_page(pgd); 85 struct page *page = virt_to_page(pgd);
86 page->index = (unsigned long) pgd_list; 86 page->index = (unsigned long) pgd_list;
87 if (pgd_list) 87 if (pgd_list)
88 pgd_list->private = (unsigned long) &page->index; 88 set_page_private(pgd_list, (unsigned long) &page->index);
89 pgd_list = page; 89 pgd_list = page;
90 set_page_private(page, (unsigned long)&pgd_list); 90 set_page_private(page, (unsigned long)&pgd_list);
91} 91}
@@ -94,10 +94,10 @@ static inline void pgd_list_del(pgd_t *pgd)
94{ 94{
95 struct page *next, **pprev, *page = virt_to_page(pgd); 95 struct page *next, **pprev, *page = virt_to_page(pgd);
96 next = (struct page *) page->index; 96 next = (struct page *) page->index;
97 pprev = (struct page **)page_private(page); 97 pprev = (struct page **) page_private(page);
98 *pprev = next; 98 *pprev = next;
99 if (next) 99 if (next)
100 next->private = (unsigned long) pprev; 100 set_page_private(next, (unsigned long) pprev);
101} 101}
102 102
103void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused) 103void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused)
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index f36677241ecd..76b1135d401a 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -248,9 +248,7 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
248 248
249 acpi_table_print_madt_entry(header); 249 acpi_table_print_madt_entry(header);
250 250
251 /* no utility in registering a disabled processor */ 251 /* Register even disabled CPUs for cpu hotplug */
252 if (processor->flags.enabled == 0)
253 return 0;
254 252
255 x86_acpiid_to_apicid[processor->acpi_id] = processor->id; 253 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
256 254
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 8f767d9aa45d..1ca5269b1e86 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -220,8 +220,9 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
220 num_processors++; 220 num_processors++;
221 221
222 if ((num_processors > 8) && 222 if ((num_processors > 8) &&
223 APIC_XAPIC(ver) && 223 ((APIC_XAPIC(ver) &&
224 (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) 224 (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) ||
225 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)))
225 def_to_bigsmp = 1; 226 def_to_bigsmp = 1;
226 else 227 else
227 def_to_bigsmp = 0; 228 def_to_bigsmp = 0;
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 1cb261f225d5..df6c2bcde067 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -393,13 +393,6 @@ void flush_thread(void)
393{ 393{
394 struct task_struct *tsk = current; 394 struct task_struct *tsk = current;
395 395
396 /*
397 * Remove function-return probe instances associated with this task
398 * and put them back on the free list. Do not insert an exit probe for
399 * this function, it will be disabled by kprobe_flush_task if you do.
400 */
401 kprobe_flush_task(tsk);
402
403 memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8); 396 memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8);
404 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); 397 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
405 /* 398 /*
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index c96bea14b98f..f6bc48da4d2a 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -132,7 +132,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
132 } 132 }
133 } 133 }
134 134
135 printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); 135 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
136 136
137 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, NULL); 137 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, NULL);
138} 138}
@@ -144,7 +144,7 @@ static int __init pcibios_init(void)
144 struct cpuinfo_x86 *c = &boot_cpu_data; 144 struct cpuinfo_x86 *c = &boot_cpu_data;
145 145
146 if (!raw_pci_ops) { 146 if (!raw_pci_ops) {
147 printk("PCI: System does not support PCI\n"); 147 printk(KERN_WARNING "PCI: System does not support PCI\n");
148 return 0; 148 return 0;
149 } 149 }
150 150
diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
index 30b7e9b4f6a2..94331d6be7a3 100644
--- a/arch/i386/pci/direct.c
+++ b/arch/i386/pci/direct.c
@@ -201,7 +201,7 @@ static int __init pci_sanity_check(struct pci_raw_ops *o)
201 return 1; 201 return 1;
202 } 202 }
203 203
204 DBG("PCI: Sanity check failed\n"); 204 DBG(KERN_WARNING "PCI: Sanity check failed\n");
205 return 0; 205 return 0;
206} 206}
207 207
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
index 6d6338500c3c..ed2c8c899bd3 100644
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -221,6 +221,11 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask)
221 continue; 221 continue;
222 222
223 r = &dev->resource[idx]; 223 r = &dev->resource[idx];
224 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
225 continue;
226 if ((idx == PCI_ROM_RESOURCE) &&
227 (!(r->flags & IORESOURCE_ROM_ENABLE)))
228 continue;
224 if (!r->start && r->end) { 229 if (!r->start && r->end) {
225 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 230 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
226 return -EINVAL; 231 return -EINVAL;
@@ -230,8 +235,6 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask)
230 if (r->flags & IORESOURCE_MEM) 235 if (r->flags & IORESOURCE_MEM)
231 cmd |= PCI_COMMAND_MEMORY; 236 cmd |= PCI_COMMAND_MEMORY;
232 } 237 }
233 if (dev->resource[PCI_ROM_RESOURCE].start)
234 cmd |= PCI_COMMAND_MEMORY;
235 if (cmd != old_cmd) { 238 if (cmd != old_cmd) {
236 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 239 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
237 pci_write_config_word(dev, PCI_COMMAND, cmd); 240 pci_write_config_word(dev, PCI_COMMAND, cmd);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 4305d2ba76f6..2e33665d9c18 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -718,13 +718,6 @@ kernel_thread_helper (int (*fn)(void *), void *arg)
718void 718void
719flush_thread (void) 719flush_thread (void)
720{ 720{
721 /*
722 * Remove function-return probe instances associated with this task
723 * and put them back on the free list. Do not insert an exit probe for
724 * this function, it will be disabled by kprobe_flush_task if you do.
725 */
726 kprobe_flush_task(current);
727
728 /* drop floating-point and debug-register state if it exists: */ 721 /* drop floating-point and debug-register state if it exists: */
729 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); 722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
730 ia64_drop_fpu(current); 723 ia64_drop_fpu(current);
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index d71f4de44f79..dd73c0cb754b 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -137,6 +137,7 @@ retry_bteop:
137 bte = bte_if_on_node(nasid_to_try[nasid_index],bte_if_index); 137 bte = bte_if_on_node(nasid_to_try[nasid_index],bte_if_index);
138 138
139 if (bte == NULL) { 139 if (bte == NULL) {
140 nasid_index++;
140 continue; 141 continue;
141 } 142 }
142 143
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 49b530c39a42..5d54f5f4e926 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -492,6 +492,9 @@ static struct proc_dir_entry *proc_sn2_ptc;
492 492
493static int __init sn2_ptc_init(void) 493static int __init sn2_ptc_init(void)
494{ 494{
495 if (!ia64_platform_is("sn2"))
496 return -ENOSYS;
497
495 if (!(proc_sn2_ptc = create_proc_entry(PTC_BASENAME, 0444, NULL))) { 498 if (!(proc_sn2_ptc = create_proc_entry(PTC_BASENAME, 0444, NULL))) {
496 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME); 499 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME);
497 return -EINVAL; 500 return -EINVAL;
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 6c6fbca3229c..19b54fbcd7ea 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -743,13 +743,14 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg)
743 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { 743 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
744 memset(p, 0, a.sz); 744 memset(p, 0, a.sz);
745 for (i = 0; i < nobj; i++) { 745 for (i = 0; i < nobj; i++) {
746 int cpuobj_index = 0;
746 if (!SN_HWPERF_IS_NODE(objs + i)) 747 if (!SN_HWPERF_IS_NODE(objs + i))
747 continue; 748 continue;
748 node = sn_hwperf_obj_to_cnode(objs + i); 749 node = sn_hwperf_obj_to_cnode(objs + i);
749 for_each_online_cpu(j) { 750 for_each_online_cpu(j) {
750 if (node != cpu_to_node(j)) 751 if (node != cpu_to_node(j))
751 continue; 752 continue;
752 cpuobj = (struct sn_hwperf_object_info *) p + j; 753 cpuobj = (struct sn_hwperf_object_info *) p + cpuobj_index++;
753 slice = 'a' + cpuid_to_slice(j); 754 slice = 'a' + cpuid_to_slice(j);
754 cdata = cpu_data(j); 755 cdata = cpu_data(j);
755 cpuobj->id = j; 756 cpuobj->id = j;
diff --git a/arch/m32r/kernel/io_mappi3.c b/arch/m32r/kernel/io_mappi3.c
index 6716ffea769a..f80321a58764 100644
--- a/arch/m32r/kernel/io_mappi3.c
+++ b/arch/m32r/kernel/io_mappi3.c
@@ -36,12 +36,13 @@ static inline void *_port2addr(unsigned long port)
36 return (void *)(port + NONCACHE_OFFSET); 36 return (void *)(port + NONCACHE_OFFSET);
37} 37}
38 38
39#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 39#if defined(CONFIG_IDE)
40static inline void *__port2addr_ata(unsigned long port) 40static inline void *__port2addr_ata(unsigned long port)
41{ 41{
42 static int dummy_reg; 42 static int dummy_reg;
43 43
44 switch (port) { 44 switch (port) {
45 /* IDE0 CF */
45 case 0x1f0: return (void *)0xb4002000; 46 case 0x1f0: return (void *)0xb4002000;
46 case 0x1f1: return (void *)0xb4012800; 47 case 0x1f1: return (void *)0xb4012800;
47 case 0x1f2: return (void *)0xb4012002; 48 case 0x1f2: return (void *)0xb4012002;
@@ -51,6 +52,17 @@ static inline void *__port2addr_ata(unsigned long port)
51 case 0x1f6: return (void *)0xb4012006; 52 case 0x1f6: return (void *)0xb4012006;
52 case 0x1f7: return (void *)0xb4012806; 53 case 0x1f7: return (void *)0xb4012806;
53 case 0x3f6: return (void *)0xb401200e; 54 case 0x3f6: return (void *)0xb401200e;
55 /* IDE1 IDE */
56 case 0x170: return (void *)0xb4810000; /* Data 16bit */
57 case 0x171: return (void *)0xb4810002; /* Features / Error */
58 case 0x172: return (void *)0xb4810004; /* Sector count */
59 case 0x173: return (void *)0xb4810006; /* Sector number */
60 case 0x174: return (void *)0xb4810008; /* Cylinder low */
61 case 0x175: return (void *)0xb481000a; /* Cylinder high */
62 case 0x176: return (void *)0xb481000c; /* Device head */
63 case 0x177: return (void *)0xb481000e; /* Command */
64 case 0x376: return (void *)0xb480800c; /* Device control / Alt status */
65
54 default: return (void *)&dummy_reg; 66 default: return (void *)&dummy_reg;
55 } 67 }
56} 68}
@@ -108,8 +120,9 @@ unsigned char _inb(unsigned long port)
108{ 120{
109 if (port >= LAN_IOSTART && port < LAN_IOEND) 121 if (port >= LAN_IOSTART && port < LAN_IOEND)
110 return _ne_inb(PORT2ADDR_NE(port)); 122 return _ne_inb(PORT2ADDR_NE(port));
111#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 123#if defined(CONFIG_IDE)
112 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 124 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
125 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
113 return *(volatile unsigned char *)__port2addr_ata(port); 126 return *(volatile unsigned char *)__port2addr_ata(port);
114 } 127 }
115#endif 128#endif
@@ -127,8 +140,9 @@ unsigned short _inw(unsigned long port)
127{ 140{
128 if (port >= LAN_IOSTART && port < LAN_IOEND) 141 if (port >= LAN_IOSTART && port < LAN_IOEND)
129 return _ne_inw(PORT2ADDR_NE(port)); 142 return _ne_inw(PORT2ADDR_NE(port));
130#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 143#if defined(CONFIG_IDE)
131 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 144 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
145 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
132 return *(volatile unsigned short *)__port2addr_ata(port); 146 return *(volatile unsigned short *)__port2addr_ata(port);
133 } 147 }
134#endif 148#endif
@@ -185,8 +199,9 @@ void _outb(unsigned char b, unsigned long port)
185 if (port >= LAN_IOSTART && port < LAN_IOEND) 199 if (port >= LAN_IOSTART && port < LAN_IOEND)
186 _ne_outb(b, PORT2ADDR_NE(port)); 200 _ne_outb(b, PORT2ADDR_NE(port));
187 else 201 else
188#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 202#if defined(CONFIG_IDE)
189 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 203 if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
204 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
190 *(volatile unsigned char *)__port2addr_ata(port) = b; 205 *(volatile unsigned char *)__port2addr_ata(port) = b;
191 } else 206 } else
192#endif 207#endif
@@ -203,8 +218,9 @@ void _outw(unsigned short w, unsigned long port)
203 if (port >= LAN_IOSTART && port < LAN_IOEND) 218 if (port >= LAN_IOSTART && port < LAN_IOEND)
204 _ne_outw(w, PORT2ADDR_NE(port)); 219 _ne_outw(w, PORT2ADDR_NE(port));
205 else 220 else
206#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 221#if defined(CONFIG_IDE)
207 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 222 if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
223 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
208 *(volatile unsigned short *)__port2addr_ata(port) = w; 224 *(volatile unsigned short *)__port2addr_ata(port) = w;
209 } else 225 } else
210#endif 226#endif
@@ -253,8 +269,9 @@ void _insb(unsigned int port, void * addr, unsigned long count)
253{ 269{
254 if (port >= LAN_IOSTART && port < LAN_IOEND) 270 if (port >= LAN_IOSTART && port < LAN_IOEND)
255 _ne_insb(PORT2ADDR_NE(port), addr, count); 271 _ne_insb(PORT2ADDR_NE(port), addr, count);
256#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 272#if defined(CONFIG_IDE)
257 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 273 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
274 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
258 unsigned char *buf = addr; 275 unsigned char *buf = addr;
259 unsigned char *portp = __port2addr_ata(port); 276 unsigned char *portp = __port2addr_ata(port);
260 while (count--) 277 while (count--)
@@ -289,8 +306,9 @@ void _insw(unsigned int port, void * addr, unsigned long count)
289 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), 306 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short),
290 count, 1); 307 count, 1);
291#endif 308#endif
292#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 309#if defined(CONFIG_IDE)
293 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 310 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
311 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
294 portp = __port2addr_ata(port); 312 portp = __port2addr_ata(port);
295 while (count--) 313 while (count--)
296 *buf++ = *(volatile unsigned short *)portp; 314 *buf++ = *(volatile unsigned short *)portp;
@@ -321,8 +339,9 @@ void _outsb(unsigned int port, const void * addr, unsigned long count)
321 portp = PORT2ADDR_NE(port); 339 portp = PORT2ADDR_NE(port);
322 while (count--) 340 while (count--)
323 _ne_outb(*buf++, portp); 341 _ne_outb(*buf++, portp);
324#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 342#if defined(CONFIG_IDE)
325 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 343 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
344 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
326 portp = __port2addr_ata(port); 345 portp = __port2addr_ata(port);
327 while (count--) 346 while (count--)
328 *(volatile unsigned char *)portp = *buf++; 347 *(volatile unsigned char *)portp = *buf++;
@@ -348,8 +367,9 @@ void _outsw(unsigned int port, const void * addr, unsigned long count)
348 portp = PORT2ADDR_NE(port); 367 portp = PORT2ADDR_NE(port);
349 while (count--) 368 while (count--)
350 *(volatile unsigned short *)portp = *buf++; 369 *(volatile unsigned short *)portp = *buf++;
351#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 370#if defined(CONFIG_IDE)
352 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 371 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
372 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
353 portp = __port2addr_ata(port); 373 portp = __port2addr_ata(port);
354 while (count--) 374 while (count--)
355 *(volatile unsigned short *)portp = *buf++; 375 *(volatile unsigned short *)portp = *buf++;
diff --git a/arch/m32r/kernel/setup_mappi3.c b/arch/m32r/kernel/setup_mappi3.c
index 9c79341a7b45..f6ecdf7f555c 100644
--- a/arch/m32r/kernel/setup_mappi3.c
+++ b/arch/m32r/kernel/setup_mappi3.c
@@ -151,7 +151,7 @@ void __init init_IRQ(void)
151 disable_mappi3_irq(M32R_IRQ_INT1); 151 disable_mappi3_irq(M32R_IRQ_INT1);
152#endif /* CONFIG_USB */ 152#endif /* CONFIG_USB */
153 153
154 /* ICUCR40: CFC IREQ */ 154 /* CFC IREQ */
155 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 155 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type; 156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type;
157 irq_desc[PLD_IRQ_CFIREQ].action = 0; 157 irq_desc[PLD_IRQ_CFIREQ].action = 0;
@@ -160,7 +160,7 @@ void __init init_IRQ(void)
160 disable_mappi3_irq(PLD_IRQ_CFIREQ); 160 disable_mappi3_irq(PLD_IRQ_CFIREQ);
161 161
162#if defined(CONFIG_M32R_CFC) 162#if defined(CONFIG_M32R_CFC)
163 /* ICUCR41: CFC Insert */ 163 /* ICUCR41: CFC Insert & eject */
164 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 164 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
165 irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type; 165 irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type;
166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0; 166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
@@ -168,14 +168,16 @@ void __init init_IRQ(void)
168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; 168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
169 disable_mappi3_irq(PLD_IRQ_CFC_INSERT); 169 disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
170 170
171 /* ICUCR42: CFC Eject */
172 irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED;
173 irq_desc[PLD_IRQ_CFC_EJECT].handler = &mappi3_irq_type;
174 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
175 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
176 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
177 disable_mappi3_irq(PLD_IRQ_CFC_EJECT);
178#endif /* CONFIG_M32R_CFC */ 171#endif /* CONFIG_M32R_CFC */
172
173 /* IDE IREQ */
174 irq_desc[PLD_IRQ_IDEIREQ].status = IRQ_DISABLED;
175 irq_desc[PLD_IRQ_IDEIREQ].handler = &mappi3_irq_type;
176 irq_desc[PLD_IRQ_IDEIREQ].action = 0;
177 irq_desc[PLD_IRQ_IDEIREQ].depth = 1; /* disable nested irq */
178 icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
179 disable_mappi3_irq(PLD_IRQ_IDEIREQ);
180
179} 181}
180 182
181#if defined(CONFIG_SMC91X) 183#if defined(CONFIG_SMC91X)
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index e0500e12c5fb..fe55b28d3725 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -41,7 +41,8 @@ asmlinkage int sys_tas(int *addr)
41 return -EFAULT; 41 return -EFAULT;
42 local_irq_save(flags); 42 local_irq_save(flags);
43 oldval = *addr; 43 oldval = *addr;
44 *addr = 1; 44 if (!oldval)
45 *addr = 1;
45 local_irq_restore(flags); 46 local_irq_restore(flags);
46 return oldval; 47 return oldval;
47} 48}
@@ -59,7 +60,8 @@ asmlinkage int sys_tas(int *addr)
59 60
60 _raw_spin_lock(&tas_lock); 61 _raw_spin_lock(&tas_lock);
61 oldval = *addr; 62 oldval = *addr;
62 *addr = 1; 63 if (!oldval)
64 *addr = 1;
63 _raw_spin_unlock(&tas_lock); 65 _raw_spin_unlock(&tas_lock);
64 66
65 return oldval; 67 return oldval;
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 98f67c78d1bd..a13eb575f834 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -61,15 +61,17 @@ endif
61LDFLAGS_vmlinux := -Bstatic 61LDFLAGS_vmlinux := -Bstatic
62 62
63# The -Iarch/$(ARCH)/include is temporary while we are merging 63# The -Iarch/$(ARCH)/include is temporary while we are merging
64CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include 64CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include
65AFLAGS += -Iarch/$(ARCH) 65AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH)
66CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe
67CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 66CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
68CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple 67CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple
69CFLAGS += $(CFLAGS-y) 68CPPFLAGS += $(CPPFLAGS-y)
69AFLAGS += $(AFLAGS-y)
70CFLAGS += -msoft-float -pipe $(CFLAGS-y)
70CPP = $(CC) -E $(CFLAGS) 71CPP = $(CC) -E $(CFLAGS)
71# Temporary hack until we have migrated to asm-powerpc 72# Temporary hack until we have migrated to asm-powerpc
72LINUXINCLUDE += -Iarch/$(ARCH)/include 73LINUXINCLUDE-$(CONFIG_PPC32) := -Iarch/$(ARCH)/include
74LINUXINCLUDE += $(LINUXINCLUDE-y)
73 75
74CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ 76CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
75 77
@@ -173,11 +175,13 @@ archclean:
173 175
174archprepare: checkbin 176archprepare: checkbin
175 177
178ifeq ($(CONFIG_PPC32),y)
176# Temporary hack until we have migrated to asm-powerpc 179# Temporary hack until we have migrated to asm-powerpc
177include/asm: arch/$(ARCH)/include/asm 180include/asm: arch/$(ARCH)/include/asm
178arch/$(ARCH)/include/asm: FORCE 181arch/$(ARCH)/include/asm: FORCE
179 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi 182 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
180 $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm 183 $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
184endif
181 185
182# Use the file '.tmp_gas_check' for binutils tests, as gas won't output 186# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
183# to stdout and these checks are run even on install targets. 187# to stdout and these checks are run even on install targets.
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index de69fb37c731..a5a7542a8ff3 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -457,7 +457,6 @@ void flush_thread(void)
457 if (t->flags & _TIF_ABI_PENDING) 457 if (t->flags & _TIF_ABI_PENDING)
458 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); 458 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT);
459#endif 459#endif
460 kprobe_flush_task(current);
461 460
462#ifndef CONFIG_SMP 461#ifndef CONFIG_SMP
463 if (last_task_used_math == current) 462 if (last_task_used_math == current)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 0d4d8bec0df4..f0c47dab0903 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -145,8 +145,7 @@ static void dump_vdso_pages(struct vm_area_struct * vma)
145 struct page *pg = virt_to_page(vdso32_kbase + 145 struct page *pg = virt_to_page(vdso32_kbase +
146 i*PAGE_SIZE); 146 i*PAGE_SIZE);
147 struct page *upg = (vma && vma->vm_mm) ? 147 struct page *upg = (vma && vma->vm_mm) ?
148 follow_page(vma->vm_mm, vma->vm_start + 148 follow_page(vma, vma->vm_start + i*PAGE_SIZE, 0)
149 i*PAGE_SIZE, 0)
150 : NULL; 149 : NULL;
151 dump_one_vdso_page(pg, upg); 150 dump_one_vdso_page(pg, upg);
152 } 151 }
@@ -157,8 +156,7 @@ static void dump_vdso_pages(struct vm_area_struct * vma)
157 struct page *pg = virt_to_page(vdso64_kbase + 156 struct page *pg = virt_to_page(vdso64_kbase +
158 i*PAGE_SIZE); 157 i*PAGE_SIZE);
159 struct page *upg = (vma && vma->vm_mm) ? 158 struct page *upg = (vma && vma->vm_mm) ?
160 follow_page(vma->vm_mm, vma->vm_start + 159 follow_page(vma, vma->vm_start + i*PAGE_SIZE, 0)
161 i*PAGE_SIZE, 0)
162 : NULL; 160 : NULL;
163 dump_one_vdso_page(pg, upg); 161 dump_one_vdso_page(pg, upg);
164 } 162 }
@@ -285,8 +283,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
285 * It's fine to use that for setting breakpoints in the vDSO code 283 * It's fine to use that for setting breakpoints in the vDSO code
286 * pages though 284 * pages though
287 */ 285 */
288 vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | 286 vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
289 VM_MAYEXEC | VM_RESERVED;
290 vma->vm_flags |= mm->def_flags; 287 vma->vm_flags |= mm->def_flags;
291 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; 288 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
292 vma->vm_ops = &vdso_vmops; 289 vma->vm_ops = &vdso_vmops;
diff --git a/arch/powerpc/mm/4xx_mmu.c b/arch/powerpc/mm/4xx_mmu.c
index b7bcbc232f39..4d006aa1a0d1 100644
--- a/arch/powerpc/mm/4xx_mmu.c
+++ b/arch/powerpc/mm/4xx_mmu.c
@@ -110,13 +110,11 @@ unsigned long __init mmu_mapin_ram(void)
110 pmd_t *pmdp; 110 pmd_t *pmdp;
111 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE; 111 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
112 112
113 spin_lock(&init_mm.page_table_lock);
114 pmdp = pmd_offset(pgd_offset_k(v), v); 113 pmdp = pmd_offset(pgd_offset_k(v), v);
115 pmd_val(*pmdp++) = val; 114 pmd_val(*pmdp++) = val;
116 pmd_val(*pmdp++) = val; 115 pmd_val(*pmdp++) = val;
117 pmd_val(*pmdp++) = val; 116 pmd_val(*pmdp++) = val;
118 pmd_val(*pmdp++) = val; 117 pmd_val(*pmdp++) = val;
119 spin_unlock(&init_mm.page_table_lock);
120 118
121 v += LARGE_PAGE_SIZE_16M; 119 v += LARGE_PAGE_SIZE_16M;
122 p += LARGE_PAGE_SIZE_16M; 120 p += LARGE_PAGE_SIZE_16M;
@@ -127,10 +125,8 @@ unsigned long __init mmu_mapin_ram(void)
127 pmd_t *pmdp; 125 pmd_t *pmdp;
128 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE; 126 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE;
129 127
130 spin_lock(&init_mm.page_table_lock);
131 pmdp = pmd_offset(pgd_offset_k(v), v); 128 pmdp = pmd_offset(pgd_offset_k(v), v);
132 pmd_val(*pmdp) = val; 129 pmd_val(*pmdp) = val;
133 spin_unlock(&init_mm.page_table_lock);
134 130
135 v += LARGE_PAGE_SIZE_4M; 131 v += LARGE_PAGE_SIZE_4M;
136 p += LARGE_PAGE_SIZE_4M; 132 p += LARGE_PAGE_SIZE_4M;
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 426c269e552e..6bc9dbad7dea 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -287,15 +287,15 @@ static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas)
287 287
288int prepare_hugepage_range(unsigned long addr, unsigned long len) 288int prepare_hugepage_range(unsigned long addr, unsigned long len)
289{ 289{
290 int err; 290 int err = 0;
291 291
292 if ( (addr+len) < addr ) 292 if ( (addr+len) < addr )
293 return -EINVAL; 293 return -EINVAL;
294 294
295 if ((addr + len) < 0x100000000UL) 295 if (addr < 0x100000000UL)
296 err = open_low_hpage_areas(current->mm, 296 err = open_low_hpage_areas(current->mm,
297 LOW_ESID_MASK(addr, len)); 297 LOW_ESID_MASK(addr, len));
298 else 298 if ((addr + len) > 0x100000000UL)
299 err = open_high_hpage_areas(current->mm, 299 err = open_high_hpage_areas(current->mm,
300 HTLB_AREA_MASK(addr, len)); 300 HTLB_AREA_MASK(addr, len));
301 if (err) { 301 if (err) {
@@ -754,9 +754,7 @@ repeat:
754 } 754 }
755 755
756 /* 756 /*
757 * No need to use ldarx/stdcx here because all who 757 * No need to use ldarx/stdcx here
758 * might be updating the pte will hold the
759 * page_table_lock
760 */ 758 */
761 *ptep = __pte(new_pte & ~_PAGE_BUSY); 759 *ptep = __pte(new_pte & ~_PAGE_BUSY);
762 760
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 4bd7b0a70996..ed6ed2e30dac 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -495,7 +495,7 @@ EXPORT_SYMBOL(flush_icache_user_range);
495 * We use it to preload an HPTE into the hash table corresponding to 495 * We use it to preload an HPTE into the hash table corresponding to
496 * the updated linux PTE. 496 * the updated linux PTE.
497 * 497 *
498 * This must always be called with the mm->page_table_lock held 498 * This must always be called with the pte lock held.
499 */ 499 */
500void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, 500void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
501 pte_t pte) 501 pte_t pte)
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index 6c3dc3c44c86..ad580f3742e5 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -149,6 +149,12 @@ void flush_tlb_mm(struct mm_struct *mm)
149 return; 149 return;
150 } 150 }
151 151
152 /*
153 * It is safe to go down the mm's list of vmas when called
154 * from dup_mmap, holding mmap_sem. It would also be safe from
155 * unmap_region or exit_mmap, but not from vmtruncate on SMP -
156 * but it seems dup_mmap is the only SMP case which gets here.
157 */
152 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next) 158 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
153 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end); 159 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
154 FINISH_FLUSH; 160 FINISH_FLUSH;
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index 53e31b834ace..859d29a0cac5 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -95,7 +95,7 @@ static void pte_free_submit(struct pte_freelist_batch *batch)
95 95
96void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) 96void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
97{ 97{
98 /* This is safe as we are holding page_table_lock */ 98 /* This is safe since tlb_gather_mmu has disabled preemption */
99 cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id()); 99 cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
100 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); 100 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
101 101
@@ -206,7 +206,7 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
206 206
207void pte_free_finish(void) 207void pte_free_finish(void)
208{ 208{
209 /* This is safe as we are holding page_table_lock */ 209 /* This is safe since tlb_gather_mmu has disabled preemption */
210 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); 210 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
211 211
212 if (*batchp == NULL) 212 if (*batchp == NULL)
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index bf081b345820..2b54eeb2c899 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Rewrite, cleanup: 4 * Rewrite, cleanup:
5 * 5 *
6 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * 7 *
8 * Dynamic DMA mapping support, iSeries-specific parts. 8 * Dynamic DMA mapping support, iSeries-specific parts.
9 * 9 *
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 97ba5214417f..c78f2b290a73 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Rewrite, cleanup: 6 * Rewrite, cleanup:
7 * 7 *
8 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 8 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
9 * 9 *
10 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR. 10 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR.
11 * 11 *
diff --git a/arch/powerpc/sysdev/dart.h b/arch/powerpc/sysdev/dart.h
index ea8f0d9eed8a..33ed9ed7fc1e 100644
--- a/arch/powerpc/sysdev/dart.h
+++ b/arch/powerpc/sysdev/dart.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 2 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
diff --git a/arch/powerpc/sysdev/u3_iommu.c b/arch/powerpc/sysdev/u3_iommu.c
index f32baf7f4693..5c1a26a6d00c 100644
--- a/arch/powerpc/sysdev/u3_iommu.c
+++ b/arch/powerpc/sysdev/u3_iommu.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * arch/powerpc/sysdev/u3_iommu.c 2 * arch/powerpc/sysdev/u3_iommu.c
3 * 3 *
4 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
5 * 5 *
6 * Based on pSeries_iommu.c: 6 * Based on pSeries_iommu.c:
7 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 7 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
8 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 8 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
9 * 9 *
10 * Dynamic DMA mapping support, Apple U3 & IBM CPC925 "DART" iommu. 10 * Dynamic DMA mapping support, Apple U3 & IBM CPC925 "DART" iommu.
11 * 11 *
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index d0f2bd227c4c..d39c9f206271 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -252,7 +252,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
252 } 252 }
253 253
254 order = get_order(len_total); 254 order = get_order(len_total);
255 if ((va = __get_free_pages(GFP_KERNEL, order)) == 0) 255 if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
256 goto err_nopages; 256 goto err_nopages;
257 257
258 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) 258 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c
index 9604893ffdbd..2cb0728cee05 100644
--- a/arch/sparc/mm/generic.c
+++ b/arch/sparc/mm/generic.c
@@ -32,9 +32,7 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigne
32 if (end > PMD_SIZE) 32 if (end > PMD_SIZE)
33 end = PMD_SIZE; 33 end = PMD_SIZE;
34 do { 34 do {
35 pte_t oldpage = *pte; 35 set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space));
36 pte_clear(mm, address, pte);
37 set_pte(pte, mk_pte_io(offset, prot, space));
38 address += PAGE_SIZE; 36 address += PAGE_SIZE;
39 offset += PAGE_SIZE; 37 offset += PAGE_SIZE;
40 pte++; 38 pte++;
@@ -63,7 +61,7 @@ static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned
63} 61}
64 62
65int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 63int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
66 unsigned long pfn, unsigned long size, pgprot_t prot) 64 unsigned long pfn, unsigned long size, pgprot_t prot)
67{ 65{
68 int error = 0; 66 int error = 0;
69 pgd_t * dir; 67 pgd_t * dir;
@@ -74,7 +72,9 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
74 unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; 72 unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
75 73
76 /* See comment in mm/memory.c remap_pfn_range */ 74 /* See comment in mm/memory.c remap_pfn_range */
77 vma->vm_flags |= VM_IO | VM_RESERVED; 75 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
76 vma->vm_pgoff = (offset >> PAGE_SHIFT) |
77 ((unsigned long)space << 28UL);
78 78
79 prot = __pgprot(pg_iobits); 79 prot = __pgprot(pg_iobits);
80 offset -= from; 80 offset -= from;
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index 96b825055668..d95a1bcf163d 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -327,7 +327,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, size_t size, dma_addr_t *dvma
327 order = get_order(size); 327 order = get_order(size);
328 if (order >= 10) 328 if (order >= 10)
329 return NULL; 329 return NULL;
330 first_page = __get_free_pages(GFP_KERNEL, order); 330 first_page = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
331 if (first_page == 0UL) 331 if (first_page == 0UL)
332 return NULL; 332 return NULL;
333 memset((char *)first_page, 0, PAGE_SIZE << order); 333 memset((char *)first_page, 0, PAGE_SIZE << order);
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c
index 112c316e7cd2..d9396c1721cd 100644
--- a/arch/sparc64/mm/generic.c
+++ b/arch/sparc64/mm/generic.c
@@ -15,6 +15,15 @@
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
19{
20 pte_t pte;
21 pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) &
22 ~(unsigned long)_PAGE_CACHE);
23 pte_val(pte) |= (((unsigned long)space) << 32);
24 return pte;
25}
26
18/* Remap IO memory, the same way as remap_pfn_range(), but use 27/* Remap IO memory, the same way as remap_pfn_range(), but use
19 * the obio memory space. 28 * the obio memory space.
20 * 29 *
@@ -126,9 +135,13 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
126 struct mm_struct *mm = vma->vm_mm; 135 struct mm_struct *mm = vma->vm_mm;
127 int space = GET_IOSPACE(pfn); 136 int space = GET_IOSPACE(pfn);
128 unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; 137 unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
138 unsigned long phys_base;
139
140 phys_base = offset | (((unsigned long) space) << 32UL);
129 141
130 /* See comment in mm/memory.c remap_pfn_range */ 142 /* See comment in mm/memory.c remap_pfn_range */
131 vma->vm_flags |= VM_IO | VM_RESERVED; 143 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
144 vma->vm_pgoff = phys_base >> PAGE_SHIFT;
132 145
133 prot = __pgprot(pg_iobits); 146 prot = __pgprot(pg_iobits);
134 offset -= from; 147 offset -= from;
diff --git a/arch/um/Makefile b/arch/um/Makefile
index e55d32e903bc..1b12feeba368 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -17,7 +17,7 @@ core-y += $(ARCH_DIR)/kernel/ \
17 17
18# Have to precede the include because the included Makefiles reference them. 18# Have to precede the include because the included Makefiles reference them.
19SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \ 19SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \
20 module.h vm-flags.h elf.h 20 module.h vm-flags.h elf.h ldt.h
21SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header)) 21SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
22 22
23# XXX: The "os" symlink is only used by arch/um/include/os.h, which includes 23# XXX: The "os" symlink is only used by arch/um/include/os.h, which includes
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
index a49ceb199ee5..6ba8cbbe0d36 100644
--- a/arch/um/include/sysdep-i386/stub.h
+++ b/arch/um/include/sysdep-i386/stub.h
@@ -16,6 +16,15 @@ extern void stub_clone_handler(void);
16#define STUB_MMAP_NR __NR_mmap2 16#define STUB_MMAP_NR __NR_mmap2
17#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) 17#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT)
18 18
19static inline long stub_syscall0(long syscall)
20{
21 long ret;
22
23 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
24
25 return ret;
26}
27
19static inline long stub_syscall1(long syscall, long arg1) 28static inline long stub_syscall1(long syscall, long arg1)
20{ 29{
21 long ret; 30 long ret;
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h
index 2bd6e7a97286..c41689c13dc9 100644
--- a/arch/um/include/sysdep-x86_64/stub.h
+++ b/arch/um/include/sysdep-x86_64/stub.h
@@ -6,7 +6,6 @@
6#ifndef __SYSDEP_STUB_H 6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H 7#define __SYSDEP_STUB_H
8 8
9#include <asm/ptrace.h>
10#include <asm/unistd.h> 9#include <asm/unistd.h>
11#include <sysdep/ptrace_user.h> 10#include <sysdep/ptrace_user.h>
12 11
@@ -20,6 +19,17 @@ extern void stub_clone_handler(void);
20#define __syscall_clobber "r11","rcx","memory" 19#define __syscall_clobber "r11","rcx","memory"
21#define __syscall "syscall" 20#define __syscall "syscall"
22 21
22static inline long stub_syscall0(long syscall)
23{
24 long ret;
25
26 __asm__ volatile (__syscall
27 : "=a" (ret)
28 : "0" (syscall) : __syscall_clobber );
29
30 return ret;
31}
32
23static inline long stub_syscall2(long syscall, long arg1, long arg2) 33static inline long stub_syscall2(long syscall, long arg1, long arg2)
24{ 34{
25 long ret; 35 long ret;
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index 4dc55f10cd18..cb37ce9124a6 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -9,18 +9,24 @@
9#include "stub-data.h" 9#include "stub-data.h"
10#include "uml-config.h" 10#include "uml-config.h"
11#include "sysdep/stub.h" 11#include "sysdep/stub.h"
12#include "kern_constants.h"
12 13
13/* This is in a separate file because it needs to be compiled with any 14/* This is in a separate file because it needs to be compiled with any
14 * extraneous gcc flags (-pg, -fprofile-arcs, -ftest-coverage) disabled 15 * extraneous gcc flags (-pg, -fprofile-arcs, -ftest-coverage) disabled
16 *
17 * Use UM_KERN_PAGE_SIZE instead of PAGE_SIZE because that calls getpagesize
18 * on some systems.
15 */ 19 */
20
21#define STUB_DATA(field) (((struct stub_data *) UML_CONFIG_STUB_DATA)->field)
22
16void __attribute__ ((__section__ (".__syscall_stub"))) 23void __attribute__ ((__section__ (".__syscall_stub")))
17stub_clone_handler(void) 24stub_clone_handler(void)
18{ 25{
19 long err; 26 long err;
20 struct stub_data *from = (struct stub_data *) UML_CONFIG_STUB_DATA;
21 27
22 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, 28 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
23 UML_CONFIG_STUB_DATA + PAGE_SIZE / 2 - 29 UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE / 2 -
24 sizeof(void *)); 30 sizeof(void *));
25 if(err != 0) 31 if(err != 0)
26 goto out; 32 goto out;
@@ -30,15 +36,16 @@ stub_clone_handler(void)
30 goto out; 36 goto out;
31 37
32 err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL, 38 err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
33 (long) &from->timer, 0); 39 (long) &STUB_DATA(timer), 0);
34 if(err) 40 if(err)
35 goto out; 41 goto out;
36 42
37 err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA, PAGE_SIZE, 43 err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA,
38 PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, 44 UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
39 from->fd, from->offset); 45 MAP_FIXED | MAP_SHARED, STUB_DATA(fd),
46 STUB_DATA(offset));
40 out: 47 out:
41 /* save current result. Parent: pid; child: retcode of mmap */ 48 /* save current result. Parent: pid; child: retcode of mmap */
42 from->err = err; 49 STUB_DATA(err) = err;
43 trap_myself(); 50 trap_myself();
44} 51}
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 6dfeb70f6957..150059dbee12 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -5,7 +5,7 @@ obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
5obj-$(CONFIG_HIGHMEM) += highmem.o 5obj-$(CONFIG_HIGHMEM) += highmem.o
6obj-$(CONFIG_MODULES) += module.o 6obj-$(CONFIG_MODULES) += module.o
7 7
8USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o 8USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o stub_segv.o
9 9
10SYMLINKS = bitops.c semaphore.c highmem.c module.c 10SYMLINKS = bitops.c semaphore.c highmem.c module.c
11 11
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 6360f1c958d0..17746b4c08ff 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -228,7 +228,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
228 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES; 228 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
229 if(size > bytecount) 229 if(size > bytecount)
230 size = bytecount; 230 size = bytecount;
231 if(copy_to_user(ptr, ldt->entries, size)) 231 if(copy_to_user(ptr, ldt->u.entries, size))
232 err = -EFAULT; 232 err = -EFAULT;
233 bytecount -= size; 233 bytecount -= size;
234 ptr += size; 234 ptr += size;
@@ -239,7 +239,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
239 size = PAGE_SIZE; 239 size = PAGE_SIZE;
240 if(size > bytecount) 240 if(size > bytecount)
241 size = bytecount; 241 size = bytecount;
242 if(copy_to_user(ptr, ldt->pages[i], size)){ 242 if(copy_to_user(ptr, ldt->u.pages[i], size)){
243 err = -EFAULT; 243 err = -EFAULT;
244 break; 244 break;
245 } 245 }
@@ -321,10 +321,11 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
321 i*LDT_ENTRIES_PER_PAGE <= ldt_info.entry_number; 321 i*LDT_ENTRIES_PER_PAGE <= ldt_info.entry_number;
322 i++){ 322 i++){
323 if(i == 0) 323 if(i == 0)
324 memcpy(&entry0, ldt->entries, sizeof(entry0)); 324 memcpy(&entry0, ldt->u.entries,
325 ldt->pages[i] = (struct ldt_entry *) 325 sizeof(entry0));
326 __get_free_page(GFP_KERNEL|__GFP_ZERO); 326 ldt->u.pages[i] = (struct ldt_entry *)
327 if(!ldt->pages[i]){ 327 __get_free_page(GFP_KERNEL|__GFP_ZERO);
328 if(!ldt->u.pages[i]){
328 err = -ENOMEM; 329 err = -ENOMEM;
329 /* Undo the change in host */ 330 /* Undo the change in host */
330 memset(&ldt_info, 0, sizeof(ldt_info)); 331 memset(&ldt_info, 0, sizeof(ldt_info));
@@ -332,8 +333,9 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
332 goto out_unlock; 333 goto out_unlock;
333 } 334 }
334 if(i == 0) { 335 if(i == 0) {
335 memcpy(ldt->pages[0], &entry0, sizeof(entry0)); 336 memcpy(ldt->u.pages[0], &entry0,
336 memcpy(ldt->pages[0]+1, ldt->entries+1, 337 sizeof(entry0));
338 memcpy(ldt->u.pages[0]+1, ldt->u.entries+1,
337 sizeof(entry0)*(LDT_DIRECT_ENTRIES-1)); 339 sizeof(entry0)*(LDT_DIRECT_ENTRIES-1));
338 } 340 }
339 ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE; 341 ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE;
@@ -343,9 +345,9 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
343 ldt->entry_count = ldt_info.entry_number + 1; 345 ldt->entry_count = ldt_info.entry_number + 1;
344 346
345 if(ldt->entry_count <= LDT_DIRECT_ENTRIES) 347 if(ldt->entry_count <= LDT_DIRECT_ENTRIES)
346 ldt_p = ldt->entries + ldt_info.entry_number; 348 ldt_p = ldt->u.entries + ldt_info.entry_number;
347 else 349 else
348 ldt_p = ldt->pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] + 350 ldt_p = ldt->u.pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] +
349 ldt_info.entry_number%LDT_ENTRIES_PER_PAGE; 351 ldt_info.entry_number%LDT_ENTRIES_PER_PAGE;
350 352
351 if(ldt_info.base_addr == 0 && ldt_info.limit == 0 && 353 if(ldt_info.base_addr == 0 && ldt_info.limit == 0 &&
@@ -501,8 +503,8 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
501 */ 503 */
502 down(&from_mm->ldt.semaphore); 504 down(&from_mm->ldt.semaphore);
503 if(from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES){ 505 if(from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES){
504 memcpy(new_mm->ldt.entries, from_mm->ldt.entries, 506 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
505 sizeof(new_mm->ldt.entries)); 507 sizeof(new_mm->ldt.u.entries));
506 } 508 }
507 else{ 509 else{
508 i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 510 i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
@@ -512,9 +514,10 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
512 err = -ENOMEM; 514 err = -ENOMEM;
513 break; 515 break;
514 } 516 }
515 new_mm->ldt.pages[i] = (struct ldt_entry*)page; 517 new_mm->ldt.u.pages[i] =
516 memcpy(new_mm->ldt.pages[i], 518 (struct ldt_entry *) page;
517 from_mm->ldt.pages[i], PAGE_SIZE); 519 memcpy(new_mm->ldt.u.pages[i],
520 from_mm->ldt.u.pages[i], PAGE_SIZE);
518 } 521 }
519 } 522 }
520 new_mm->ldt.entry_count = from_mm->ldt.entry_count; 523 new_mm->ldt.entry_count = from_mm->ldt.entry_count;
@@ -532,7 +535,7 @@ void free_ldt(struct mmu_context_skas * mm)
532 if(!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES){ 535 if(!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES){
533 i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 536 i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
534 while(i-- > 0){ 537 while(i-- > 0){
535 free_page((long )mm->ldt.pages[i]); 538 free_page((long )mm->ldt.u.pages[i]);
536 } 539 }
537 } 540 }
538 mm->ldt.entry_count = 0; 541 mm->ldt.entry_count = 0;
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
index 1e88b275edac..a37f672ec964 100644
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -3,9 +3,11 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <asm/signal.h> 6#include <signal.h>
7#include <sys/select.h> /* The only way I can see to get sigset_t */
7#include <asm/unistd.h> 8#include <asm/unistd.h>
8#include "uml-config.h" 9#include "uml-config.h"
10#include "sysdep/stub.h"
9#include "sysdep/sigcontext.h" 11#include "sysdep/sigcontext.h"
10#include "sysdep/faultinfo.h" 12#include "sysdep/faultinfo.h"
11 13
@@ -13,13 +15,14 @@ void __attribute__ ((__section__ (".__syscall_stub")))
13stub_segv_handler(int sig) 15stub_segv_handler(int sig)
14{ 16{
15 struct sigcontext *sc = (struct sigcontext *) (&sig + 1); 17 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
18 int pid;
16 19
17 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 20 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
18 sc); 21 sc);
19 22
20 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); 23 pid = stub_syscall0(__NR_getpid);
21 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" 24 stub_syscall2(__NR_kill, pid, SIGUSR1);
22 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); 25
23 /* Load pointer to sigcontext into esp, since we need to leave 26 /* Load pointer to sigcontext into esp, since we need to leave
24 * the stack in its original form when we do the sigreturn here, by 27 * the stack in its original form when we do the sigreturn here, by
25 * hand. 28 * hand.
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index ea977df395a1..00b2025427df 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -12,7 +12,7 @@ lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \
12obj-y := ksyms.o 12obj-y := ksyms.o
13obj-$(CONFIG_MODULES) += module.o um_module.o 13obj-$(CONFIG_MODULES) += module.o um_module.o
14 14
15USER_OBJS := ptrace_user.o sigcontext.o 15USER_OBJS := ptrace_user.o sigcontext.o stub_segv.o
16 16
17SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c ldt.c memcpy.S \ 17SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c ldt.c memcpy.S \
18 thunk.S module.c 18 thunk.S module.c
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
index d1e53bdf2e85..a27099533198 100644
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -3,14 +3,14 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <asm/signal.h> 6#include <stddef.h>
7#include <signal.h>
7#include <linux/compiler.h> 8#include <linux/compiler.h>
8#include <asm/unistd.h> 9#include <asm/unistd.h>
9#include <asm/ucontext.h>
10#include "uml-config.h" 10#include "uml-config.h"
11#include "sysdep/sigcontext.h" 11#include "sysdep/sigcontext.h"
12#include "sysdep/faultinfo.h" 12#include "sysdep/faultinfo.h"
13#include <stddef.h> 13#include "sysdep/stub.h"
14 14
15/* Copied from sys-x86_64/signal.c - Can't find an equivalent definition 15/* Copied from sys-x86_64/signal.c - Can't find an equivalent definition
16 * in the libc headers anywhere. 16 * in the libc headers anywhere.
@@ -31,21 +31,21 @@ void __attribute__ ((__section__ (".__syscall_stub")))
31stub_segv_handler(int sig) 31stub_segv_handler(int sig)
32{ 32{
33 struct ucontext *uc; 33 struct ucontext *uc;
34 int pid;
34 35
35 __asm__("movq %%rdx, %0" : "=g" (uc) :); 36 __asm__("movq %%rdx, %0" : "=g" (uc) :);
36 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 37 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
37 &uc->uc_mcontext); 38 &uc->uc_mcontext);
38 39
39 __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid)); 40 pid = stub_syscall0(__NR_getpid);
40 __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;" 41 stub_syscall2(__NR_kill, pid, SIGUSR1);
41 "syscall": : "g" (__NR_kill), "g" (SIGUSR1) : 42
42 "%rdi", "%rax", "%rsi");
43 /* sys_sigreturn expects that the stack pointer will be 8 bytes into 43 /* sys_sigreturn expects that the stack pointer will be 8 bytes into
44 * the signal frame. So, we use the ucontext pointer, which we know 44 * the signal frame. So, we use the ucontext pointer, which we know
45 * already, to get the signal frame pointer, and add 8 to that. 45 * already, to get the signal frame pointer, and add 8 to that.
46 */ 46 */
47 __asm__("movq %0, %%rsp": : 47 __asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": :
48 "g" ((unsigned long) container_of(uc, struct rt_sigframe, 48 "g" ((unsigned long) container_of(uc, struct rt_sigframe,
49 uc) + 8)); 49 uc) + 8),
50 __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn)); 50 "g" (__NR_rt_sigreturn));
51} 51}
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 5afd63e8cef7..7519fc520eb3 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -351,13 +351,6 @@ void flush_thread(void)
351 struct task_struct *tsk = current; 351 struct task_struct *tsk = current;
352 struct thread_info *t = current_thread_info(); 352 struct thread_info *t = current_thread_info();
353 353
354 /*
355 * Remove function-return probe instances associated with this task
356 * and put them back on the free list. Do not insert an exit probe for
357 * this function, it will be disabled by kprobe_flush_task if you do.
358 */
359 kprobe_flush_task(tsk);
360
361 if (t->flags & _TIF_ABI_PENDING) 354 if (t->flags & _TIF_ABI_PENDING)
362 t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32); 355 t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32);
363 356
diff --git a/block/as-iosched.c b/block/as-iosched.c
index fbe050124ec5..43fa20495688 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1371,10 +1371,6 @@ static void as_add_request(request_queue_t *q, struct request *rq)
1371 struct as_rq *alias; 1371 struct as_rq *alias;
1372 int data_dir; 1372 int data_dir;
1373 1373
1374 if (arq->state != AS_RQ_PRESCHED) {
1375 printk("arq->state: %d\n", arq->state);
1376 WARN_ON(1);
1377 }
1378 arq->state = AS_RQ_NEW; 1374 arq->state = AS_RQ_NEW;
1379 1375
1380 if (rq_data_dir(arq->request) == READ 1376 if (rq_data_dir(arq->request) == READ
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 03204bfd17af..fa601b085eba 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,7 +133,7 @@ static struct kobj_type ktype_bus = {
133decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
134 134
135 135
136/* Manually detach a device from it's associated driver. */ 136/* Manually detach a device from its associated driver. */
137static int driver_helper(struct device *dev, void *data) 137static int driver_helper(struct device *dev, void *data)
138{ 138{
139 const char *name = data; 139 const char *name = data;
@@ -151,14 +151,13 @@ static ssize_t driver_unbind(struct device_driver *drv,
151 int err = -ENODEV; 151 int err = -ENODEV;
152 152
153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); 153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
154 if ((dev) && 154 if (dev && dev->driver == drv) {
155 (dev->driver == drv)) {
156 device_release_driver(dev); 155 device_release_driver(dev);
157 err = count; 156 err = count;
158 } 157 }
159 if (err) 158 put_device(dev);
160 return err; 159 put_bus(bus);
161 return count; 160 return err;
162} 161}
163static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); 162static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
164 163
@@ -175,16 +174,14 @@ static ssize_t driver_bind(struct device_driver *drv,
175 int err = -ENODEV; 174 int err = -ENODEV;
176 175
177 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); 176 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
178 if ((dev) && 177 if (dev && dev->driver == NULL) {
179 (dev->driver == NULL)) {
180 down(&dev->sem); 178 down(&dev->sem);
181 err = driver_probe_device(drv, dev); 179 err = driver_probe_device(drv, dev);
182 up(&dev->sem); 180 up(&dev->sem);
183 put_device(dev);
184 } 181 }
185 if (err) 182 put_device(dev);
186 return err; 183 put_bus(bus);
187 return count; 184 return err;
188} 185}
189static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 186static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
190 187
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 3565e9795301..3b419c9a1e7e 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -62,7 +62,6 @@ void device_bind_driver(struct device * dev)
62 * because we don't know the format of the ID structures, nor what 62 * because we don't know the format of the ID structures, nor what
63 * is to be considered a match and what is not. 63 * is to be considered a match and what is not.
64 * 64 *
65 *
66 * This function returns 1 if a match is found, an error if one 65 * This function returns 1 if a match is found, an error if one
67 * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. 66 * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
68 * 67 *
@@ -158,7 +157,6 @@ static int __driver_attach(struct device * dev, void * data)
158 driver_probe_device(drv, dev); 157 driver_probe_device(drv, dev);
159 up(&dev->sem); 158 up(&dev->sem);
160 159
161
162 return 0; 160 return 0;
163} 161}
164 162
@@ -225,15 +223,15 @@ void driver_detach(struct device_driver * drv)
225 struct device * dev; 223 struct device * dev;
226 224
227 for (;;) { 225 for (;;) {
228 spin_lock_irq(&drv->klist_devices.k_lock); 226 spin_lock(&drv->klist_devices.k_lock);
229 if (list_empty(&drv->klist_devices.k_list)) { 227 if (list_empty(&drv->klist_devices.k_list)) {
230 spin_unlock_irq(&drv->klist_devices.k_lock); 228 spin_unlock(&drv->klist_devices.k_lock);
231 break; 229 break;
232 } 230 }
233 dev = list_entry(drv->klist_devices.k_list.prev, 231 dev = list_entry(drv->klist_devices.k_list.prev,
234 struct device, knode_driver.n_node); 232 struct device, knode_driver.n_node);
235 get_device(dev); 233 get_device(dev);
236 spin_unlock_irq(&drv->klist_devices.k_lock); 234 spin_unlock(&drv->klist_devices.k_lock);
237 235
238 down(&dev->sem); 236 down(&dev->sem);
239 if (dev->driver == drv) 237 if (dev->driver == drv)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 13b8a9bed66e..f7e765a1d313 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3714,12 +3714,6 @@ static int floppy_open(struct inode *inode, struct file *filp)
3714 USETF(FD_VERIFY); 3714 USETF(FD_VERIFY);
3715 } 3715 }
3716 3716
3717 /* set underlying gendisk policy to reflect real ro/rw status */
3718 if (UTESTF(FD_DISK_WRITABLE))
3719 inode->i_bdev->bd_disk->policy = 0;
3720 else
3721 inode->i_bdev->bd_disk->policy = 1;
3722
3723 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) 3717 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL)))
3724 goto out2; 3718 goto out2;
3725 3719
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 76589782adcb..810679dcbbb0 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -416,7 +416,7 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data
416} 416}
417 417
418 418
419static struct aper_size_info_32 uli_sizes[7] = 419static const struct aper_size_info_32 uli_sizes[7] =
420{ 420{
421 {256, 65536, 6, 10}, 421 {256, 65536, 6, 10},
422 {128, 32768, 5, 9}, 422 {128, 32768, 5, 9},
@@ -470,7 +470,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
470} 470}
471 471
472 472
473static struct aper_size_info_32 nforce3_sizes[5] = 473static const struct aper_size_info_32 nforce3_sizes[5] =
474{ 474{
475 {512, 131072, 7, 0x00000000 }, 475 {512, 131072, 7, 0x00000000 },
476 {256, 65536, 6, 0x00000008 }, 476 {256, 65536, 6, 0x00000008 },
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 27bca34b4a65..80ee17a8fc23 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -97,7 +97,7 @@ void agp_backend_release(struct agp_bridge_data *bridge)
97EXPORT_SYMBOL(agp_backend_release); 97EXPORT_SYMBOL(agp_backend_release);
98 98
99 99
100static struct { int mem, agp; } maxes_table[] = { 100static const struct { int mem, agp; } maxes_table[] = {
101 {0, 0}, 101 {0, 0},
102 {32, 4}, 102 {32, 4},
103 {64, 28}, 103 {64, 28},
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index c847df575cf5..97b0a890ba7f 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -371,6 +371,11 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
371 .device_id = PCI_DEVICE_ID_VIA_3296_0, 371 .device_id = PCI_DEVICE_ID_VIA_3296_0,
372 .chipset_name = "P4M800", 372 .chipset_name = "P4M800",
373 }, 373 },
374 /* P4M800CE */
375 {
376 .device_id = PCI_DEVICE_ID_VIA_P4M800CE,
377 .chipset_name = "P4M800CE",
378 },
374 379
375 { }, /* dummy final entry, always present */ 380 { }, /* dummy final entry, always present */
376}; 381};
@@ -511,6 +516,7 @@ static struct pci_device_id agp_via_pci_table[] = {
511 ID(PCI_DEVICE_ID_VIA_3269_0), 516 ID(PCI_DEVICE_ID_VIA_3269_0),
512 ID(PCI_DEVICE_ID_VIA_83_87XX_1), 517 ID(PCI_DEVICE_ID_VIA_83_87XX_1),
513 ID(PCI_DEVICE_ID_VIA_3296_0), 518 ID(PCI_DEVICE_ID_VIA_3296_0),
519 ID(PCI_DEVICE_ID_VIA_P4M800CE),
514 { } 520 { }
515}; 521};
516 522
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c
index b276ae8a6633..b48a595d54ec 100644
--- a/drivers/char/drm/drm_lock.c
+++ b/drivers/char/drm/drm_lock.c
@@ -104,6 +104,10 @@ int drm_lock(struct inode *inode, struct file *filp,
104 __set_current_state(TASK_RUNNING); 104 __set_current_state(TASK_RUNNING);
105 remove_wait_queue(&dev->lock.lock_queue, &entry); 105 remove_wait_queue(&dev->lock.lock_queue, &entry);
106 106
107 DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
108 if (ret)
109 return ret;
110
107 sigemptyset(&dev->sigmask); 111 sigemptyset(&dev->sigmask);
108 sigaddset(&dev->sigmask, SIGSTOP); 112 sigaddset(&dev->sigmask, SIGSTOP);
109 sigaddset(&dev->sigmask, SIGTSTP); 113 sigaddset(&dev->sigmask, SIGTSTP);
@@ -116,8 +120,12 @@ int drm_lock(struct inode *inode, struct file *filp,
116 if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY)) 120 if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY))
117 dev->driver->dma_ready(dev); 121 dev->driver->dma_ready(dev);
118 122
119 if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) 123 if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) {
120 return dev->driver->dma_quiescent(dev); 124 if (dev->driver->dma_quiescent(dev)) {
125 DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context);
126 return DRM_ERR(EBUSY);
127 }
128 }
121 129
122 /* dev->driver->kernel_context_switch isn't used by any of the x86 130 /* dev->driver->kernel_context_switch isn't used by any of the x86
123 * drivers but is used by the Sparc driver. 131 * drivers but is used by the Sparc driver.
@@ -128,9 +136,7 @@ int drm_lock(struct inode *inode, struct file *filp,
128 dev->driver->kernel_context_switch(dev, dev->last_context, 136 dev->driver->kernel_context_switch(dev, dev->last_context,
129 lock.context); 137 lock.context);
130 } 138 }
131 DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); 139 return 0;
132
133 return ret;
134} 140}
135 141
136/** 142/**
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c
index 2c74155aa84f..abef2acf99f5 100644
--- a/drivers/char/drm/drm_memory.c
+++ b/drivers/char/drm/drm_memory.c
@@ -95,7 +95,7 @@ unsigned long drm_alloc_pages(int order, int area)
95 unsigned long addr; 95 unsigned long addr;
96 unsigned int sz; 96 unsigned int sz;
97 97
98 address = __get_free_pages(GFP_KERNEL, order); 98 address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
99 if (!address) 99 if (!address)
100 return 0; 100 return 0;
101 101
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h
index 4542353195bd..b370aca718d2 100644
--- a/drivers/char/drm/drm_memory_debug.h
+++ b/drivers/char/drm/drm_memory_debug.h
@@ -221,7 +221,7 @@ unsigned long DRM(alloc_pages) (int order, int area) {
221 } 221 }
222 spin_unlock(&DRM(mem_lock)); 222 spin_unlock(&DRM(mem_lock));
223 223
224 address = __get_free_pages(GFP_KERNEL, order); 224 address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
225 if (!address) { 225 if (!address) {
226 spin_lock(&DRM(mem_lock)); 226 spin_lock(&DRM(mem_lock));
227 ++DRM(mem_stats)[area].fail_count; 227 ++DRM(mem_stats)[area].fail_count;
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 0cc7c305a7f6..1713451a5cc6 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -161,7 +161,7 @@ static int mga_driver_device_is_agp(drm_device_t * dev)
161 * device. 161 * device.
162 */ 162 */
163 163
164 if ((pdev->device == 0x0525) 164 if ((pdev->device == 0x0525) && pdev->bus->self
165 && (pdev->bus->self->vendor == 0x3388) 165 && (pdev->bus->self->vendor == 0x3388)
166 && (pdev->bus->self->device == 0x0021)) { 166 && (pdev->bus->self->device == 0x0021)) {
167 return 0; 167 return 0;
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 120ee5a8ebcc..7bda7e33d2bd 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -214,8 +214,6 @@ typedef struct drm_radeon_private {
214 214
215 int microcode_version; 215 int microcode_version;
216 216
217 int is_pci;
218
219 struct { 217 struct {
220 u32 boxes; 218 u32 boxes;
221 int freelist_timeouts; 219 int freelist_timeouts;
@@ -275,6 +273,7 @@ typedef struct drm_radeon_private {
275 273
276 /* starting from here on, data is preserved accross an open */ 274 /* starting from here on, data is preserved accross an open */
277 uint32_t flags; /* see radeon_chip_flags */ 275 uint32_t flags; /* see radeon_chip_flags */
276 int is_pci;
278} drm_radeon_private_t; 277} drm_radeon_private_t;
279 278
280typedef struct drm_radeon_buf_priv { 279typedef struct drm_radeon_buf_priv {
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 23a63207d747..815902c2c856 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -693,8 +693,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
693 unsigned int cpu = sys_dev->id; 693 unsigned int cpu = sys_dev->id;
694 unsigned long flags; 694 unsigned long flags;
695 struct cpufreq_policy *data; 695 struct cpufreq_policy *data;
696 struct sys_device *cpu_sys_dev;
697#ifdef CONFIG_SMP 696#ifdef CONFIG_SMP
697 struct sys_device *cpu_sys_dev;
698 unsigned int j; 698 unsigned int j;
699#endif 699#endif
700 700
@@ -1113,21 +1113,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
1113{ 1113{
1114 int retval = -EINVAL; 1114 int retval = -EINVAL;
1115 1115
1116 /* 1116 lock_cpu_hotplug();
1117 * If we are already in context of hotplug thread, we dont need to
1118 * acquire the hotplug lock. Otherwise acquire cpucontrol to prevent
1119 * hotplug from removing this cpu that we are working on.
1120 */
1121 if (!current_in_cpu_hotplug())
1122 lock_cpu_hotplug();
1123
1124 dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, 1117 dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
1125 target_freq, relation); 1118 target_freq, relation);
1126 if (cpu_online(policy->cpu) && cpufreq_driver->target) 1119 if (cpu_online(policy->cpu) && cpufreq_driver->target)
1127 retval = cpufreq_driver->target(policy, target_freq, relation); 1120 retval = cpufreq_driver->target(policy, target_freq, relation);
1128 1121
1129 if (!current_in_cpu_hotplug()) 1122 unlock_cpu_hotplug();
1130 unlock_cpu_hotplug();
1131 1123
1132 return retval; 1124 return retval;
1133} 1125}
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index b6815c6c29a2..1e371a510dd2 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -60,6 +60,7 @@ config EFI_PCDP
60 60
61config DELL_RBU 61config DELL_RBU
62 tristate "BIOS update support for DELL systems via sysfs" 62 tristate "BIOS update support for DELL systems via sysfs"
63 depends on X86
63 select FW_LOADER 64 select FW_LOADER
64 help 65 help
65 Say m if you want to have the option of updating the BIOS for your 66 Say m if you want to have the option of updating the BIOS for your
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index c81bd4bce1b8..23a9e1ea8e32 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -570,7 +570,7 @@ static int __init hdaps_init(void)
570 hdaps_idev->evbit[0] = BIT(EV_ABS); 570 hdaps_idev->evbit[0] = BIT(EV_ABS);
571 input_set_abs_params(hdaps_idev, ABS_X, 571 input_set_abs_params(hdaps_idev, ABS_X,
572 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); 572 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
573 input_set_abs_params(hdaps_idev, ABS_X, 573 input_set_abs_params(hdaps_idev, ABS_Y,
574 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); 574 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
575 575
576 input_register_device(hdaps_idev); 576 input_register_device(hdaps_idev);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6c41e25e670b..a61f5d00f10a 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
522 struct i2c_client *client = to_i2c_client(dev); 522 struct i2c_client *client = to_i2c_client(dev);
523 struct it87_data *data = i2c_get_clientdata(client); 523 struct it87_data *data = i2c_get_clientdata(client);
524 int val = simple_strtol(buf, NULL, 10); 524 int val = simple_strtol(buf, NULL, 10);
525 u8 reg = it87_read_value(client, IT87_REG_FAN_DIV);
525 526
526 down(&data->update_lock); 527 down(&data->update_lock);
528 switch (nr) {
529 case 0: data->fan_div[nr] = reg & 0x07; break;
530 case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break;
531 case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break;
532 }
533
527 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); 534 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
528 it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); 535 it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]);
529 up(&data->update_lock); 536 up(&data->update_lock);
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index bde0cda9477e..78cdd506439f 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -451,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL);
451static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) 451static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
452{ 452{
453 struct lm78_data *data = lm78_update_device(dev); 453 struct lm78_data *data = lm78_update_device(dev);
454 return sprintf(buf, "%d\n", vid_from_reg(82, data->vid)); 454 return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82));
455} 455}
456static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 456static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
457 457
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 4e9a04e1f08e..bbb3dcde146b 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -456,7 +456,9 @@ static ssize_t store_regs_in_min0(struct device *dev, struct device_attribute *a
456 (w83627thf == data->type || w83637hf == data->type)) 456 (w83627thf == data->type || w83637hf == data->type))
457 457
458 /* use VRM9 calculation */ 458 /* use VRM9 calculation */
459 data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488); 459 data->in_min[0] =
460 SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0,
461 255);
460 else 462 else
461 /* use VRM8 (standard) calculation */ 463 /* use VRM8 (standard) calculation */
462 data->in_min[0] = IN_TO_REG(val); 464 data->in_min[0] = IN_TO_REG(val);
@@ -481,7 +483,9 @@ static ssize_t store_regs_in_max0(struct device *dev, struct device_attribute *a
481 (w83627thf == data->type || w83637hf == data->type)) 483 (w83627thf == data->type || w83637hf == data->type))
482 484
483 /* use VRM9 calculation */ 485 /* use VRM9 calculation */
484 data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488); 486 data->in_max[0] =
487 SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0,
488 255);
485 else 489 else
486 /* use VRM8 (standard) calculation */ 490 /* use VRM8 (standard) calculation */
487 data->in_max[0] = IN_TO_REG(val); 491 data->in_max[0] = IN_TO_REG(val);
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 12cec7c4a342..f7e18ccc5c0a 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -2350,6 +2350,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
2350 struct scsi_cmnd *SCpnt = NULL; 2350 struct scsi_cmnd *SCpnt = NULL;
2351 u32 scsi_status = SBP2_SCSI_STATUS_GOOD; 2351 u32 scsi_status = SBP2_SCSI_STATUS_GOOD;
2352 struct sbp2_command_info *command; 2352 struct sbp2_command_info *command;
2353 unsigned long flags;
2353 2354
2354 SBP2_DEBUG("sbp2_handle_status_write"); 2355 SBP2_DEBUG("sbp2_handle_status_write");
2355 2356
@@ -2451,9 +2452,11 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
2451 * null out last orb so that next time around we write directly to the orb pointer... 2452 * null out last orb so that next time around we write directly to the orb pointer...
2452 * Quick start saves one 1394 bus transaction. 2453 * Quick start saves one 1394 bus transaction.
2453 */ 2454 */
2455 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
2454 if (list_empty(&scsi_id->sbp2_command_orb_inuse)) { 2456 if (list_empty(&scsi_id->sbp2_command_orb_inuse)) {
2455 scsi_id->last_orb = NULL; 2457 scsi_id->last_orb = NULL;
2456 } 2458 }
2459 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
2457 2460
2458 } else { 2461 } else {
2459 2462
@@ -2563,9 +2566,11 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
2563 struct sbp2scsi_host_info *hi = scsi_id->hi; 2566 struct sbp2scsi_host_info *hi = scsi_id->hi;
2564 struct list_head *lh; 2567 struct list_head *lh;
2565 struct sbp2_command_info *command; 2568 struct sbp2_command_info *command;
2569 unsigned long flags;
2566 2570
2567 SBP2_DEBUG("sbp2scsi_complete_all_commands"); 2571 SBP2_DEBUG("sbp2scsi_complete_all_commands");
2568 2572
2573 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
2569 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { 2574 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
2570 SBP2_DEBUG("Found pending command to complete"); 2575 SBP2_DEBUG("Found pending command to complete");
2571 lh = scsi_id->sbp2_command_orb_inuse.next; 2576 lh = scsi_id->sbp2_command_orb_inuse.next;
@@ -2582,6 +2587,7 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
2582 command->Current_done(command->Current_SCpnt); 2587 command->Current_done(command->Current_SCpnt);
2583 } 2588 }
2584 } 2589 }
2590 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
2585 2591
2586 return; 2592 return;
2587} 2593}
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 41d6b4017acb..d393b504bf26 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -355,9 +355,9 @@ error4:
355 spin_unlock_irqrestore(&port_priv->reg_lock, flags); 355 spin_unlock_irqrestore(&port_priv->reg_lock, flags);
356 kfree(reg_req); 356 kfree(reg_req);
357error3: 357error3:
358 kfree(mad_agent_priv);
359error2:
360 ib_dereg_mr(mad_agent_priv->agent.mr); 358 ib_dereg_mr(mad_agent_priv->agent.mr);
359error2:
360 kfree(mad_agent_priv);
361error1: 361error1:
362 return ret; 362 return ret;
363} 363}
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 0506934244f0..caac6d63d46f 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -339,14 +339,20 @@ static struct gameport_event *gameport_get_event(void)
339 return event; 339 return event;
340} 340}
341 341
342static void gameport_handle_events(void) 342static void gameport_handle_event(void)
343{ 343{
344 struct gameport_event *event; 344 struct gameport_event *event;
345 struct gameport_driver *gameport_drv; 345 struct gameport_driver *gameport_drv;
346 346
347 down(&gameport_sem); 347 down(&gameport_sem);
348 348
349 while ((event = gameport_get_event())) { 349 /*
350 * Note that we handle only one event here to give swsusp
351 * a chance to freeze kgameportd thread. Gameport events
352 * should be pretty rare so we are not concerned about
353 * taking performance hit.
354 */
355 if ((event = gameport_get_event())) {
350 356
351 switch (event->type) { 357 switch (event->type) {
352 case GAMEPORT_REGISTER_PORT: 358 case GAMEPORT_REGISTER_PORT:
@@ -433,7 +439,7 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent)
433static int gameport_thread(void *nothing) 439static int gameport_thread(void *nothing)
434{ 440{
435 do { 441 do {
436 gameport_handle_events(); 442 gameport_handle_event();
437 wait_event_interruptible(gameport_wait, 443 wait_event_interruptible(gameport_wait,
438 kthread_should_stop() || !list_empty(&gameport_event_list)); 444 kthread_should_stop() || !list_empty(&gameport_event_list));
439 try_to_freeze(); 445 try_to_freeze();
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c8ae2bb054e0..bdd2a7fc268d 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -536,7 +536,7 @@ static struct attribute *input_dev_attrs[] = {
536 NULL 536 NULL
537}; 537};
538 538
539static struct attribute_group input_dev_group = { 539static struct attribute_group input_dev_attr_group = {
540 .attrs = input_dev_attrs, 540 .attrs = input_dev_attrs,
541}; 541};
542 542
@@ -717,35 +717,14 @@ struct input_dev *input_allocate_device(void)
717 return dev; 717 return dev;
718} 718}
719 719
720static void input_register_classdevice(struct input_dev *dev)
721{
722 static atomic_t input_no = ATOMIC_INIT(0);
723 const char *path;
724
725 __module_get(THIS_MODULE);
726
727 dev->dev = dev->cdev.dev;
728
729 snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id),
730 "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1);
731
732 path = kobject_get_path(&dev->cdev.class->subsys.kset.kobj, GFP_KERNEL);
733 printk(KERN_INFO "input: %s as %s/%s\n",
734 dev->name ? dev->name : "Unspecified device",
735 path ? path : "", dev->cdev.class_id);
736 kfree(path);
737
738 class_device_add(&dev->cdev);
739 sysfs_create_group(&dev->cdev.kobj, &input_dev_group);
740 sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group);
741 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
742}
743
744int input_register_device(struct input_dev *dev) 720int input_register_device(struct input_dev *dev)
745{ 721{
722 static atomic_t input_no = ATOMIC_INIT(0);
746 struct input_handle *handle; 723 struct input_handle *handle;
747 struct input_handler *handler; 724 struct input_handler *handler;
748 struct input_device_id *id; 725 struct input_device_id *id;
726 const char *path;
727 int error;
749 728
750 if (!dev->dynalloc) { 729 if (!dev->dynalloc) {
751 printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" 730 printk(KERN_WARNING "input: device %s is statically allocated, will not register\n"
@@ -773,7 +752,32 @@ int input_register_device(struct input_dev *dev)
773 INIT_LIST_HEAD(&dev->h_list); 752 INIT_LIST_HEAD(&dev->h_list);
774 list_add_tail(&dev->node, &input_dev_list); 753 list_add_tail(&dev->node, &input_dev_list);
775 754
776 input_register_classdevice(dev); 755 dev->cdev.class = &input_class;
756 snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id),
757 "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1);
758
759 error = class_device_add(&dev->cdev);
760 if (error)
761 return error;
762
763 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group);
764 if (error)
765 goto fail1;
766
767 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group);
768 if (error)
769 goto fail2;
770
771 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
772 if (error)
773 goto fail3;
774
775 __module_get(THIS_MODULE);
776
777 path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL);
778 printk(KERN_INFO "input: %s as %s\n",
779 dev->name ? dev->name : "Unspecified device", path ? path : "N/A");
780 kfree(path);
777 781
778 list_for_each_entry(handler, &input_handler_list, node) 782 list_for_each_entry(handler, &input_handler_list, node)
779 if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) 783 if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
@@ -784,6 +788,11 @@ int input_register_device(struct input_dev *dev)
784 input_wakeup_procfs_readers(); 788 input_wakeup_procfs_readers();
785 789
786 return 0; 790 return 0;
791
792 fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
793 fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
794 fail1: class_device_del(&dev->cdev);
795 return error;
787} 796}
788 797
789void input_unregister_device(struct input_dev *dev) 798void input_unregister_device(struct input_dev *dev)
@@ -805,7 +814,7 @@ void input_unregister_device(struct input_dev *dev)
805 814
806 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 815 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
807 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); 816 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
808 sysfs_remove_group(&dev->cdev.kobj, &input_dev_group); 817 sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
809 class_device_unregister(&dev->cdev); 818 class_device_unregister(&dev->cdev);
810 819
811 input_wakeup_procfs_readers(); 820 input_wakeup_procfs_readers();
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 820c7fd9a604..a0256f8de8ef 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -166,6 +166,9 @@ static unsigned char atkbd_unxlate_table[128] = {
166 166
167#define ATKBD_SPECIAL 248 167#define ATKBD_SPECIAL 248
168 168
169#define ATKBD_LED_EVENT_BIT 0
170#define ATKBD_REP_EVENT_BIT 1
171
169static struct { 172static struct {
170 unsigned char keycode; 173 unsigned char keycode;
171 unsigned char set2; 174 unsigned char set2;
@@ -211,6 +214,10 @@ struct atkbd {
211 unsigned char err_xl; 214 unsigned char err_xl;
212 unsigned int last; 215 unsigned int last;
213 unsigned long time; 216 unsigned long time;
217
218 struct work_struct event_work;
219 struct semaphore event_sem;
220 unsigned long event_mask;
214}; 221};
215 222
216static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, 223static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
@@ -424,58 +431,86 @@ out:
424} 431}
425 432
426/* 433/*
427 * Event callback from the input module. Events that change the state of 434 * atkbd_event_work() is used to complete processing of events that
428 * the hardware are processed here. 435 * can not be processed by input_event() which is often called from
436 * interrupt context.
429 */ 437 */
430 438
431static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 439static void atkbd_event_work(void *data)
432{ 440{
433 struct atkbd *atkbd = dev->private;
434 const short period[32] = 441 const short period[32] =
435 { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, 442 { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125,
436 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; 443 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 };
437 const short delay[4] = 444 const short delay[4] =
438 { 250, 500, 750, 1000 }; 445 { 250, 500, 750, 1000 };
446
447 struct atkbd *atkbd = data;
448 struct input_dev *dev = atkbd->dev;
439 unsigned char param[2]; 449 unsigned char param[2];
440 int i, j; 450 int i, j;
441 451
452 down(&atkbd->event_sem);
453
454 if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) {
455 param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0)
456 | (test_bit(LED_NUML, dev->led) ? 2 : 0)
457 | (test_bit(LED_CAPSL, dev->led) ? 4 : 0);
458 ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS);
459
460 if (atkbd->extra) {
461 param[0] = 0;
462 param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0)
463 | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0)
464 | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0)
465 | (test_bit(LED_MISC, dev->led) ? 0x10 : 0)
466 | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0);
467 ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS);
468 }
469 }
470
471 if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) {
472 i = j = 0;
473 while (i < 31 && period[i] < dev->rep[REP_PERIOD])
474 i++;
475 while (j < 3 && delay[j] < dev->rep[REP_DELAY])
476 j++;
477 dev->rep[REP_PERIOD] = period[i];
478 dev->rep[REP_DELAY] = delay[j];
479 param[0] = i | (j << 5);
480 ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP);
481 }
482
483 up(&atkbd->event_sem);
484}
485
486/*
487 * Event callback from the input module. Events that change the state of
488 * the hardware are processed here. If action can not be performed in
489 * interrupt context it is offloaded to atkbd_event_work.
490 */
491
492static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
493{
494 struct atkbd *atkbd = dev->private;
495
442 if (!atkbd->write) 496 if (!atkbd->write)
443 return -1; 497 return -1;
444 498
445 switch (type) { 499 switch (type) {
446 500
447 case EV_LED: 501 case EV_LED:
448 502 set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask);
449 param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) 503 wmb();
450 | (test_bit(LED_NUML, dev->led) ? 2 : 0) 504 schedule_work(&atkbd->event_work);
451 | (test_bit(LED_CAPSL, dev->led) ? 4 : 0);
452 ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS);
453
454 if (atkbd->extra) {
455 param[0] = 0;
456 param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0)
457 | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0)
458 | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0)
459 | (test_bit(LED_MISC, dev->led) ? 0x10 : 0)
460 | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0);
461 ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS);
462 }
463
464 return 0; 505 return 0;
465 506
466 case EV_REP: 507 case EV_REP:
467 508
468 if (atkbd->softrepeat) return 0; 509 if (!atkbd->softrepeat) {
469 510 set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask);
470 i = j = 0; 511 wmb();
471 while (i < 31 && period[i] < dev->rep[REP_PERIOD]) 512 schedule_work(&atkbd->event_work);
472 i++; 513 }
473 while (j < 3 && delay[j] < dev->rep[REP_DELAY])
474 j++;
475 dev->rep[REP_PERIOD] = period[i];
476 dev->rep[REP_DELAY] = delay[j];
477 param[0] = i | (j << 5);
478 ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP);
479 514
480 return 0; 515 return 0;
481 } 516 }
@@ -810,6 +845,8 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
810 845
811 atkbd->dev = dev; 846 atkbd->dev = dev;
812 ps2_init(&atkbd->ps2dev, serio); 847 ps2_init(&atkbd->ps2dev, serio);
848 INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd);
849 init_MUTEX(&atkbd->event_sem);
813 850
814 switch (serio->id.type) { 851 switch (serio->id.type) {
815 852
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index b3eaac1b35b6..07813fc0523f 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP
40 tristate "M68k Beeper support" 40 tristate "M68k Beeper support"
41 depends on M68K 41 depends on M68K
42 42
43config INPUT_WISTRON_BTNS
44 tristate "x86 Wistron laptop button interface"
45 depends on X86 && !X86_64
46 help
47 Say Y here for support of Winstron laptop button interface, used on
48 laptops of various brands, including Acer and Fujitsu-Siemens.
49
50 To compile this driver as a module, choose M here: the module will
51 be called wistron_btns.
52
43config INPUT_UINPUT 53config INPUT_UINPUT
44 tristate "User level driver support" 54 tristate "User level driver support"
45 help 55 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index f8d01c69f349..ce44cce01285 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -9,4 +9,5 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
10obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o 10obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o
11obj-$(CONFIG_INPUT_UINPUT) += uinput.o 11obj-$(CONFIG_INPUT_UINPUT) += uinput.o
12obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
12obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 13obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 948c1cc01bc9..546ed9b4901d 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -92,24 +92,19 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques
92{ 92{
93 /* Mark slot as available */ 93 /* Mark slot as available */
94 udev->requests[request->id] = NULL; 94 udev->requests[request->id] = NULL;
95 wake_up_interruptible(&udev->requests_waitq); 95 wake_up(&udev->requests_waitq);
96 96
97 complete(&request->done); 97 complete(&request->done);
98} 98}
99 99
100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) 100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)
101{ 101{
102 int retval;
103
104 /* Tell our userspace app about this new request by queueing an input event */ 102 /* Tell our userspace app about this new request by queueing an input event */
105 uinput_dev_event(dev, EV_UINPUT, request->code, request->id); 103 uinput_dev_event(dev, EV_UINPUT, request->code, request->id);
106 104
107 /* Wait for the request to complete */ 105 /* Wait for the request to complete */
108 retval = wait_for_completion_interruptible(&request->done); 106 wait_for_completion(&request->done);
109 if (!retval) 107 return request->retval;
110 retval = request->retval;
111
112 return retval;
113} 108}
114 109
115static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) 110static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)
@@ -152,67 +147,62 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
152 return retval; 147 return retval;
153} 148}
154 149
155static int uinput_create_device(struct uinput_device *udev) 150static void uinput_destroy_device(struct uinput_device *udev)
156{ 151{
157 if (!udev->dev->name) { 152 const char *name, *phys;
158 printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); 153
159 return -EINVAL; 154 if (udev->dev) {
155 name = udev->dev->name;
156 phys = udev->dev->phys;
157 if (udev->state == UIST_CREATED)
158 input_unregister_device(udev->dev);
159 else
160 input_free_device(udev->dev);
161 kfree(name);
162 kfree(phys);
163 udev->dev = NULL;
160 } 164 }
161 165
162 udev->dev->event = uinput_dev_event; 166 udev->state = UIST_NEW_DEVICE;
163 udev->dev->upload_effect = uinput_dev_upload_effect;
164 udev->dev->erase_effect = uinput_dev_erase_effect;
165 udev->dev->private = udev;
166
167 init_waitqueue_head(&udev->waitq);
168
169 input_register_device(udev->dev);
170
171 set_bit(UIST_CREATED, &udev->state);
172
173 return 0;
174} 167}
175 168
176static int uinput_destroy_device(struct uinput_device *udev) 169static int uinput_create_device(struct uinput_device *udev)
177{ 170{
178 if (!test_bit(UIST_CREATED, &udev->state)) { 171 int error;
179 printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); 172
173 if (udev->state != UIST_SETUP_COMPLETE) {
174 printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME);
180 return -EINVAL; 175 return -EINVAL;
181 } 176 }
182 177
183 input_unregister_device(udev->dev); 178 error = input_register_device(udev->dev);
179 if (error) {
180 uinput_destroy_device(udev);
181 return error;
182 }
184 183
185 clear_bit(UIST_CREATED, &udev->state); 184 udev->state = UIST_CREATED;
186 185
187 return 0; 186 return 0;
188} 187}
189 188
190static int uinput_open(struct inode *inode, struct file *file) 189static int uinput_open(struct inode *inode, struct file *file)
191{ 190{
192 struct uinput_device *newdev; 191 struct uinput_device *newdev;
193 struct input_dev *newinput;
194 192
195 newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL); 193 newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL);
196 if (!newdev) 194 if (!newdev)
197 goto error; 195 return -ENOMEM;
198 memset(newdev, 0, sizeof(struct uinput_device)); 196
197 init_MUTEX(&newdev->sem);
199 spin_lock_init(&newdev->requests_lock); 198 spin_lock_init(&newdev->requests_lock);
200 init_waitqueue_head(&newdev->requests_waitq); 199 init_waitqueue_head(&newdev->requests_waitq);
201 200 init_waitqueue_head(&newdev->waitq);
202 newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); 201 newdev->state = UIST_NEW_DEVICE;
203 if (!newinput)
204 goto cleanup;
205 memset(newinput, 0, sizeof(struct input_dev));
206
207 newdev->dev = newinput;
208 202
209 file->private_data = newdev; 203 file->private_data = newdev;
210 204
211 return 0; 205 return 0;
212cleanup:
213 kfree(newdev);
214error:
215 return -ENOMEM;
216} 206}
217 207
218static int uinput_validate_absbits(struct input_dev *dev) 208static int uinput_validate_absbits(struct input_dev *dev)
@@ -246,34 +236,55 @@ static int uinput_validate_absbits(struct input_dev *dev)
246 return retval; 236 return retval;
247} 237}
248 238
249static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) 239static int uinput_allocate_device(struct uinput_device *udev)
240{
241 udev->dev = input_allocate_device();
242 if (!udev->dev)
243 return -ENOMEM;
244
245 udev->dev->event = uinput_dev_event;
246 udev->dev->upload_effect = uinput_dev_upload_effect;
247 udev->dev->erase_effect = uinput_dev_erase_effect;
248 udev->dev->private = udev;
249
250 return 0;
251}
252
253static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count)
250{ 254{
251 struct uinput_user_dev *user_dev; 255 struct uinput_user_dev *user_dev;
252 struct input_dev *dev; 256 struct input_dev *dev;
253 struct uinput_device *udev;
254 char *name; 257 char *name;
255 int size; 258 int size;
256 int retval; 259 int retval;
257 260
258 retval = count; 261 if (count != sizeof(struct uinput_user_dev))
262 return -EINVAL;
263
264 if (!udev->dev) {
265 retval = uinput_allocate_device(udev);
266 if (retval)
267 return retval;
268 }
259 269
260 udev = file->private_data;
261 dev = udev->dev; 270 dev = udev->dev;
262 271
263 user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); 272 user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL);
264 if (!user_dev) { 273 if (!user_dev)
265 retval = -ENOMEM; 274 return -ENOMEM;
266 goto exit;
267 }
268 275
269 if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { 276 if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) {
270 retval = -EFAULT; 277 retval = -EFAULT;
271 goto exit; 278 goto exit;
272 } 279 }
273 280
274 kfree(dev->name);
275
276 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; 281 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
282 if (!size) {
283 retval = -EINVAL;
284 goto exit;
285 }
286
287 kfree(dev->name);
277 dev->name = name = kmalloc(size, GFP_KERNEL); 288 dev->name = name = kmalloc(size, GFP_KERNEL);
278 if (!name) { 289 if (!name) {
279 retval = -ENOMEM; 290 retval = -ENOMEM;
@@ -296,32 +307,50 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
296 /* check if absmin/absmax/absfuzz/absflat are filled as 307 /* check if absmin/absmax/absfuzz/absflat are filled as
297 * told in Documentation/input/input-programming.txt */ 308 * told in Documentation/input/input-programming.txt */
298 if (test_bit(EV_ABS, dev->evbit)) { 309 if (test_bit(EV_ABS, dev->evbit)) {
299 int err = uinput_validate_absbits(dev); 310 retval = uinput_validate_absbits(dev);
300 if (err < 0) { 311 if (retval < 0)
301 retval = err; 312 goto exit;
302 kfree(dev->name);
303 }
304 } 313 }
305 314
306exit: 315 udev->state = UIST_SETUP_COMPLETE;
316 retval = count;
317
318 exit:
307 kfree(user_dev); 319 kfree(user_dev);
308 return retval; 320 return retval;
309} 321}
310 322
323static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count)
324{
325 struct input_event ev;
326
327 if (count != sizeof(struct input_event))
328 return -EINVAL;
329
330 if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
331 return -EFAULT;
332
333 input_event(udev->dev, ev.type, ev.code, ev.value);
334
335 return sizeof(struct input_event);
336}
337
311static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) 338static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
312{ 339{
313 struct uinput_device *udev = file->private_data; 340 struct uinput_device *udev = file->private_data;
341 int retval;
342
343 retval = down_interruptible(&udev->sem);
344 if (retval)
345 return retval;
314 346
315 if (test_bit(UIST_CREATED, &udev->state)) { 347 retval = udev->state == UIST_CREATED ?
316 struct input_event ev; 348 uinput_inject_event(udev, buffer, count) :
349 uinput_setup_device(udev, buffer, count);
317 350
318 if (copy_from_user(&ev, buffer, sizeof(struct input_event))) 351 up(&udev->sem);
319 return -EFAULT;
320 input_event(udev->dev, ev.type, ev.code, ev.value);
321 } else
322 count = uinput_alloc_device(file, buffer, count);
323 352
324 return count; 353 return retval;
325} 354}
326 355
327static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) 356static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
@@ -329,28 +358,38 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count,
329 struct uinput_device *udev = file->private_data; 358 struct uinput_device *udev = file->private_data;
330 int retval = 0; 359 int retval = 0;
331 360
332 if (!test_bit(UIST_CREATED, &udev->state)) 361 if (udev->state != UIST_CREATED)
333 return -ENODEV; 362 return -ENODEV;
334 363
335 if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) 364 if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK))
336 return -EAGAIN; 365 return -EAGAIN;
337 366
338 retval = wait_event_interruptible(udev->waitq, 367 retval = wait_event_interruptible(udev->waitq,
339 udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); 368 udev->head != udev->tail || udev->state != UIST_CREATED);
340 if (retval) 369 if (retval)
341 return retval; 370 return retval;
342 371
343 if (!test_bit(UIST_CREATED, &udev->state)) 372 retval = down_interruptible(&udev->sem);
344 return -ENODEV; 373 if (retval)
374 return retval;
345 375
346 while ((udev->head != udev->tail) && 376 if (udev->state != UIST_CREATED) {
347 (retval + sizeof(struct input_event) <= count)) { 377 retval = -ENODEV;
348 if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) 378 goto out;
349 return -EFAULT; 379 }
380
381 while (udev->head != udev->tail && retval + sizeof(struct input_event) <= count) {
382 if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) {
383 retval = -EFAULT;
384 goto out;
385 }
350 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; 386 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE;
351 retval += sizeof(struct input_event); 387 retval += sizeof(struct input_event);
352 } 388 }
353 389
390 out:
391 up(&udev->sem);
392
354 return retval; 393 return retval;
355} 394}
356 395
@@ -366,28 +405,30 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait)
366 return 0; 405 return 0;
367} 406}
368 407
369static int uinput_burn_device(struct uinput_device *udev) 408static int uinput_release(struct inode *inode, struct file *file)
370{ 409{
371 if (test_bit(UIST_CREATED, &udev->state)) 410 struct uinput_device *udev = file->private_data;
372 uinput_destroy_device(udev);
373 411
374 kfree(udev->dev->name); 412 uinput_destroy_device(udev);
375 kfree(udev->dev->phys);
376 kfree(udev->dev);
377 kfree(udev); 413 kfree(udev);
378 414
379 return 0; 415 return 0;
380} 416}
381 417
382static int uinput_close(struct inode *inode, struct file *file) 418#define uinput_set_bit(_arg, _bit, _max) \
419({ \
420 int __ret = 0; \
421 if (udev->state == UIST_CREATED) \
422 __ret = -EINVAL; \
423 else if ((_arg) > (_max)) \
424 __ret = -EINVAL; \
425 else set_bit((_arg), udev->dev->_bit); \
426 __ret; \
427})
428
429static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
383{ 430{
384 uinput_burn_device(file->private_data); 431 int retval;
385 return 0;
386}
387
388static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
389{
390 int retval = 0;
391 struct uinput_device *udev; 432 struct uinput_device *udev;
392 void __user *p = (void __user *)arg; 433 void __user *p = (void __user *)arg;
393 struct uinput_ff_upload ff_up; 434 struct uinput_ff_upload ff_up;
@@ -398,19 +439,14 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
398 439
399 udev = file->private_data; 440 udev = file->private_data;
400 441
401 /* device attributes can not be changed after the device is created */ 442 retval = down_interruptible(&udev->sem);
402 switch (cmd) { 443 if (retval)
403 case UI_SET_EVBIT: 444 return retval;
404 case UI_SET_KEYBIT: 445
405 case UI_SET_RELBIT: 446 if (!udev->dev) {
406 case UI_SET_ABSBIT: 447 retval = uinput_allocate_device(udev);
407 case UI_SET_MSCBIT: 448 if (retval)
408 case UI_SET_LEDBIT: 449 goto out;
409 case UI_SET_SNDBIT:
410 case UI_SET_FFBIT:
411 case UI_SET_PHYS:
412 if (test_bit(UIST_CREATED, &udev->state))
413 return -EINVAL;
414 } 450 }
415 451
416 switch (cmd) { 452 switch (cmd) {
@@ -419,74 +455,50 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
419 break; 455 break;
420 456
421 case UI_DEV_DESTROY: 457 case UI_DEV_DESTROY:
422 retval = uinput_destroy_device(udev); 458 uinput_destroy_device(udev);
423 break; 459 break;
424 460
425 case UI_SET_EVBIT: 461 case UI_SET_EVBIT:
426 if (arg > EV_MAX) { 462 retval = uinput_set_bit(arg, evbit, EV_MAX);
427 retval = -EINVAL;
428 break;
429 }
430 set_bit(arg, udev->dev->evbit);
431 break; 463 break;
432 464
433 case UI_SET_KEYBIT: 465 case UI_SET_KEYBIT:
434 if (arg > KEY_MAX) { 466 retval = uinput_set_bit(arg, keybit, KEY_MAX);
435 retval = -EINVAL;
436 break;
437 }
438 set_bit(arg, udev->dev->keybit);
439 break; 467 break;
440 468
441 case UI_SET_RELBIT: 469 case UI_SET_RELBIT:
442 if (arg > REL_MAX) { 470 retval = uinput_set_bit(arg, relbit, REL_MAX);
443 retval = -EINVAL;
444 break;
445 }
446 set_bit(arg, udev->dev->relbit);
447 break; 471 break;
448 472
449 case UI_SET_ABSBIT: 473 case UI_SET_ABSBIT:
450 if (arg > ABS_MAX) { 474 retval = uinput_set_bit(arg, absbit, ABS_MAX);
451 retval = -EINVAL;
452 break;
453 }
454 set_bit(arg, udev->dev->absbit);
455 break; 475 break;
456 476
457 case UI_SET_MSCBIT: 477 case UI_SET_MSCBIT:
458 if (arg > MSC_MAX) { 478 retval = uinput_set_bit(arg, mscbit, MSC_MAX);
459 retval = -EINVAL;
460 break;
461 }
462 set_bit(arg, udev->dev->mscbit);
463 break; 479 break;
464 480
465 case UI_SET_LEDBIT: 481 case UI_SET_LEDBIT:
466 if (arg > LED_MAX) { 482 retval = uinput_set_bit(arg, ledbit, LED_MAX);
467 retval = -EINVAL;
468 break;
469 }
470 set_bit(arg, udev->dev->ledbit);
471 break; 483 break;
472 484
473 case UI_SET_SNDBIT: 485 case UI_SET_SNDBIT:
474 if (arg > SND_MAX) { 486 retval = uinput_set_bit(arg, sndbit, SND_MAX);
475 retval = -EINVAL;
476 break;
477 }
478 set_bit(arg, udev->dev->sndbit);
479 break; 487 break;
480 488
481 case UI_SET_FFBIT: 489 case UI_SET_FFBIT:
482 if (arg > FF_MAX) { 490 retval = uinput_set_bit(arg, ffbit, FF_MAX);
483 retval = -EINVAL; 491 break;
484 break; 492
485 } 493 case UI_SET_SWBIT:
486 set_bit(arg, udev->dev->ffbit); 494 retval = uinput_set_bit(arg, swbit, SW_MAX);
487 break; 495 break;
488 496
489 case UI_SET_PHYS: 497 case UI_SET_PHYS:
498 if (udev->state == UIST_CREATED) {
499 retval = -EINVAL;
500 goto out;
501 }
490 length = strnlen_user(p, 1024); 502 length = strnlen_user(p, 1024);
491 if (length <= 0) { 503 if (length <= 0) {
492 retval = -EFAULT; 504 retval = -EFAULT;
@@ -575,23 +587,26 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
575 default: 587 default:
576 retval = -EINVAL; 588 retval = -EINVAL;
577 } 589 }
590
591 out:
592 up(&udev->sem);
578 return retval; 593 return retval;
579} 594}
580 595
581static struct file_operations uinput_fops = { 596static struct file_operations uinput_fops = {
582 .owner = THIS_MODULE, 597 .owner = THIS_MODULE,
583 .open = uinput_open, 598 .open = uinput_open,
584 .release = uinput_close, 599 .release = uinput_release,
585 .read = uinput_read, 600 .read = uinput_read,
586 .write = uinput_write, 601 .write = uinput_write,
587 .poll = uinput_poll, 602 .poll = uinput_poll,
588 .ioctl = uinput_ioctl, 603 .unlocked_ioctl = uinput_ioctl,
589}; 604};
590 605
591static struct miscdevice uinput_misc = { 606static struct miscdevice uinput_misc = {
592 .fops = &uinput_fops, 607 .fops = &uinput_fops,
593 .minor = UINPUT_MINOR, 608 .minor = UINPUT_MINOR,
594 .name = UINPUT_NAME, 609 .name = UINPUT_NAME,
595}; 610};
596 611
597static int __init uinput_init(void) 612static int __init uinput_init(void)
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
new file mode 100644
index 000000000000..49d0416a2a9a
--- /dev/null
+++ b/drivers/input/misc/wistron_btns.c
@@ -0,0 +1,561 @@
1/*
2 * Wistron laptop button driver
3 * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
4 * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
5 * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
6 *
7 * You can redistribute and/or modify this program under the terms of the
8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 * Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA.
19 */
20#include <asm/io.h>
21#include <linux/dmi.h>
22#include <linux/init.h>
23#include <linux/input.h>
24#include <linux/interrupt.h>
25#include <linux/kernel.h>
26#include <linux/mc146818rtc.h>
27#include <linux/module.h>
28#include <linux/preempt.h>
29#include <linux/string.h>
30#include <linux/timer.h>
31#include <linux/types.h>
32#include <linux/platform_device.h>
33
34/*
35 * Number of attempts to read data from queue per poll;
36 * the queue can hold up to 31 entries
37 */
38#define MAX_POLL_ITERATIONS 64
39
40#define POLL_FREQUENCY 10 /* Number of polls per second */
41
42#if POLL_FREQUENCY > HZ
43#error "POLL_FREQUENCY too high"
44#endif
45
46/* BIOS subsystem IDs */
47#define WIFI 0x35
48#define BLUETOOTH 0x34
49
50MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
51MODULE_DESCRIPTION("Wistron laptop button driver");
52MODULE_LICENSE("GPL v2");
53MODULE_VERSION("0.1");
54
55static int force; /* = 0; */
56module_param(force, bool, 0);
57MODULE_PARM_DESC(force, "Load even if computer is not in database");
58
59static char *keymap_name; /* = NULL; */
60module_param_named(keymap, keymap_name, charp, 0);
61MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected");
62
63static struct platform_device *wistron_device;
64
65 /* BIOS interface implementation */
66
67static void __iomem *bios_entry_point; /* BIOS routine entry point */
68static void __iomem *bios_code_map_base;
69static void __iomem *bios_data_map_base;
70
71static u8 cmos_address;
72
73struct regs {
74 u32 eax, ebx, ecx;
75};
76
77static void call_bios(struct regs *regs)
78{
79 unsigned long flags;
80
81 preempt_disable();
82 local_irq_save(flags);
83 asm volatile ("pushl %%ebp;"
84 "movl %7, %%ebp;"
85 "call *%6;"
86 "popl %%ebp"
87 : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx)
88 : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx),
89 "m" (bios_entry_point), "m" (bios_data_map_base)
90 : "edx", "edi", "esi", "memory");
91 local_irq_restore(flags);
92 preempt_enable();
93}
94
95static size_t __init locate_wistron_bios(void __iomem *base)
96{
97 static const unsigned char __initdata signature[] =
98 { 0x42, 0x21, 0x55, 0x30 };
99 size_t offset;
100
101 for (offset = 0; offset < 0x10000; offset += 0x10) {
102 if (check_signature(base + offset, signature,
103 sizeof(signature)) != 0)
104 return offset;
105 }
106 return -1;
107}
108
109static int __init map_bios(void)
110{
111 void __iomem *base;
112 size_t offset;
113 u32 entry_point;
114
115 base = ioremap(0xF0000, 0x10000); /* Can't fail */
116 offset = locate_wistron_bios(base);
117 if (offset < 0) {
118 printk(KERN_ERR "wistron_btns: BIOS entry point not found\n");
119 iounmap(base);
120 return -ENODEV;
121 }
122
123 entry_point = readl(base + offset + 5);
124 printk(KERN_DEBUG
125 "wistron_btns: BIOS signature found at %p, entry point %08X\n",
126 base + offset, entry_point);
127
128 if (entry_point >= 0xF0000) {
129 bios_code_map_base = base;
130 bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
131 } else {
132 iounmap(base);
133 bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
134 if (bios_code_map_base == NULL) {
135 printk(KERN_ERR
136 "wistron_btns: Can't map BIOS code at %08X\n",
137 entry_point & ~0x3FFF);
138 goto err;
139 }
140 bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
141 }
142 /* The Windows driver maps 0x10000 bytes, we keep only one page... */
143 bios_data_map_base = ioremap(0x400, 0xc00);
144 if (bios_data_map_base == NULL) {
145 printk(KERN_ERR "wistron_btns: Can't map BIOS data\n");
146 goto err_code;
147 }
148 return 0;
149
150err_code:
151 iounmap(bios_code_map_base);
152err:
153 return -ENOMEM;
154}
155
156static inline void unmap_bios(void)
157{
158 iounmap(bios_code_map_base);
159 iounmap(bios_data_map_base);
160}
161
162 /* BIOS calls */
163
164static u16 bios_pop_queue(void)
165{
166 struct regs regs;
167
168 memset(&regs, 0, sizeof (regs));
169 regs.eax = 0x9610;
170 regs.ebx = 0x061C;
171 regs.ecx = 0x0000;
172 call_bios(&regs);
173
174 return regs.eax;
175}
176
177static void __init bios_attach(void)
178{
179 struct regs regs;
180
181 memset(&regs, 0, sizeof (regs));
182 regs.eax = 0x9610;
183 regs.ebx = 0x012E;
184 call_bios(&regs);
185}
186
187static void bios_detach(void)
188{
189 struct regs regs;
190
191 memset(&regs, 0, sizeof (regs));
192 regs.eax = 0x9610;
193 regs.ebx = 0x002E;
194 call_bios(&regs);
195}
196
197static u8 __init bios_get_cmos_address(void)
198{
199 struct regs regs;
200
201 memset(&regs, 0, sizeof (regs));
202 regs.eax = 0x9610;
203 regs.ebx = 0x051C;
204 call_bios(&regs);
205
206 return regs.ecx;
207}
208
209static u16 __init bios_get_default_setting(u8 subsys)
210{
211 struct regs regs;
212
213 memset(&regs, 0, sizeof (regs));
214 regs.eax = 0x9610;
215 regs.ebx = 0x0200 | subsys;
216 call_bios(&regs);
217
218 return regs.eax;
219}
220
221static void bios_set_state(u8 subsys, int enable)
222{
223 struct regs regs;
224
225 memset(&regs, 0, sizeof (regs));
226 regs.eax = 0x9610;
227 regs.ebx = (enable ? 0x0100 : 0x0000) | subsys;
228 call_bios(&regs);
229}
230
231/* Hardware database */
232
233struct key_entry {
234 char type; /* See KE_* below */
235 u8 code;
236 unsigned keycode; /* For KE_KEY */
237};
238
239enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH };
240
241static const struct key_entry *keymap; /* = NULL; Current key map */
242static int have_wifi;
243static int have_bluetooth;
244
245static int __init dmi_matched(struct dmi_system_id *dmi)
246{
247 const struct key_entry *key;
248
249 keymap = dmi->driver_data;
250 for (key = keymap; key->type != KE_END; key++) {
251 if (key->type == KE_WIFI) {
252 have_wifi = 1;
253 break;
254 } else if (key->type == KE_BLUETOOTH) {
255 have_bluetooth = 1;
256 break;
257 }
258 }
259 return 1;
260}
261
262static struct key_entry keymap_empty[] = {
263 { KE_END, 0 }
264};
265
266static struct key_entry keymap_fs_amilo_pro_v2000[] = {
267 { KE_KEY, 0x01, KEY_HELP },
268 { KE_KEY, 0x11, KEY_PROG1 },
269 { KE_KEY, 0x12, KEY_PROG2 },
270 { KE_WIFI, 0x30, 0 },
271 { KE_KEY, 0x31, KEY_MAIL },
272 { KE_KEY, 0x36, KEY_WWW },
273 { KE_END, 0 }
274};
275
276static struct key_entry keymap_wistron_ms2141[] = {
277 { KE_KEY, 0x11, KEY_PROG1 },
278 { KE_KEY, 0x12, KEY_PROG2 },
279 { KE_WIFI, 0x30, 0 },
280 { KE_KEY, 0x22, KEY_REWIND },
281 { KE_KEY, 0x23, KEY_FORWARD },
282 { KE_KEY, 0x24, KEY_PLAYPAUSE },
283 { KE_KEY, 0x25, KEY_STOPCD },
284 { KE_KEY, 0x31, KEY_MAIL },
285 { KE_KEY, 0x36, KEY_WWW },
286 { KE_END, 0 }
287};
288
289static struct key_entry keymap_acer_aspire_1500[] = {
290 { KE_KEY, 0x11, KEY_PROG1 },
291 { KE_KEY, 0x12, KEY_PROG2 },
292 { KE_WIFI, 0x30, 0 },
293 { KE_KEY, 0x31, KEY_MAIL },
294 { KE_KEY, 0x36, KEY_WWW },
295 { KE_BLUETOOTH, 0x44, 0 },
296 { KE_END, 0 }
297};
298
299/*
300 * If your machine is not here (which is currently rather likely), please send
301 * a list of buttons and their key codes (reported when loading this module
302 * with force=1) and the output of dmidecode to $MODULE_AUTHOR.
303 */
304static struct dmi_system_id dmi_ids[] = {
305 {
306 .callback = dmi_matched,
307 .ident = "Fujitsu-Siemens Amilo Pro V2000",
308 .matches = {
309 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
310 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"),
311 },
312 .driver_data = keymap_fs_amilo_pro_v2000
313 },
314 {
315 .callback = dmi_matched,
316 .ident = "Acer Aspire 1500",
317 .matches = {
318 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
319 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"),
320 },
321 .driver_data = keymap_acer_aspire_1500
322 },
323 { 0, }
324};
325
326static int __init select_keymap(void)
327{
328 if (keymap_name != NULL) {
329 if (strcmp (keymap_name, "1557/MS2141") == 0)
330 keymap = keymap_wistron_ms2141;
331 else {
332 printk(KERN_ERR "wistron_btns: Keymap unknown\n");
333 return -EINVAL;
334 }
335 }
336 dmi_check_system(dmi_ids);
337 if (keymap == NULL) {
338 if (!force) {
339 printk(KERN_ERR "wistron_btns: System unknown\n");
340 return -ENODEV;
341 }
342 keymap = keymap_empty;
343 }
344 return 0;
345}
346
347 /* Input layer interface */
348
349static struct input_dev *input_dev;
350
351static int __init setup_input_dev(void)
352{
353 const struct key_entry *key;
354 int error;
355
356 input_dev = input_allocate_device();
357 if (!input_dev)
358 return -ENOMEM;
359
360 input_dev->name = "Wistron laptop buttons";
361 input_dev->phys = "wistron/input0";
362 input_dev->id.bustype = BUS_HOST;
363 input_dev->cdev.dev = &wistron_device->dev;
364
365 for (key = keymap; key->type != KE_END; key++) {
366 if (key->type == KE_KEY) {
367 input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY);
368 set_bit(key->keycode, input_dev->keybit);
369 }
370 }
371
372 error = input_register_device(input_dev);
373 if (error) {
374 input_free_device(input_dev);
375 return error;
376 }
377
378 return 0;
379}
380
381static void report_key(unsigned keycode)
382{
383 input_report_key(input_dev, keycode, 1);
384 input_sync(input_dev);
385 input_report_key(input_dev, keycode, 0);
386 input_sync(input_dev);
387}
388
389 /* Driver core */
390
391static int wifi_enabled;
392static int bluetooth_enabled;
393
394static void poll_bios(unsigned long);
395
396static struct timer_list poll_timer = TIMER_INITIALIZER(poll_bios, 0, 0);
397
398static void handle_key(u8 code)
399{
400 const struct key_entry *key;
401
402 for (key = keymap; key->type != KE_END; key++) {
403 if (code == key->code) {
404 switch (key->type) {
405 case KE_KEY:
406 report_key(key->keycode);
407 break;
408
409 case KE_WIFI:
410 if (have_wifi) {
411 wifi_enabled = !wifi_enabled;
412 bios_set_state(WIFI, wifi_enabled);
413 }
414 break;
415
416 case KE_BLUETOOTH:
417 if (have_bluetooth) {
418 bluetooth_enabled = !bluetooth_enabled;
419 bios_set_state(BLUETOOTH, bluetooth_enabled);
420 }
421 break;
422
423 case KE_END:
424 default:
425 BUG();
426 }
427 return;
428 }
429 }
430 printk(KERN_NOTICE "wistron_btns: Unknown key code %02X\n", code);
431}
432
433static void poll_bios(unsigned long discard)
434{
435 u8 qlen;
436 u16 val;
437
438 for (;;) {
439 qlen = CMOS_READ(cmos_address);
440 if (qlen == 0)
441 break;
442 val = bios_pop_queue();
443 if (val != 0 && !discard)
444 handle_key((u8)val);
445 }
446
447 mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY);
448}
449
450static int wistron_suspend(struct platform_device *dev, pm_message_t state)
451{
452 del_timer_sync(&poll_timer);
453
454 if (have_wifi)
455 bios_set_state(WIFI, 0);
456
457 if (have_bluetooth)
458 bios_set_state(BLUETOOTH, 0);
459
460 return 0;
461}
462
463static int wistron_resume(struct platform_device *dev)
464{
465 if (have_wifi)
466 bios_set_state(WIFI, wifi_enabled);
467
468 if (have_bluetooth)
469 bios_set_state(BLUETOOTH, bluetooth_enabled);
470
471 poll_bios(1);
472
473 return 0;
474}
475
476static struct platform_driver wistron_driver = {
477 .suspend = wistron_suspend,
478 .resume = wistron_resume,
479 .driver = {
480 .name = "wistron-bios",
481 },
482};
483
484static int __init wb_module_init(void)
485{
486 int err;
487
488 err = select_keymap();
489 if (err)
490 return err;
491
492 err = map_bios();
493 if (err)
494 return err;
495
496 bios_attach();
497 cmos_address = bios_get_cmos_address();
498
499 err = platform_driver_register(&wistron_driver);
500 if (err)
501 goto err_detach_bios;
502
503 wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0);
504 if (IS_ERR(wistron_device)) {
505 err = PTR_ERR(wistron_device);
506 goto err_unregister_driver;
507 }
508
509 if (have_wifi) {
510 u16 wifi = bios_get_default_setting(WIFI);
511 if (wifi & 1)
512 wifi_enabled = (wifi & 2) ? 1 : 0;
513 else
514 have_wifi = 0;
515
516 if (have_wifi)
517 bios_set_state(WIFI, wifi_enabled);
518 }
519
520 if (have_bluetooth) {
521 u16 bt = bios_get_default_setting(BLUETOOTH);
522 if (bt & 1)
523 bluetooth_enabled = (bt & 2) ? 1 : 0;
524 else
525 have_bluetooth = 0;
526
527 if (have_bluetooth)
528 bios_set_state(BLUETOOTH, bluetooth_enabled);
529 }
530
531 err = setup_input_dev();
532 if (err)
533 goto err_unregister_device;
534
535 poll_bios(1); /* Flush stale event queue and arm timer */
536
537 return 0;
538
539 err_unregister_device:
540 platform_device_unregister(wistron_device);
541 err_unregister_driver:
542 platform_driver_unregister(&wistron_driver);
543 err_detach_bios:
544 bios_detach();
545 unmap_bios();
546
547 return err;
548}
549
550static void __exit wb_module_exit(void)
551{
552 del_timer_sync(&poll_timer);
553 input_unregister_device(input_dev);
554 platform_device_unregister(wistron_device);
555 platform_driver_unregister(&wistron_driver);
556 bios_detach();
557 unmap_bios();
558}
559
560module_init(wb_module_init);
561module_exit(wb_module_exit);
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index edd15db17715..fbb69ef6a77b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -269,14 +269,20 @@ static struct serio_event *serio_get_event(void)
269 return event; 269 return event;
270} 270}
271 271
272static void serio_handle_events(void) 272static void serio_handle_event(void)
273{ 273{
274 struct serio_event *event; 274 struct serio_event *event;
275 struct serio_driver *serio_drv; 275 struct serio_driver *serio_drv;
276 276
277 down(&serio_sem); 277 down(&serio_sem);
278 278
279 while ((event = serio_get_event())) { 279 /*
280 * Note that we handle only one event here to give swsusp
281 * a chance to freeze kseriod thread. Serio events should
282 * be pretty rare so we are not concerned about taking
283 * performance hit.
284 */
285 if ((event = serio_get_event())) {
280 286
281 switch (event->type) { 287 switch (event->type) {
282 case SERIO_REGISTER_PORT: 288 case SERIO_REGISTER_PORT:
@@ -368,7 +374,7 @@ static struct serio *serio_get_pending_child(struct serio *parent)
368static int serio_thread(void *nothing) 374static int serio_thread(void *nothing)
369{ 375{
370 do { 376 do {
371 serio_handle_events(); 377 serio_handle_event();
372 wait_event_interruptible(serio_wait, 378 wait_event_interruptible(serio_wait,
373 kthread_should_stop() || !list_empty(&serio_event_list)); 379 kthread_should_stop() || !list_empty(&serio_event_list));
374 try_to_freeze(); 380 try_to_freeze();
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h
index bc021e1fd4d1..bbf4615f0e30 100644
--- a/drivers/md/dm-bio-list.h
+++ b/drivers/md/dm-bio-list.h
@@ -33,6 +33,9 @@ static inline void bio_list_add(struct bio_list *bl, struct bio *bio)
33 33
34static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) 34static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2)
35{ 35{
36 if (!bl2->head)
37 return;
38
36 if (bl->tail) 39 if (bl->tail)
37 bl->tail->bi_next = bl2->head; 40 bl->tail->bi_next = bl2->head;
38 else 41 else
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 54ec737195e0..07d44e19536e 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -425,8 +425,8 @@ static void list_version_get_needed(struct target_type *tt, void *needed_param)
425{ 425{
426 size_t *needed = needed_param; 426 size_t *needed = needed_param;
427 427
428 *needed += sizeof(struct dm_target_versions);
428 *needed += strlen(tt->name); 429 *needed += strlen(tt->name);
429 *needed += sizeof(tt->version);
430 *needed += ALIGN_MASK; 430 *needed += ALIGN_MASK;
431} 431}
432 432
@@ -974,6 +974,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size)
974 if (!hc) { 974 if (!hc) {
975 DMWARN("device doesn't appear to be in the dev hash table."); 975 DMWARN("device doesn't appear to be in the dev hash table.");
976 up_write(&_hash_lock); 976 up_write(&_hash_lock);
977 dm_table_put(t);
977 return -ENXIO; 978 return -ENXIO;
978 } 979 }
979 980
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index e110655eabdb..a76349cb10a5 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -333,10 +333,10 @@ static int core_ctr(struct dirty_log *log, struct dm_target *ti,
333 lc->sync = sync; 333 lc->sync = sync;
334 334
335 /* 335 /*
336 * Work out how many words we need to hold the bitset. 336 * Work out how many "unsigned long"s we need to hold the bitset.
337 */ 337 */
338 bitset_size = dm_round_up(region_count, 338 bitset_size = dm_round_up(region_count,
339 sizeof(*lc->clean_bits) << BYTE_SHIFT); 339 sizeof(unsigned long) << BYTE_SHIFT);
340 bitset_size >>= BYTE_SHIFT; 340 bitset_size >>= BYTE_SHIFT;
341 341
342 lc->bitset_uint32_count = bitset_size / 4; 342 lc->bitset_uint32_count = bitset_size / 4;
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index f9b7b32d5d5c..f72a82fb9434 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1000,6 +1000,7 @@ static int do_end_io(struct multipath *m, struct bio *bio,
1000{ 1000{
1001 struct hw_handler *hwh = &m->hw_handler; 1001 struct hw_handler *hwh = &m->hw_handler;
1002 unsigned err_flags = MP_FAIL_PATH; /* Default behavior */ 1002 unsigned err_flags = MP_FAIL_PATH; /* Default behavior */
1003 unsigned long flags;
1003 1004
1004 if (!error) 1005 if (!error)
1005 return 0; /* I/O complete */ 1006 return 0; /* I/O complete */
@@ -1010,17 +1011,17 @@ static int do_end_io(struct multipath *m, struct bio *bio,
1010 if (error == -EOPNOTSUPP) 1011 if (error == -EOPNOTSUPP)
1011 return error; 1012 return error;
1012 1013
1013 spin_lock(&m->lock); 1014 spin_lock_irqsave(&m->lock, flags);
1014 if (!m->nr_valid_paths) { 1015 if (!m->nr_valid_paths) {
1015 if (!m->queue_if_no_path) { 1016 if (!m->queue_if_no_path) {
1016 spin_unlock(&m->lock); 1017 spin_unlock_irqrestore(&m->lock, flags);
1017 return -EIO; 1018 return -EIO;
1018 } else { 1019 } else {
1019 spin_unlock(&m->lock); 1020 spin_unlock_irqrestore(&m->lock, flags);
1020 goto requeue; 1021 goto requeue;
1021 } 1022 }
1022 } 1023 }
1023 spin_unlock(&m->lock); 1024 spin_unlock_irqrestore(&m->lock, flags);
1024 1025
1025 if (hwh->type && hwh->type->error) 1026 if (hwh->type && hwh->type->error)
1026 err_flags = hwh->type->error(hwh, bio); 1027 err_flags = hwh->type->error(hwh, bio);
@@ -1040,12 +1041,12 @@ static int do_end_io(struct multipath *m, struct bio *bio,
1040 dm_bio_restore(&mpio->details, bio); 1041 dm_bio_restore(&mpio->details, bio);
1041 1042
1042 /* queue for the daemon to resubmit or fail */ 1043 /* queue for the daemon to resubmit or fail */
1043 spin_lock(&m->lock); 1044 spin_lock_irqsave(&m->lock, flags);
1044 bio_list_add(&m->queued_ios, bio); 1045 bio_list_add(&m->queued_ios, bio);
1045 m->queue_size++; 1046 m->queue_size++;
1046 if (!m->queue_io) 1047 if (!m->queue_io)
1047 queue_work(kmultipathd, &m->process_queued_ios); 1048 queue_work(kmultipathd, &m->process_queued_ios);
1048 spin_unlock(&m->lock); 1049 spin_unlock_irqrestore(&m->lock, flags);
1049 1050
1050 return 1; /* io not complete */ 1051 return 1; /* io not complete */
1051} 1052}
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 2375709a392c..6b0fc1670929 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -376,16 +376,18 @@ static void rh_inc(struct region_hash *rh, region_t region)
376 read_lock(&rh->hash_lock); 376 read_lock(&rh->hash_lock);
377 reg = __rh_find(rh, region); 377 reg = __rh_find(rh, region);
378 378
379 spin_lock_irq(&rh->region_lock);
379 atomic_inc(&reg->pending); 380 atomic_inc(&reg->pending);
380 381
381 spin_lock_irq(&rh->region_lock);
382 if (reg->state == RH_CLEAN) { 382 if (reg->state == RH_CLEAN) {
383 rh->log->type->mark_region(rh->log, reg->key);
384
385 reg->state = RH_DIRTY; 383 reg->state = RH_DIRTY;
386 list_del_init(&reg->list); /* take off the clean list */ 384 list_del_init(&reg->list); /* take off the clean list */
387 } 385 spin_unlock_irq(&rh->region_lock);
388 spin_unlock_irq(&rh->region_lock); 386
387 rh->log->type->mark_region(rh->log, reg->key);
388 } else
389 spin_unlock_irq(&rh->region_lock);
390
389 391
390 read_unlock(&rh->hash_lock); 392 read_unlock(&rh->hash_lock);
391} 393}
@@ -408,21 +410,17 @@ static void rh_dec(struct region_hash *rh, region_t region)
408 reg = __rh_lookup(rh, region); 410 reg = __rh_lookup(rh, region);
409 read_unlock(&rh->hash_lock); 411 read_unlock(&rh->hash_lock);
410 412
413 spin_lock_irqsave(&rh->region_lock, flags);
411 if (atomic_dec_and_test(&reg->pending)) { 414 if (atomic_dec_and_test(&reg->pending)) {
412 spin_lock_irqsave(&rh->region_lock, flags);
413 if (atomic_read(&reg->pending)) { /* check race */
414 spin_unlock_irqrestore(&rh->region_lock, flags);
415 return;
416 }
417 if (reg->state == RH_RECOVERING) { 415 if (reg->state == RH_RECOVERING) {
418 list_add_tail(&reg->list, &rh->quiesced_regions); 416 list_add_tail(&reg->list, &rh->quiesced_regions);
419 } else { 417 } else {
420 reg->state = RH_CLEAN; 418 reg->state = RH_CLEAN;
421 list_add(&reg->list, &rh->clean_regions); 419 list_add(&reg->list, &rh->clean_regions);
422 } 420 }
423 spin_unlock_irqrestore(&rh->region_lock, flags);
424 should_wake = 1; 421 should_wake = 1;
425 } 422 }
423 spin_unlock_irqrestore(&rh->region_lock, flags);
426 424
427 if (should_wake) 425 if (should_wake)
428 wake(); 426 wake();
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 78c7418478d6..cd12fca73b0d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1028,7 +1028,6 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
1028 mddev->size = le64_to_cpu(sb->size)/2; 1028 mddev->size = le64_to_cpu(sb->size)/2;
1029 mddev->events = le64_to_cpu(sb->events); 1029 mddev->events = le64_to_cpu(sb->events);
1030 mddev->bitmap_offset = 0; 1030 mddev->bitmap_offset = 0;
1031 mddev->default_bitmap_offset = 0;
1032 mddev->default_bitmap_offset = 1024; 1031 mddev->default_bitmap_offset = 1024;
1033 1032
1034 mddev->recovery_cp = le64_to_cpu(sb->resync_offset); 1033 mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
@@ -2932,6 +2931,9 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
2932 2931
2933 mddev->sb_dirty = 1; 2932 mddev->sb_dirty = 1;
2934 2933
2934 mddev->default_bitmap_offset = MD_SB_BYTES >> 9;
2935 mddev->bitmap_offset = 0;
2936
2935 /* 2937 /*
2936 * Generate a 128 bit UUID 2938 * Generate a 128 bit UUID
2937 */ 2939 */
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 2da9d3ba902d..3066c587b539 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -953,9 +953,6 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
953 int mirror = 0; 953 int mirror = 0;
954 mirror_info_t *p; 954 mirror_info_t *p;
955 955
956 if (rdev->saved_raid_disk >= 0 &&
957 conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
958 mirror = rdev->saved_raid_disk;
959 for (mirror=0; mirror < mddev->raid_disks; mirror++) 956 for (mirror=0; mirror < mddev->raid_disks; mirror++)
960 if ( !(p=conf->mirrors+mirror)->rdev) { 957 if ( !(p=conf->mirrors+mirror)->rdev) {
961 958
@@ -972,7 +969,10 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
972 p->head_position = 0; 969 p->head_position = 0;
973 rdev->raid_disk = mirror; 970 rdev->raid_disk = mirror;
974 found = 1; 971 found = 1;
975 if (rdev->saved_raid_disk != mirror) 972 /* As all devices are equivalent, we don't need a full recovery
973 * if this was recently any drive of the array
974 */
975 if (rdev->saved_raid_disk < 0)
976 conf->fullsync = 1; 976 conf->fullsync = 1;
977 rcu_assign_pointer(p->rdev, rdev); 977 rcu_assign_pointer(p->rdev, rdev);
978 break; 978 break;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 867f06ae33d9..713dc9c2c730 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -552,7 +552,11 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio)
552 !test_bit(In_sync, &rdev->flags)) 552 !test_bit(In_sync, &rdev->flags))
553 continue; 553 continue;
554 554
555 if (!atomic_read(&rdev->nr_pending)) { 555 /* This optimisation is debatable, and completely destroys
556 * sequential read speed for 'far copies' arrays. So only
557 * keep it for 'near' arrays, and review those later.
558 */
559 if (conf->near_copies > 1 && !atomic_read(&rdev->nr_pending)) {
556 disk = ndisk; 560 disk = ndisk;
557 slot = nslot; 561 slot = nslot;
558 break; 562 break;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e2a40283e323..36d5f8ac8265 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1704,7 +1704,9 @@ static void raid5d (mddev_t *mddev)
1704 1704
1705 if (conf->seq_flush - conf->seq_write > 0) { 1705 if (conf->seq_flush - conf->seq_write > 0) {
1706 int seq = conf->seq_flush; 1706 int seq = conf->seq_flush;
1707 spin_unlock_irq(&conf->device_lock);
1707 bitmap_unplug(mddev->bitmap); 1708 bitmap_unplug(mddev->bitmap);
1709 spin_lock_irq(&conf->device_lock);
1708 conf->seq_write = seq; 1710 conf->seq_write = seq;
1709 activate_bit_delay(conf); 1711 activate_bit_delay(conf);
1710 } 1712 }
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index eae5a35629c5..0000d162d198 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -1702,6 +1702,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1702 int data_disks = raid_disks - 2; 1702 int data_disks = raid_disks - 2;
1703 sector_t max_sector = mddev->size << 1; 1703 sector_t max_sector = mddev->size << 1;
1704 int sync_blocks; 1704 int sync_blocks;
1705 int still_degraded = 0;
1706 int i;
1705 1707
1706 if (sector_nr >= max_sector) { 1708 if (sector_nr >= max_sector) {
1707 /* just being told to finish up .. nothing much to do */ 1709 /* just being told to finish up .. nothing much to do */
@@ -1710,7 +1712,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1710 if (mddev->curr_resync < max_sector) /* aborted */ 1712 if (mddev->curr_resync < max_sector) /* aborted */
1711 bitmap_end_sync(mddev->bitmap, mddev->curr_resync, 1713 bitmap_end_sync(mddev->bitmap, mddev->curr_resync,
1712 &sync_blocks, 1); 1714 &sync_blocks, 1);
1713 else /* compelted sync */ 1715 else /* completed sync */
1714 conf->fullsync = 0; 1716 conf->fullsync = 0;
1715 bitmap_close_sync(mddev->bitmap); 1717 bitmap_close_sync(mddev->bitmap);
1716 1718
@@ -1748,7 +1750,16 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1748 */ 1750 */
1749 schedule_timeout_uninterruptible(1); 1751 schedule_timeout_uninterruptible(1);
1750 } 1752 }
1751 bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 0); 1753 /* Need to check if array will still be degraded after recovery/resync
1754 * We don't need to check the 'failed' flag as when that gets set,
1755 * recovery aborts.
1756 */
1757 for (i=0; i<mddev->raid_disks; i++)
1758 if (conf->disks[i].rdev == NULL)
1759 still_degraded = 1;
1760
1761 bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded);
1762
1752 spin_lock(&sh->lock); 1763 spin_lock(&sh->lock);
1753 set_bit(STRIPE_SYNCING, &sh->state); 1764 set_bit(STRIPE_SYNCING, &sh->state);
1754 clear_bit(STRIPE_INSYNC, &sh->state); 1765 clear_bit(STRIPE_INSYNC, &sh->state);
@@ -1784,7 +1795,9 @@ static void raid6d (mddev_t *mddev)
1784 1795
1785 if (conf->seq_flush - conf->seq_write > 0) { 1796 if (conf->seq_flush - conf->seq_write > 0) {
1786 int seq = conf->seq_flush; 1797 int seq = conf->seq_flush;
1798 spin_unlock_irq(&conf->device_lock);
1787 bitmap_unplug(mddev->bitmap); 1799 bitmap_unplug(mddev->bitmap);
1800 spin_lock_irq(&conf->device_lock);
1788 conf->seq_write = seq; 1801 conf->seq_write = seq;
1789 activate_bit_delay(conf); 1802 activate_bit_delay(conf);
1790 } 1803 }
@@ -2145,9 +2158,15 @@ static int raid6_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
2145 /* no point adding a device */ 2158 /* no point adding a device */
2146 return 0; 2159 return 0;
2147 /* 2160 /*
2148 * find the disk ... 2161 * find the disk ... but prefer rdev->saved_raid_disk
2162 * if possible.
2149 */ 2163 */
2150 for (disk=0; disk < mddev->raid_disks; disk++) 2164 if (rdev->saved_raid_disk >= 0 &&
2165 conf->disks[rdev->saved_raid_disk].rdev == NULL)
2166 disk = rdev->saved_raid_disk;
2167 else
2168 disk = 0;
2169 for ( ; disk < mddev->raid_disks; disk++)
2151 if ((p=conf->disks + disk)->rdev == NULL) { 2170 if ((p=conf->disks + disk)->rdev == NULL) {
2152 clear_bit(In_sync, &rdev->flags); 2171 clear_bit(In_sync, &rdev->flags);
2153 rdev->raid_disk = disk; 2172 rdev->raid_disk = disk;
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index fb394a0d838c..336fc284fa52 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -772,7 +772,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
772 input_dev->name = DRIVER_NAME " remote control"; 772 input_dev->name = DRIVER_NAME " remote control";
773 input_dev->phys = cinergyt2->phys; 773 input_dev->phys = cinergyt2->phys;
774 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 774 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
775 for (i = 0; ARRAY_SIZE(rc_keys); i += 3) 775 for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3)
776 set_bit(rc_keys[i + 2], input_dev->keybit); 776 set_bit(rc_keys[i + 2], input_dev->keybit);
777 input_dev->keycodesize = 0; 777 input_dev->keycodesize = 0;
778 input_dev->keycodemax = 0; 778 input_dev->keycodemax = 0;
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 1a3b3c7e5e99..ecb9a31dd003 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -26,7 +26,7 @@ config VIDEO_BT848
26 module will be called bttv. 26 module will be called bttv.
27 27
28config VIDEO_BT848_DVB 28config VIDEO_BT848_DVB
29 tristate "DVB/ATSC Support for bt878 based TV cards" 29 bool "DVB/ATSC Support for bt878 based TV cards"
30 depends on VIDEO_BT848 && DVB_CORE 30 depends on VIDEO_BT848 && DVB_CORE
31 select DVB_BT8XX 31 select DVB_BT8XX
32 ---help--- 32 ---help---
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 41818b6205b3..85ba4106dc79 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -46,8 +46,8 @@ config VIDEO_CX88_DVB_ALL_FRONTENDS
46 If you are unsure, choose Y. 46 If you are unsure, choose Y.
47 47
48config VIDEO_CX88_DVB_MT352 48config VIDEO_CX88_DVB_MT352
49 tristate "Zarlink MT352 DVB-T Support" 49 bool "Zarlink MT352 DVB-T Support"
50 default m 50 default y
51 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS 51 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
52 select DVB_MT352 52 select DVB_MT352
53 ---help--- 53 ---help---
@@ -55,8 +55,8 @@ config VIDEO_CX88_DVB_MT352
55 Connexant 2388x chip and the MT352 demodulator. 55 Connexant 2388x chip and the MT352 demodulator.
56 56
57config VIDEO_CX88_DVB_OR51132 57config VIDEO_CX88_DVB_OR51132
58 tristate "OR51132 ATSC Support" 58 bool "OR51132 ATSC Support"
59 default m 59 default y
60 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS 60 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
61 select DVB_OR51132 61 select DVB_OR51132
62 ---help--- 62 ---help---
@@ -64,8 +64,8 @@ config VIDEO_CX88_DVB_OR51132
64 Connexant 2388x chip and the OR51132 demodulator. 64 Connexant 2388x chip and the OR51132 demodulator.
65 65
66config VIDEO_CX88_DVB_CX22702 66config VIDEO_CX88_DVB_CX22702
67 tristate "Conexant CX22702 DVB-T Support" 67 bool "Conexant CX22702 DVB-T Support"
68 default m 68 default y
69 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS 69 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
70 select DVB_CX22702 70 select DVB_CX22702
71 ---help--- 71 ---help---
@@ -73,8 +73,8 @@ config VIDEO_CX88_DVB_CX22702
73 Connexant 2388x chip and the CX22702 demodulator. 73 Connexant 2388x chip and the CX22702 demodulator.
74 74
75config VIDEO_CX88_DVB_LGDT330X 75config VIDEO_CX88_DVB_LGDT330X
76 tristate "LG Electronics DT3302/DT3303 ATSC Support" 76 bool "LG Electronics DT3302/DT3303 ATSC Support"
77 default m 77 default y
78 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS 78 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
79 select DVB_LGDT330X 79 select DVB_LGDT330X
80 ---help--- 80 ---help---
@@ -82,8 +82,8 @@ config VIDEO_CX88_DVB_LGDT330X
82 Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. 82 Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator.
83 83
84config VIDEO_CX88_DVB_NXT200X 84config VIDEO_CX88_DVB_NXT200X
85 tristate "NXT2002/NXT2004 ATSC Support" 85 bool "NXT2002/NXT2004 ATSC Support"
86 default m 86 default y
87 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS 87 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
88 select DVB_NXT200X 88 select DVB_NXT200X
89 ---help--- 89 ---help---
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 0df40b773454..54401b02b7ce 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -9,21 +9,12 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
9EXTRA_CFLAGS += -I$(src)/.. 9EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
12ifneq ($(CONFIG_VIDEO_BUF_DVB),n) 12
13 EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 13extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
14endif 14extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1
15ifneq ($(CONFIG_DVB_CX22702),n) 15extra-cflags-$(CONFIG_DVB_OR51132) += -DHAVE_OR51132=1
16 EXTRA_CFLAGS += -DHAVE_CX22702=1 16extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1
17endif 17extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
18ifneq ($(CONFIG_DVB_OR51132),n) 18extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1
19 EXTRA_CFLAGS += -DHAVE_OR51132=1 19
20endif 20EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
21ifneq ($(CONFIG_DVB_LGDT330X),n)
22 EXTRA_CFLAGS += -DHAVE_LGDT330X=1
23endif
24ifneq ($(CONFIG_DVB_MT352),n)
25 EXTRA_CFLAGS += -DHAVE_MT352=1
26endif
27ifneq ($(CONFIG_DVB_NXT200X),n)
28 EXTRA_CFLAGS += -DHAVE_NXT200X=1
29endif
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
index 5abfc0fbf6de..6345e29e4951 100644
--- a/drivers/media/video/ir-kbd-gpio.c
+++ b/drivers/media/video/ir-kbd-gpio.c
@@ -673,7 +673,6 @@ static int ir_probe(struct device *dev)
673 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 673 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
674 pci_name(sub->core->pci)); 674 pci_name(sub->core->pci));
675 675
676 ir->sub = sub;
677 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); 676 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
678 input_dev->name = ir->name; 677 input_dev->name = ir->name;
679 input_dev->phys = ir->phys; 678 input_dev->phys = ir->phys;
@@ -688,6 +687,9 @@ static int ir_probe(struct device *dev)
688 } 687 }
689 input_dev->cdev.dev = &sub->core->pci->dev; 688 input_dev->cdev.dev = &sub->core->pci->dev;
690 689
690 ir->input = input_dev;
691 ir->sub = sub;
692
691 if (ir->polling) { 693 if (ir->polling) {
692 INIT_WORK(&ir->work, ir_work, ir); 694 INIT_WORK(&ir->work, ir_work, ir);
693 init_timer(&ir->timer); 695 init_timer(&ir->timer);
@@ -708,7 +710,6 @@ static int ir_probe(struct device *dev)
708 /* all done */ 710 /* all done */
709 dev_set_drvdata(dev, ir); 711 dev_set_drvdata(dev, ir);
710 input_register_device(ir->input); 712 input_register_device(ir->input);
711 printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys);
712 713
713 /* the remote isn't as bouncy as a keyboard */ 714 /* the remote isn't as bouncy as a keyboard */
714 ir->input->rep[REP_DELAY] = repeat_delay; 715 ir->input->rep[REP_DELAY] = repeat_delay;
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index 7bdeabe638ca..c512c4411b38 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -42,8 +42,8 @@ config VIDEO_SAA7134_DVB_ALL_FRONTENDS
42 If you are unsure, choose Y. 42 If you are unsure, choose Y.
43 43
44config VIDEO_SAA7134_DVB_MT352 44config VIDEO_SAA7134_DVB_MT352
45 tristate "Zarlink MT352 DVB-T Support" 45 bool "Zarlink MT352 DVB-T Support"
46 default m 46 default y
47 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS 47 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
48 select DVB_MT352 48 select DVB_MT352
49 ---help--- 49 ---help---
@@ -51,8 +51,8 @@ config VIDEO_SAA7134_DVB_MT352
51 Philips saa7134 chip and the MT352 demodulator. 51 Philips saa7134 chip and the MT352 demodulator.
52 52
53config VIDEO_SAA7134_DVB_TDA1004X 53config VIDEO_SAA7134_DVB_TDA1004X
54 tristate "Phillips TDA10045H/TDA10046H DVB-T Support" 54 bool "Phillips TDA10045H/TDA10046H DVB-T Support"
55 default m 55 default y
56 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS 56 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
57 select DVB_TDA1004X 57 select DVB_TDA1004X
58 ---help--- 58 ---help---
@@ -60,8 +60,8 @@ config VIDEO_SAA7134_DVB_TDA1004X
60 Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. 60 Philips saa7134 chip and the TDA10045H/TDA10046H demodulator.
61 61
62config VIDEO_SAA7134_DVB_NXT200X 62config VIDEO_SAA7134_DVB_NXT200X
63 tristate "NXT2002/NXT2004 ATSC Support" 63 bool "NXT2002/NXT2004 ATSC Support"
64 default m 64 default y
65 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS 65 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
66 select DVB_NXT200X 66 select DVB_NXT200X
67 ---help--- 67 ---help---
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index 4226b61cc613..134f83a96218 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -11,15 +11,10 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
11EXTRA_CFLAGS += -I$(src)/.. 11EXTRA_CFLAGS += -I$(src)/..
12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
13EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 13EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
14ifneq ($(CONFIG_VIDEO_BUF_DVB),n) 14
15 EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 15extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
16endif 16extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
17ifneq ($(CONFIG_DVB_MT352),n) 17extra-cflags-$(CONFIG_DVB_TDA1004X) += -DHAVE_TDA1004X=1
18 EXTRA_CFLAGS += -DHAVE_MT352=1 18extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1
19endif 19
20ifneq ($(CONFIG_DVB_TDA1004X),n) 20EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
21 EXTRA_CFLAGS += -DHAVE_TDA1004X=1
22endif
23ifneq ($(CONFIG_DVB_NXT200X),n)
24 EXTRA_CFLAGS += -DHAVE_NXT200X=1
25endif
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index e648cc3bc96d..ab75ca5ac356 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -713,6 +713,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)
713 return -ENOMEM; 713 return -ENOMEM;
714 } 714 }
715 715
716 ir->dev = input_dev;
717
716 /* init hardware-specific stuff */ 718 /* init hardware-specific stuff */
717 ir->mask_keycode = mask_keycode; 719 ir->mask_keycode = mask_keycode;
718 ir->mask_keydown = mask_keydown; 720 ir->mask_keydown = mask_keydown;
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 66c03e882570..81ef306cb124 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -421,8 +421,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
421 i2o_pci_free(c); 421 i2o_pci_free(c);
422 422
423 free_controller: 423 free_controller:
424 i2o_iop_free(c);
425 put_device(c->device.parent); 424 put_device(c->device.parent);
425 i2o_iop_free(c);
426 426
427 disable: 427 disable:
428 pci_disable_device(pdev); 428 pci_disable_device(pdev);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index da528390acf8..d336a1d65dc7 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -816,7 +816,7 @@ static void mmc_discover_cards(struct mmc_host *host)
816 816
817 cmd.opcode = SD_SEND_RELATIVE_ADDR; 817 cmd.opcode = SD_SEND_RELATIVE_ADDR;
818 cmd.arg = 0; 818 cmd.arg = 0;
819 cmd.flags = MMC_RSP_R1; 819 cmd.flags = MMC_RSP_R6;
820 820
821 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 821 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
822 if (err != MMC_ERR_NONE) 822 if (err != MMC_ERR_NONE)
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c
index 2a290cc397ad..70b47e4c4e9c 100644
--- a/drivers/net/dgrs.c
+++ b/drivers/net/dgrs.c
@@ -1458,6 +1458,8 @@ static struct pci_driver dgrs_pci_driver = {
1458 .probe = dgrs_pci_probe, 1458 .probe = dgrs_pci_probe,
1459 .remove = __devexit_p(dgrs_pci_remove), 1459 .remove = __devexit_p(dgrs_pci_remove),
1460}; 1460};
1461#else
1462static struct pci_driver dgrs_pci_driver = {};
1461#endif 1463#endif
1462 1464
1463 1465
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index c42b68d3aa24..6a61b9f286e1 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -59,7 +59,6 @@ struct slot {
59 struct slot *next; 59 struct slot *next;
60 u8 bus; 60 u8 bus;
61 u8 device; 61 u8 device;
62 u16 status;
63 u32 number; 62 u32 number;
64 u8 state; 63 u8 state;
65 struct timer_list task_event; 64 struct timer_list task_event;
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 5e582eca21d8..83c4b865718a 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -207,7 +207,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
207 * power fault Cleared 207 * power fault Cleared
208 */ 208 */
209 info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); 209 info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot);
210 p_slot->status = 0x00;
211 taskInfo->event_type = INT_POWER_FAULT_CLEAR; 210 taskInfo->event_type = INT_POWER_FAULT_CLEAR;
212 } else { 211 } else {
213 /* 212 /*
@@ -215,8 +214,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
215 */ 214 */
216 info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); 215 info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot);
217 taskInfo->event_type = INT_POWER_FAULT; 216 taskInfo->event_type = INT_POWER_FAULT;
218 /* set power fault status for this board */
219 p_slot->status = 0xFF;
220 info("power fault bit %x set\n", hp_slot); 217 info("power fault bit %x set\n", hp_slot);
221 } 218 }
222 if (rc) 219 if (rc)
@@ -317,13 +314,10 @@ static int board_added(struct slot *p_slot)
317 return rc; 314 return rc;
318 } 315 }
319 316
320 dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status);
321
322 /* Check for a power fault */ 317 /* Check for a power fault */
323 if (p_slot->status == 0xFF) { 318 if (p_slot->hpc_ops->query_power_fault(p_slot)) {
324 /* power fault occurred, but it was benign */ 319 dbg("%s: power fault detected\n", __FUNCTION__);
325 rc = POWER_FAILURE; 320 rc = POWER_FAILURE;
326 p_slot->status = 0;
327 goto err_exit; 321 goto err_exit;
328 } 322 }
329 323
@@ -334,8 +328,6 @@ static int board_added(struct slot *p_slot)
334 goto err_exit; 328 goto err_exit;
335 } 329 }
336 330
337 p_slot->status = 0;
338
339 /* 331 /*
340 * Some PCI Express root ports require fixup after hot-plug operation. 332 * Some PCI Express root ports require fixup after hot-plug operation.
341 */ 333 */
@@ -382,9 +374,6 @@ static int remove_board(struct slot *p_slot)
382 374
383 dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); 375 dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);
384 376
385 /* Change status to shutdown */
386 p_slot->status = 0x01;
387
388 /* Wait for exclusive access to hardware */ 377 /* Wait for exclusive access to hardware */
389 down(&ctrl->crit_sect); 378 down(&ctrl->crit_sect);
390 379
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 2387e75da0fe..0b8b26beb163 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -750,7 +750,7 @@ static int hpc_power_on_slot(struct slot * slot)
750{ 750{
751 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; 751 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
752 u16 slot_cmd; 752 u16 slot_cmd;
753 u16 slot_ctrl; 753 u16 slot_ctrl, slot_status;
754 754
755 int retval = 0; 755 int retval = 0;
756 756
@@ -767,6 +767,14 @@ static int hpc_power_on_slot(struct slot * slot)
767 return -1; 767 return -1;
768 } 768 }
769 769
770 /* Clear sticky power-fault bit from previous power failures */
771 hp_register_read_word(php_ctlr->pci_dev,
772 SLOT_STATUS(slot->ctrl->cap_base), slot_status);
773 slot_status &= PWR_FAULT_DETECTED;
774 if (slot_status)
775 hp_register_write_word(php_ctlr->pci_dev,
776 SLOT_STATUS(slot->ctrl->cap_base), slot_status);
777
770 retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl); 778 retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl);
771 779
772 if (retval) { 780 if (retval) {
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index a9b00cc2d885..6917c6cb0912 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -178,6 +178,7 @@ EXPORT_SYMBOL(pci_osc_support_set);
178 178
179/** 179/**
180 * pci_osc_control_set - commit requested control to Firmware 180 * pci_osc_control_set - commit requested control to Firmware
181 * @handle: acpi_handle for the target ACPI object
181 * @flags: driver's requested control bits 182 * @flags: driver's requested control bits
182 * 183 *
183 * Attempt to take control from Firmware on requested control bits. 184 * Attempt to take control from Firmware on requested control bits.
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 2c22b4b3619d..078579ae6359 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -355,9 +355,10 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, kio_addr_t ioaddr
355#ifndef CONFIG_PLAT_USRV 355#ifndef CONFIG_PLAT_USRV
356 /* insert interrupt */ 356 /* insert interrupt */
357 request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); 357 request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt);
358#ifndef CONFIG_PLAT_MAPPI3
358 /* eject interrupt */ 359 /* eject interrupt */
359 request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); 360 request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt);
360 361#endif
361 debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); 362 debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n");
362 pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); 363 pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01);
363#endif /* CONFIG_PLAT_USRV */ 364#endif /* CONFIG_PLAT_USRV */
diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c
index 672f9f2b2163..92e6c5639dd3 100644
--- a/drivers/sbus/char/aurora.c
+++ b/drivers/sbus/char/aurora.c
@@ -124,25 +124,25 @@ static inline int aurora_paranoia_check(struct Aurora_port const * port,
124 */ 124 */
125 125
126/* Get board number from pointer */ 126/* Get board number from pointer */
127extern inline int board_No (struct Aurora_board const * bp) 127static inline int board_No (struct Aurora_board const * bp)
128{ 128{
129 return bp - aurora_board; 129 return bp - aurora_board;
130} 130}
131 131
132/* Get port number from pointer */ 132/* Get port number from pointer */
133extern inline int port_No (struct Aurora_port const * port) 133static inline int port_No (struct Aurora_port const * port)
134{ 134{
135 return AURORA_PORT(port - aurora_port); 135 return AURORA_PORT(port - aurora_port);
136} 136}
137 137
138/* Get pointer to board from pointer to port */ 138/* Get pointer to board from pointer to port */
139extern inline struct Aurora_board * port_Board(struct Aurora_port const * port) 139static inline struct Aurora_board * port_Board(struct Aurora_port const * port)
140{ 140{
141 return &aurora_board[AURORA_BOARD(port - aurora_port)]; 141 return &aurora_board[AURORA_BOARD(port - aurora_port)];
142} 142}
143 143
144/* Wait for Channel Command Register ready */ 144/* Wait for Channel Command Register ready */
145extern inline void aurora_wait_CCR(struct aurora_reg128 * r) 145static inline void aurora_wait_CCR(struct aurora_reg128 * r)
146{ 146{
147 unsigned long delay; 147 unsigned long delay;
148 148
@@ -161,7 +161,7 @@ printk("aurora_wait_CCR\n");
161 */ 161 */
162 162
163/* Must be called with enabled interrupts */ 163/* Must be called with enabled interrupts */
164extern inline void aurora_long_delay(unsigned long delay) 164static inline void aurora_long_delay(unsigned long delay)
165{ 165{
166 unsigned long i; 166 unsigned long i;
167 167
@@ -420,7 +420,7 @@ static void aurora_release_io_range(struct Aurora_board *bp)
420 sbus_iounmap((unsigned long)bp->r3, 4); 420 sbus_iounmap((unsigned long)bp->r3, 4);
421} 421}
422 422
423extern inline void aurora_mark_event(struct Aurora_port * port, int event) 423static inline void aurora_mark_event(struct Aurora_port * port, int event)
424{ 424{
425#ifdef AURORA_DEBUG 425#ifdef AURORA_DEBUG
426 printk("aurora_mark_event: start\n"); 426 printk("aurora_mark_event: start\n");
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index c28e3aea1c3c..418fc7b896ac 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -816,7 +816,7 @@ static int adpt_hba_reset(adpt_hba* pHba)
816static void adpt_i2o_sys_shutdown(void) 816static void adpt_i2o_sys_shutdown(void)
817{ 817{
818 adpt_hba *pHba, *pNext; 818 adpt_hba *pHba, *pNext;
819 struct adpt_i2o_post_wait_data *p1, *p2; 819 struct adpt_i2o_post_wait_data *p1, *old;
820 820
821 printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n"); 821 printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n");
822 printk(KERN_INFO" This could take a few minutes if there are many devices attached\n"); 822 printk(KERN_INFO" This could take a few minutes if there are many devices attached\n");
@@ -830,13 +830,14 @@ static void adpt_i2o_sys_shutdown(void)
830 } 830 }
831 831
832 /* Remove any timedout entries from the wait queue. */ 832 /* Remove any timedout entries from the wait queue. */
833 p2 = NULL;
834// spin_lock_irqsave(&adpt_post_wait_lock, flags); 833// spin_lock_irqsave(&adpt_post_wait_lock, flags);
835 /* Nothing should be outstanding at this point so just 834 /* Nothing should be outstanding at this point so just
836 * free them 835 * free them
837 */ 836 */
838 for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p2->next) { 837 for(p1 = adpt_post_wait_queue; p1;) {
839 kfree(p1); 838 old = p1;
839 p1 = p1->next;
840 kfree(old);
840 } 841 }
841// spin_unlock_irqrestore(&adpt_post_wait_lock, flags); 842// spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
842 adpt_post_wait_queue = NULL; 843 adpt_post_wait_queue = NULL;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 0be60bba58d3..180676d7115a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -265,10 +265,10 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask)
265 spin_lock_irqsave(&dev->list_lock, flags); 265 spin_lock_irqsave(&dev->list_lock, flags);
266 list_add_tail(&cmd->list, &dev->cmd_list); 266 list_add_tail(&cmd->list, &dev->cmd_list);
267 spin_unlock_irqrestore(&dev->list_lock, flags); 267 spin_unlock_irqrestore(&dev->list_lock, flags);
268 cmd->jiffies_at_alloc = jiffies;
268 } else 269 } else
269 put_device(&dev->sdev_gendev); 270 put_device(&dev->sdev_gendev);
270 271
271 cmd->jiffies_at_alloc = jiffies;
272 return cmd; 272 return cmd;
273} 273}
274EXPORT_SYMBOL(scsi_get_command); 274EXPORT_SYMBOL(scsi_get_command);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index e08510d09ff6..d2bcd1f87cd6 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -102,7 +102,7 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
102#define SERIAL_PORT_DFNS 102#define SERIAL_PORT_DFNS
103#endif 103#endif
104 104
105static struct old_serial_port old_serial_port[] = { 105static const struct old_serial_port old_serial_port[] = {
106 SERIAL_PORT_DFNS /* defined in asm/serial.h */ 106 SERIAL_PORT_DFNS /* defined in asm/serial.h */
107}; 107};
108 108
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 5c3c03932d6d..8d92adfbb8bd 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -468,7 +468,7 @@ static unsigned short timedia_eight_port[] = {
468 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 468 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
469}; 469};
470 470
471static struct timedia_struct { 471static const struct timedia_struct {
472 int num; 472 int num;
473 unsigned short *ids; 473 unsigned short *ids;
474} timedia_data[] = { 474} timedia_data[] = {
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 355cd93a8a87..83c4c1216587 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -994,7 +994,7 @@ static int __init imx_serial_init(void)
994static void __exit imx_serial_exit(void) 994static void __exit imx_serial_exit(void)
995{ 995{
996 uart_unregister_driver(&imx_reg); 996 uart_unregister_driver(&imx_reg);
997 driver_unregister(&serial_imx_driver); 997 platform_driver_unregister(&serial_imx_driver);
998} 998}
999 999
1000module_init(imx_serial_init); 1000module_init(imx_serial_init);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 2331296e1e17..c17d680e3f04 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1779,7 +1779,7 @@ struct baud_rates {
1779 unsigned int cflag; 1779 unsigned int cflag;
1780}; 1780};
1781 1781
1782static struct baud_rates baud_rates[] = { 1782static const struct baud_rates baud_rates[] = {
1783 { 921600, B921600 }, 1783 { 921600, B921600 },
1784 { 460800, B460800 }, 1784 { 460800, B460800 },
1785 { 230400, B230400 }, 1785 { 230400, B230400 },
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 2c7d3ef76e8e..7ce0c7e66d37 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -85,7 +85,7 @@ struct multi_id {
85 int multi; /* 1 = multifunction, > 1 = # ports */ 85 int multi; /* 1 = multifunction, > 1 = # ports */
86}; 86};
87 87
88static struct multi_id multi_id[] = { 88static const struct multi_id multi_id[] = {
89 { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 }, 89 { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 },
90 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 }, 90 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 },
91 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 }, 91 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 },
@@ -354,8 +354,8 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse)
354 354
355static int simple_config(dev_link_t *link) 355static int simple_config(dev_link_t *link)
356{ 356{
357 static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 357 static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
358 static int size_table[2] = { 8, 16 }; 358 static const int size_table[2] = { 8, 16 };
359 client_handle_t handle = link->handle; 359 client_handle_t handle = link->handle;
360 struct serial_info *info = link->priv; 360 struct serial_info *info = link->priv;
361 struct serial_cfg_mem *cfg_mem; 361 struct serial_cfg_mem *cfg_mem;
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 7feb829362d6..5131d88e8c5b 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -20,9 +20,17 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/usb.h>
24
23#include <asm/io.h> 25#include <asm/io.h>
24#include <asm/irq.h> 26#include <asm/irq.h>
25#include <linux/usb.h> 27
28#ifdef CONFIG_PPC_PMAC
29#include <asm/machdep.h>
30#include <asm/pmac_feature.h>
31#include <asm/pci-bridge.h>
32#include <asm/prom.h>
33#endif
26 34
27#include "usb.h" 35#include "usb.h"
28#include "hcd.h" 36#include "hcd.h"
@@ -277,8 +285,22 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
277 } 285 }
278 286
279done: 287done:
280 if (retval == 0) 288 if (retval == 0) {
281 dev->dev.power.power_state = PMSG_SUSPEND; 289 dev->dev.power.power_state = PMSG_SUSPEND;
290
291#ifdef CONFIG_PPC_PMAC
292 /* Disable ASIC clocks for USB */
293 if (_machine == _MACH_Pmac) {
294 struct device_node *of_node;
295
296 of_node = pci_device_to_OF_node (dev);
297 if (of_node)
298 pmac_call_feature(PMAC_FTR_USB_ENABLE,
299 of_node, 0, 0);
300 }
301#endif
302 }
303
282 return retval; 304 return retval;
283} 305}
284EXPORT_SYMBOL (usb_hcd_pci_suspend); 306EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -301,6 +323,18 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
301 return 0; 323 return 0;
302 } 324 }
303 325
326#ifdef CONFIG_PPC_PMAC
327 /* Reenable ASIC clocks for USB */
328 if (_machine == _MACH_Pmac) {
329 struct device_node *of_node;
330
331 of_node = pci_device_to_OF_node (dev);
332 if (of_node)
333 pmac_call_feature (PMAC_FTR_USB_ENABLE,
334 of_node, 0, 1);
335 }
336#endif
337
304 /* NOTE: chip docs cover clean "real suspend" cases (what Linux 338 /* NOTE: chip docs cover clean "real suspend" cases (what Linux
305 * calls "standby", "suspend to RAM", and so on). There are also 339 * calls "standby", "suspend to RAM", and so on). There are also
306 * dirty cases when swsusp fakes a suspend in "shutdown" mode. 340 * dirty cases when swsusp fakes a suspend in "shutdown" mode.
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 840727948d84..f78bd124d290 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1669,7 +1669,6 @@ int usb_suspend_device(struct usb_device *udev)
1669 return 0; 1669 return 0;
1670#endif 1670#endif
1671} 1671}
1672EXPORT_SYMBOL_GPL(usb_suspend_device);
1673 1672
1674/* 1673/*
1675 * If the USB "suspend" state is in use (rather than "global suspend"), 1674 * If the USB "suspend" state is in use (rather than "global suspend"),
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index af3c05eb86fc..29f52a44b928 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -411,50 +411,39 @@ static void ehci_stop (struct usb_hcd *hcd)
411 dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status)); 411 dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status));
412} 412}
413 413
414static int ehci_run (struct usb_hcd *hcd) 414/* one-time init, only for memory state */
415static int ehci_init(struct usb_hcd *hcd)
415{ 416{
416 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 417 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
417 u32 temp; 418 u32 temp;
418 int retval; 419 int retval;
419 u32 hcc_params; 420 u32 hcc_params;
420 int first; 421
421 422 spin_lock_init(&ehci->lock);
422 /* skip some things on restart paths */ 423
423 first = (ehci->watchdog.data == 0); 424 init_timer(&ehci->watchdog);
424 if (first) { 425 ehci->watchdog.function = ehci_watchdog;
425 init_timer (&ehci->watchdog); 426 ehci->watchdog.data = (unsigned long) ehci;
426 ehci->watchdog.function = ehci_watchdog;
427 ehci->watchdog.data = (unsigned long) ehci;
428 }
429 427
430 /* 428 /*
431 * hw default: 1K periodic list heads, one per frame. 429 * hw default: 1K periodic list heads, one per frame.
432 * periodic_size can shrink by USBCMD update if hcc_params allows. 430 * periodic_size can shrink by USBCMD update if hcc_params allows.
433 */ 431 */
434 ehci->periodic_size = DEFAULT_I_TDPS; 432 ehci->periodic_size = DEFAULT_I_TDPS;
435 if (first && (retval = ehci_mem_init (ehci, GFP_KERNEL)) < 0) 433 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
436 return retval; 434 return retval;
437 435
438 /* controllers may cache some of the periodic schedule ... */ 436 /* controllers may cache some of the periodic schedule ... */
439 hcc_params = readl (&ehci->caps->hcc_params); 437 hcc_params = readl(&ehci->caps->hcc_params);
440 if (HCC_ISOC_CACHE (hcc_params)) // full frame cache 438 if (HCC_ISOC_CACHE(hcc_params)) // full frame cache
441 ehci->i_thresh = 8; 439 ehci->i_thresh = 8;
442 else // N microframes cached 440 else // N microframes cached
443 ehci->i_thresh = 2 + HCC_ISOC_THRES (hcc_params); 441 ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params);
444 442
445 ehci->reclaim = NULL; 443 ehci->reclaim = NULL;
446 ehci->reclaim_ready = 0; 444 ehci->reclaim_ready = 0;
447 ehci->next_uframe = -1; 445 ehci->next_uframe = -1;
448 446
449 /* controller state: unknown --> reset */
450
451 /* EHCI spec section 4.1 */
452 if ((retval = ehci_reset (ehci)) != 0) {
453 ehci_mem_cleanup (ehci);
454 return retval;
455 }
456 writel (ehci->periodic_dma, &ehci->regs->frame_list);
457
458 /* 447 /*
459 * dedicate a qh for the async ring head, since we couldn't unlink 448 * dedicate a qh for the async ring head, since we couldn't unlink
460 * a 'real' qh without stopping the async schedule [4.8]. use it 449 * a 'real' qh without stopping the async schedule [4.8]. use it
@@ -462,37 +451,13 @@ static int ehci_run (struct usb_hcd *hcd)
462 * its dummy is used in hw_alt_next of many tds, to prevent the qh 451 * its dummy is used in hw_alt_next of many tds, to prevent the qh
463 * from automatically advancing to the next td after short reads. 452 * from automatically advancing to the next td after short reads.
464 */ 453 */
465 if (first) { 454 ehci->async->qh_next.qh = NULL;
466 ehci->async->qh_next.qh = NULL; 455 ehci->async->hw_next = QH_NEXT(ehci->async->qh_dma);
467 ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma); 456 ehci->async->hw_info1 = cpu_to_le32(QH_HEAD);
468 ehci->async->hw_info1 = cpu_to_le32 (QH_HEAD); 457 ehci->async->hw_token = cpu_to_le32(QTD_STS_HALT);
469 ehci->async->hw_token = cpu_to_le32 (QTD_STS_HALT); 458 ehci->async->hw_qtd_next = EHCI_LIST_END;
470 ehci->async->hw_qtd_next = EHCI_LIST_END; 459 ehci->async->qh_state = QH_STATE_LINKED;
471 ehci->async->qh_state = QH_STATE_LINKED; 460 ehci->async->hw_alt_next = QTD_NEXT(ehci->async->dummy->qtd_dma);
472 ehci->async->hw_alt_next = QTD_NEXT (ehci->async->dummy->qtd_dma);
473 }
474 writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next);
475
476 /*
477 * hcc_params controls whether ehci->regs->segment must (!!!)
478 * be used; it constrains QH/ITD/SITD and QTD locations.
479 * pci_pool consistent memory always uses segment zero.
480 * streaming mappings for I/O buffers, like pci_map_single(),
481 * can return segments above 4GB, if the device allows.
482 *
483 * NOTE: the dma mask is visible through dma_supported(), so
484 * drivers can pass this info along ... like NETIF_F_HIGHDMA,
485 * Scsi_Host.highmem_io, and so forth. It's readonly to all
486 * host side drivers though.
487 */
488 if (HCC_64BIT_ADDR (hcc_params)) {
489 writel (0, &ehci->regs->segment);
490#if 0
491// this is deeply broken on almost all architectures
492 if (!dma_set_mask (hcd->self.controller, DMA_64BIT_MASK))
493 ehci_info (ehci, "enabled 64bit DMA\n");
494#endif
495 }
496 461
497 /* clear interrupt enables, set irq latency */ 462 /* clear interrupt enables, set irq latency */
498 if (log2_irq_thresh < 0 || log2_irq_thresh > 6) 463 if (log2_irq_thresh < 0 || log2_irq_thresh > 6)
@@ -507,13 +472,13 @@ static int ehci_run (struct usb_hcd *hcd)
507 * make problems: throughput reduction (!), data errors... 472 * make problems: throughput reduction (!), data errors...
508 */ 473 */
509 if (park) { 474 if (park) {
510 park = min (park, (unsigned) 3); 475 park = min(park, (unsigned) 3);
511 temp |= CMD_PARK; 476 temp |= CMD_PARK;
512 temp |= park << 8; 477 temp |= park << 8;
513 } 478 }
514 ehci_info (ehci, "park %d\n", park); 479 ehci_dbg(ehci, "park %d\n", park);
515 } 480 }
516 if (HCC_PGM_FRAMELISTLEN (hcc_params)) { 481 if (HCC_PGM_FRAMELISTLEN(hcc_params)) {
517 /* periodic schedule size can be smaller than default */ 482 /* periodic schedule size can be smaller than default */
518 temp &= ~(3 << 2); 483 temp &= ~(3 << 2);
519 temp |= (EHCI_TUNE_FLS << 2); 484 temp |= (EHCI_TUNE_FLS << 2);
@@ -521,16 +486,63 @@ static int ehci_run (struct usb_hcd *hcd)
521 case 0: ehci->periodic_size = 1024; break; 486 case 0: ehci->periodic_size = 1024; break;
522 case 1: ehci->periodic_size = 512; break; 487 case 1: ehci->periodic_size = 512; break;
523 case 2: ehci->periodic_size = 256; break; 488 case 2: ehci->periodic_size = 256; break;
524 default: BUG (); 489 default: BUG();
525 } 490 }
526 } 491 }
492 ehci->command = temp;
493
494 ehci->reboot_notifier.notifier_call = ehci_reboot;
495 register_reboot_notifier(&ehci->reboot_notifier);
496
497 return 0;
498}
499
500/* start HC running; it's halted, ehci_init() has been run (once) */
501static int ehci_run (struct usb_hcd *hcd)
502{
503 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
504 int retval;
505 u32 temp;
506 u32 hcc_params;
507
508 /* EHCI spec section 4.1 */
509 if ((retval = ehci_reset(ehci)) != 0) {
510 unregister_reboot_notifier(&ehci->reboot_notifier);
511 ehci_mem_cleanup(ehci);
512 return retval;
513 }
514 writel(ehci->periodic_dma, &ehci->regs->frame_list);
515 writel((u32)ehci->async->qh_dma, &ehci->regs->async_next);
516
517 /*
518 * hcc_params controls whether ehci->regs->segment must (!!!)
519 * be used; it constrains QH/ITD/SITD and QTD locations.
520 * pci_pool consistent memory always uses segment zero.
521 * streaming mappings for I/O buffers, like pci_map_single(),
522 * can return segments above 4GB, if the device allows.
523 *
524 * NOTE: the dma mask is visible through dma_supported(), so
525 * drivers can pass this info along ... like NETIF_F_HIGHDMA,
526 * Scsi_Host.highmem_io, and so forth. It's readonly to all
527 * host side drivers though.
528 */
529 hcc_params = readl(&ehci->caps->hcc_params);
530 if (HCC_64BIT_ADDR(hcc_params)) {
531 writel(0, &ehci->regs->segment);
532#if 0
533// this is deeply broken on almost all architectures
534 if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK))
535 ehci_info(ehci, "enabled 64bit DMA\n");
536#endif
537 }
538
539
527 // Philips, Intel, and maybe others need CMD_RUN before the 540 // Philips, Intel, and maybe others need CMD_RUN before the
528 // root hub will detect new devices (why?); NEC doesn't 541 // root hub will detect new devices (why?); NEC doesn't
529 temp |= CMD_RUN; 542 ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET);
530 writel (temp, &ehci->regs->command); 543 ehci->command |= CMD_RUN;
531 dbg_cmd (ehci, "init", temp); 544 writel (ehci->command, &ehci->regs->command);
532 545 dbg_cmd (ehci, "init", ehci->command);
533 /* set async sleep time = 10 us ... ? */
534 546
535 /* 547 /*
536 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices 548 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices
@@ -538,26 +550,23 @@ static int ehci_run (struct usb_hcd *hcd)
538 * involved with the root hub. (Except where one is integrated, 550 * involved with the root hub. (Except where one is integrated,
539 * and there's no companion controller unless maybe for USB OTG.) 551 * and there's no companion controller unless maybe for USB OTG.)
540 */ 552 */
541 if (first) {
542 ehci->reboot_notifier.notifier_call = ehci_reboot;
543 register_reboot_notifier (&ehci->reboot_notifier);
544 }
545
546 hcd->state = HC_STATE_RUNNING; 553 hcd->state = HC_STATE_RUNNING;
547 writel (FLAG_CF, &ehci->regs->configured_flag); 554 writel (FLAG_CF, &ehci->regs->configured_flag);
548 readl (&ehci->regs->command); /* unblock posted write */ 555 readl (&ehci->regs->command); /* unblock posted writes */
549 556
550 temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); 557 temp = HC_VERSION(readl (&ehci->caps->hc_capbase));
551 ehci_info (ehci, 558 ehci_info (ehci,
552 "USB %x.%x %s, EHCI %x.%02x, driver %s\n", 559 "USB %x.%x started, EHCI %x.%02x, driver %s\n",
553 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), 560 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
554 first ? "initialized" : "restarted",
555 temp >> 8, temp & 0xff, DRIVER_VERSION); 561 temp >> 8, temp & 0xff, DRIVER_VERSION);
556 562
557 writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ 563 writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */
558 564
559 if (first) 565 /* GRR this is run-once init(), being done every time the HC starts.
560 create_debug_files (ehci); 566 * So long as they're part of class devices, we can't do it init()
567 * since the class device isn't created that early.
568 */
569 create_debug_files(ehci);
561 570
562 return 0; 571 return 0;
563} 572}
@@ -636,9 +645,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
636 * stop that signaling. 645 * stop that signaling.
637 */ 646 */
638 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); 647 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
639 mod_timer (&hcd->rh_timer,
640 ehci->reset_done [i] + 1);
641 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); 648 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
649 usb_hcd_resume_root_hub(hcd);
642 } 650 }
643 } 651 }
644 652
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 88cb4ada686e..82caf336e9b6 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -94,6 +94,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
94 msleep(5); 94 msleep(5);
95 spin_lock_irq (&ehci->lock); 95 spin_lock_irq (&ehci->lock);
96 96
97 /* Ideally and we've got a real resume here, and no port's power
98 * was lost. (For PCI, that means Vaux was maintained.) But we
99 * could instead be restoring a swsusp snapshot -- so that BIOS was
100 * the last user of the controller, not reset/pm hardware keeping
101 * state we gave to it.
102 */
103
97 /* re-init operational registers in case we lost power */ 104 /* re-init operational registers in case we lost power */
98 if (readl (&ehci->regs->intr_enable) == 0) { 105 if (readl (&ehci->regs->intr_enable) == 0) {
99 /* at least some APM implementations will try to deliver 106 /* at least some APM implementations will try to deliver
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index dfd9bd0b1828..441c26064b44 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -27,7 +27,7 @@
27/* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... 27/* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/...
28 * off the controller (maybe it can boot from highspeed USB disks). 28 * off the controller (maybe it can boot from highspeed USB disks).
29 */ 29 */
30static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) 30static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap)
31{ 31{
32 struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); 32 struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
33 33
@@ -48,7 +48,7 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
48 where, cap); 48 where, cap);
49 // some BIOS versions seem buggy... 49 // some BIOS versions seem buggy...
50 // return 1; 50 // return 1;
51 ehci_warn (ehci, "continuing after BIOS bug...\n"); 51 ehci_warn(ehci, "continuing after BIOS bug...\n");
52 /* disable all SMIs, and clear "BIOS owns" flag */ 52 /* disable all SMIs, and clear "BIOS owns" flag */
53 pci_write_config_dword(pdev, where + 4, 0); 53 pci_write_config_dword(pdev, where + 4, 0);
54 pci_write_config_byte(pdev, where + 2, 0); 54 pci_write_config_byte(pdev, where + 2, 0);
@@ -58,96 +58,47 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
58 return 0; 58 return 0;
59} 59}
60 60
61/* called by khubd or root hub init threads */ 61/* called after powerup, by probe or system-pm "wakeup" */
62static int ehci_pci_reset (struct usb_hcd *hcd) 62static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
63{ 63{
64 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
65 u32 temp; 64 u32 temp;
65 int retval;
66 unsigned count = 256/4; 66 unsigned count = 256/4;
67 67
68 spin_lock_init (&ehci->lock); 68 /* optional debug port, normally in the first BAR */
69 69 temp = pci_find_capability(pdev, 0x0a);
70 ehci->caps = hcd->regs; 70 if (temp) {
71 ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase)); 71 pci_read_config_dword(pdev, temp, &temp);
72 dbg_hcs_params (ehci, "reset"); 72 temp >>= 16;
73 dbg_hcc_params (ehci, "reset"); 73 if ((temp & (3 << 13)) == (1 << 13)) {
74 74 temp &= 0x1fff;
75 /* cache this readonly data; minimize chip reads */ 75 ehci->debug = ehci_to_hcd(ehci)->regs + temp;
76 ehci->hcs_params = readl (&ehci->caps->hcs_params); 76 temp = readl(&ehci->debug->control);
77 77 ehci_info(ehci, "debug port %d%s\n",
78 if (hcd->self.controller->bus == &pci_bus_type) { 78 HCS_DEBUG_PORT(ehci->hcs_params),
79 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 79 (temp & DBGP_ENABLED)
80 80 ? " IN USE"
81 switch (pdev->vendor) { 81 : "");
82 case PCI_VENDOR_ID_TDI: 82 if (!(temp & DBGP_ENABLED))
83 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 83 ehci->debug = NULL;
84 ehci->is_tdi_rh_tt = 1;
85 tdi_reset (ehci);
86 }
87 break;
88 case PCI_VENDOR_ID_AMD:
89 /* AMD8111 EHCI doesn't work, according to AMD errata */
90 if (pdev->device == 0x7463) {
91 ehci_info (ehci, "ignoring AMD8111 (errata)\n");
92 return -EIO;
93 }
94 break;
95 case PCI_VENDOR_ID_NVIDIA:
96 /* NVidia reports that certain chips don't handle
97 * QH, ITD, or SITD addresses above 2GB. (But TD,
98 * data buffer, and periodic schedule are normal.)
99 */
100 switch (pdev->device) {
101 case 0x003c: /* MCP04 */
102 case 0x005b: /* CK804 */
103 case 0x00d8: /* CK8 */
104 case 0x00e8: /* CK8S */
105 if (pci_set_consistent_dma_mask(pdev,
106 DMA_31BIT_MASK) < 0)
107 ehci_warn (ehci, "can't enable NVidia "
108 "workaround for >2GB RAM\n");
109 break;
110 }
111 break;
112 }
113
114 /* optional debug port, normally in the first BAR */
115 temp = pci_find_capability (pdev, 0x0a);
116 if (temp) {
117 pci_read_config_dword(pdev, temp, &temp);
118 temp >>= 16;
119 if ((temp & (3 << 13)) == (1 << 13)) {
120 temp &= 0x1fff;
121 ehci->debug = hcd->regs + temp;
122 temp = readl (&ehci->debug->control);
123 ehci_info (ehci, "debug port %d%s\n",
124 HCS_DEBUG_PORT(ehci->hcs_params),
125 (temp & DBGP_ENABLED)
126 ? " IN USE"
127 : "");
128 if (!(temp & DBGP_ENABLED))
129 ehci->debug = NULL;
130 }
131 } 84 }
85 }
132 86
133 temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); 87 temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params));
134 } else
135 temp = 0;
136 88
137 /* EHCI 0.96 and later may have "extended capabilities" */ 89 /* EHCI 0.96 and later may have "extended capabilities" */
138 while (temp && count--) { 90 while (temp && count--) {
139 u32 cap; 91 u32 cap;
140 92
141 pci_read_config_dword (to_pci_dev(hcd->self.controller), 93 pci_read_config_dword(pdev, temp, &cap);
142 temp, &cap); 94 ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp);
143 ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
144 switch (cap & 0xff) { 95 switch (cap & 0xff) {
145 case 1: /* BIOS/SMM/... handoff */ 96 case 1: /* BIOS/SMM/... handoff */
146 if (bios_handoff (ehci, temp, cap) != 0) 97 if (bios_handoff(ehci, temp, cap) != 0)
147 return -EOPNOTSUPP; 98 return -EOPNOTSUPP;
148 break; 99 break;
149 case 0: /* illegal reserved capability */ 100 case 0: /* illegal reserved capability */
150 ehci_warn (ehci, "illegal capability!\n"); 101 ehci_dbg(ehci, "illegal capability!\n");
151 cap = 0; 102 cap = 0;
152 /* FALLTHROUGH */ 103 /* FALLTHROUGH */
153 default: /* unknown */ 104 default: /* unknown */
@@ -156,77 +107,109 @@ static int ehci_pci_reset (struct usb_hcd *hcd)
156 temp = (cap >> 8) & 0xff; 107 temp = (cap >> 8) & 0xff;
157 } 108 }
158 if (!count) { 109 if (!count) {
159 ehci_err (ehci, "bogus capabilities ... PCI problems!\n"); 110 ehci_err(ehci, "bogus capabilities ... PCI problems!\n");
160 return -EIO; 111 return -EIO;
161 } 112 }
162 if (ehci_is_TDI(ehci))
163 ehci_reset (ehci);
164 113
165 ehci_port_power (ehci, 0); 114 /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */
115 retval = pci_set_mwi(pdev);
116 if (!retval)
117 ehci_dbg(ehci, "MWI active\n");
118
119 ehci_port_power(ehci, 0);
120
121 return 0;
122}
123
124/* called by khubd or root hub (re)init threads; leaves HC in halt state */
125static int ehci_pci_reset(struct usb_hcd *hcd)
126{
127 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
128 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
129 u32 temp;
130 int retval;
131
132 ehci->caps = hcd->regs;
133 ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));
134 dbg_hcs_params(ehci, "reset");
135 dbg_hcc_params(ehci, "reset");
136
137 /* cache this readonly data; minimize chip reads */
138 ehci->hcs_params = readl(&ehci->caps->hcs_params);
139
140 retval = ehci_halt(ehci);
141 if (retval)
142 return retval;
143
144 /* NOTE: only the parts below this line are PCI-specific */
145
146 switch (pdev->vendor) {
147 case PCI_VENDOR_ID_TDI:
148 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
149 ehci->is_tdi_rh_tt = 1;
150 tdi_reset(ehci);
151 }
152 break;
153 case PCI_VENDOR_ID_AMD:
154 /* AMD8111 EHCI doesn't work, according to AMD errata */
155 if (pdev->device == 0x7463) {
156 ehci_info(ehci, "ignoring AMD8111 (errata)\n");
157 return -EIO;
158 }
159 break;
160 case PCI_VENDOR_ID_NVIDIA:
161 /* NVidia reports that certain chips don't handle
162 * QH, ITD, or SITD addresses above 2GB. (But TD,
163 * data buffer, and periodic schedule are normal.)
164 */
165 switch (pdev->device) {
166 case 0x003c: /* MCP04 */
167 case 0x005b: /* CK804 */
168 case 0x00d8: /* CK8 */
169 case 0x00e8: /* CK8S */
170 if (pci_set_consistent_dma_mask(pdev,
171 DMA_31BIT_MASK) < 0)
172 ehci_warn(ehci, "can't enable NVidia "
173 "workaround for >2GB RAM\n");
174 break;
175 }
176 break;
177 }
178
179 if (ehci_is_TDI(ehci))
180 ehci_reset(ehci);
166 181
167 /* at least the Genesys GL880S needs fixup here */ 182 /* at least the Genesys GL880S needs fixup here */
168 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 183 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
169 temp &= 0x0f; 184 temp &= 0x0f;
170 if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { 185 if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
171 ehci_dbg (ehci, "bogus port configuration: " 186 ehci_dbg(ehci, "bogus port configuration: "
172 "cc=%d x pcc=%d < ports=%d\n", 187 "cc=%d x pcc=%d < ports=%d\n",
173 HCS_N_CC(ehci->hcs_params), 188 HCS_N_CC(ehci->hcs_params),
174 HCS_N_PCC(ehci->hcs_params), 189 HCS_N_PCC(ehci->hcs_params),
175 HCS_N_PORTS(ehci->hcs_params)); 190 HCS_N_PORTS(ehci->hcs_params));
176 191
177 if (hcd->self.controller->bus == &pci_bus_type) { 192 switch (pdev->vendor) {
178 struct pci_dev *pdev; 193 case 0x17a0: /* GENESYS */
179 194 /* GL880S: should be PORTS=2 */
180 pdev = to_pci_dev(hcd->self.controller); 195 temp |= (ehci->hcs_params & ~0xf);
181 switch (pdev->vendor) { 196 ehci->hcs_params = temp;
182 case 0x17a0: /* GENESYS */ 197 break;
183 /* GL880S: should be PORTS=2 */ 198 case PCI_VENDOR_ID_NVIDIA:
184 temp |= (ehci->hcs_params & ~0xf); 199 /* NF4: should be PCC=10 */
185 ehci->hcs_params = temp; 200 break;
186 break;
187 case PCI_VENDOR_ID_NVIDIA:
188 /* NF4: should be PCC=10 */
189 break;
190 }
191 } 201 }
192 } 202 }
193 203
194 /* force HC to halt state */ 204 /* Serial Bus Release Number is at PCI 0x60 offset */
195 return ehci_halt (ehci); 205 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
196}
197
198static int ehci_pci_start (struct usb_hcd *hcd)
199{
200 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
201 int result = 0;
202
203 if (hcd->self.controller->bus == &pci_bus_type) {
204 struct pci_dev *pdev;
205 u16 port_wake;
206
207 pdev = to_pci_dev(hcd->self.controller);
208
209 /* Serial Bus Release Number is at PCI 0x60 offset */
210 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
211
212 /* port wake capability, reported by boot firmware */
213 pci_read_config_word(pdev, 0x62, &port_wake);
214 hcd->can_wakeup = (port_wake & 1) != 0;
215 206
216 /* help hc dma work well with cachelines */ 207 /* REVISIT: per-port wake capability (PCI 0x62) currently unused */
217 result = pci_set_mwi(pdev);
218 if (result)
219 ehci_dbg(ehci, "unable to enable MWI - not fatal.\n");
220 }
221
222 return ehci_run (hcd);
223}
224 208
225/* always called by thread; normally rmmod */ 209 retval = ehci_pci_reinit(ehci, pdev);
226 210
227static void ehci_pci_stop (struct usb_hcd *hcd) 211 /* finish init */
228{ 212 return ehci_init(hcd);
229 ehci_stop (hcd);
230} 213}
231 214
232/*-------------------------------------------------------------------------*/ 215/*-------------------------------------------------------------------------*/
@@ -235,90 +218,88 @@ static void ehci_pci_stop (struct usb_hcd *hcd)
235 218
236/* suspend/resume, section 4.3 */ 219/* suspend/resume, section 4.3 */
237 220
238/* These routines rely on the bus (pci, platform, etc) 221/* These routines rely on the PCI bus glue
239 * to handle powerdown and wakeup, and currently also on 222 * to handle powerdown and wakeup, and currently also on
240 * transceivers that don't need any software attention to set up 223 * transceivers that don't need any software attention to set up
241 * the right sort of wakeup. 224 * the right sort of wakeup.
225 * Also they depend on separate root hub suspend/resume.
242 */ 226 */
243 227
244static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 228static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
245{ 229{
246 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 230 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
247 231
248 if (time_before (jiffies, ehci->next_statechange)) 232 if (time_before(jiffies, ehci->next_statechange))
249 msleep (100); 233 msleep(10);
250 234
251#ifdef CONFIG_USB_SUSPEND 235 // could save FLADJ in case of Vaux power loss
252 (void) usb_suspend_device (hcd->self.root_hub);
253#else
254 usb_lock_device (hcd->self.root_hub);
255 (void) ehci_bus_suspend (hcd);
256 usb_unlock_device (hcd->self.root_hub);
257#endif
258
259 // save (PCI) FLADJ in case of Vaux power loss
260 // ... we'd only use it to handle clock skew 236 // ... we'd only use it to handle clock skew
261 237
262 return 0; 238 return 0;
263} 239}
264 240
265static int ehci_pci_resume (struct usb_hcd *hcd) 241static int ehci_pci_resume(struct usb_hcd *hcd)
266{ 242{
267 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 243 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
268 unsigned port; 244 unsigned port;
269 struct usb_device *root = hcd->self.root_hub; 245 struct usb_device *root = hcd->self.root_hub;
246 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
270 int retval = -EINVAL; 247 int retval = -EINVAL;
271 248
272 // maybe restore (PCI) FLADJ 249 // maybe restore FLADJ
273 250
274 if (time_before (jiffies, ehci->next_statechange)) 251 if (time_before(jiffies, ehci->next_statechange))
275 msleep (100); 252 msleep(100);
253
254 /* If CF is clear, we lost PCI Vaux power and need to restart. */
255 if (readl(&ehci->regs->configured_flag) != FLAG_CF)
256 goto restart;
276 257
277 /* If any port is suspended (or owned by the companion), 258 /* If any port is suspended (or owned by the companion),
278 * we know we can/must resume the HC (and mustn't reset it). 259 * we know we can/must resume the HC (and mustn't reset it).
260 * We just defer that to the root hub code.
279 */ 261 */
280 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { 262 for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) {
281 u32 status; 263 u32 status;
282 port--; 264 port--;
283 status = readl (&ehci->regs->port_status [port]); 265 status = readl(&ehci->regs->port_status [port]);
284 if (!(status & PORT_POWER)) 266 if (!(status & PORT_POWER))
285 continue; 267 continue;
286 if (status & (PORT_SUSPEND | PORT_OWNER)) { 268 if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) {
287 down (&hcd->self.root_hub->serialize); 269 usb_hcd_resume_root_hub(hcd);
288 retval = ehci_bus_resume (hcd); 270 return 0;
289 up (&hcd->self.root_hub->serialize);
290 break;
291 } 271 }
272 }
273
274restart:
275 ehci_dbg(ehci, "lost power, restarting\n");
276 for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) {
277 port--;
292 if (!root->children [port]) 278 if (!root->children [port])
293 continue; 279 continue;
294 dbg_port (ehci, __FUNCTION__, port + 1, status); 280 usb_set_device_state(root->children[port],
295 usb_set_device_state (root->children[port],
296 USB_STATE_NOTATTACHED); 281 USB_STATE_NOTATTACHED);
297 } 282 }
298 283
299 /* Else reset, to cope with power loss or flush-to-storage 284 /* Else reset, to cope with power loss or flush-to-storage
300 * style "resume" having activated BIOS during reboot. 285 * style "resume" having let BIOS kick in during reboot.
301 */ 286 */
302 if (port == 0) { 287 (void) ehci_halt(ehci);
303 (void) ehci_halt (ehci); 288 (void) ehci_reset(ehci);
304 (void) ehci_reset (ehci); 289 (void) ehci_pci_reinit(ehci, pdev);
305 (void) ehci_pci_reset (hcd); 290
306 291 /* emptying the schedule aborts any urbs */
307 /* emptying the schedule aborts any urbs */ 292 spin_lock_irq(&ehci->lock);
308 spin_lock_irq (&ehci->lock); 293 if (ehci->reclaim)
309 if (ehci->reclaim) 294 ehci->reclaim_ready = 1;
310 ehci->reclaim_ready = 1; 295 ehci_work(ehci, NULL);
311 ehci_work (ehci, NULL); 296 spin_unlock_irq(&ehci->lock);
312 spin_unlock_irq (&ehci->lock); 297
313 298 /* restart; khubd will disconnect devices */
314 /* restart; khubd will disconnect devices */ 299 retval = ehci_run(hcd);
315 retval = ehci_run (hcd); 300
316 301 /* here we "know" root ports should always stay powered */
317 /* here we "know" root ports should always stay powered; 302 ehci_port_power(ehci, 1);
318 * but some controllers may lose all power.
319 */
320 ehci_port_power (ehci, 1);
321 }
322 303
323 return retval; 304 return retval;
324} 305}
@@ -339,12 +320,12 @@ static const struct hc_driver ehci_pci_hc_driver = {
339 * basic lifecycle operations 320 * basic lifecycle operations
340 */ 321 */
341 .reset = ehci_pci_reset, 322 .reset = ehci_pci_reset,
342 .start = ehci_pci_start, 323 .start = ehci_run,
343#ifdef CONFIG_PM 324#ifdef CONFIG_PM
344 .suspend = ehci_pci_suspend, 325 .suspend = ehci_pci_suspend,
345 .resume = ehci_pci_resume, 326 .resume = ehci_pci_resume,
346#endif 327#endif
347 .stop = ehci_pci_stop, 328 .stop = ehci_stop,
348 329
349 /* 330 /*
350 * managing i/o requests and associated device resources 331 * managing i/o requests and associated device resources
@@ -377,7 +358,7 @@ static const struct pci_device_id pci_ids [] = { {
377 }, 358 },
378 { /* end: all zeroes */ } 359 { /* end: all zeroes */ }
379}; 360};
380MODULE_DEVICE_TABLE (pci, pci_ids); 361MODULE_DEVICE_TABLE(pci, pci_ids);
381 362
382/* pci driver glue; this is a "new style" PCI driver module */ 363/* pci driver glue; this is a "new style" PCI driver module */
383static struct pci_driver ehci_pci_driver = { 364static struct pci_driver ehci_pci_driver = {
@@ -393,22 +374,22 @@ static struct pci_driver ehci_pci_driver = {
393#endif 374#endif
394}; 375};
395 376
396static int __init ehci_hcd_pci_init (void) 377static int __init ehci_hcd_pci_init(void)
397{ 378{
398 if (usb_disabled()) 379 if (usb_disabled())
399 return -ENODEV; 380 return -ENODEV;
400 381
401 pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", 382 pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
402 hcd_name, 383 hcd_name,
403 sizeof (struct ehci_qh), sizeof (struct ehci_qtd), 384 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
404 sizeof (struct ehci_itd), sizeof (struct ehci_sitd)); 385 sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
405 386
406 return pci_register_driver (&ehci_pci_driver); 387 return pci_register_driver(&ehci_pci_driver);
407} 388}
408module_init (ehci_hcd_pci_init); 389module_init(ehci_hcd_pci_init);
409 390
410static void __exit ehci_hcd_pci_cleanup (void) 391static void __exit ehci_hcd_pci_cleanup(void)
411{ 392{
412 pci_unregister_driver (&ehci_pci_driver); 393 pci_unregister_driver(&ehci_pci_driver);
413} 394}
414module_exit (ehci_hcd_pci_cleanup); 395module_exit(ehci_hcd_pci_cleanup);
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index a59e536441e1..5f22e6590cd1 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -14,15 +14,6 @@
14 * This file is licenced under the GPL. 14 * This file is licenced under the GPL.
15 */ 15 */
16 16
17#include <linux/jiffies.h>
18
19#ifdef CONFIG_PPC_PMAC
20#include <asm/machdep.h>
21#include <asm/pmac_feature.h>
22#include <asm/pci-bridge.h>
23#include <asm/prom.h>
24#endif
25
26#ifndef CONFIG_PCI 17#ifndef CONFIG_PCI
27#error "This file is PCI bus glue. CONFIG_PCI must be defined." 18#error "This file is PCI bus glue. CONFIG_PCI must be defined."
28#endif 19#endif
@@ -115,39 +106,12 @@ ohci_pci_start (struct usb_hcd *hcd)
115static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 106static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
116{ 107{
117 /* root hub was already suspended */ 108 /* root hub was already suspended */
118
119 /* FIXME these PMAC things get called in the wrong places. ASIC
120 * clocks should be turned off AFTER entering D3, and on BEFORE
121 * trying to enter D0. Evidently the PCI layer doesn't currently
122 * provide the right sort of platform hooks for this ...
123 */
124#ifdef CONFIG_PPC_PMAC
125 if (_machine == _MACH_Pmac) {
126 struct device_node *of_node;
127
128 /* Disable USB PAD & cell clock */
129 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
130 if (of_node)
131 pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
132 }
133#endif /* CONFIG_PPC_PMAC */
134 return 0; 109 return 0;
135} 110}
136 111
137 112
138static int ohci_pci_resume (struct usb_hcd *hcd) 113static int ohci_pci_resume (struct usb_hcd *hcd)
139{ 114{
140#ifdef CONFIG_PPC_PMAC
141 if (_machine == _MACH_Pmac) {
142 struct device_node *of_node;
143
144 /* Re-enable USB PAD & cell clock */
145 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
146 if (of_node)
147 pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
148 }
149#endif /* CONFIG_PPC_PMAC */
150
151 usb_hcd_resume_root_hub(hcd); 115 usb_hcd_resume_root_hub(hcd);
152 return 0; 116 return 0;
153} 117}
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c
index cf8cfbabefde..b2e66e3b90aa 100644
--- a/drivers/usb/media/sn9c102_core.c
+++ b/drivers/usb/media/sn9c102_core.c
@@ -199,7 +199,7 @@ static void sn9c102_release_buffers(struct sn9c102_device* cam)
199{ 199{
200 if (cam->nbuffers) { 200 if (cam->nbuffers) {
201 rvfree(cam->frame[0].bufmem, 201 rvfree(cam->frame[0].bufmem,
202 cam->nbuffers * cam->frame[0].buf.length); 202 cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length));
203 cam->nbuffers = 0; 203 cam->nbuffers = 0;
204 } 204 }
205} 205}
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 61204bf7cd78..06e04b442ff1 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -475,6 +475,8 @@ static struct usb_device_id id_table_combined [] = {
475 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 475 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
476 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 476 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
477 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, 477 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) },
478 { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) },
479 { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) },
478 { }, /* Optional parameter entry */ 480 { }, /* Optional parameter entry */
479 { } /* Terminating entry */ 481 { } /* Terminating entry */
480}; 482};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index ddb63df31ce6..773ea3eca086 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -128,6 +128,13 @@
128#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ 128#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */
129 129
130/* 130/*
131 * The following are the values for two KOBIL chipcard terminals.
132 */
133#define KOBIL_VID 0x0d46 /* KOBIL Vendor ID */
134#define KOBIL_CONV_B1_PID 0x2020 /* KOBIL Konverter for B1 */
135#define KOBIL_CONV_KAAN_PID 0x2021 /* KOBIL_Konverter for KAAN */
136
137/*
131 * DSS-20 Sync Station for Sony Ericsson P800 138 * DSS-20 Sync Station for Sony Ericsson P800
132 */ 139 */
133 140
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index a02fada85362..7744b8148bc5 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -46,7 +46,6 @@
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/spinlock.h> 47#include <linux/spinlock.h>
48#include <linux/usb.h> 48#include <linux/usb.h>
49#include <linux/usb.h>
50#include <asm/uaccess.h> 49#include <asm/uaccess.h>
51#include "usb-serial.h" 50#include "usb-serial.h"
52 51
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 0a9858f69a9b..f5f47a34b168 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1118,6 +1118,15 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1118 US_SC_DEVICE, US_PR_DEVICE, NULL, 1118 US_SC_DEVICE, US_PR_DEVICE, NULL,
1119 US_FL_GO_SLOW ), 1119 US_FL_GO_SLOW ),
1120 1120
1121/*
1122 * David Härdeman <david@2gen.com>
1123 * The key makes the SCSI stack print confusing (but harmless) messages
1124 */
1125UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
1126 "Iomega",
1127 "Micro Mini 1GB",
1128 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
1129
1121#ifdef CONFIG_USB_STORAGE_SDDR55 1130#ifdef CONFIG_USB_STORAGE_SDDR55
1122UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999, 1131UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
1123 "Sandisk", 1132 "Sandisk",
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c
index 3afd1eeb1ade..4952b66ae206 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/console/fbcon_ccw.c
@@ -34,7 +34,7 @@ static inline void ccw_update_attr(u8 *dst, u8 *src, int attribute,
34 msk <<= (8 - mod); 34 msk <<= (8 - mod);
35 35
36 if (offset > mod) 36 if (offset > mod)
37 set_bit(FBCON_BIT(7), (void *)&msk1); 37 msk1 |= 0x01;
38 38
39 for (i = 0; i < vc->vc_font.width; i++) { 39 for (i = 0; i < vc->vc_font.width; i++) {
40 for (j = 0; j < width; j++) { 40 for (j = 0; j < width; j++) {
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h
index 90c672096c2e..1b8f92fdc6a8 100644
--- a/drivers/video/console/fbcon_rotate.h
+++ b/drivers/video/console/fbcon_rotate.h
@@ -21,21 +21,13 @@
21 (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ 21 (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \
22 (i)->var.xres : (i)->var.xres_virtual; }) 22 (i)->var.xres : (i)->var.xres_virtual; })
23 23
24/*
25 * The bitmap is always big endian
26 */
27#if defined(__LITTLE_ENDIAN)
28#define FBCON_BIT(b) (7 - (b))
29#else
30#define FBCON_BIT(b) (b)
31#endif
32 24
33static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat) 25static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat)
34{ 26{
35 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; 27 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;
36 28
37 pat +=index; 29 pat +=index;
38 return (test_bit(FBCON_BIT(bit), (void *)pat)); 30 return (*pat) & (0x80 >> bit);
39} 31}
40 32
41static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) 33static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat)
@@ -43,13 +35,14 @@ static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat)
43 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; 35 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;
44 36
45 pat += index; 37 pat += index;
46 set_bit(FBCON_BIT(bit), (void *)pat); 38
39 (*pat) |= 0x80 >> bit;
47} 40}
48 41
49static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) 42static inline void rotate_ud(const char *in, char *out, u32 width, u32 height)
50{ 43{
51 int i, j; 44 int i, j;
52 int shift = width % 8; 45 int shift = (8 - (width % 8)) & 7;
53 46
54 width = (width + 7) & ~7; 47 width = (width + 7) & ~7;
55 48
@@ -85,7 +78,7 @@ static inline void rotate_cw(const char *in, char *out, u32 width, u32 height)
85static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) 78static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
86{ 79{
87 int i, j, h = height, w = width; 80 int i, j, h = height, w = width;
88 int shift = width % 8; 81 int shift = (8 - (width % 8)) & 7;
89 82
90 width = (width + 7) & ~7; 83 width = (width + 7) & ~7;
91 height = (height + 7) & ~7; 84 height = (height + 7) & ~7;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 274f90543e32..167de397e4b4 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -966,6 +966,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
966 outb_p(0x12, vga_video_port_reg); /* Vertical display limit */ 966 outb_p(0x12, vga_video_port_reg); /* Vertical display limit */
967 outb_p(vde, vga_video_port_val); 967 outb_p(vde, vga_video_port_val);
968 spin_unlock_irq(&vga_lock); 968 spin_unlock_irq(&vga_lock);
969 vga_video_font_height = fontheight;
969 970
970 for (i = 0; i < MAX_NR_CONSOLES; i++) { 971 for (i = 0; i < MAX_NR_CONSOLES; i++) {
971 struct vc_data *c = vc_cons[i].d; 972 struct vc_data *c = vc_cons[i].d;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 9f180096c896..6240aedb4154 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -452,13 +452,17 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
452 452
453 /* Return if no suitable logo was found */ 453 /* Return if no suitable logo was found */
454 fb_logo.logo = fb_find_logo(depth); 454 fb_logo.logo = fb_find_logo(depth);
455
456 if (!fb_logo.logo) {
457 return 0;
458 }
455 459
456 if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) 460 if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD)
457 yres = info->var.yres; 461 yres = info->var.yres;
458 else 462 else
459 yres = info->var.xres; 463 yres = info->var.xres;
460 464
461 if (fb_logo.logo && fb_logo.logo->height > yres) { 465 if (fb_logo.logo->height > yres) {
462 fb_logo.logo = NULL; 466 fb_logo.logo = NULL;
463 return 0; 467 return 0;
464 } 468 }
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index be7288184fa9..0ea965c3bb7d 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -427,6 +427,8 @@ v9fs_create(struct inode *dir,
427 427
428 v9fs_mistat2inode(fcall->params.rstat.stat, file_inode, sb); 428 v9fs_mistat2inode(fcall->params.rstat.stat, file_inode, sb);
429 kfree(fcall); 429 kfree(fcall);
430 fcall = NULL;
431 file_dentry->d_op = &v9fs_dentry_operations;
430 d_instantiate(file_dentry, file_inode); 432 d_instantiate(file_dentry, file_inode);
431 433
432 if (perm & V9FS_DMDIR) { 434 if (perm & V9FS_DMDIR) {
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index eab3750cf304..6bded10c0d50 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -3,6 +3,8 @@ Version 1.39
3Defer close of a file handle slightly if pending writes depend on that file handle 3Defer close of a file handle slightly if pending writes depend on that file handle
4(this reduces the EBADF bad file handle errors that can be logged under heavy 4(this reduces the EBADF bad file handle errors that can be logged under heavy
5stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 5stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2
6Fix SFU style symlinks and mknod needed for servers which do not support the CIFS
7Unix Extensions. Fix setfacl/getfacl on bigendian.
6 8
7Version 1.38 9Version 1.38
8------------ 10------------
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 4e12053f0806..d2b128255944 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/cifs_unicode.c 2 * fs/cifs/cifs_unicode.c
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2000,2002 4 * Copyright (c) International Business Machines Corp., 2000,2005
5 * Modified by Steve French (sfrench@us.ibm.com) 5 * Modified by Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
31 * 31 *
32 */ 32 */
33int 33int
34cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ 34cifs_strfromUCS_le(char *to, const __le16 * from,
35 int len, const struct nls_table *codepage) 35 int len, const struct nls_table *codepage)
36{ 36{
37 int i; 37 int i;
@@ -60,25 +60,26 @@ cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
60 * 60 *
61 */ 61 */
62int 62int
63cifs_strtoUCS(wchar_t * to, const char *from, int len, 63cifs_strtoUCS(__le16 * to, const char *from, int len,
64 const struct nls_table *codepage) 64 const struct nls_table *codepage)
65{ 65{
66 int charlen; 66 int charlen;
67 int i; 67 int i;
68 wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
68 69
69 for (i = 0; len && *from; i++, from += charlen, len -= charlen) { 70 for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
70 71
71 /* works for 2.4.0 kernel or later */ 72 /* works for 2.4.0 kernel or later */
72 charlen = codepage->char2uni(from, len, &to[i]); 73 charlen = codepage->char2uni(from, len, &wchar_to[i]);
73 if (charlen < 1) { 74 if (charlen < 1) {
74 cERROR(1, 75 cERROR(1,
75 ("cifs_strtoUCS: char2uni returned %d", 76 ("cifs_strtoUCS: char2uni returned %d",
76 charlen)); 77 charlen));
77 /* A question mark */ 78 /* A question mark */
78 to[i] = (wchar_t)cpu_to_le16(0x003f); 79 to[i] = cpu_to_le16(0x003f);
79 charlen = 1; 80 charlen = 1;
80 } else 81 } else
81 to[i] = (wchar_t)cpu_to_le16(to[i]); 82 to[i] = cpu_to_le16(wchar_to[i]);
82 83
83 } 84 }
84 85
diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h
index da8dde965275..39e5b970325f 100644
--- a/fs/cifs/cifs_unicode.h
+++ b/fs/cifs/cifs_unicode.h
@@ -5,7 +5,7 @@
5 * Convert a unicode character to upper or lower case using 5 * Convert a unicode character to upper or lower case using
6 * compressed tables. 6 * compressed tables.
7 * 7 *
8 * Copyright (c) International Business Machines Corp., 2000,2002 8 * Copyright (c) International Business Machines Corp., 2000,2005555555555555555555555555555555555555555555555555555555
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -59,8 +59,8 @@ extern struct UniCaseRange UniLowerRange[];
59#endif /* UNIUPR_NOLOWER */ 59#endif /* UNIUPR_NOLOWER */
60 60
61#ifdef __KERNEL__ 61#ifdef __KERNEL__
62int cifs_strfromUCS_le(char *, const wchar_t *, int, const struct nls_table *); 62int cifs_strfromUCS_le(char *, const __le16 *, int, const struct nls_table *);
63int cifs_strtoUCS(wchar_t *, const char *, int, const struct nls_table *); 63int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
64#endif 64#endif
65 65
66/* 66/*
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 1959c7c4b185..fe2bb7c4c912 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -149,7 +149,7 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_
149 char temp_hash[16]; 149 char temp_hash[16];
150 struct HMACMD5Context ctx; 150 struct HMACMD5Context ctx;
151 char * ucase_buf; 151 char * ucase_buf;
152 wchar_t * unicode_buf; 152 __le16 * unicode_buf;
153 unsigned int i,user_name_len,dom_name_len; 153 unsigned int i,user_name_len,dom_name_len;
154 154
155 if(ses == NULL) 155 if(ses == NULL)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 682b0235ad9a..51548ed2e9cc 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -483,57 +483,30 @@ cifs_get_sb(struct file_system_type *fs_type,
483 return sb; 483 return sb;
484} 484}
485 485
486static ssize_t 486static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov,
487cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size, 487 unsigned long nr_segs, loff_t *ppos)
488 loff_t * poffset)
489{ 488{
490 if(file->f_dentry == NULL) 489 struct inode *inode = file->f_dentry->d_inode;
491 return -EIO; 490 ssize_t written;
492 else if(file->f_dentry->d_inode == NULL)
493 return -EIO;
494
495 cFYI(1,("In read_wrapper size %zd at %lld",read_size,*poffset));
496 491
497 if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) { 492 written = generic_file_writev(file, iov, nr_segs, ppos);
498 return generic_file_read(file,read_data,read_size,poffset); 493 if (!CIFS_I(inode)->clientCanCacheAll)
499 } else { 494 filemap_fdatawrite(inode->i_mapping);
500 /* BB do we need to lock inode from here until after invalidate? */ 495 return written;
501/* if(file->f_dentry->d_inode->i_mapping) {
502 filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);
503 filemap_fdatawait(file->f_dentry->d_inode->i_mapping);
504 }*/
505/* cifs_revalidate(file->f_dentry);*/ /* BB fixme */
506
507 /* BB we should make timer configurable - perhaps
508 by simply calling cifs_revalidate here */
509 /* invalidate_remote_inode(file->f_dentry->d_inode);*/
510 return generic_file_read(file,read_data,read_size,poffset);
511 }
512} 496}
513 497
514static ssize_t 498static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
515cifs_write_wrapper(struct file * file, const char __user *write_data, 499 size_t count, loff_t pos)
516 size_t write_size, loff_t * poffset)
517{ 500{
501 struct inode *inode = iocb->ki_filp->f_dentry->d_inode;
518 ssize_t written; 502 ssize_t written;
519 503
520 if(file->f_dentry == NULL) 504 written = generic_file_aio_write(iocb, buf, count, pos);
521 return -EIO; 505 if (!CIFS_I(inode)->clientCanCacheAll)
522 else if(file->f_dentry->d_inode == NULL) 506 filemap_fdatawrite(inode->i_mapping);
523 return -EIO;
524
525 cFYI(1,("In write_wrapper size %zd at %lld",write_size,*poffset));
526
527 written = generic_file_write(file,write_data,write_size,poffset);
528 if(!CIFS_I(file->f_dentry->d_inode)->clientCanCacheAll) {
529 if(file->f_dentry->d_inode->i_mapping) {
530 filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);
531 }
532 }
533 return written; 507 return written;
534} 508}
535 509
536
537static struct file_system_type cifs_fs_type = { 510static struct file_system_type cifs_fs_type = {
538 .owner = THIS_MODULE, 511 .owner = THIS_MODULE,
539 .name = "cifs", 512 .name = "cifs",
@@ -594,8 +567,12 @@ struct inode_operations cifs_symlink_inode_ops = {
594}; 567};
595 568
596struct file_operations cifs_file_ops = { 569struct file_operations cifs_file_ops = {
597 .read = cifs_read_wrapper, 570 .read = do_sync_read,
598 .write = cifs_write_wrapper, 571 .write = do_sync_write,
572 .readv = generic_file_readv,
573 .writev = cifs_file_writev,
574 .aio_read = generic_file_aio_read,
575 .aio_write = cifs_file_aio_write,
599 .open = cifs_open, 576 .open = cifs_open,
600 .release = cifs_close, 577 .release = cifs_close,
601 .lock = cifs_lock, 578 .lock = cifs_lock,
@@ -608,10 +585,6 @@ struct file_operations cifs_file_ops = {
608#endif /* CONFIG_CIFS_POSIX */ 585#endif /* CONFIG_CIFS_POSIX */
609 586
610#ifdef CONFIG_CIFS_EXPERIMENTAL 587#ifdef CONFIG_CIFS_EXPERIMENTAL
611 .readv = generic_file_readv,
612 .writev = generic_file_writev,
613 .aio_read = generic_file_aio_read,
614 .aio_write = generic_file_aio_write,
615 .dir_notify = cifs_dir_notify, 588 .dir_notify = cifs_dir_notify,
616#endif /* CONFIG_CIFS_EXPERIMENTAL */ 589#endif /* CONFIG_CIFS_EXPERIMENTAL */
617}; 590};
@@ -635,6 +608,46 @@ struct file_operations cifs_file_direct_ops = {
635 .dir_notify = cifs_dir_notify, 608 .dir_notify = cifs_dir_notify,
636#endif /* CONFIG_CIFS_EXPERIMENTAL */ 609#endif /* CONFIG_CIFS_EXPERIMENTAL */
637}; 610};
611struct file_operations cifs_file_nobrl_ops = {
612 .read = do_sync_read,
613 .write = do_sync_write,
614 .readv = generic_file_readv,
615 .writev = cifs_file_writev,
616 .aio_read = generic_file_aio_read,
617 .aio_write = cifs_file_aio_write,
618 .open = cifs_open,
619 .release = cifs_close,
620 .fsync = cifs_fsync,
621 .flush = cifs_flush,
622 .mmap = cifs_file_mmap,
623 .sendfile = generic_file_sendfile,
624#ifdef CONFIG_CIFS_POSIX
625 .ioctl = cifs_ioctl,
626#endif /* CONFIG_CIFS_POSIX */
627
628#ifdef CONFIG_CIFS_EXPERIMENTAL
629 .dir_notify = cifs_dir_notify,
630#endif /* CONFIG_CIFS_EXPERIMENTAL */
631};
632
633struct file_operations cifs_file_direct_nobrl_ops = {
634 /* no mmap, no aio, no readv -
635 BB reevaluate whether they can be done with directio, no cache */
636 .read = cifs_user_read,
637 .write = cifs_user_write,
638 .open = cifs_open,
639 .release = cifs_close,
640 .fsync = cifs_fsync,
641 .flush = cifs_flush,
642 .sendfile = generic_file_sendfile, /* BB removeme BB */
643#ifdef CONFIG_CIFS_POSIX
644 .ioctl = cifs_ioctl,
645#endif /* CONFIG_CIFS_POSIX */
646
647#ifdef CONFIG_CIFS_EXPERIMENTAL
648 .dir_notify = cifs_dir_notify,
649#endif /* CONFIG_CIFS_EXPERIMENTAL */
650};
638 651
639struct file_operations cifs_dir_ops = { 652struct file_operations cifs_dir_ops = {
640 .readdir = cifs_readdir, 653 .readdir = cifs_readdir,
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 1223fa81dbd2..9ec40e0e54fc 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops;
63/* Functions related to files and directories */ 63/* Functions related to files and directories */
64extern struct file_operations cifs_file_ops; 64extern struct file_operations cifs_file_ops;
65extern struct file_operations cifs_file_direct_ops; /* if directio mount */ 65extern struct file_operations cifs_file_direct_ops; /* if directio mount */
66extern struct file_operations cifs_file_nobrl_ops;
67extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
66extern int cifs_open(struct inode *inode, struct file *file); 68extern int cifs_open(struct inode *inode, struct file *file);
67extern int cifs_close(struct inode *inode, struct file *file); 69extern int cifs_close(struct inode *inode, struct file *file);
68extern int cifs_closedir(struct inode *inode, struct file *file); 70extern int cifs_closedir(struct inode *inode, struct file *file);
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 48a05b9df7eb..33e1859fd2f6 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -603,7 +603,9 @@ typedef struct smb_com_logoff_andx_rsp {
603 __u16 ByteCount; 603 __u16 ByteCount;
604} __attribute__((packed)) LOGOFF_ANDX_RSP; 604} __attribute__((packed)) LOGOFF_ANDX_RSP;
605 605
606typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */ 606typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on
607 tree_connect PDU to effect disconnect */
608 /* tdis is probably simplest SMB PDU */
607 struct { 609 struct {
608 struct smb_hdr hdr; /* wct = 0 */ 610 struct smb_hdr hdr; /* wct = 0 */
609 __u16 ByteCount; /* bcc = 0 */ 611 __u16 ByteCount; /* bcc = 0 */
@@ -2025,6 +2027,12 @@ typedef struct {
2025} __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */ 2027} __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */
2026 2028
2027 2029
2030struct win_dev {
2031 unsigned char type[8]; /* IntxCHR or IntxBLK */
2032 __le64 major;
2033 __le64 minor;
2034} __attribute__((packed));
2035
2028struct gea { 2036struct gea {
2029 unsigned char name_len; 2037 unsigned char name_len;
2030 char name[1]; 2038 char name[1];
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a53c596e1082..d179b0c3eee4 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1142,7 +1142,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1142 int bytes_returned, wct; 1142 int bytes_returned, wct;
1143 int smb_hdr_len; 1143 int smb_hdr_len;
1144 1144
1145 cFYI(1,("write2 at %lld %d bytes",offset,count)); /* BB removeme BB */ 1145 /* BB removeme BB */
1146 cFYI(1,("write2 at %lld %d bytes", (long long)offset, count));
1147
1146 if(tcon->ses->capabilities & CAP_LARGE_FILES) 1148 if(tcon->ses->capabilities & CAP_LARGE_FILES)
1147 wct = 14; 1149 wct = 14;
1148 else 1150 else
@@ -1553,7 +1555,7 @@ createSymLinkRetry:
1553 1555
1554 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1556 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1555 name_len = 1557 name_len =
1556 cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, PATH_MAX 1558 cifs_strtoUCS((__le16 *) pSMB->FileName, fromName, PATH_MAX
1557 /* find define for this maxpathcomponent */ 1559 /* find define for this maxpathcomponent */
1558 , nls_codepage); 1560 , nls_codepage);
1559 name_len++; /* trailing null */ 1561 name_len++; /* trailing null */
@@ -1577,7 +1579,7 @@ createSymLinkRetry:
1577 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 1579 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
1578 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1580 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1579 name_len_target = 1581 name_len_target =
1580 cifs_strtoUCS((wchar_t *) data_offset, toName, PATH_MAX 1582 cifs_strtoUCS((__le16 *) data_offset, toName, PATH_MAX
1581 /* find define for this maxpathcomponent */ 1583 /* find define for this maxpathcomponent */
1582 , nls_codepage); 1584 , nls_codepage);
1583 name_len_target++; /* trailing null */ 1585 name_len_target++; /* trailing null */
@@ -1803,7 +1805,7 @@ querySymLinkRetry:
1803 1805
1804 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1806 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1805 name_len = 1807 name_len =
1806 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 1808 cifs_strtoUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX
1807 /* find define for this maxpathcomponent */ 1809 /* find define for this maxpathcomponent */
1808 , nls_codepage); 1810 , nls_codepage);
1809 name_len++; /* trailing null */ 1811 name_len++; /* trailing null */
@@ -1860,7 +1862,7 @@ querySymLinkRetry:
1860 min_t(const int, buflen,count) / 2); 1862 min_t(const int, buflen,count) / 2);
1861 /* BB FIXME investigate remapping reserved chars here */ 1863 /* BB FIXME investigate remapping reserved chars here */
1862 cifs_strfromUCS_le(symlinkinfo, 1864 cifs_strfromUCS_le(symlinkinfo,
1863 (wchar_t *) ((char *)&pSMBr->hdr.Protocol + 1865 (__le16 *) ((char *)&pSMBr->hdr.Protocol +
1864 data_offset), 1866 data_offset),
1865 name_len, nls_codepage); 1867 name_len, nls_codepage);
1866 } else { 1868 } else {
@@ -1951,7 +1953,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
1951 reparse_buf->TargetNameOffset), 1953 reparse_buf->TargetNameOffset),
1952 min(buflen/2, reparse_buf->TargetNameLen / 2)); 1954 min(buflen/2, reparse_buf->TargetNameLen / 2));
1953 cifs_strfromUCS_le(symlinkinfo, 1955 cifs_strfromUCS_le(symlinkinfo,
1954 (wchar_t *) (reparse_buf->LinkNamesBuf + 1956 (__le16 *) (reparse_buf->LinkNamesBuf +
1955 reparse_buf->TargetNameOffset), 1957 reparse_buf->TargetNameOffset),
1956 name_len, nls_codepage); 1958 name_len, nls_codepage);
1957 } else { /* ASCII names */ 1959 } else { /* ASCII names */
@@ -1983,9 +1985,9 @@ qreparse_out:
1983static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace) 1985static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace)
1984{ 1986{
1985 /* u8 cifs fields do not need le conversion */ 1987 /* u8 cifs fields do not need le conversion */
1986 ace->e_perm = (__u16)cifs_ace->cifs_e_perm; 1988 ace->e_perm = cpu_to_le16(cifs_ace->cifs_e_perm);
1987 ace->e_tag = (__u16)cifs_ace->cifs_e_tag; 1989 ace->e_tag = cpu_to_le16(cifs_ace->cifs_e_tag);
1988 ace->e_id = (__u32)le64_to_cpu(cifs_ace->cifs_uid); 1990 ace->e_id = cpu_to_le32(le64_to_cpu(cifs_ace->cifs_uid));
1989 /* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */ 1991 /* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */
1990 1992
1991 return; 1993 return;
@@ -2037,7 +2039,7 @@ static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,
2037 } else if(size > buflen) { 2039 } else if(size > buflen) {
2038 return -ERANGE; 2040 return -ERANGE;
2039 } else /* buffer big enough */ { 2041 } else /* buffer big enough */ {
2040 local_acl->a_version = POSIX_ACL_XATTR_VERSION; 2042 local_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION);
2041 for(i = 0;i < count ;i++) { 2043 for(i = 0;i < count ;i++) {
2042 cifs_convert_ace(&local_acl->a_entries[i],pACE); 2044 cifs_convert_ace(&local_acl->a_entries[i],pACE);
2043 pACE ++; 2045 pACE ++;
@@ -2051,14 +2053,14 @@ static __u16 convert_ace_to_cifs_ace(struct cifs_posix_ace * cifs_ace,
2051{ 2053{
2052 __u16 rc = 0; /* 0 = ACL converted ok */ 2054 __u16 rc = 0; /* 0 = ACL converted ok */
2053 2055
2054 cifs_ace->cifs_e_perm = (__u8)cpu_to_le16(local_ace->e_perm); 2056 cifs_ace->cifs_e_perm = le16_to_cpu(local_ace->e_perm);
2055 cifs_ace->cifs_e_tag = (__u8)cpu_to_le16(local_ace->e_tag); 2057 cifs_ace->cifs_e_tag = le16_to_cpu(local_ace->e_tag);
2056 /* BB is there a better way to handle the large uid? */ 2058 /* BB is there a better way to handle the large uid? */
2057 if(local_ace->e_id == -1) { 2059 if(local_ace->e_id == cpu_to_le32(-1)) {
2058 /* Probably no need to le convert -1 on any arch but can not hurt */ 2060 /* Probably no need to le convert -1 on any arch but can not hurt */
2059 cifs_ace->cifs_uid = cpu_to_le64(-1); 2061 cifs_ace->cifs_uid = cpu_to_le64(-1);
2060 } else 2062 } else
2061 cifs_ace->cifs_uid = (__u64)cpu_to_le32(local_ace->e_id); 2063 cifs_ace->cifs_uid = cpu_to_le64(le32_to_cpu(local_ace->e_id));
2062 /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/ 2064 /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/
2063 return rc; 2065 return rc;
2064} 2066}
@@ -2078,16 +2080,17 @@ static __u16 ACL_to_cifs_posix(char * parm_data,const char * pACL,const int bufl
2078 2080
2079 count = posix_acl_xattr_count((size_t)buflen); 2081 count = posix_acl_xattr_count((size_t)buflen);
2080 cFYI(1,("setting acl with %d entries from buf of length %d and version of %d", 2082 cFYI(1,("setting acl with %d entries from buf of length %d and version of %d",
2081 count,buflen,local_acl->a_version)); 2083 count, buflen, le32_to_cpu(local_acl->a_version)));
2082 if(local_acl->a_version != 2) { 2084 if(le32_to_cpu(local_acl->a_version) != 2) {
2083 cFYI(1,("unknown POSIX ACL version %d",local_acl->a_version)); 2085 cFYI(1,("unknown POSIX ACL version %d",
2086 le32_to_cpu(local_acl->a_version)));
2084 return 0; 2087 return 0;
2085 } 2088 }
2086 cifs_acl->version = cpu_to_le16(1); 2089 cifs_acl->version = cpu_to_le16(1);
2087 if(acl_type == ACL_TYPE_ACCESS) 2090 if(acl_type == ACL_TYPE_ACCESS)
2088 cifs_acl->access_entry_count = count; 2091 cifs_acl->access_entry_count = cpu_to_le16(count);
2089 else if(acl_type == ACL_TYPE_DEFAULT) 2092 else if(acl_type == ACL_TYPE_DEFAULT)
2090 cifs_acl->default_entry_count = count; 2093 cifs_acl->default_entry_count = cpu_to_le16(count);
2091 else { 2094 else {
2092 cFYI(1,("unknown ACL type %d",acl_type)); 2095 cFYI(1,("unknown ACL type %d",acl_type));
2093 return 0; 2096 return 0;
@@ -3203,7 +3206,7 @@ getDFSRetry:
3203 temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset); 3206 temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset);
3204 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { 3207 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
3205 cifs_strfromUCS_le(*targetUNCs, 3208 cifs_strfromUCS_le(*targetUNCs,
3206 (wchar_t *) temp, name_len, nls_codepage); 3209 (__le16 *) temp, name_len, nls_codepage);
3207 } else { 3210 } else {
3208 strncpy(*targetUNCs,temp,name_len); 3211 strncpy(*targetUNCs,temp,name_len);
3209 } 3212 }
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 2cb620716bc1..c467de857610 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1986,32 +1986,32 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
1986 bytes_returned = 0; /* skill null user */ 1986 bytes_returned = 0; /* skill null user */
1987 else 1987 else
1988 bytes_returned = 1988 bytes_returned =
1989 cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, 1989 cifs_strtoUCS((__le16 *) bcc_ptr, user, 100,
1990 nls_codepage); 1990 nls_codepage);
1991 /* convert number of 16 bit words to bytes */ 1991 /* convert number of 16 bit words to bytes */
1992 bcc_ptr += 2 * bytes_returned; 1992 bcc_ptr += 2 * bytes_returned;
1993 bcc_ptr += 2; /* trailing null */ 1993 bcc_ptr += 2; /* trailing null */
1994 if (domain == NULL) 1994 if (domain == NULL)
1995 bytes_returned = 1995 bytes_returned =
1996 cifs_strtoUCS((wchar_t *) bcc_ptr, 1996 cifs_strtoUCS((__le16 *) bcc_ptr,
1997 "CIFS_LINUX_DOM", 32, nls_codepage); 1997 "CIFS_LINUX_DOM", 32, nls_codepage);
1998 else 1998 else
1999 bytes_returned = 1999 bytes_returned =
2000 cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, 2000 cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2001 nls_codepage); 2001 nls_codepage);
2002 bcc_ptr += 2 * bytes_returned; 2002 bcc_ptr += 2 * bytes_returned;
2003 bcc_ptr += 2; 2003 bcc_ptr += 2;
2004 bytes_returned = 2004 bytes_returned =
2005 cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", 2005 cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
2006 32, nls_codepage); 2006 32, nls_codepage);
2007 bcc_ptr += 2 * bytes_returned; 2007 bcc_ptr += 2 * bytes_returned;
2008 bytes_returned = 2008 bytes_returned =
2009 cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 2009 cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release,
2010 32, nls_codepage); 2010 32, nls_codepage);
2011 bcc_ptr += 2 * bytes_returned; 2011 bcc_ptr += 2 * bytes_returned;
2012 bcc_ptr += 2; 2012 bcc_ptr += 2;
2013 bytes_returned = 2013 bytes_returned =
2014 cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, 2014 cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
2015 64, nls_codepage); 2015 64, nls_codepage);
2016 bcc_ptr += 2 * bytes_returned; 2016 bcc_ptr += 2 * bytes_returned;
2017 bcc_ptr += 2; 2017 bcc_ptr += 2;
@@ -2081,7 +2081,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2081 if(ses->serverOS == NULL) 2081 if(ses->serverOS == NULL)
2082 goto sesssetup_nomem; 2082 goto sesssetup_nomem;
2083 cifs_strfromUCS_le(ses->serverOS, 2083 cifs_strfromUCS_le(ses->serverOS,
2084 (wchar_t *)bcc_ptr, len,nls_codepage); 2084 (__le16 *)bcc_ptr, len,nls_codepage);
2085 bcc_ptr += 2 * (len + 1); 2085 bcc_ptr += 2 * (len + 1);
2086 remaining_words -= len + 1; 2086 remaining_words -= len + 1;
2087 ses->serverOS[2 * len] = 0; 2087 ses->serverOS[2 * len] = 0;
@@ -2093,7 +2093,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2093 if(ses->serverNOS == NULL) 2093 if(ses->serverNOS == NULL)
2094 goto sesssetup_nomem; 2094 goto sesssetup_nomem;
2095 cifs_strfromUCS_le(ses->serverNOS, 2095 cifs_strfromUCS_le(ses->serverNOS,
2096 (wchar_t *)bcc_ptr,len,nls_codepage); 2096 (__le16 *)bcc_ptr,len,nls_codepage);
2097 bcc_ptr += 2 * (len + 1); 2097 bcc_ptr += 2 * (len + 1);
2098 ses->serverNOS[2 * len] = 0; 2098 ses->serverNOS[2 * len] = 0;
2099 ses->serverNOS[1 + (2 * len)] = 0; 2099 ses->serverNOS[1 + (2 * len)] = 0;
@@ -2111,7 +2111,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2111 if(ses->serverDomain == NULL) 2111 if(ses->serverDomain == NULL)
2112 goto sesssetup_nomem; 2112 goto sesssetup_nomem;
2113 cifs_strfromUCS_le(ses->serverDomain, 2113 cifs_strfromUCS_le(ses->serverDomain,
2114 (wchar_t *)bcc_ptr,len,nls_codepage); 2114 (__le16 *)bcc_ptr,len,nls_codepage);
2115 bcc_ptr += 2 * (len + 1); 2115 bcc_ptr += 2 * (len + 1);
2116 ses->serverDomain[2*len] = 0; 2116 ses->serverDomain[2*len] = 0;
2117 ses->serverDomain[1+(2*len)] = 0; 2117 ses->serverDomain[1+(2*len)] = 0;
@@ -2255,30 +2255,30 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2255 bcc_ptr++; 2255 bcc_ptr++;
2256 } 2256 }
2257 bytes_returned = 2257 bytes_returned =
2258 cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, nls_codepage); 2258 cifs_strtoUCS((__le16 *) bcc_ptr, user, 100, nls_codepage);
2259 bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */ 2259 bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */
2260 bcc_ptr += 2; /* trailing null */ 2260 bcc_ptr += 2; /* trailing null */
2261 if (domain == NULL) 2261 if (domain == NULL)
2262 bytes_returned = 2262 bytes_returned =
2263 cifs_strtoUCS((wchar_t *) bcc_ptr, 2263 cifs_strtoUCS((__le16 *) bcc_ptr,
2264 "CIFS_LINUX_DOM", 32, nls_codepage); 2264 "CIFS_LINUX_DOM", 32, nls_codepage);
2265 else 2265 else
2266 bytes_returned = 2266 bytes_returned =
2267 cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, 2267 cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2268 nls_codepage); 2268 nls_codepage);
2269 bcc_ptr += 2 * bytes_returned; 2269 bcc_ptr += 2 * bytes_returned;
2270 bcc_ptr += 2; 2270 bcc_ptr += 2;
2271 bytes_returned = 2271 bytes_returned =
2272 cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", 2272 cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
2273 32, nls_codepage); 2273 32, nls_codepage);
2274 bcc_ptr += 2 * bytes_returned; 2274 bcc_ptr += 2 * bytes_returned;
2275 bytes_returned = 2275 bytes_returned =
2276 cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, 2276 cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
2277 nls_codepage); 2277 nls_codepage);
2278 bcc_ptr += 2 * bytes_returned; 2278 bcc_ptr += 2 * bytes_returned;
2279 bcc_ptr += 2; 2279 bcc_ptr += 2;
2280 bytes_returned = 2280 bytes_returned =
2281 cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, 2281 cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
2282 64, nls_codepage); 2282 64, nls_codepage);
2283 bcc_ptr += 2 * bytes_returned; 2283 bcc_ptr += 2 * bytes_returned;
2284 bcc_ptr += 2; 2284 bcc_ptr += 2;
@@ -2357,7 +2357,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2357 ses->serverOS = 2357 ses->serverOS =
2358 kzalloc(2 * (len + 1), GFP_KERNEL); 2358 kzalloc(2 * (len + 1), GFP_KERNEL);
2359 cifs_strfromUCS_le(ses->serverOS, 2359 cifs_strfromUCS_le(ses->serverOS,
2360 (wchar_t *) 2360 (__le16 *)
2361 bcc_ptr, len, 2361 bcc_ptr, len,
2362 nls_codepage); 2362 nls_codepage);
2363 bcc_ptr += 2 * (len + 1); 2363 bcc_ptr += 2 * (len + 1);
@@ -2372,7 +2372,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2372 kzalloc(2 * (len + 1), 2372 kzalloc(2 * (len + 1),
2373 GFP_KERNEL); 2373 GFP_KERNEL);
2374 cifs_strfromUCS_le(ses->serverNOS, 2374 cifs_strfromUCS_le(ses->serverNOS,
2375 (wchar_t *)bcc_ptr, 2375 (__le16 *)bcc_ptr,
2376 len, 2376 len,
2377 nls_codepage); 2377 nls_codepage);
2378 bcc_ptr += 2 * (len + 1); 2378 bcc_ptr += 2 * (len + 1);
@@ -2384,9 +2384,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2384 /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ 2384 /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
2385 ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); 2385 ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL);
2386 cifs_strfromUCS_le(ses->serverDomain, 2386 cifs_strfromUCS_le(ses->serverDomain,
2387 (wchar_t *)bcc_ptr, 2387 (__le16 *)bcc_ptr,
2388 len, 2388 len, nls_codepage);
2389 nls_codepage);
2390 bcc_ptr += 2*(len+1); 2389 bcc_ptr += 2*(len+1);
2391 ses->serverDomain[2*len] = 0; 2390 ses->serverDomain[2*len] = 0;
2392 ses->serverDomain[1+(2*len)] = 0; 2391 ses->serverDomain[1+(2*len)] = 0;
@@ -2560,16 +2559,16 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2560 } 2559 }
2561 2560
2562 bytes_returned = 2561 bytes_returned =
2563 cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", 2562 cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
2564 32, nls_codepage); 2563 32, nls_codepage);
2565 bcc_ptr += 2 * bytes_returned; 2564 bcc_ptr += 2 * bytes_returned;
2566 bytes_returned = 2565 bytes_returned =
2567 cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, 2566 cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
2568 nls_codepage); 2567 nls_codepage);
2569 bcc_ptr += 2 * bytes_returned; 2568 bcc_ptr += 2 * bytes_returned;
2570 bcc_ptr += 2; /* null terminate Linux version */ 2569 bcc_ptr += 2; /* null terminate Linux version */
2571 bytes_returned = 2570 bytes_returned =
2572 cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, 2571 cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
2573 64, nls_codepage); 2572 64, nls_codepage);
2574 bcc_ptr += 2 * bytes_returned; 2573 bcc_ptr += 2 * bytes_returned;
2575 *(bcc_ptr + 1) = 0; 2574 *(bcc_ptr + 1) = 0;
@@ -2673,7 +2672,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2673 ses->serverOS = 2672 ses->serverOS =
2674 kzalloc(2 * (len + 1), GFP_KERNEL); 2673 kzalloc(2 * (len + 1), GFP_KERNEL);
2675 cifs_strfromUCS_le(ses->serverOS, 2674 cifs_strfromUCS_le(ses->serverOS,
2676 (wchar_t *) 2675 (__le16 *)
2677 bcc_ptr, len, 2676 bcc_ptr, len,
2678 nls_codepage); 2677 nls_codepage);
2679 bcc_ptr += 2 * (len + 1); 2678 bcc_ptr += 2 * (len + 1);
@@ -2690,7 +2689,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2690 GFP_KERNEL); 2689 GFP_KERNEL);
2691 cifs_strfromUCS_le(ses-> 2690 cifs_strfromUCS_le(ses->
2692 serverNOS, 2691 serverNOS,
2693 (wchar_t *) 2692 (__le16 *)
2694 bcc_ptr, 2693 bcc_ptr,
2695 len, 2694 len,
2696 nls_codepage); 2695 nls_codepage);
@@ -2708,23 +2707,15 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2708 1), 2707 1),
2709 GFP_KERNEL); 2708 GFP_KERNEL);
2710 cifs_strfromUCS_le 2709 cifs_strfromUCS_le
2711 (ses-> 2710 (ses->serverDomain,
2712 serverDomain, 2711 (__le16 *)bcc_ptr,
2713 (wchar_t *) 2712 len, nls_codepage);
2714 bcc_ptr, len,
2715 nls_codepage);
2716 bcc_ptr += 2713 bcc_ptr +=
2717 2 * (len + 1); 2714 2 * (len + 1);
2718 ses-> 2715 ses->serverDomain[2*len]
2719 serverDomain[2
2720 * len]
2721 = 0; 2716 = 0;
2722 ses-> 2717 ses->serverDomain
2723 serverDomain[1 2718 [1 + (2 * len)]
2724 +
2725 (2
2726 *
2727 len)]
2728 = 0; 2719 = 0;
2729 } /* else no more room so create dummy domain string */ 2720 } /* else no more room so create dummy domain string */
2730 else 2721 else
@@ -2903,7 +2894,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2903 SecurityBlob->DomainName.MaximumLength = 0; 2894 SecurityBlob->DomainName.MaximumLength = 0;
2904 } else { 2895 } else {
2905 __u16 len = 2896 __u16 len =
2906 cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, 2897 cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2907 nls_codepage); 2898 nls_codepage);
2908 len *= 2; 2899 len *= 2;
2909 SecurityBlob->DomainName.MaximumLength = 2900 SecurityBlob->DomainName.MaximumLength =
@@ -2921,7 +2912,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2921 SecurityBlob->UserName.MaximumLength = 0; 2912 SecurityBlob->UserName.MaximumLength = 0;
2922 } else { 2913 } else {
2923 __u16 len = 2914 __u16 len =
2924 cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64, 2915 cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
2925 nls_codepage); 2916 nls_codepage);
2926 len *= 2; 2917 len *= 2;
2927 SecurityBlob->UserName.MaximumLength = 2918 SecurityBlob->UserName.MaximumLength =
@@ -2934,7 +2925,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2934 cpu_to_le16(len); 2925 cpu_to_le16(len);
2935 } 2926 }
2936 2927
2937 /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage); 2928 /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((__le16 *) bcc_ptr, "AMACHINE",64, nls_codepage);
2938 SecurityBlob->WorkstationName.Length *= 2; 2929 SecurityBlob->WorkstationName.Length *= 2;
2939 SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length); 2930 SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length);
2940 SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength); 2931 SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength);
@@ -2947,16 +2938,16 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2947 bcc_ptr++; 2938 bcc_ptr++;
2948 } 2939 }
2949 bytes_returned = 2940 bytes_returned =
2950 cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", 2941 cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
2951 32, nls_codepage); 2942 32, nls_codepage);
2952 bcc_ptr += 2 * bytes_returned; 2943 bcc_ptr += 2 * bytes_returned;
2953 bytes_returned = 2944 bytes_returned =
2954 cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, 2945 cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
2955 nls_codepage); 2946 nls_codepage);
2956 bcc_ptr += 2 * bytes_returned; 2947 bcc_ptr += 2 * bytes_returned;
2957 bcc_ptr += 2; /* null term version string */ 2948 bcc_ptr += 2; /* null term version string */
2958 bytes_returned = 2949 bytes_returned =
2959 cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, 2950 cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
2960 64, nls_codepage); 2951 64, nls_codepage);
2961 bcc_ptr += 2 * bytes_returned; 2952 bcc_ptr += 2 * bytes_returned;
2962 *(bcc_ptr + 1) = 0; 2953 *(bcc_ptr + 1) = 0;
@@ -3069,7 +3060,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3069 ses->serverOS = 3060 ses->serverOS =
3070 kzalloc(2 * (len + 1), GFP_KERNEL); 3061 kzalloc(2 * (len + 1), GFP_KERNEL);
3071 cifs_strfromUCS_le(ses->serverOS, 3062 cifs_strfromUCS_le(ses->serverOS,
3072 (wchar_t *) 3063 (__le16 *)
3073 bcc_ptr, len, 3064 bcc_ptr, len,
3074 nls_codepage); 3065 nls_codepage);
3075 bcc_ptr += 2 * (len + 1); 3066 bcc_ptr += 2 * (len + 1);
@@ -3086,7 +3077,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3086 GFP_KERNEL); 3077 GFP_KERNEL);
3087 cifs_strfromUCS_le(ses-> 3078 cifs_strfromUCS_le(ses->
3088 serverNOS, 3079 serverNOS,
3089 (wchar_t *) 3080 (__le16 *)
3090 bcc_ptr, 3081 bcc_ptr,
3091 len, 3082 len,
3092 nls_codepage); 3083 nls_codepage);
@@ -3105,7 +3096,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3105 cifs_strfromUCS_le 3096 cifs_strfromUCS_le
3106 (ses-> 3097 (ses->
3107 serverDomain, 3098 serverDomain,
3108 (wchar_t *) 3099 (__le16 *)
3109 bcc_ptr, len, 3100 bcc_ptr, len,
3110 nls_codepage); 3101 nls_codepage);
3111 bcc_ptr += 3102 bcc_ptr +=
@@ -3227,7 +3218,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3227 if (ses->capabilities & CAP_UNICODE) { 3218 if (ses->capabilities & CAP_UNICODE) {
3228 smb_buffer->Flags2 |= SMBFLG2_UNICODE; 3219 smb_buffer->Flags2 |= SMBFLG2_UNICODE;
3229 length = 3220 length =
3230 cifs_strtoUCS((wchar_t *) bcc_ptr, tree, 100, nls_codepage); 3221 cifs_strtoUCS((__le16 *) bcc_ptr, tree, 100, nls_codepage);
3231 bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */ 3222 bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */
3232 bcc_ptr += 2; /* skip trailing null */ 3223 bcc_ptr += 2; /* skip trailing null */
3233 } else { /* ASCII */ 3224 } else { /* ASCII */
@@ -3263,7 +3254,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3263 tcon->nativeFileSystem = 3254 tcon->nativeFileSystem =
3264 kzalloc(length + 2, GFP_KERNEL); 3255 kzalloc(length + 2, GFP_KERNEL);
3265 cifs_strfromUCS_le(tcon->nativeFileSystem, 3256 cifs_strfromUCS_le(tcon->nativeFileSystem,
3266 (wchar_t *) bcc_ptr, 3257 (__le16 *) bcc_ptr,
3267 length, nls_codepage); 3258 length, nls_codepage);
3268 bcc_ptr += 2 * length; 3259 bcc_ptr += 2 * length;
3269 bcc_ptr[0] = 0; /* null terminate the string */ 3260 bcc_ptr[0] = 0; /* null terminate the string */
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 8dfe717a332a..16b21522e8fe 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -292,7 +292,8 @@ cifs_create_out:
292 return rc; 292 return rc;
293} 293}
294 294
295int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t device_number) 295int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
296 dev_t device_number)
296{ 297{
297 int rc = -EPERM; 298 int rc = -EPERM;
298 int xid; 299 int xid;
@@ -368,7 +369,34 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
368 369
369 if(!rc) { 370 if(!rc) {
370 /* BB Do not bother to decode buf since no 371 /* BB Do not bother to decode buf since no
371 local inode yet to put timestamps in */ 372 local inode yet to put timestamps in,
373 but we can reuse it safely */
374 int bytes_written;
375 struct win_dev *pdev;
376 pdev = (struct win_dev *)buf;
377 if(S_ISCHR(mode)) {
378 memcpy(pdev->type, "IntxCHR", 8);
379 pdev->major =
380 cpu_to_le64(MAJOR(device_number));
381 pdev->minor =
382 cpu_to_le64(MINOR(device_number));
383 rc = CIFSSMBWrite(xid, pTcon,
384 fileHandle,
385 sizeof(struct win_dev),
386 0, &bytes_written, (char *)pdev,
387 NULL, 0);
388 } else if(S_ISBLK(mode)) {
389 memcpy(pdev->type, "IntxBLK", 8);
390 pdev->major =
391 cpu_to_le64(MAJOR(device_number));
392 pdev->minor =
393 cpu_to_le64(MINOR(device_number));
394 rc = CIFSSMBWrite(xid, pTcon,
395 fileHandle,
396 sizeof(struct win_dev),
397 0, &bytes_written, (char *)pdev,
398 NULL, 0);
399 } /* else if(S_ISFIFO */
372 CIFSSMBClose(xid, pTcon, fileHandle); 400 CIFSSMBClose(xid, pTcon, fileHandle);
373 d_drop(direntry); 401 d_drop(direntry);
374 } 402 }
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index da4f5e10b3cc..14a1c72ced92 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -489,8 +489,10 @@ int cifs_close(struct inode *inode, struct file *file)
489 the struct would be in each open file, 489 the struct would be in each open file,
490 but this should give enough time to 490 but this should give enough time to
491 clear the socket */ 491 clear the socket */
492 write_unlock(&file->f_owner.lock);
492 cERROR(1,("close with pending writes")); 493 cERROR(1,("close with pending writes"));
493 msleep(timeout); 494 msleep(timeout);
495 write_lock(&file->f_owner.lock);
494 timeout *= 4; 496 timeout *= 4;
495 } 497 }
496 write_unlock(&file->f_owner.lock); 498 write_unlock(&file->f_owner.lock);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 923d071163b2..05b525812adb 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -41,7 +41,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
41 char *tmp_path; 41 char *tmp_path;
42 42
43 pTcon = cifs_sb->tcon; 43 pTcon = cifs_sb->tcon;
44 cFYI(1, (" Getting info on %s ", search_path)); 44 cFYI(1, ("Getting info on %s ", search_path));
45 /* could have done a find first instead but this returns more info */ 45 /* could have done a find first instead but this returns more info */
46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData, 46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData,
47 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 47 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
@@ -97,9 +97,9 @@ int cifs_get_inode_info_unix(struct inode **pinode,
97 inode = *pinode; 97 inode = *pinode;
98 cifsInfo = CIFS_I(inode); 98 cifsInfo = CIFS_I(inode);
99 99
100 cFYI(1, (" Old time %ld ", cifsInfo->time)); 100 cFYI(1, ("Old time %ld ", cifsInfo->time));
101 cifsInfo->time = jiffies; 101 cifsInfo->time = jiffies;
102 cFYI(1, (" New time %ld ", cifsInfo->time)); 102 cFYI(1, ("New time %ld ", cifsInfo->time));
103 /* this is ok to set on every inode revalidate */ 103 /* this is ok to set on every inode revalidate */
104 atomic_set(&cifsInfo->inUse,1); 104 atomic_set(&cifsInfo->inUse,1);
105 105
@@ -111,6 +111,9 @@ int cifs_get_inode_info_unix(struct inode **pinode,
111 inode->i_ctime = 111 inode->i_ctime =
112 cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); 112 cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange));
113 inode->i_mode = le64_to_cpu(findData.Permissions); 113 inode->i_mode = le64_to_cpu(findData.Permissions);
114 /* since we set the inode type below we need to mask off
115 to avoid strange results if bits set above */
116 inode->i_mode &= ~S_IFMT;
114 if (type == UNIX_FILE) { 117 if (type == UNIX_FILE) {
115 inode->i_mode |= S_IFREG; 118 inode->i_mode |= S_IFREG;
116 } else if (type == UNIX_SYMLINK) { 119 } else if (type == UNIX_SYMLINK) {
@@ -129,6 +132,10 @@ int cifs_get_inode_info_unix(struct inode **pinode,
129 inode->i_mode |= S_IFIFO; 132 inode->i_mode |= S_IFIFO;
130 } else if (type == UNIX_SOCKET) { 133 } else if (type == UNIX_SOCKET) {
131 inode->i_mode |= S_IFSOCK; 134 inode->i_mode |= S_IFSOCK;
135 } else {
136 /* safest to call it a file if we do not know */
137 inode->i_mode |= S_IFREG;
138 cFYI(1,("unknown type %d",type));
132 } 139 }
133 inode->i_uid = le64_to_cpu(findData.Uid); 140 inode->i_uid = le64_to_cpu(findData.Uid);
134 inode->i_gid = le64_to_cpu(findData.Gid); 141 inode->i_gid = le64_to_cpu(findData.Gid);
@@ -155,34 +162,39 @@ int cifs_get_inode_info_unix(struct inode **pinode,
155 } 162 }
156 163
157 if (num_of_bytes < end_of_file) 164 if (num_of_bytes < end_of_file)
158 cFYI(1, ("allocation size less than end of file ")); 165 cFYI(1, ("allocation size less than end of file"));
159 cFYI(1, 166 cFYI(1,
160 ("Size %ld and blocks %ld", 167 ("Size %ld and blocks %ld",
161 (unsigned long) inode->i_size, inode->i_blocks)); 168 (unsigned long) inode->i_size, inode->i_blocks));
162 if (S_ISREG(inode->i_mode)) { 169 if (S_ISREG(inode->i_mode)) {
163 cFYI(1, (" File inode ")); 170 cFYI(1, ("File inode"));
164 inode->i_op = &cifs_file_inode_ops; 171 inode->i_op = &cifs_file_inode_ops;
165 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 172 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
166 inode->i_fop = &cifs_file_direct_ops; 173 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
167 else 174 inode->i_fop =
175 &cifs_file_direct_nobrl_ops;
176 else
177 inode->i_fop = &cifs_file_direct_ops;
178 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
179 inode->i_fop = &cifs_file_nobrl_ops;
180 else /* not direct, send byte range locks */
168 inode->i_fop = &cifs_file_ops; 181 inode->i_fop = &cifs_file_ops;
169 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 182
170 inode->i_fop->lock = NULL;
171 inode->i_data.a_ops = &cifs_addr_ops; 183 inode->i_data.a_ops = &cifs_addr_ops;
172 /* check if server can support readpages */ 184 /* check if server can support readpages */
173 if(pTcon->ses->server->maxBuf < 185 if(pTcon->ses->server->maxBuf <
174 4096 + MAX_CIFS_HDR_SIZE) 186 4096 + MAX_CIFS_HDR_SIZE)
175 inode->i_data.a_ops->readpages = NULL; 187 inode->i_data.a_ops->readpages = NULL;
176 } else if (S_ISDIR(inode->i_mode)) { 188 } else if (S_ISDIR(inode->i_mode)) {
177 cFYI(1, (" Directory inode")); 189 cFYI(1, ("Directory inode"));
178 inode->i_op = &cifs_dir_inode_ops; 190 inode->i_op = &cifs_dir_inode_ops;
179 inode->i_fop = &cifs_dir_ops; 191 inode->i_fop = &cifs_dir_ops;
180 } else if (S_ISLNK(inode->i_mode)) { 192 } else if (S_ISLNK(inode->i_mode)) {
181 cFYI(1, (" Symbolic Link inode ")); 193 cFYI(1, ("Symbolic Link inode"));
182 inode->i_op = &cifs_symlink_inode_ops; 194 inode->i_op = &cifs_symlink_inode_ops;
183 /* tmp_inode->i_fop = */ /* do not need to set to anything */ 195 /* tmp_inode->i_fop = */ /* do not need to set to anything */
184 } else { 196 } else {
185 cFYI(1, (" Init special inode ")); 197 cFYI(1, ("Init special inode"));
186 init_special_inode(inode, inode->i_mode, 198 init_special_inode(inode, inode->i_mode,
187 inode->i_rdev); 199 inode->i_rdev);
188 } 200 }
@@ -190,6 +202,111 @@ int cifs_get_inode_info_unix(struct inode **pinode,
190 return rc; 202 return rc;
191} 203}
192 204
205static int decode_sfu_inode(struct inode * inode, __u64 size,
206 const unsigned char *path,
207 struct cifs_sb_info *cifs_sb, int xid)
208{
209 int rc;
210 int oplock = FALSE;
211 __u16 netfid;
212 struct cifsTconInfo *pTcon = cifs_sb->tcon;
213 char buf[24];
214 unsigned int bytes_read;
215 char * pbuf;
216
217 pbuf = buf;
218
219 if(size == 0) {
220 inode->i_mode |= S_IFIFO;
221 return 0;
222 } else if (size < 8) {
223 return -EINVAL; /* EOPNOTSUPP? */
224 }
225
226 rc = CIFSSMBOpen(xid, pTcon, path, FILE_OPEN, GENERIC_READ,
227 CREATE_NOT_DIR, &netfid, &oplock, NULL,
228 cifs_sb->local_nls,
229 cifs_sb->mnt_cifs_flags &
230 CIFS_MOUNT_MAP_SPECIAL_CHR);
231 if (rc==0) {
232 /* Read header */
233 rc = CIFSSMBRead(xid, pTcon,
234 netfid,
235 24 /* length */, 0 /* offset */,
236 &bytes_read, &pbuf);
237 if((rc == 0) && (bytes_read >= 8)) {
238 if(memcmp("IntxBLK", pbuf, 8) == 0) {
239 cFYI(1,("Block device"));
240 inode->i_mode |= S_IFBLK;
241 if(bytes_read == 24) {
242 /* we have enough to decode dev num */
243 __u64 mjr; /* major */
244 __u64 mnr; /* minor */
245 mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
246 mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
247 inode->i_rdev = MKDEV(mjr, mnr);
248 }
249 } else if(memcmp("IntxCHR", pbuf, 8) == 0) {
250 cFYI(1,("Char device"));
251 inode->i_mode |= S_IFCHR;
252 if(bytes_read == 24) {
253 /* we have enough to decode dev num */
254 __u64 mjr; /* major */
255 __u64 mnr; /* minor */
256 mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
257 mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
258 inode->i_rdev = MKDEV(mjr, mnr);
259 }
260 } else if(memcmp("IntxLNK", pbuf, 7) == 0) {
261 cFYI(1,("Symlink"));
262 inode->i_mode |= S_IFLNK;
263 } else {
264 inode->i_mode |= S_IFREG; /* file? */
265 rc = -EOPNOTSUPP;
266 }
267 } else {
268 inode->i_mode |= S_IFREG; /* then it is a file */
269 rc = -EOPNOTSUPP; /* or some unknown SFU type */
270 }
271 CIFSSMBClose(xid, pTcon, netfid);
272 }
273 return rc;
274
275}
276
277#define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */
278
279static int get_sfu_uid_mode(struct inode * inode,
280 const unsigned char *path,
281 struct cifs_sb_info *cifs_sb, int xid)
282{
283#ifdef CONFIG_CIFS_XATTR
284 ssize_t rc;
285 char ea_value[4];
286 __u32 mode;
287
288 rc = CIFSSMBQueryEA(xid, cifs_sb->tcon, path, "SETFILEBITS",
289 ea_value, 4 /* size of buf */, cifs_sb->local_nls,
290 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
291 if(rc < 0)
292 return (int)rc;
293 else if (rc > 3) {
294 mode = le32_to_cpu(*((__le32 *)ea_value));
295 inode->i_mode &= ~SFBITS_MASK;
296 cFYI(1,("special bits 0%o org mode 0%o", mode, inode->i_mode));
297 inode->i_mode = (mode & SFBITS_MASK) | inode->i_mode;
298 cFYI(1,("special mode bits 0%o", mode));
299 return 0;
300 } else {
301 return 0;
302 }
303#else
304 return -EOPNOTSUPP;
305#endif
306
307
308}
309
193int cifs_get_inode_info(struct inode **pinode, 310int cifs_get_inode_info(struct inode **pinode,
194 const unsigned char *search_path, FILE_ALL_INFO *pfindData, 311 const unsigned char *search_path, FILE_ALL_INFO *pfindData,
195 struct super_block *sb, int xid) 312 struct super_block *sb, int xid)
@@ -202,7 +319,7 @@ int cifs_get_inode_info(struct inode **pinode,
202 char *buf = NULL; 319 char *buf = NULL;
203 320
204 pTcon = cifs_sb->tcon; 321 pTcon = cifs_sb->tcon;
205 cFYI(1,("Getting info on %s ", search_path)); 322 cFYI(1,("Getting info on %s", search_path));
206 323
207 if ((pfindData == NULL) && (*pinode != NULL)) { 324 if ((pfindData == NULL) && (*pinode != NULL)) {
208 if (CIFS_I(*pinode)->clientCanCacheRead) { 325 if (CIFS_I(*pinode)->clientCanCacheRead) {
@@ -303,9 +420,9 @@ int cifs_get_inode_info(struct inode **pinode,
303 inode = *pinode; 420 inode = *pinode;
304 cifsInfo = CIFS_I(inode); 421 cifsInfo = CIFS_I(inode);
305 cifsInfo->cifsAttrs = attr; 422 cifsInfo->cifsAttrs = attr;
306 cFYI(1, (" Old time %ld ", cifsInfo->time)); 423 cFYI(1, ("Old time %ld ", cifsInfo->time));
307 cifsInfo->time = jiffies; 424 cifsInfo->time = jiffies;
308 cFYI(1, (" New time %ld ", cifsInfo->time)); 425 cFYI(1, ("New time %ld ", cifsInfo->time));
309 426
310 /* blksize needs to be multiple of two. So safer to default to 427 /* blksize needs to be multiple of two. So safer to default to
311 blksize and blkbits set in superblock so 2**blkbits and blksize 428 blksize and blkbits set in superblock so 2**blkbits and blksize
@@ -319,13 +436,15 @@ int cifs_get_inode_info(struct inode **pinode,
319 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); 436 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime));
320 inode->i_ctime = 437 inode->i_ctime =
321 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); 438 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
322 cFYI(0, (" Attributes came in as 0x%x ", attr)); 439 cFYI(0, ("Attributes came in as 0x%x ", attr));
323 440
324 /* set default mode. will override for dirs below */ 441 /* set default mode. will override for dirs below */
325 if (atomic_read(&cifsInfo->inUse) == 0) 442 if (atomic_read(&cifsInfo->inUse) == 0)
326 /* new inode, can safely set these fields */ 443 /* new inode, can safely set these fields */
327 inode->i_mode = cifs_sb->mnt_file_mode; 444 inode->i_mode = cifs_sb->mnt_file_mode;
328 445 else /* since we set the inode type below we need to mask off
446 to avoid strange results if type changes and both get orred in */
447 inode->i_mode &= ~S_IFMT;
329/* if (attr & ATTR_REPARSE) */ 448/* if (attr & ATTR_REPARSE) */
330 /* We no longer handle these as symlinks because we could not 449 /* We no longer handle these as symlinks because we could not
331 follow them due to the absolute path with drive letter */ 450 follow them due to the absolute path with drive letter */
@@ -340,10 +459,16 @@ int cifs_get_inode_info(struct inode **pinode,
340 (pfindData->EndOfFile == 0)) { 459 (pfindData->EndOfFile == 0)) {
341 inode->i_mode = cifs_sb->mnt_file_mode; 460 inode->i_mode = cifs_sb->mnt_file_mode;
342 inode->i_mode |= S_IFIFO; 461 inode->i_mode |= S_IFIFO;
343/* BB Finish for SFU style symlinks and devies */ 462/* BB Finish for SFU style symlinks and devices */
344/* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 463 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
345 (cifsInfo->cifsAttrs & ATTR_SYSTEM) && ) */ 464 (cifsInfo->cifsAttrs & ATTR_SYSTEM)) {
346 465 if (decode_sfu_inode(inode,
466 le64_to_cpu(pfindData->EndOfFile),
467 search_path,
468 cifs_sb, xid)) {
469 cFYI(1,("Unrecognized sfu inode type"));
470 }
471 cFYI(1,("sfu mode 0%o",inode->i_mode));
347 } else { 472 } else {
348 inode->i_mode |= S_IFREG; 473 inode->i_mode |= S_IFREG;
349 /* treat the dos attribute of read-only as read-only 474 /* treat the dos attribute of read-only as read-only
@@ -368,7 +493,10 @@ int cifs_get_inode_info(struct inode **pinode,
368 493
369 /* BB fill in uid and gid here? with help from winbind? 494 /* BB fill in uid and gid here? with help from winbind?
370 or retrieve from NTFS stream extended attribute */ 495 or retrieve from NTFS stream extended attribute */
371 if (atomic_read(&cifsInfo->inUse) == 0) { 496 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
497 /* fill in uid, gid, mode from server ACL */
498 get_sfu_uid_mode(inode, search_path, cifs_sb, xid);
499 } else if (atomic_read(&cifsInfo->inUse) == 0) {
372 inode->i_uid = cifs_sb->mnt_uid; 500 inode->i_uid = cifs_sb->mnt_uid;
373 inode->i_gid = cifs_sb->mnt_gid; 501 inode->i_gid = cifs_sb->mnt_gid;
374 /* set so we do not keep refreshing these fields with 502 /* set so we do not keep refreshing these fields with
@@ -377,24 +505,29 @@ int cifs_get_inode_info(struct inode **pinode,
377 } 505 }
378 506
379 if (S_ISREG(inode->i_mode)) { 507 if (S_ISREG(inode->i_mode)) {
380 cFYI(1, (" File inode ")); 508 cFYI(1, ("File inode"));
381 inode->i_op = &cifs_file_inode_ops; 509 inode->i_op = &cifs_file_inode_ops;
382 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 510 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
383 inode->i_fop = &cifs_file_direct_ops; 511 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
384 else 512 inode->i_fop =
513 &cifs_file_direct_nobrl_ops;
514 else
515 inode->i_fop = &cifs_file_direct_ops;
516 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
517 inode->i_fop = &cifs_file_nobrl_ops;
518 else /* not direct, send byte range locks */
385 inode->i_fop = &cifs_file_ops; 519 inode->i_fop = &cifs_file_ops;
386 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 520
387 inode->i_fop->lock = NULL;
388 inode->i_data.a_ops = &cifs_addr_ops; 521 inode->i_data.a_ops = &cifs_addr_ops;
389 if(pTcon->ses->server->maxBuf < 522 if(pTcon->ses->server->maxBuf <
390 4096 + MAX_CIFS_HDR_SIZE) 523 4096 + MAX_CIFS_HDR_SIZE)
391 inode->i_data.a_ops->readpages = NULL; 524 inode->i_data.a_ops->readpages = NULL;
392 } else if (S_ISDIR(inode->i_mode)) { 525 } else if (S_ISDIR(inode->i_mode)) {
393 cFYI(1, (" Directory inode ")); 526 cFYI(1, ("Directory inode"));
394 inode->i_op = &cifs_dir_inode_ops; 527 inode->i_op = &cifs_dir_inode_ops;
395 inode->i_fop = &cifs_dir_ops; 528 inode->i_fop = &cifs_dir_ops;
396 } else if (S_ISLNK(inode->i_mode)) { 529 } else if (S_ISLNK(inode->i_mode)) {
397 cFYI(1, (" Symbolic Link inode ")); 530 cFYI(1, ("Symbolic Link inode"));
398 inode->i_op = &cifs_symlink_inode_ops; 531 inode->i_op = &cifs_symlink_inode_ops;
399 } else { 532 } else {
400 init_special_inode(inode, inode->i_mode, 533 init_special_inode(inode, inode->i_mode,
@@ -431,7 +564,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
431 struct cifsInodeInfo *cifsInode; 564 struct cifsInodeInfo *cifsInode;
432 FILE_BASIC_INFO *pinfo_buf; 565 FILE_BASIC_INFO *pinfo_buf;
433 566
434 cFYI(1, (" cifs_unlink, inode = 0x%p with ", inode)); 567 cFYI(1, ("cifs_unlink, inode = 0x%p with ", inode));
435 568
436 xid = GetXid(); 569 xid = GetXid();
437 570
@@ -651,7 +784,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
651 char *full_path = NULL; 784 char *full_path = NULL;
652 struct cifsInodeInfo *cifsInode; 785 struct cifsInodeInfo *cifsInode;
653 786
654 cFYI(1, (" cifs_rmdir, inode = 0x%p with ", inode)); 787 cFYI(1, ("cifs_rmdir, inode = 0x%p with ", inode));
655 788
656 xid = GetXid(); 789 xid = GetXid();
657 790
@@ -970,7 +1103,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
970 1103
971 xid = GetXid(); 1104 xid = GetXid();
972 1105
973 cFYI(1, (" In cifs_setattr, name = %s attrs->iavalid 0x%x ", 1106 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ",
974 direntry->d_name.name, attrs->ia_valid)); 1107 direntry->d_name.name, attrs->ia_valid));
975 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1108 cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
976 pTcon = cifs_sb->tcon; 1109 pTcon = cifs_sb->tcon;
@@ -1086,6 +1219,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1086 cifs_sb->mnt_cifs_flags & 1219 cifs_sb->mnt_cifs_flags &
1087 CIFS_MOUNT_MAP_SPECIAL_CHR); 1220 CIFS_MOUNT_MAP_SPECIAL_CHR);
1088 else if (attrs->ia_valid & ATTR_MODE) { 1221 else if (attrs->ia_valid & ATTR_MODE) {
1222 rc = 0;
1089 if ((mode & S_IWUGO) == 0) /* not writeable */ { 1223 if ((mode & S_IWUGO) == 0) /* not writeable */ {
1090 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) 1224 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0)
1091 time_buf.Attributes = 1225 time_buf.Attributes =
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 34a06692e4fa..ca27a82c54cd 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -678,7 +678,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
678 __u16 temp; 678 __u16 temp;
679 679
680 if(!mapChars) 680 if(!mapChars)
681 return cifs_strtoUCS((wchar_t *) target, source, PATH_MAX, cp); 681 return cifs_strtoUCS(target, source, PATH_MAX, cp);
682 682
683 for(i = 0, j = 0; i < maxlen; j++) { 683 for(i = 0, j = 0; i < maxlen; j++) {
684 src_char = source[i]; 684 src_char = source[i];
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index a86bd1c07602..9bdaaecae36f 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -142,6 +142,11 @@ static void fill_in_inode(struct inode *tmp_inode,
142 tmp_inode->i_gid = cifs_sb->mnt_gid; 142 tmp_inode->i_gid = cifs_sb->mnt_gid;
143 /* set default mode. will override for dirs below */ 143 /* set default mode. will override for dirs below */
144 tmp_inode->i_mode = cifs_sb->mnt_file_mode; 144 tmp_inode->i_mode = cifs_sb->mnt_file_mode;
145 } else {
146 /* mask off the type bits since it gets set
147 below and we do not want to get two type
148 bits set */
149 tmp_inode->i_mode &= ~S_IFMT;
145 } 150 }
146 151
147 if (attr & ATTR_DIRECTORY) { 152 if (attr & ATTR_DIRECTORY) {
@@ -152,12 +157,18 @@ static void fill_in_inode(struct inode *tmp_inode,
152 } 157 }
153 tmp_inode->i_mode |= S_IFDIR; 158 tmp_inode->i_mode |= S_IFDIR;
154 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 159 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
155 (attr & ATTR_SYSTEM) && (end_of_file == 0)) { 160 (attr & ATTR_SYSTEM)) {
156 *pobject_type = DT_FIFO; 161 if (end_of_file == 0) {
157 tmp_inode->i_mode |= S_IFIFO; 162 *pobject_type = DT_FIFO;
158/* BB Finish for SFU style symlinks and devies */ 163 tmp_inode->i_mode |= S_IFIFO;
159/* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 164 } else {
160 (attr & ATTR_SYSTEM) && ) { */ 165 /* rather than get the type here, we mark the
166 inode as needing revalidate and get the real type
167 (blk vs chr vs. symlink) later ie in lookup */
168 *pobject_type = DT_REG;
169 tmp_inode->i_mode |= S_IFREG;
170 cifsInfo->time = 0;
171 }
161/* we no longer mark these because we could not follow them */ 172/* we no longer mark these because we could not follow them */
162/* } else if (attr & ATTR_REPARSE) { 173/* } else if (attr & ATTR_REPARSE) {
163 *pobject_type = DT_LNK; 174 *pobject_type = DT_LNK;
@@ -193,8 +204,14 @@ static void fill_in_inode(struct inode *tmp_inode,
193 if (S_ISREG(tmp_inode->i_mode)) { 204 if (S_ISREG(tmp_inode->i_mode)) {
194 cFYI(1, ("File inode")); 205 cFYI(1, ("File inode"));
195 tmp_inode->i_op = &cifs_file_inode_ops; 206 tmp_inode->i_op = &cifs_file_inode_ops;
196 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 207 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
197 tmp_inode->i_fop = &cifs_file_direct_ops; 208 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
209 tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
210 else
211 tmp_inode->i_fop = &cifs_file_direct_ops;
212
213 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
214 tmp_inode->i_fop = &cifs_file_nobrl_ops;
198 else 215 else
199 tmp_inode->i_fop = &cifs_file_ops; 216 tmp_inode->i_fop = &cifs_file_ops;
200 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 217 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
@@ -258,6 +275,9 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
258 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange)); 275 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange));
259 276
260 tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); 277 tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions);
278 /* since we set the inode type below we need to mask off type
279 to avoid strange results if bits above were corrupt */
280 tmp_inode->i_mode &= ~S_IFMT;
261 if (type == UNIX_FILE) { 281 if (type == UNIX_FILE) {
262 *pobject_type = DT_REG; 282 *pobject_type = DT_REG;
263 tmp_inode->i_mode |= S_IFREG; 283 tmp_inode->i_mode |= S_IFREG;
@@ -283,6 +303,11 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
283 } else if (type == UNIX_SOCKET) { 303 } else if (type == UNIX_SOCKET) {
284 *pobject_type = DT_SOCK; 304 *pobject_type = DT_SOCK;
285 tmp_inode->i_mode |= S_IFSOCK; 305 tmp_inode->i_mode |= S_IFSOCK;
306 } else {
307 /* safest to just call it a file */
308 *pobject_type = DT_REG;
309 tmp_inode->i_mode |= S_IFREG;
310 cFYI(1,("unknown inode type %d",type));
286 } 311 }
287 312
288 tmp_inode->i_uid = le64_to_cpu(pfindData->Uid); 313 tmp_inode->i_uid = le64_to_cpu(pfindData->Uid);
@@ -699,7 +724,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
699 (__le16 *)filename, len/2, nlt); 724 (__le16 *)filename, len/2, nlt);
700 else 725 else
701 pqst->len = cifs_strfromUCS_le((char *)pqst->name, 726 pqst->len = cifs_strfromUCS_le((char *)pqst->name,
702 (wchar_t *)filename,len/2,nlt); 727 (__le16 *)filename,len/2,nlt);
703 } else { 728 } else {
704 pqst->name = filename; 729 pqst->name = filename;
705 pqst->len = len; 730 pqst->len = len;
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 981ea0d8b9cd..41a9659c16bc 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -522,7 +522,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
522 sizeof (struct smb_hdr) - 522 sizeof (struct smb_hdr) -
523 4 /* do not count RFC1001 header */ + 523 4 /* do not count RFC1001 header */ +
524 (2 * in_buf->WordCount) + 2 /* bcc */ ) 524 (2 * in_buf->WordCount) + 2 /* bcc */ )
525 BCC(in_buf) = le16_to_cpu(BCC(in_buf)); 525 BCC(in_buf) = le16_to_cpu(BCC_LE(in_buf));
526 } else { 526 } else {
527 rc = -EIO; 527 rc = -EIO;
528 cFYI(1,("Bad MID state?")); 528 cFYI(1,("Bad MID state?"));
@@ -786,7 +786,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
786 sizeof (struct smb_hdr) - 786 sizeof (struct smb_hdr) -
787 4 /* do not count RFC1001 header */ + 787 4 /* do not count RFC1001 header */ +
788 (2 * out_buf->WordCount) + 2 /* bcc */ ) 788 (2 * out_buf->WordCount) + 2 /* bcc */ )
789 BCC(out_buf) = le16_to_cpu(BCC(out_buf)); 789 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
790 } else { 790 } else {
791 rc = -EIO; 791 rc = -EIO;
792 cERROR(1,("Bad MID state? ")); 792 cERROR(1,("Bad MID state? "));
diff --git a/fs/compat.c b/fs/compat.c
index 8e71cdbecc7c..818634120b69 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -168,8 +168,8 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
168 if (!error) { 168 if (!error) {
169 struct kstatfs tmp; 169 struct kstatfs tmp;
170 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); 170 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
171 if (!error && put_compat_statfs(buf, &tmp)) 171 if (!error)
172 error = -EFAULT; 172 error = put_compat_statfs(buf, &tmp);
173 path_release(&nd); 173 path_release(&nd);
174 } 174 }
175 return error; 175 return error;
@@ -186,8 +186,8 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
186 if (!file) 186 if (!file)
187 goto out; 187 goto out;
188 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); 188 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
189 if (!error && put_compat_statfs(buf, &tmp)) 189 if (!error)
190 error = -EFAULT; 190 error = put_compat_statfs(buf, &tmp);
191 fput(file); 191 fput(file);
192out: 192out:
193 return error; 193 return error;
@@ -236,8 +236,8 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
236 if (!error) { 236 if (!error) {
237 struct kstatfs tmp; 237 struct kstatfs tmp;
238 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); 238 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
239 if (!error && put_compat_statfs64(buf, &tmp)) 239 if (!error)
240 error = -EFAULT; 240 error = put_compat_statfs64(buf, &tmp);
241 path_release(&nd); 241 path_release(&nd);
242 } 242 }
243 return error; 243 return error;
@@ -257,8 +257,8 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
257 if (!file) 257 if (!file)
258 goto out; 258 goto out;
259 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); 259 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
260 if (!error && put_compat_statfs64(buf, &tmp)) 260 if (!error)
261 error = -EFAULT; 261 error = put_compat_statfs64(buf, &tmp);
262 fput(file); 262 fput(file);
263out: 263out:
264 return error; 264 return error;
@@ -268,7 +268,6 @@ out:
268 268
269#define IOCTL_HASHSIZE 256 269#define IOCTL_HASHSIZE 256
270static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE]; 270static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE];
271static DECLARE_RWSEM(ioctl32_sem);
272 271
273extern struct ioctl_trans ioctl_start[]; 272extern struct ioctl_trans ioctl_start[];
274extern int ioctl_table_size; 273extern int ioctl_table_size;
@@ -390,14 +389,10 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
390 break; 389 break;
391 } 390 }
392 391
393 /* When register_ioctl32_conversion is finally gone remove
394 this lock! -AK */
395 down_read(&ioctl32_sem);
396 for (t = ioctl32_hash_table[ioctl32_hash(cmd)]; t; t = t->next) { 392 for (t = ioctl32_hash_table[ioctl32_hash(cmd)]; t; t = t->next) {
397 if (t->cmd == cmd) 393 if (t->cmd == cmd)
398 goto found_handler; 394 goto found_handler;
399 } 395 }
400 up_read(&ioctl32_sem);
401 396
402 if (S_ISSOCK(filp->f_dentry->d_inode->i_mode) && 397 if (S_ISSOCK(filp->f_dentry->d_inode->i_mode) &&
403 cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { 398 cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
@@ -417,11 +412,9 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
417 lock_kernel(); 412 lock_kernel();
418 error = t->handler(fd, cmd, arg, filp); 413 error = t->handler(fd, cmd, arg, filp);
419 unlock_kernel(); 414 unlock_kernel();
420 up_read(&ioctl32_sem);
421 goto out_fput; 415 goto out_fput;
422 } 416 }
423 417
424 up_read(&ioctl32_sem);
425 do_ioctl: 418 do_ioctl:
426 error = vfs_ioctl(filp, fd, cmd, arg); 419 error = vfs_ioctl(filp, fd, cmd, arg);
427 out_fput: 420 out_fput:
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 31b7efd94d66..43a2508ac696 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -686,7 +686,8 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
686 686
687 ifr = ifc.ifc_req; 687 ifr = ifc.ifc_req;
688 ifr32 = compat_ptr(ifc32.ifcbuf); 688 ifr32 = compat_ptr(ifc32.ifcbuf);
689 for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len; 689 for (i = 0, j = 0;
690 i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len;
690 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { 691 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
691 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) 692 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
692 return -EFAULT; 693 return -EFAULT;
@@ -702,10 +703,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
702 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32)); 703 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
703 ifc32.ifc_len = i; 704 ifc32.ifc_len = i;
704 } else { 705 } else {
705 if (i <= ifc32.ifc_len) 706 ifc32.ifc_len = i;
706 ifc32.ifc_len = i;
707 else
708 ifc32.ifc_len = i - sizeof (struct ifreq32);
709 } 707 }
710 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32))) 708 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
711 return -EFAULT; 709 return -EFAULT;
diff --git a/fs/dquot.c b/fs/dquot.c
index 05b60283c9c2..2a62b3dc20ec 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1513,10 +1513,16 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
1513 if (IS_ERR(dentry)) 1513 if (IS_ERR(dentry))
1514 return PTR_ERR(dentry); 1514 return PTR_ERR(dentry);
1515 1515
1516 if (!dentry->d_inode) {
1517 error = -ENOENT;
1518 goto out;
1519 }
1520
1516 error = security_quota_on(dentry); 1521 error = security_quota_on(dentry);
1517 if (!error) 1522 if (!error)
1518 error = vfs_quota_on_inode(dentry->d_inode, type, format_id); 1523 error = vfs_quota_on_inode(dentry->d_inode, type, format_id);
1519 1524
1525out:
1520 dput(dentry); 1526 dput(dentry);
1521 return error; 1527 return error;
1522} 1528}
diff --git a/fs/exec.c b/fs/exec.c
index c466fec5de20..1f8a9fd2c9ed 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -668,7 +668,7 @@ static inline int de_thread(struct task_struct *tsk)
668 if (!thread_group_leader(current)) { 668 if (!thread_group_leader(current)) {
669 struct task_struct *parent; 669 struct task_struct *parent;
670 struct dentry *proc_dentry1, *proc_dentry2; 670 struct dentry *proc_dentry1, *proc_dentry2;
671 unsigned long exit_state, ptrace; 671 unsigned long ptrace;
672 672
673 /* 673 /*
674 * Wait for the thread group leader to be a zombie. 674 * Wait for the thread group leader to be a zombie.
@@ -726,15 +726,15 @@ static inline int de_thread(struct task_struct *tsk)
726 list_del(&current->tasks); 726 list_del(&current->tasks);
727 list_add_tail(&current->tasks, &init_task.tasks); 727 list_add_tail(&current->tasks, &init_task.tasks);
728 current->exit_signal = SIGCHLD; 728 current->exit_signal = SIGCHLD;
729 exit_state = leader->exit_state; 729
730 BUG_ON(leader->exit_state != EXIT_ZOMBIE);
731 leader->exit_state = EXIT_DEAD;
730 732
731 write_unlock_irq(&tasklist_lock); 733 write_unlock_irq(&tasklist_lock);
732 spin_unlock(&leader->proc_lock); 734 spin_unlock(&leader->proc_lock);
733 spin_unlock(&current->proc_lock); 735 spin_unlock(&current->proc_lock);
734 proc_pid_flush(proc_dentry1); 736 proc_pid_flush(proc_dentry1);
735 proc_pid_flush(proc_dentry2); 737 proc_pid_flush(proc_dentry2);
736
737 BUG_ON(exit_state != EXIT_ZOMBIE);
738 } 738 }
739 739
740 /* 740 /*
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 1be78b4b4de9..6104ad310507 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -767,6 +767,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
767 if (input->group != EXT3_SB(sb)->s_groups_count) { 767 if (input->group != EXT3_SB(sb)->s_groups_count) {
768 ext3_warning(sb, __FUNCTION__, 768 ext3_warning(sb, __FUNCTION__,
769 "multiple resizers run on filesystem!\n"); 769 "multiple resizers run on filesystem!\n");
770 err = -EBUSY;
770 goto exit_journal; 771 goto exit_journal;
771 } 772 }
772 773
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index c045cc70c749..51f5da652771 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -74,6 +74,24 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
74 return 1; 74 return 1;
75} 75}
76 76
77static int dir_alias(struct inode *inode)
78{
79 if (S_ISDIR(inode->i_mode)) {
80 /* Don't allow creating an alias to a directory */
81 struct dentry *alias = d_find_alias(inode);
82 if (alias) {
83 dput(alias);
84 return 1;
85 }
86 }
87 return 0;
88}
89
90static inline int invalid_nodeid(u64 nodeid)
91{
92 return !nodeid || nodeid == FUSE_ROOT_ID;
93}
94
77static struct dentry_operations fuse_dentry_operations = { 95static struct dentry_operations fuse_dentry_operations = {
78 .d_revalidate = fuse_dentry_revalidate, 96 .d_revalidate = fuse_dentry_revalidate,
79}; 97};
@@ -97,7 +115,7 @@ static int fuse_lookup_iget(struct inode *dir, struct dentry *entry,
97 fuse_lookup_init(req, dir, entry, &outarg); 115 fuse_lookup_init(req, dir, entry, &outarg);
98 request_send(fc, req); 116 request_send(fc, req);
99 err = req->out.h.error; 117 err = req->out.h.error;
100 if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID)) 118 if (!err && invalid_nodeid(outarg.nodeid))
101 err = -EIO; 119 err = -EIO;
102 if (!err) { 120 if (!err) {
103 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 121 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
@@ -193,7 +211,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
193 } 211 }
194 212
195 err = -EIO; 213 err = -EIO;
196 if (!S_ISREG(outentry.attr.mode)) 214 if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid))
197 goto out_free_ff; 215 goto out_free_ff;
198 216
199 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, 217 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation,
@@ -250,7 +268,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
250 fuse_put_request(fc, req); 268 fuse_put_request(fc, req);
251 return err; 269 return err;
252 } 270 }
253 if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) { 271 if (invalid_nodeid(outarg.nodeid)) {
254 fuse_put_request(fc, req); 272 fuse_put_request(fc, req);
255 return -EIO; 273 return -EIO;
256 } 274 }
@@ -263,7 +281,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
263 fuse_put_request(fc, req); 281 fuse_put_request(fc, req);
264 282
265 /* Don't allow userspace to do really stupid things... */ 283 /* Don't allow userspace to do really stupid things... */
266 if ((inode->i_mode ^ mode) & S_IFMT) { 284 if (((inode->i_mode ^ mode) & S_IFMT) || dir_alias(inode)) {
267 iput(inode); 285 iput(inode);
268 return -EIO; 286 return -EIO;
269 } 287 }
@@ -874,14 +892,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
874 err = fuse_lookup_iget(dir, entry, &inode); 892 err = fuse_lookup_iget(dir, entry, &inode);
875 if (err) 893 if (err)
876 return ERR_PTR(err); 894 return ERR_PTR(err);
877 if (inode && S_ISDIR(inode->i_mode)) { 895 if (inode && dir_alias(inode)) {
878 /* Don't allow creating an alias to a directory */ 896 iput(inode);
879 struct dentry *alias = d_find_alias(inode); 897 return ERR_PTR(-EIO);
880 if (alias) {
881 dput(alias);
882 iput(inode);
883 return ERR_PTR(-EIO);
884 }
885 } 898 }
886 d_add(entry, inode); 899 d_add(entry, inode);
887 return NULL; 900 return NULL;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 64983ab55586..8c1cef3bb677 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -512,10 +512,14 @@ static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf)
512 buf->f_bsize = HPAGE_SIZE; 512 buf->f_bsize = HPAGE_SIZE;
513 if (sbinfo) { 513 if (sbinfo) {
514 spin_lock(&sbinfo->stat_lock); 514 spin_lock(&sbinfo->stat_lock);
515 buf->f_blocks = sbinfo->max_blocks; 515 /* If no limits set, just report 0 for max/free/used
516 buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; 516 * blocks, like simple_statfs() */
517 buf->f_files = sbinfo->max_inodes; 517 if (sbinfo->max_blocks >= 0) {
518 buf->f_ffree = sbinfo->free_inodes; 518 buf->f_blocks = sbinfo->max_blocks;
519 buf->f_bavail = buf->f_bfree = sbinfo->free_blocks;
520 buf->f_files = sbinfo->max_inodes;
521 buf->f_ffree = sbinfo->free_inodes;
522 }
519 spin_unlock(&sbinfo->stat_lock); 523 spin_unlock(&sbinfo->stat_lock);
520 } 524 }
521 buf->f_namelen = NAME_MAX; 525 buf->f_namelen = NAME_MAX;
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h
index f193d43a8a59..162af6dfe292 100644
--- a/fs/jffs2/debug.h
+++ b/fs/jffs2/debug.h
@@ -82,28 +82,28 @@
82 do { \ 82 do { \
83 printk(JFFS2_ERR_MSG_PREFIX \ 83 printk(JFFS2_ERR_MSG_PREFIX \
84 " (%d) %s: " fmt, current->pid, \ 84 " (%d) %s: " fmt, current->pid, \
85 __FUNCTION__, ##__VA_ARGS__); \ 85 __FUNCTION__ , ##__VA_ARGS__); \
86 } while(0) 86 } while(0)
87 87
88#define JFFS2_WARNING(fmt, ...) \ 88#define JFFS2_WARNING(fmt, ...) \
89 do { \ 89 do { \
90 printk(JFFS2_WARN_MSG_PREFIX \ 90 printk(JFFS2_WARN_MSG_PREFIX \
91 " (%d) %s: " fmt, current->pid, \ 91 " (%d) %s: " fmt, current->pid, \
92 __FUNCTION__, ##__VA_ARGS__); \ 92 __FUNCTION__ , ##__VA_ARGS__); \
93 } while(0) 93 } while(0)
94 94
95#define JFFS2_NOTICE(fmt, ...) \ 95#define JFFS2_NOTICE(fmt, ...) \
96 do { \ 96 do { \
97 printk(JFFS2_NOTICE_MSG_PREFIX \ 97 printk(JFFS2_NOTICE_MSG_PREFIX \
98 " (%d) %s: " fmt, current->pid, \ 98 " (%d) %s: " fmt, current->pid, \
99 __FUNCTION__, ##__VA_ARGS__); \ 99 __FUNCTION__ , ##__VA_ARGS__); \
100 } while(0) 100 } while(0)
101 101
102#define JFFS2_DEBUG(fmt, ...) \ 102#define JFFS2_DEBUG(fmt, ...) \
103 do { \ 103 do { \
104 printk(JFFS2_DBG_MSG_PREFIX \ 104 printk(JFFS2_DBG_MSG_PREFIX \
105 " (%d) %s: " fmt, current->pid, \ 105 " (%d) %s: " fmt, current->pid, \
106 __FUNCTION__, ##__VA_ARGS__); \ 106 __FUNCTION__ , ##__VA_ARGS__); \
107 } while(0) 107 } while(0)
108 108
109/* 109/*
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6391d8964214..aaab1a5ac461 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -643,14 +643,11 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
643/* 643/*
644 * Invalidate the local caches 644 * Invalidate the local caches
645 */ 645 */
646void 646static void nfs_zap_caches_locked(struct inode *inode)
647nfs_zap_caches(struct inode *inode)
648{ 647{
649 struct nfs_inode *nfsi = NFS_I(inode); 648 struct nfs_inode *nfsi = NFS_I(inode);
650 int mode = inode->i_mode; 649 int mode = inode->i_mode;
651 650
652 spin_lock(&inode->i_lock);
653
654 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode); 651 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
655 NFS_ATTRTIMEO_UPDATE(inode) = jiffies; 652 NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
656 653
@@ -659,7 +656,12 @@ nfs_zap_caches(struct inode *inode)
659 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 656 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
660 else 657 else
661 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 658 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
659}
662 660
661void nfs_zap_caches(struct inode *inode)
662{
663 spin_lock(&inode->i_lock);
664 nfs_zap_caches_locked(inode);
663 spin_unlock(&inode->i_lock); 665 spin_unlock(&inode->i_lock);
664} 666}
665 667
@@ -676,16 +678,13 @@ static void nfs_zap_acl_cache(struct inode *inode)
676} 678}
677 679
678/* 680/*
679 * Invalidate, but do not unhash, the inode 681 * Invalidate, but do not unhash, the inode.
682 * NB: must be called with inode->i_lock held!
680 */ 683 */
681static void 684static void nfs_invalidate_inode(struct inode *inode)
682nfs_invalidate_inode(struct inode *inode)
683{ 685{
684 umode_t save_mode = inode->i_mode; 686 set_bit(NFS_INO_STALE, &NFS_FLAGS(inode));
685 687 nfs_zap_caches_locked(inode);
686 make_bad_inode(inode);
687 inode->i_mode = save_mode;
688 nfs_zap_caches(inode);
689} 688}
690 689
691struct nfs_find_desc { 690struct nfs_find_desc {
@@ -1528,14 +1527,13 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1528 printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", 1527 printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n",
1529 __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); 1528 __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode);
1530#endif 1529#endif
1530 out_err:
1531 /* 1531 /*
1532 * No need to worry about unhashing the dentry, as the 1532 * No need to worry about unhashing the dentry, as the
1533 * lookup validation will know that the inode is bad. 1533 * lookup validation will know that the inode is bad.
1534 * (But we fall through to invalidate the caches.) 1534 * (But we fall through to invalidate the caches.)
1535 */ 1535 */
1536 nfs_invalidate_inode(inode); 1536 nfs_invalidate_inode(inode);
1537 out_err:
1538 set_bit(NFS_INO_STALE, &NFS_FLAGS(inode));
1539 return -ESTALE; 1537 return -ESTALE;
1540} 1538}
1541 1539
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 21482b2518f6..60e0dd800cc3 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3071,15 +3071,15 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
3071 struct nfs4_client *clp = state->owner->so_client; 3071 struct nfs4_client *clp = state->owner->so_client;
3072 int status; 3072 int status;
3073 3073
3074 down_read(&clp->cl_sem);
3075 /* Is this a delegated open? */ 3074 /* Is this a delegated open? */
3076 if (test_bit(NFS_DELEGATED_STATE, &state->flags)) { 3075 if (NFS_I(state->inode)->delegation_state != 0) {
3077 /* Yes: cache locks! */ 3076 /* Yes: cache locks! */
3078 status = do_vfs_lock(request->fl_file, request); 3077 status = do_vfs_lock(request->fl_file, request);
3079 /* ...but avoid races with delegation recall... */ 3078 /* ...but avoid races with delegation recall... */
3080 if (status < 0 || test_bit(NFS_DELEGATED_STATE, &state->flags)) 3079 if (status < 0 || test_bit(NFS_DELEGATED_STATE, &state->flags))
3081 goto out; 3080 return status;
3082 } 3081 }
3082 down_read(&clp->cl_sem);
3083 status = nfs4_set_lock_state(state, request); 3083 status = nfs4_set_lock_state(state, request);
3084 if (status != 0) 3084 if (status != 0)
3085 goto out; 3085 goto out;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 0675f3215e0a..5ef4c57618fe 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -644,12 +644,15 @@ void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t f
644 644
645struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter) 645struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
646{ 646{
647 struct rpc_sequence *sequence = counter->sequence;
647 struct nfs_seqid *new; 648 struct nfs_seqid *new;
648 649
649 new = kmalloc(sizeof(*new), GFP_KERNEL); 650 new = kmalloc(sizeof(*new), GFP_KERNEL);
650 if (new != NULL) { 651 if (new != NULL) {
651 new->sequence = counter; 652 new->sequence = counter;
652 INIT_LIST_HEAD(&new->list); 653 spin_lock(&sequence->lock);
654 list_add_tail(&new->list, &sequence->list);
655 spin_unlock(&sequence->lock);
653 } 656 }
654 return new; 657 return new;
655} 658}
@@ -658,12 +661,10 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
658{ 661{
659 struct rpc_sequence *sequence = seqid->sequence->sequence; 662 struct rpc_sequence *sequence = seqid->sequence->sequence;
660 663
661 if (!list_empty(&seqid->list)) { 664 spin_lock(&sequence->lock);
662 spin_lock(&sequence->lock); 665 list_del(&seqid->list);
663 list_del(&seqid->list); 666 spin_unlock(&sequence->lock);
664 spin_unlock(&sequence->lock); 667 rpc_wake_up(&sequence->wait);
665 }
666 rpc_wake_up_next(&sequence->wait);
667 kfree(seqid); 668 kfree(seqid);
668} 669}
669 670
@@ -722,11 +723,10 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
722 if (sequence->list.next == &seqid->list) 723 if (sequence->list.next == &seqid->list)
723 goto out; 724 goto out;
724 spin_lock(&sequence->lock); 725 spin_lock(&sequence->lock);
725 if (!list_empty(&sequence->list)) { 726 if (sequence->list.next != &seqid->list) {
726 rpc_sleep_on(&sequence->wait, task, NULL, NULL); 727 rpc_sleep_on(&sequence->wait, task, NULL, NULL);
727 status = -EAGAIN; 728 status = -EAGAIN;
728 } else 729 }
729 list_add(&seqid->list, &sequence->list);
730 spin_unlock(&sequence->lock); 730 spin_unlock(&sequence->lock);
731out: 731out:
732 return status; 732 return status;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 9ab97cef0daa..50bd5a8f0446 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -402,12 +402,11 @@ struct numa_maps {
402/* 402/*
403 * Calculate numa node maps for a vma 403 * Calculate numa node maps for a vma
404 */ 404 */
405static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) 405static struct numa_maps *get_numa_maps(struct vm_area_struct *vma)
406{ 406{
407 int i;
407 struct page *page; 408 struct page *page;
408 unsigned long vaddr; 409 unsigned long vaddr;
409 struct mm_struct *mm = vma->vm_mm;
410 int i;
411 struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL); 410 struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL);
412 411
413 if (!md) 412 if (!md)
@@ -420,7 +419,7 @@ static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma)
420 md->node[i] =0; 419 md->node[i] =0;
421 420
422 for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { 421 for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) {
423 page = follow_page(mm, vaddr, 0); 422 page = follow_page(vma, vaddr, 0);
424 if (page) { 423 if (page) {
425 int count = page_mapcount(page); 424 int count = page_mapcount(page);
426 425
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 5f82352b97e1..0a044ad98885 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2194,7 +2194,7 @@ static int map_block_for_writepage(struct inode *inode,
2194 INITIALIZE_PATH(path); 2194 INITIALIZE_PATH(path);
2195 int pos_in_item; 2195 int pos_in_item;
2196 int jbegin_count = JOURNAL_PER_BALANCE_CNT; 2196 int jbegin_count = JOURNAL_PER_BALANCE_CNT;
2197 loff_t byte_offset = (block << inode->i_sb->s_blocksize_bits) + 1; 2197 loff_t byte_offset = ((loff_t)block << inode->i_sb->s_blocksize_bits)+1;
2198 int retval; 2198 int retval;
2199 int use_get_block = 0; 2199 int use_get_block = 0;
2200 int bytes_copied = 0; 2200 int bytes_copied = 0;
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index c6108971b4e6..94d3cdfbf9b8 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -941,13 +941,12 @@ __linvfs_get_block(
941 int retpbbm = 1; 941 int retpbbm = 1;
942 int error; 942 int error;
943 943
944 if (blocks) {
945 offset = blocks << inode->i_blkbits; /* 64 bit goodness */
946 size = (ssize_t) min_t(xfs_off_t, offset, LONG_MAX);
947 } else {
948 size = 1 << inode->i_blkbits;
949 }
950 offset = (xfs_off_t)iblock << inode->i_blkbits; 944 offset = (xfs_off_t)iblock << inode->i_blkbits;
945 if (blocks)
946 size = (ssize_t) min_t(xfs_off_t, LONG_MAX,
947 (xfs_off_t)blocks << inode->i_blkbits);
948 else
949 size = 1 << inode->i_blkbits;
951 950
952 VOP_BMAP(vp, offset, size, 951 VOP_BMAP(vp, offset, size,
953 create ? flags : BMAPI_READ, &iomap, &retpbbm, error); 952 create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
@@ -1007,7 +1006,7 @@ __linvfs_get_block(
1007 ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0); 1006 ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0);
1008 offset = min_t(xfs_off_t, 1007 offset = min_t(xfs_off_t,
1009 iomap.iomap_bsize - iomap.iomap_delta, 1008 iomap.iomap_bsize - iomap.iomap_delta,
1010 blocks << inode->i_blkbits); 1009 (xfs_off_t)blocks << inode->i_blkbits);
1011 bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset); 1010 bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset);
1012 } 1011 }
1013 1012
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 35e557b00db2..1c7421840c18 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -310,7 +310,8 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
310 * Fix up the start offset of the attribute fork 310 * Fix up the start offset of the attribute fork
311 */ 311 */
312 totsize -= size; 312 totsize -= size;
313 if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname) { 313 if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname &&
314 !(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)) {
314 /* 315 /*
315 * Last attribute now removed, revert to original 316 * Last attribute now removed, revert to original
316 * inode format making all literal area available 317 * inode format making all literal area available
@@ -328,7 +329,8 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
328 xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); 329 xfs_idata_realloc(dp, -size, XFS_ATTR_FORK);
329 dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); 330 dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize);
330 ASSERT(dp->i_d.di_forkoff); 331 ASSERT(dp->i_d.di_forkoff);
331 ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname); 332 ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname ||
333 (mp->m_flags & XFS_MOUNT_COMPAT_ATTR));
332 dp->i_afp->if_ext_max = 334 dp->i_afp->if_ext_max =
333 XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t); 335 XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
334 dp->i_df.if_ext_max = 336 dp->i_df.if_ext_max =
@@ -737,7 +739,8 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp)
737 + name_loc->namelen 739 + name_loc->namelen
738 + INT_GET(name_loc->valuelen, ARCH_CONVERT); 740 + INT_GET(name_loc->valuelen, ARCH_CONVERT);
739 } 741 }
740 if (bytes == sizeof(struct xfs_attr_sf_hdr)) 742 if (!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR) &&
743 (bytes == sizeof(struct xfs_attr_sf_hdr)))
741 return(-1); 744 return(-1);
742 return(xfs_attr_shortform_bytesfit(dp, bytes)); 745 return(xfs_attr_shortform_bytesfit(dp, bytes));
743} 746}
@@ -775,6 +778,8 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
775 goto out; 778 goto out;
776 779
777 if (forkoff == -1) { 780 if (forkoff == -1) {
781 ASSERT(!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR));
782
778 /* 783 /*
779 * Last attribute was removed, revert to original 784 * Last attribute was removed, revert to original
780 * inode format making all literal area available 785 * inode format making all literal area available
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 7ceabd0e2d9d..d1236d6f4045 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -550,7 +550,7 @@ xfs_fs_goingdown(
550 struct vfs *vfsp = XFS_MTOVFS(mp); 550 struct vfs *vfsp = XFS_MTOVFS(mp);
551 struct super_block *sb = freeze_bdev(vfsp->vfs_super->s_bdev); 551 struct super_block *sb = freeze_bdev(vfsp->vfs_super->s_bdev);
552 552
553 if (sb) { 553 if (sb && !IS_ERR(sb)) {
554 xfs_force_shutdown(mp, XFS_FORCE_UMOUNT); 554 xfs_force_shutdown(mp, XFS_FORCE_UMOUNT);
555 thaw_bdev(sb->s_bdev, sb); 555 thaw_bdev(sb->s_bdev, sb);
556 } 556 }
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index fcd6d63bb68b..3ce204a524b0 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -69,7 +69,7 @@ typedef struct xfs_iomap {
69 xfs_buftarg_t *iomap_target; 69 xfs_buftarg_t *iomap_target;
70 xfs_off_t iomap_offset; /* offset of mapping, bytes */ 70 xfs_off_t iomap_offset; /* offset of mapping, bytes */
71 xfs_off_t iomap_bsize; /* size of mapping, bytes */ 71 xfs_off_t iomap_bsize; /* size of mapping, bytes */
72 size_t iomap_delta; /* offset into mapping, bytes */ 72 xfs_off_t iomap_delta; /* offset into mapping, bytes */
73 iomap_flags_t iomap_flags; 73 iomap_flags_t iomap_flags;
74} xfs_iomap_t; 74} xfs_iomap_t;
75 75
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 8f285149681f..4518b188ade6 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -494,10 +494,8 @@ typedef struct log {
494 494
495#define XLOG_FORCED_SHUTDOWN(log) ((log)->l_flags & XLOG_IO_ERROR) 495#define XLOG_FORCED_SHUTDOWN(log) ((log)->l_flags & XLOG_IO_ERROR)
496 496
497#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \ 497#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
498 xlog_grant_sub_space(log,bytes,type) 498 { \
499static inline void xlog_grant_sub_space(struct log *log, int bytes, int type)
500{
501 if (type == 'w') { \ 499 if (type == 'w') { \
502 (log)->l_grant_write_bytes -= (bytes); \ 500 (log)->l_grant_write_bytes -= (bytes); \
503 if ((log)->l_grant_write_bytes < 0) { \ 501 if ((log)->l_grant_write_bytes < 0) { \
@@ -511,13 +509,9 @@ static inline void xlog_grant_sub_space(struct log *log, int bytes, int type)
511 (log)->l_grant_reserve_cycle--; \ 509 (log)->l_grant_reserve_cycle--; \
512 } \ 510 } \
513 } \ 511 } \
514} 512 }
515 513#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
516#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \ 514 { \
517 xlog_grant_add_space(log,bytes,type)
518static inline void
519xlog_grant_add_space(struct log *log, int bytes, int type)
520{
521 if (type == 'w') { \ 515 if (type == 'w') { \
522 (log)->l_grant_write_bytes += (bytes); \ 516 (log)->l_grant_write_bytes += (bytes); \
523 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \ 517 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
@@ -531,12 +525,9 @@ xlog_grant_add_space(struct log *log, int bytes, int type)
531 (log)->l_grant_reserve_cycle++; \ 525 (log)->l_grant_reserve_cycle++; \
532 } \ 526 } \
533 } \ 527 } \
534} 528 }
535 529#define XLOG_INS_TICKETQ(q, tic) \
536#define XLOG_INS_TICKETQ(q, tic) xlog_ins_ticketq(q, tic) 530 { \
537static inline void
538xlog_ins_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
539{ \
540 if (q) { \ 531 if (q) { \
541 (tic)->t_next = (q); \ 532 (tic)->t_next = (q); \
542 (tic)->t_prev = (q)->t_prev; \ 533 (tic)->t_prev = (q)->t_prev; \
@@ -547,12 +538,9 @@ xlog_ins_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
547 (q) = (tic); \ 538 (q) = (tic); \
548 } \ 539 } \
549 (tic)->t_flags |= XLOG_TIC_IN_Q; \ 540 (tic)->t_flags |= XLOG_TIC_IN_Q; \
550} 541 }
551 542#define XLOG_DEL_TICKETQ(q, tic) \
552#define XLOG_DEL_TICKETQ(q, tic) xlog_del_ticketq(q, tic) 543 { \
553static inline void
554xlog_del_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
555{ \
556 if ((tic) == (tic)->t_next) { \ 544 if ((tic) == (tic)->t_next) { \
557 (q) = NULL; \ 545 (q) = NULL; \
558 } else { \ 546 } else { \
@@ -562,7 +550,7 @@ xlog_del_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
562 } \ 550 } \
563 (tic)->t_next = (tic)->t_prev = NULL; \ 551 (tic)->t_next = (tic)->t_prev = NULL; \
564 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \ 552 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \
565} 553 }
566 554
567/* common routines */ 555/* common routines */
568extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); 556extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 7c1f74531463..e03fa2a3d5ed 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3958,8 +3958,9 @@ xfs_finish_reclaim_all(xfs_mount_t *mp, int noblock)
3958 } 3958 }
3959 } 3959 }
3960 XFS_MOUNT_IUNLOCK(mp); 3960 XFS_MOUNT_IUNLOCK(mp);
3961 xfs_finish_reclaim(ip, noblock, 3961 if (xfs_finish_reclaim(ip, noblock,
3962 XFS_IFLUSH_DELWRI_ELSE_ASYNC); 3962 XFS_IFLUSH_DELWRI_ELSE_ASYNC))
3963 delay(1);
3963 purged = 1; 3964 purged = 1;
3964 break; 3965 break;
3965 } 3966 }
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
index 36505bb4e8cb..6183eab006d4 100644
--- a/include/asm-alpha/atomic.h
+++ b/include/asm-alpha/atomic.h
@@ -118,8 +118,6 @@ static __inline__ long atomic_add_return(int i, atomic_t * v)
118 return result; 118 return result;
119} 119}
120 120
121#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
122
123static __inline__ long atomic64_add_return(long i, atomic64_t * v) 121static __inline__ long atomic64_add_return(long i, atomic64_t * v)
124{ 122{
125 long temp, result; 123 long temp, result;
@@ -189,6 +187,9 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
189}) 187})
190#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 188#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
191 189
190#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
191#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
192
192#define atomic_dec_return(v) atomic_sub_return(1,(v)) 193#define atomic_dec_return(v) atomic_sub_return(1,(v))
193#define atomic64_dec_return(v) atomic64_sub_return(1,(v)) 194#define atomic64_dec_return(v) atomic64_sub_return(1,(v))
194 195
@@ -199,6 +200,8 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
199#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0) 200#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
200 201
201#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) 202#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
203#define atomic64_inc_and_test(v) (atomic64_add_return(1, (v)) == 0)
204
202#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 205#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
203#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0) 206#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
204 207
diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h
index 68e04c0bb3f7..ae048441c9ed 100644
--- a/include/asm-arm/arch-ebsa110/io.h
+++ b/include/asm-arm/arch-ebsa110/io.h
@@ -64,7 +64,7 @@ void __writel(u32 val, void __iomem *addr);
64#define writew(v,b) __writew(v,b) 64#define writew(v,b) __writew(v,b)
65#define writel(v,b) __writel(v,b) 65#define writel(v,b) __writel(v,b)
66 66
67#define __arch_ioremap(cookie,sz,c,a) ((void __iomem *)(cookie)) 67#define __arch_ioremap(cookie,sz,c) ((void __iomem *)(cookie))
68#define __arch_iounmap(cookie) do { } while (0) 68#define __arch_iounmap(cookie) do { } while (0)
69 69
70extern void insb(unsigned int port, void *buf, int sz); 70extern void insb(unsigned int port, void *buf, int sz);
diff --git a/include/asm-arm/arch-iop3xx/timex.h b/include/asm-arm/arch-iop3xx/timex.h
index d4187fe9a85a..472badb451c4 100644
--- a/include/asm-arm/arch-iop3xx/timex.h
+++ b/include/asm-arm/arch-iop3xx/timex.h
@@ -4,7 +4,7 @@
4 * IOP3xx architecture timex specifications 4 * IOP3xx architecture timex specifications
5 */ 5 */
6#include <linux/config.h> 6#include <linux/config.h>
7 7#include <asm/hardware.h>
8 8
9#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244) 9#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244)
10 10
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 2b149ed59149..9444958bec1e 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -47,6 +47,7 @@
47 * Queue Manager 47 * Queue Manager
48 */ 48 */
49#define IXP4XX_QMGR_BASE_PHYS (0x60000000) 49#define IXP4XX_QMGR_BASE_PHYS (0x60000000)
50#define IXP4XX_QMGR_REGION_SIZE (0x00004000)
50 51
51/* 52/*
52 * Expansion BUS Configuration registers 53 * Expansion BUS Configuration registers
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index cb33d57c146c..7f1be48ad67e 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -21,6 +21,7 @@
21 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 21 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
22 * 28-Mar-2005 LCVR Fixed definition of GPB10 22 * 28-Mar-2005 LCVR Fixed definition of GPB10
23 * 26-Oct-2005 BJD Added generic configuration types 23 * 26-Oct-2005 BJD Added generic configuration types
24 * 27-Nov-2005 LCVR Added definitions to S3C2400 registers
24*/ 25*/
25 26
26 27
@@ -54,12 +55,16 @@
54 55
55#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO) 56#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
56 57
57/* port A - 22bits, zero in bit X makes pin X output 58/* port A - S3C2410: 22bits, zero in bit X makes pin X output
59 * S3C2400: 18bits, zero in bit X makes pin X output
58 * 1 makes port special function, this is default 60 * 1 makes port special function, this is default
59*/ 61*/
60#define S3C2410_GPACON S3C2410_GPIOREG(0x00) 62#define S3C2410_GPACON S3C2410_GPIOREG(0x00)
61#define S3C2410_GPADAT S3C2410_GPIOREG(0x04) 63#define S3C2410_GPADAT S3C2410_GPIOREG(0x04)
62 64
65#define S3C2400_GPACON S3C2410_GPIOREG(0x00)
66#define S3C2400_GPADAT S3C2410_GPIOREG(0x04)
67
63#define S3C2410_GPA0 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 0) 68#define S3C2410_GPA0 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 0)
64#define S3C2410_GPA0_OUT (0<<0) 69#define S3C2410_GPA0_OUT (0<<0)
65#define S3C2410_GPA0_ADDR0 (1<<0) 70#define S3C2410_GPA0_ADDR0 (1<<0)
@@ -103,34 +108,42 @@
103#define S3C2410_GPA10 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 10) 108#define S3C2410_GPA10 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 10)
104#define S3C2410_GPA10_OUT (0<<10) 109#define S3C2410_GPA10_OUT (0<<10)
105#define S3C2410_GPA10_ADDR25 (1<<10) 110#define S3C2410_GPA10_ADDR25 (1<<10)
111#define S3C2400_GPA10_SCKE (1<<10)
106 112
107#define S3C2410_GPA11 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 11) 113#define S3C2410_GPA11 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 11)
108#define S3C2410_GPA11_OUT (0<<11) 114#define S3C2410_GPA11_OUT (0<<11)
109#define S3C2410_GPA11_ADDR26 (1<<11) 115#define S3C2410_GPA11_ADDR26 (1<<11)
116#define S3C2400_GPA11_nCAS0 (1<<11)
110 117
111#define S3C2410_GPA12 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 12) 118#define S3C2410_GPA12 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 12)
112#define S3C2410_GPA12_OUT (0<<12) 119#define S3C2410_GPA12_OUT (0<<12)
113#define S3C2410_GPA12_nGCS1 (1<<12) 120#define S3C2410_GPA12_nGCS1 (1<<12)
121#define S3C2400_GPA12_nCAS1 (1<<12)
114 122
115#define S3C2410_GPA13 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 13) 123#define S3C2410_GPA13 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 13)
116#define S3C2410_GPA13_OUT (0<<13) 124#define S3C2410_GPA13_OUT (0<<13)
117#define S3C2410_GPA13_nGCS2 (1<<13) 125#define S3C2410_GPA13_nGCS2 (1<<13)
126#define S3C2400_GPA13_nGCS1 (1<<13)
118 127
119#define S3C2410_GPA14 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 14) 128#define S3C2410_GPA14 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 14)
120#define S3C2410_GPA14_OUT (0<<14) 129#define S3C2410_GPA14_OUT (0<<14)
121#define S3C2410_GPA14_nGCS3 (1<<14) 130#define S3C2410_GPA14_nGCS3 (1<<14)
131#define S3C2400_GPA14_nGCS2 (1<<14)
122 132
123#define S3C2410_GPA15 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 15) 133#define S3C2410_GPA15 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 15)
124#define S3C2410_GPA15_OUT (0<<15) 134#define S3C2410_GPA15_OUT (0<<15)
125#define S3C2410_GPA15_nGCS4 (1<<15) 135#define S3C2410_GPA15_nGCS4 (1<<15)
136#define S3C2400_GPA15_nGCS3 (1<<15)
126 137
127#define S3C2410_GPA16 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 16) 138#define S3C2410_GPA16 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 16)
128#define S3C2410_GPA16_OUT (0<<16) 139#define S3C2410_GPA16_OUT (0<<16)
129#define S3C2410_GPA16_nGCS5 (1<<16) 140#define S3C2410_GPA16_nGCS5 (1<<16)
141#define S3C2400_GPA16_nGCS4 (1<<16)
130 142
131#define S3C2410_GPA17 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 17) 143#define S3C2410_GPA17 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 17)
132#define S3C2410_GPA17_OUT (0<<17) 144#define S3C2410_GPA17_OUT (0<<17)
133#define S3C2410_GPA17_CLE (1<<17) 145#define S3C2410_GPA17_CLE (1<<17)
146#define S3C2400_GPA17_nGCS5 (1<<17)
134 147
135#define S3C2410_GPA18 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 18) 148#define S3C2410_GPA18 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 18)
136#define S3C2410_GPA18_OUT (0<<18) 149#define S3C2410_GPA18_OUT (0<<18)
@@ -152,10 +165,16 @@
152#define S3C2410_GPA22_OUT (0<<22) 165#define S3C2410_GPA22_OUT (0<<22)
153#define S3C2410_GPA22_nFCE (1<<22) 166#define S3C2410_GPA22_nFCE (1<<22)
154 167
155/* 0x08 and 0x0c are reserved */ 168/* 0x08 and 0x0c are reserved on S3C2410 */
156 169
157/* GPB is 10 IO pins, each configured by 2 bits each in GPBCON. 170/* S3C2410:
171 * GPB is 10 IO pins, each configured by 2 bits each in GPBCON.
158 * 00 = input, 01 = output, 10=special function, 11=reserved 172 * 00 = input, 01 = output, 10=special function, 11=reserved
173
174 * S3C2400:
175 * GPB is 16 IO pins, each configured by 2 bits each in GPBCON.
176 * 00 = input, 01 = output, 10=data, 11=special function
177
159 * bit 0,1 = pin 0, 2,3= pin 1... 178 * bit 0,1 = pin 0, 2,3= pin 1...
160 * 179 *
161 * CPBUP = pull up resistor control, 1=disabled, 0=enabled 180 * CPBUP = pull up resistor control, 1=disabled, 0=enabled
@@ -165,63 +184,113 @@
165#define S3C2410_GPBDAT S3C2410_GPIOREG(0x14) 184#define S3C2410_GPBDAT S3C2410_GPIOREG(0x14)
166#define S3C2410_GPBUP S3C2410_GPIOREG(0x18) 185#define S3C2410_GPBUP S3C2410_GPIOREG(0x18)
167 186
187#define S3C2400_GPBCON S3C2410_GPIOREG(0x08)
188#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C)
189#define S3C2400_GPBUP S3C2410_GPIOREG(0x10)
190
168/* no i/o pin in port b can have value 3! */ 191/* no i/o pin in port b can have value 3! */
169 192
170#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0) 193#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0)
171#define S3C2410_GPB0_INP (0x00 << 0) 194#define S3C2410_GPB0_INP (0x00 << 0)
172#define S3C2410_GPB0_OUTP (0x01 << 0) 195#define S3C2410_GPB0_OUTP (0x01 << 0)
173#define S3C2410_GPB0_TOUT0 (0x02 << 0) 196#define S3C2410_GPB0_TOUT0 (0x02 << 0)
197#define S3C2400_GPB0_DATA16 (0x02 << 0)
174 198
175#define S3C2410_GPB1 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 1) 199#define S3C2410_GPB1 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 1)
176#define S3C2410_GPB1_INP (0x00 << 2) 200#define S3C2410_GPB1_INP (0x00 << 2)
177#define S3C2410_GPB1_OUTP (0x01 << 2) 201#define S3C2410_GPB1_OUTP (0x01 << 2)
178#define S3C2410_GPB1_TOUT1 (0x02 << 2) 202#define S3C2410_GPB1_TOUT1 (0x02 << 2)
203#define S3C2400_GPB1_DATA17 (0x02 << 2)
179 204
180#define S3C2410_GPB2 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 2) 205#define S3C2410_GPB2 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 2)
181#define S3C2410_GPB2_INP (0x00 << 4) 206#define S3C2410_GPB2_INP (0x00 << 4)
182#define S3C2410_GPB2_OUTP (0x01 << 4) 207#define S3C2410_GPB2_OUTP (0x01 << 4)
183#define S3C2410_GPB2_TOUT2 (0x02 << 4) 208#define S3C2410_GPB2_TOUT2 (0x02 << 4)
209#define S3C2400_GPB2_DATA18 (0x02 << 4)
210#define S3C2400_GPB2_TCLK1 (0x03 << 4)
184 211
185#define S3C2410_GPB3 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 3) 212#define S3C2410_GPB3 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 3)
186#define S3C2410_GPB3_INP (0x00 << 6) 213#define S3C2410_GPB3_INP (0x00 << 6)
187#define S3C2410_GPB3_OUTP (0x01 << 6) 214#define S3C2410_GPB3_OUTP (0x01 << 6)
188#define S3C2410_GPB3_TOUT3 (0x02 << 6) 215#define S3C2410_GPB3_TOUT3 (0x02 << 6)
216#define S3C2400_GPB3_DATA19 (0x02 << 6)
217#define S3C2400_GPB3_TXD1 (0x03 << 6)
189 218
190#define S3C2410_GPB4 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 4) 219#define S3C2410_GPB4 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 4)
191#define S3C2410_GPB4_INP (0x00 << 8) 220#define S3C2410_GPB4_INP (0x00 << 8)
192#define S3C2410_GPB4_OUTP (0x01 << 8) 221#define S3C2410_GPB4_OUTP (0x01 << 8)
193#define S3C2410_GPB4_TCLK0 (0x02 << 8) 222#define S3C2410_GPB4_TCLK0 (0x02 << 8)
223#define S3C2400_GPB4_DATA20 (0x02 << 8)
194#define S3C2410_GPB4_MASK (0x03 << 8) 224#define S3C2410_GPB4_MASK (0x03 << 8)
225#define S3C2400_GPB4_RXD1 (0x03 << 8)
226#define S3C2400_GPB4_MASK (0x03 << 8)
195 227
196#define S3C2410_GPB5 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 5) 228#define S3C2410_GPB5 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 5)
197#define S3C2410_GPB5_INP (0x00 << 10) 229#define S3C2410_GPB5_INP (0x00 << 10)
198#define S3C2410_GPB5_OUTP (0x01 << 10) 230#define S3C2410_GPB5_OUTP (0x01 << 10)
199#define S3C2410_GPB5_nXBACK (0x02 << 10) 231#define S3C2410_GPB5_nXBACK (0x02 << 10)
232#define S3C2400_GPB5_DATA21 (0x02 << 10)
233#define S3C2400_GPB5_nCTS1 (0x03 << 10)
200 234
201#define S3C2410_GPB6 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 6) 235#define S3C2410_GPB6 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 6)
202#define S3C2410_GPB6_INP (0x00 << 12) 236#define S3C2410_GPB6_INP (0x00 << 12)
203#define S3C2410_GPB6_OUTP (0x01 << 12) 237#define S3C2410_GPB6_OUTP (0x01 << 12)
204#define S3C2410_GPB6_nXBREQ (0x02 << 12) 238#define S3C2410_GPB6_nXBREQ (0x02 << 12)
239#define S3C2400_GPB6_DATA22 (0x02 << 12)
240#define S3C2400_GPB6_nRTS1 (0x03 << 12)
205 241
206#define S3C2410_GPB7 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 7) 242#define S3C2410_GPB7 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 7)
207#define S3C2410_GPB7_INP (0x00 << 14) 243#define S3C2410_GPB7_INP (0x00 << 14)
208#define S3C2410_GPB7_OUTP (0x01 << 14) 244#define S3C2410_GPB7_OUTP (0x01 << 14)
209#define S3C2410_GPB7_nXDACK1 (0x02 << 14) 245#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
246#define S3C2400_GPB7_DATA23 (0x02 << 14)
210 247
211#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8) 248#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8)
212#define S3C2410_GPB8_INP (0x00 << 16) 249#define S3C2410_GPB8_INP (0x00 << 16)
213#define S3C2410_GPB8_OUTP (0x01 << 16) 250#define S3C2410_GPB8_OUTP (0x01 << 16)
214#define S3C2410_GPB8_nXDREQ1 (0x02 << 16) 251#define S3C2410_GPB8_nXDREQ1 (0x02 << 16)
252#define S3C2400_GPB8_DATA24 (0x02 << 16)
215 253
216#define S3C2410_GPB9 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 9) 254#define S3C2410_GPB9 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 9)
217#define S3C2410_GPB9_INP (0x00 << 18) 255#define S3C2410_GPB9_INP (0x00 << 18)
218#define S3C2410_GPB9_OUTP (0x01 << 18) 256#define S3C2410_GPB9_OUTP (0x01 << 18)
219#define S3C2410_GPB9_nXDACK0 (0x02 << 18) 257#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
258#define S3C2400_GPB9_DATA25 (0x02 << 18)
259#define S3C2400_GPB9_I2SSDI (0x03 << 18)
220 260
221#define S3C2410_GPB10 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 10) 261#define S3C2410_GPB10 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 10)
222#define S3C2410_GPB10_INP (0x00 << 20) 262#define S3C2410_GPB10_INP (0x00 << 20)
223#define S3C2410_GPB10_OUTP (0x01 << 20) 263#define S3C2410_GPB10_OUTP (0x01 << 20)
224#define S3C2410_GPB10_nXDRE0 (0x02 << 20) 264#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
265#define S3C2400_GPB10_DATA26 (0x02 << 20)
266#define S3C2400_GPB10_nSS (0x03 << 20)
267
268#define S3C2400_GPB11 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 11)
269#define S3C2400_GPB11_INP (0x00 << 22)
270#define S3C2400_GPB11_OUTP (0x01 << 22)
271#define S3C2400_GPB11_DATA27 (0x02 << 22)
272
273#define S3C2400_GPB12 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 12)
274#define S3C2400_GPB12_INP (0x00 << 24)
275#define S3C2400_GPB12_OUTP (0x01 << 24)
276#define S3C2400_GPB12_DATA28 (0x02 << 24)
277
278#define S3C2400_GPB13 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 13)
279#define S3C2400_GPB13_INP (0x00 << 26)
280#define S3C2400_GPB13_OUTP (0x01 << 26)
281#define S3C2400_GPB13_DATA29 (0x02 << 26)
282
283#define S3C2400_GPB14 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 14)
284#define S3C2400_GPB14_INP (0x00 << 28)
285#define S3C2400_GPB14_OUTP (0x01 << 28)
286#define S3C2400_GPB14_DATA30 (0x02 << 28)
287
288#define S3C2400_GPB15 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 15)
289#define S3C2400_GPB15_INP (0x00 << 30)
290#define S3C2400_GPB15_OUTP (0x01 << 30)
291#define S3C2400_GPB15_DATA31 (0x02 << 30)
292
293#define S3C2410_GPB_PUPDIS(x) (1<<(x))
225 294
226/* Port C consits of 16 GPIO/Special function 295/* Port C consits of 16 GPIO/Special function
227 * 296 *
@@ -233,150 +302,193 @@
233#define S3C2410_GPCDAT S3C2410_GPIOREG(0x24) 302#define S3C2410_GPCDAT S3C2410_GPIOREG(0x24)
234#define S3C2410_GPCUP S3C2410_GPIOREG(0x28) 303#define S3C2410_GPCUP S3C2410_GPIOREG(0x28)
235 304
305#define S3C2400_GPCCON S3C2410_GPIOREG(0x14)
306#define S3C2400_GPCDAT S3C2410_GPIOREG(0x18)
307#define S3C2400_GPCUP S3C2410_GPIOREG(0x1C)
308
236#define S3C2410_GPC0 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 0) 309#define S3C2410_GPC0 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 0)
237#define S3C2410_GPC0_INP (0x00 << 0) 310#define S3C2410_GPC0_INP (0x00 << 0)
238#define S3C2410_GPC0_OUTP (0x01 << 0) 311#define S3C2410_GPC0_OUTP (0x01 << 0)
239#define S3C2410_GPC0_LEND (0x02 << 0) 312#define S3C2410_GPC0_LEND (0x02 << 0)
313#define S3C2400_GPC0_VD0 (0x02 << 0)
240 314
241#define S3C2410_GPC1 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 1) 315#define S3C2410_GPC1 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 1)
242#define S3C2410_GPC1_INP (0x00 << 2) 316#define S3C2410_GPC1_INP (0x00 << 2)
243#define S3C2410_GPC1_OUTP (0x01 << 2) 317#define S3C2410_GPC1_OUTP (0x01 << 2)
244#define S3C2410_GPC1_VCLK (0x02 << 2) 318#define S3C2410_GPC1_VCLK (0x02 << 2)
319#define S3C2400_GPC1_VD1 (0x02 << 2)
245 320
246#define S3C2410_GPC2 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 2) 321#define S3C2410_GPC2 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 2)
247#define S3C2410_GPC2_INP (0x00 << 4) 322#define S3C2410_GPC2_INP (0x00 << 4)
248#define S3C2410_GPC2_OUTP (0x01 << 4) 323#define S3C2410_GPC2_OUTP (0x01 << 4)
249#define S3C2410_GPC2_VLINE (0x02 << 4) 324#define S3C2410_GPC2_VLINE (0x02 << 4)
325#define S3C2400_GPC2_VD2 (0x02 << 4)
250 326
251#define S3C2410_GPC3 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 3) 327#define S3C2410_GPC3 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 3)
252#define S3C2410_GPC3_INP (0x00 << 6) 328#define S3C2410_GPC3_INP (0x00 << 6)
253#define S3C2410_GPC3_OUTP (0x01 << 6) 329#define S3C2410_GPC3_OUTP (0x01 << 6)
254#define S3C2410_GPC3_VFRAME (0x02 << 6) 330#define S3C2410_GPC3_VFRAME (0x02 << 6)
331#define S3C2400_GPC3_VD3 (0x02 << 6)
255 332
256#define S3C2410_GPC4 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 4) 333#define S3C2410_GPC4 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 4)
257#define S3C2410_GPC4_INP (0x00 << 8) 334#define S3C2410_GPC4_INP (0x00 << 8)
258#define S3C2410_GPC4_OUTP (0x01 << 8) 335#define S3C2410_GPC4_OUTP (0x01 << 8)
259#define S3C2410_GPC4_VM (0x02 << 8) 336#define S3C2410_GPC4_VM (0x02 << 8)
337#define S3C2400_GPC4_VD4 (0x02 << 8)
260 338
261#define S3C2410_GPC5 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 5) 339#define S3C2410_GPC5 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 5)
262#define S3C2410_GPC5_INP (0x00 << 10) 340#define S3C2410_GPC5_INP (0x00 << 10)
263#define S3C2410_GPC5_OUTP (0x01 << 10) 341#define S3C2410_GPC5_OUTP (0x01 << 10)
264#define S3C2410_GPC5_LCDVF0 (0x02 << 10) 342#define S3C2410_GPC5_LCDVF0 (0x02 << 10)
343#define S3C2400_GPC5_VD5 (0x02 << 10)
265 344
266#define S3C2410_GPC6 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 6) 345#define S3C2410_GPC6 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 6)
267#define S3C2410_GPC6_INP (0x00 << 12) 346#define S3C2410_GPC6_INP (0x00 << 12)
268#define S3C2410_GPC6_OUTP (0x01 << 12) 347#define S3C2410_GPC6_OUTP (0x01 << 12)
269#define S3C2410_GPC6_LCDVF1 (0x02 << 12) 348#define S3C2410_GPC6_LCDVF1 (0x02 << 12)
349#define S3C2400_GPC6_VD6 (0x02 << 12)
270 350
271#define S3C2410_GPC7 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 7) 351#define S3C2410_GPC7 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 7)
272#define S3C2410_GPC7_INP (0x00 << 14) 352#define S3C2410_GPC7_INP (0x00 << 14)
273#define S3C2410_GPC7_OUTP (0x01 << 14) 353#define S3C2410_GPC7_OUTP (0x01 << 14)
274#define S3C2410_GPC7_LCDVF2 (0x02 << 14) 354#define S3C2410_GPC7_LCDVF2 (0x02 << 14)
355#define S3C2400_GPC7_VD7 (0x02 << 14)
275 356
276#define S3C2410_GPC8 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 8) 357#define S3C2410_GPC8 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 8)
277#define S3C2410_GPC8_INP (0x00 << 16) 358#define S3C2410_GPC8_INP (0x00 << 16)
278#define S3C2410_GPC8_OUTP (0x01 << 16) 359#define S3C2410_GPC8_OUTP (0x01 << 16)
279#define S3C2410_GPC8_VD0 (0x02 << 16) 360#define S3C2410_GPC8_VD0 (0x02 << 16)
361#define S3C2400_GPC8_VD8 (0x02 << 16)
280 362
281#define S3C2410_GPC9 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 9) 363#define S3C2410_GPC9 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 9)
282#define S3C2410_GPC9_INP (0x00 << 18) 364#define S3C2410_GPC9_INP (0x00 << 18)
283#define S3C2410_GPC9_OUTP (0x01 << 18) 365#define S3C2410_GPC9_OUTP (0x01 << 18)
284#define S3C2410_GPC9_VD1 (0x02 << 18) 366#define S3C2410_GPC9_VD1 (0x02 << 18)
367#define S3C2400_GPC9_VD9 (0x02 << 18)
285 368
286#define S3C2410_GPC10 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 10) 369#define S3C2410_GPC10 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 10)
287#define S3C2410_GPC10_INP (0x00 << 20) 370#define S3C2410_GPC10_INP (0x00 << 20)
288#define S3C2410_GPC10_OUTP (0x01 << 20) 371#define S3C2410_GPC10_OUTP (0x01 << 20)
289#define S3C2410_GPC10_VD2 (0x02 << 20) 372#define S3C2410_GPC10_VD2 (0x02 << 20)
373#define S3C2400_GPC10_VD10 (0x02 << 20)
290 374
291#define S3C2410_GPC11 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 11) 375#define S3C2410_GPC11 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 11)
292#define S3C2410_GPC11_INP (0x00 << 22) 376#define S3C2410_GPC11_INP (0x00 << 22)
293#define S3C2410_GPC11_OUTP (0x01 << 22) 377#define S3C2410_GPC11_OUTP (0x01 << 22)
294#define S3C2410_GPC11_VD3 (0x02 << 22) 378#define S3C2410_GPC11_VD3 (0x02 << 22)
379#define S3C2400_GPC11_VD11 (0x02 << 22)
295 380
296#define S3C2410_GPC12 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 12) 381#define S3C2410_GPC12 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 12)
297#define S3C2410_GPC12_INP (0x00 << 24) 382#define S3C2410_GPC12_INP (0x00 << 24)
298#define S3C2410_GPC12_OUTP (0x01 << 24) 383#define S3C2410_GPC12_OUTP (0x01 << 24)
299#define S3C2410_GPC12_VD4 (0x02 << 24) 384#define S3C2410_GPC12_VD4 (0x02 << 24)
385#define S3C2400_GPC12_VD12 (0x02 << 24)
300 386
301#define S3C2410_GPC13 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 13) 387#define S3C2410_GPC13 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 13)
302#define S3C2410_GPC13_INP (0x00 << 26) 388#define S3C2410_GPC13_INP (0x00 << 26)
303#define S3C2410_GPC13_OUTP (0x01 << 26) 389#define S3C2410_GPC13_OUTP (0x01 << 26)
304#define S3C2410_GPC13_VD5 (0x02 << 26) 390#define S3C2410_GPC13_VD5 (0x02 << 26)
391#define S3C2400_GPC13_VD13 (0x02 << 26)
305 392
306#define S3C2410_GPC14 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 14) 393#define S3C2410_GPC14 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 14)
307#define S3C2410_GPC14_INP (0x00 << 28) 394#define S3C2410_GPC14_INP (0x00 << 28)
308#define S3C2410_GPC14_OUTP (0x01 << 28) 395#define S3C2410_GPC14_OUTP (0x01 << 28)
309#define S3C2410_GPC14_VD6 (0x02 << 28) 396#define S3C2410_GPC14_VD6 (0x02 << 28)
397#define S3C2400_GPC14_VD14 (0x02 << 28)
310 398
311#define S3C2410_GPC15 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 15) 399#define S3C2410_GPC15 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 15)
312#define S3C2410_GPC15_INP (0x00 << 30) 400#define S3C2410_GPC15_INP (0x00 << 30)
313#define S3C2410_GPC15_OUTP (0x01 << 30) 401#define S3C2410_GPC15_OUTP (0x01 << 30)
314#define S3C2410_GPC15_VD7 (0x02 << 30) 402#define S3C2410_GPC15_VD7 (0x02 << 30)
403#define S3C2400_GPC15_VD15 (0x02 << 30)
404
405#define S3C2410_GPC_PUPDIS(x) (1<<(x))
315 406
316/* Port D consists of 16 GPIO/Special function 407/*
408 * S3C2410: Port D consists of 16 GPIO/Special function
317 * 409 *
318 * almost identical setup to port b, but the special functions are mostly 410 * almost identical setup to port b, but the special functions are mostly
319 * to do with the video system's data. 411 * to do with the video system's data.
412 *
413 * S3C2400: Port D consists of 11 GPIO/Special function
414 *
415 * almost identical setup to port c
320*/ 416*/
321 417
322#define S3C2410_GPDCON S3C2410_GPIOREG(0x30) 418#define S3C2410_GPDCON S3C2410_GPIOREG(0x30)
323#define S3C2410_GPDDAT S3C2410_GPIOREG(0x34) 419#define S3C2410_GPDDAT S3C2410_GPIOREG(0x34)
324#define S3C2410_GPDUP S3C2410_GPIOREG(0x38) 420#define S3C2410_GPDUP S3C2410_GPIOREG(0x38)
325 421
422#define S3C2400_GPDCON S3C2410_GPIOREG(0x20)
423#define S3C2400_GPDDAT S3C2410_GPIOREG(0x24)
424#define S3C2400_GPDUP S3C2410_GPIOREG(0x28)
425
326#define S3C2410_GPD0 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 0) 426#define S3C2410_GPD0 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 0)
327#define S3C2410_GPD0_INP (0x00 << 0) 427#define S3C2410_GPD0_INP (0x00 << 0)
328#define S3C2410_GPD0_OUTP (0x01 << 0) 428#define S3C2410_GPD0_OUTP (0x01 << 0)
329#define S3C2410_GPD0_VD8 (0x02 << 0) 429#define S3C2410_GPD0_VD8 (0x02 << 0)
430#define S3C2400_GPD0_VFRAME (0x02 << 0)
330 431
331#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1) 432#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1)
332#define S3C2410_GPD1_INP (0x00 << 2) 433#define S3C2410_GPD1_INP (0x00 << 2)
333#define S3C2410_GPD1_OUTP (0x01 << 2) 434#define S3C2410_GPD1_OUTP (0x01 << 2)
334#define S3C2410_GPD1_VD9 (0x02 << 2) 435#define S3C2410_GPD1_VD9 (0x02 << 2)
436#define S3C2400_GPD1_VM (0x02 << 2)
335 437
336#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2) 438#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2)
337#define S3C2410_GPD2_INP (0x00 << 4) 439#define S3C2410_GPD2_INP (0x00 << 4)
338#define S3C2410_GPD2_OUTP (0x01 << 4) 440#define S3C2410_GPD2_OUTP (0x01 << 4)
339#define S3C2410_GPD2_VD10 (0x02 << 4) 441#define S3C2410_GPD2_VD10 (0x02 << 4)
442#define S3C2400_GPD2_VLINE (0x02 << 4)
340 443
341#define S3C2410_GPD3 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 3) 444#define S3C2410_GPD3 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 3)
342#define S3C2410_GPD3_INP (0x00 << 6) 445#define S3C2410_GPD3_INP (0x00 << 6)
343#define S3C2410_GPD3_OUTP (0x01 << 6) 446#define S3C2410_GPD3_OUTP (0x01 << 6)
344#define S3C2410_GPD3_VD11 (0x02 << 6) 447#define S3C2410_GPD3_VD11 (0x02 << 6)
448#define S3C2400_GPD3_VCLK (0x02 << 6)
345 449
346#define S3C2410_GPD4 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 4) 450#define S3C2410_GPD4 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 4)
347#define S3C2410_GPD4_INP (0x00 << 8) 451#define S3C2410_GPD4_INP (0x00 << 8)
348#define S3C2410_GPD4_OUTP (0x01 << 8) 452#define S3C2410_GPD4_OUTP (0x01 << 8)
349#define S3C2410_GPD4_VD12 (0x02 << 8) 453#define S3C2410_GPD4_VD12 (0x02 << 8)
454#define S3C2400_GPD4_LEND (0x02 << 8)
350 455
351#define S3C2410_GPD5 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 5) 456#define S3C2410_GPD5 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 5)
352#define S3C2410_GPD5_INP (0x00 << 10) 457#define S3C2410_GPD5_INP (0x00 << 10)
353#define S3C2410_GPD5_OUTP (0x01 << 10) 458#define S3C2410_GPD5_OUTP (0x01 << 10)
354#define S3C2410_GPD5_VD13 (0x02 << 10) 459#define S3C2410_GPD5_VD13 (0x02 << 10)
460#define S3C2400_GPD5_TOUT0 (0x02 << 10)
355 461
356#define S3C2410_GPD6 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 6) 462#define S3C2410_GPD6 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 6)
357#define S3C2410_GPD6_INP (0x00 << 12) 463#define S3C2410_GPD6_INP (0x00 << 12)
358#define S3C2410_GPD6_OUTP (0x01 << 12) 464#define S3C2410_GPD6_OUTP (0x01 << 12)
359#define S3C2410_GPD6_VD14 (0x02 << 12) 465#define S3C2410_GPD6_VD14 (0x02 << 12)
466#define S3C2400_GPD6_TOUT1 (0x02 << 12)
360 467
361#define S3C2410_GPD7 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 7) 468#define S3C2410_GPD7 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 7)
362#define S3C2410_GPD7_INP (0x00 << 14) 469#define S3C2410_GPD7_INP (0x00 << 14)
363#define S3C2410_GPD7_OUTP (0x01 << 14) 470#define S3C2410_GPD7_OUTP (0x01 << 14)
364#define S3C2410_GPD7_VD15 (0x02 << 14) 471#define S3C2410_GPD7_VD15 (0x02 << 14)
472#define S3C2400_GPD7_TOUT2 (0x02 << 14)
365 473
366#define S3C2410_GPD8 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 8) 474#define S3C2410_GPD8 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 8)
367#define S3C2410_GPD8_INP (0x00 << 16) 475#define S3C2410_GPD8_INP (0x00 << 16)
368#define S3C2410_GPD8_OUTP (0x01 << 16) 476#define S3C2410_GPD8_OUTP (0x01 << 16)
369#define S3C2410_GPD8_VD16 (0x02 << 16) 477#define S3C2410_GPD8_VD16 (0x02 << 16)
478#define S3C2400_GPD8_TOUT3 (0x02 << 16)
370 479
371#define S3C2410_GPD9 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 9) 480#define S3C2410_GPD9 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 9)
372#define S3C2410_GPD9_INP (0x00 << 18) 481#define S3C2410_GPD9_INP (0x00 << 18)
373#define S3C2410_GPD9_OUTP (0x01 << 18) 482#define S3C2410_GPD9_OUTP (0x01 << 18)
374#define S3C2410_GPD9_VD17 (0x02 << 18) 483#define S3C2410_GPD9_VD17 (0x02 << 18)
484#define S3C2400_GPD9_TCLK0 (0x02 << 18)
485#define S3C2410_GPD9_MASK (0x03 << 18)
375 486
376#define S3C2410_GPD10 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 10) 487#define S3C2410_GPD10 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 10)
377#define S3C2410_GPD10_INP (0x00 << 20) 488#define S3C2410_GPD10_INP (0x00 << 20)
378#define S3C2410_GPD10_OUTP (0x01 << 20) 489#define S3C2410_GPD10_OUTP (0x01 << 20)
379#define S3C2410_GPD10_VD18 (0x02 << 20) 490#define S3C2410_GPD10_VD18 (0x02 << 20)
491#define S3C2400_GPD10_nWAIT (0x02 << 20)
380 492
381#define S3C2410_GPD11 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 11) 493#define S3C2410_GPD11 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 11)
382#define S3C2410_GPD11_INP (0x00 << 22) 494#define S3C2410_GPD11_INP (0x00 << 22)
@@ -403,37 +515,56 @@
403#define S3C2410_GPD15_OUTP (0x01 << 30) 515#define S3C2410_GPD15_OUTP (0x01 << 30)
404#define S3C2410_GPD15_VD23 (0x02 << 30) 516#define S3C2410_GPD15_VD23 (0x02 << 30)
405 517
406/* Port E consists of 16 GPIO/Special function 518#define S3C2410_GPD_PUPDIS(x) (1<<(x))
519
520/* S3C2410:
521 * Port E consists of 16 GPIO/Special function
407 * 522 *
408 * again, the same as port B, but dealing with I2S, SDI, and 523 * again, the same as port B, but dealing with I2S, SDI, and
409 * more miscellaneous functions 524 * more miscellaneous functions
525 *
526 * S3C2400:
527 * Port E consists of 12 GPIO/Special function
528 *
529 * GPIO / interrupt inputs
410*/ 530*/
411 531
412#define S3C2410_GPECON S3C2410_GPIOREG(0x40) 532#define S3C2410_GPECON S3C2410_GPIOREG(0x40)
413#define S3C2410_GPEDAT S3C2410_GPIOREG(0x44) 533#define S3C2410_GPEDAT S3C2410_GPIOREG(0x44)
414#define S3C2410_GPEUP S3C2410_GPIOREG(0x48) 534#define S3C2410_GPEUP S3C2410_GPIOREG(0x48)
415 535
536#define S3C2400_GPECON S3C2410_GPIOREG(0x2C)
537#define S3C2400_GPEDAT S3C2410_GPIOREG(0x30)
538#define S3C2400_GPEUP S3C2410_GPIOREG(0x34)
539
416#define S3C2410_GPE0 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 0) 540#define S3C2410_GPE0 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 0)
417#define S3C2410_GPE0_INP (0x00 << 0) 541#define S3C2410_GPE0_INP (0x00 << 0)
418#define S3C2410_GPE0_OUTP (0x01 << 0) 542#define S3C2410_GPE0_OUTP (0x01 << 0)
419#define S3C2410_GPE0_I2SLRCK (0x02 << 0) 543#define S3C2410_GPE0_I2SLRCK (0x02 << 0)
544#define S3C2400_GPE0_EINT0 (0x02 << 0)
420#define S3C2410_GPE0_MASK (0x03 << 0) 545#define S3C2410_GPE0_MASK (0x03 << 0)
421 546
422#define S3C2410_GPE1 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 1) 547#define S3C2410_GPE1 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 1)
423#define S3C2410_GPE1_INP (0x00 << 2) 548#define S3C2410_GPE1_INP (0x00 << 2)
424#define S3C2410_GPE1_OUTP (0x01 << 2) 549#define S3C2410_GPE1_OUTP (0x01 << 2)
425#define S3C2410_GPE1_I2SSCLK (0x02 << 2) 550#define S3C2410_GPE1_I2SSCLK (0x02 << 2)
551#define S3C2400_GPE1_EINT1 (0x02 << 2)
552#define S3C2400_GPE1_nSS (0x03 << 2)
426#define S3C2410_GPE1_MASK (0x03 << 2) 553#define S3C2410_GPE1_MASK (0x03 << 2)
427 554
428#define S3C2410_GPE2 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 2) 555#define S3C2410_GPE2 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 2)
429#define S3C2410_GPE2_INP (0x00 << 4) 556#define S3C2410_GPE2_INP (0x00 << 4)
430#define S3C2410_GPE2_OUTP (0x01 << 4) 557#define S3C2410_GPE2_OUTP (0x01 << 4)
431#define S3C2410_GPE2_CDCLK (0x02 << 4) 558#define S3C2410_GPE2_CDCLK (0x02 << 4)
559#define S3C2400_GPE2_EINT2 (0x02 << 4)
560#define S3C2400_GPE2_I2SSDI (0x03 << 4)
432 561
433#define S3C2410_GPE3 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 3) 562#define S3C2410_GPE3 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 3)
434#define S3C2410_GPE3_INP (0x00 << 6) 563#define S3C2410_GPE3_INP (0x00 << 6)
435#define S3C2410_GPE3_OUTP (0x01 << 6) 564#define S3C2410_GPE3_OUTP (0x01 << 6)
436#define S3C2410_GPE3_I2SSDI (0x02 << 6) 565#define S3C2410_GPE3_I2SSDI (0x02 << 6)
566#define S3C2400_GPE3_EINT3 (0x02 << 6)
567#define S3C2400_GPE3_nCTS1 (0x03 << 6)
437#define S3C2410_GPE3_nSS0 (0x03 << 6) 568#define S3C2410_GPE3_nSS0 (0x03 << 6)
438#define S3C2410_GPE3_MASK (0x03 << 6) 569#define S3C2410_GPE3_MASK (0x03 << 6)
439 570
@@ -441,6 +572,8 @@
441#define S3C2410_GPE4_INP (0x00 << 8) 572#define S3C2410_GPE4_INP (0x00 << 8)
442#define S3C2410_GPE4_OUTP (0x01 << 8) 573#define S3C2410_GPE4_OUTP (0x01 << 8)
443#define S3C2410_GPE4_I2SSDO (0x02 << 8) 574#define S3C2410_GPE4_I2SSDO (0x02 << 8)
575#define S3C2400_GPE4_EINT4 (0x02 << 8)
576#define S3C2400_GPE4_nRTS1 (0x03 << 8)
444#define S3C2410_GPE4_I2SSDI (0x03 << 8) 577#define S3C2410_GPE4_I2SSDI (0x03 << 8)
445#define S3C2410_GPE4_MASK (0x03 << 8) 578#define S3C2410_GPE4_MASK (0x03 << 8)
446 579
@@ -448,36 +581,46 @@
448#define S3C2410_GPE5_INP (0x00 << 10) 581#define S3C2410_GPE5_INP (0x00 << 10)
449#define S3C2410_GPE5_OUTP (0x01 << 10) 582#define S3C2410_GPE5_OUTP (0x01 << 10)
450#define S3C2410_GPE5_SDCLK (0x02 << 10) 583#define S3C2410_GPE5_SDCLK (0x02 << 10)
584#define S3C2400_GPE5_EINT5 (0x02 << 10)
585#define S3C2400_GPE5_TCLK1 (0x03 << 10)
451 586
452#define S3C2410_GPE6 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 6) 587#define S3C2410_GPE6 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 6)
453#define S3C2410_GPE6_INP (0x00 << 12) 588#define S3C2410_GPE6_INP (0x00 << 12)
454#define S3C2410_GPE6_OUTP (0x01 << 12) 589#define S3C2410_GPE6_OUTP (0x01 << 12)
455#define S3C2410_GPE6_SDCMD (0x02 << 12) 590#define S3C2410_GPE6_SDCMD (0x02 << 12)
591#define S3C2400_GPE6_EINT6 (0x02 << 12)
456 592
457#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7) 593#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7)
458#define S3C2410_GPE7_INP (0x00 << 14) 594#define S3C2410_GPE7_INP (0x00 << 14)
459#define S3C2410_GPE7_OUTP (0x01 << 14) 595#define S3C2410_GPE7_OUTP (0x01 << 14)
460#define S3C2410_GPE7_SDDAT0 (0x02 << 14) 596#define S3C2410_GPE7_SDDAT0 (0x02 << 14)
597#define S3C2400_GPE7_EINT7 (0x02 << 14)
461 598
462#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8) 599#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8)
463#define S3C2410_GPE8_INP (0x00 << 16) 600#define S3C2410_GPE8_INP (0x00 << 16)
464#define S3C2410_GPE8_OUTP (0x01 << 16) 601#define S3C2410_GPE8_OUTP (0x01 << 16)
465#define S3C2410_GPE8_SDDAT1 (0x02 << 16) 602#define S3C2410_GPE8_SDDAT1 (0x02 << 16)
603#define S3C2400_GPE8_nXDACK0 (0x02 << 16)
466 604
467#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9) 605#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9)
468#define S3C2410_GPE9_INP (0x00 << 18) 606#define S3C2410_GPE9_INP (0x00 << 18)
469#define S3C2410_GPE9_OUTP (0x01 << 18) 607#define S3C2410_GPE9_OUTP (0x01 << 18)
470#define S3C2410_GPE9_SDDAT2 (0x02 << 18) 608#define S3C2410_GPE9_SDDAT2 (0x02 << 18)
609#define S3C2400_GPE9_nXDACK1 (0x02 << 18)
610#define S3C2400_GPE9_nXBACK (0x03 << 18)
471 611
472#define S3C2410_GPE10 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 10) 612#define S3C2410_GPE10 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 10)
473#define S3C2410_GPE10_INP (0x00 << 20) 613#define S3C2410_GPE10_INP (0x00 << 20)
474#define S3C2410_GPE10_OUTP (0x01 << 20) 614#define S3C2410_GPE10_OUTP (0x01 << 20)
475#define S3C2410_GPE10_SDDAT3 (0x02 << 20) 615#define S3C2410_GPE10_SDDAT3 (0x02 << 20)
616#define S3C2400_GPE10_nXDREQ0 (0x02 << 20)
476 617
477#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11) 618#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11)
478#define S3C2410_GPE11_INP (0x00 << 22) 619#define S3C2410_GPE11_INP (0x00 << 22)
479#define S3C2410_GPE11_OUTP (0x01 << 22) 620#define S3C2410_GPE11_OUTP (0x01 << 22)
480#define S3C2410_GPE11_SPIMISO0 (0x02 << 22) 621#define S3C2410_GPE11_SPIMISO0 (0x02 << 22)
622#define S3C2400_GPE11_nXDREQ1 (0x02 << 22)
623#define S3C2400_GPE11_nXBREQ (0x03 << 22)
481 624
482#define S3C2410_GPE12 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 12) 625#define S3C2410_GPE12 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 12)
483#define S3C2410_GPE12_INP (0x00 << 24) 626#define S3C2410_GPE12_INP (0x00 << 24)
@@ -509,7 +652,8 @@
509 652
510#define S3C2410_GPE_PUPDIS(x) (1<<(x)) 653#define S3C2410_GPE_PUPDIS(x) (1<<(x))
511 654
512/* Port F consists of 8 GPIO/Special function 655/* S3C2410:
656 * Port F consists of 8 GPIO/Special function
513 * 657 *
514 * GPIO / interrupt inputs 658 * GPIO / interrupt inputs
515 * 659 *
@@ -517,100 +661,141 @@
517 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined 661 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined
518 * 662 *
519 * pull up works like all other ports. 663 * pull up works like all other ports.
664 *
665 * S3C2400:
666 * Port F consists of 7 GPIO/Special function
667 *
668 * GPIO/serial/misc pins
520*/ 669*/
521 670
522#define S3C2410_GPFCON S3C2410_GPIOREG(0x50) 671#define S3C2410_GPFCON S3C2410_GPIOREG(0x50)
523#define S3C2410_GPFDAT S3C2410_GPIOREG(0x54) 672#define S3C2410_GPFDAT S3C2410_GPIOREG(0x54)
524#define S3C2410_GPFUP S3C2410_GPIOREG(0x58) 673#define S3C2410_GPFUP S3C2410_GPIOREG(0x58)
525 674
675#define S3C2400_GPFCON S3C2410_GPIOREG(0x38)
676#define S3C2400_GPFDAT S3C2410_GPIOREG(0x3C)
677#define S3C2400_GPFUP S3C2410_GPIOREG(0x40)
678
526#define S3C2410_GPF0 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 0) 679#define S3C2410_GPF0 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 0)
527#define S3C2410_GPF0_INP (0x00 << 0) 680#define S3C2410_GPF0_INP (0x00 << 0)
528#define S3C2410_GPF0_OUTP (0x01 << 0) 681#define S3C2410_GPF0_OUTP (0x01 << 0)
529#define S3C2410_GPF0_EINT0 (0x02 << 0) 682#define S3C2410_GPF0_EINT0 (0x02 << 0)
683#define S3C2400_GPF0_RXD0 (0x02 << 0)
530 684
531#define S3C2410_GPF1 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 1) 685#define S3C2410_GPF1 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 1)
532#define S3C2410_GPF1_INP (0x00 << 2) 686#define S3C2410_GPF1_INP (0x00 << 2)
533#define S3C2410_GPF1_OUTP (0x01 << 2) 687#define S3C2410_GPF1_OUTP (0x01 << 2)
534#define S3C2410_GPF1_EINT1 (0x02 << 2) 688#define S3C2410_GPF1_EINT1 (0x02 << 2)
689#define S3C2400_GPF1_RXD1 (0x02 << 2)
690#define S3C2400_GPF1_IICSDA (0x03 << 2)
535 691
536#define S3C2410_GPF2 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 2) 692#define S3C2410_GPF2 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 2)
537#define S3C2410_GPF2_INP (0x00 << 4) 693#define S3C2410_GPF2_INP (0x00 << 4)
538#define S3C2410_GPF2_OUTP (0x01 << 4) 694#define S3C2410_GPF2_OUTP (0x01 << 4)
539#define S3C2410_GPF2_EINT2 (0x02 << 4) 695#define S3C2410_GPF2_EINT2 (0x02 << 4)
696#define S3C2400_GPF2_TXD0 (0x02 << 4)
540 697
541#define S3C2410_GPF3 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 3) 698#define S3C2410_GPF3 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 3)
542#define S3C2410_GPF3_INP (0x00 << 6) 699#define S3C2410_GPF3_INP (0x00 << 6)
543#define S3C2410_GPF3_OUTP (0x01 << 6) 700#define S3C2410_GPF3_OUTP (0x01 << 6)
544#define S3C2410_GPF3_EINT3 (0x02 << 6) 701#define S3C2410_GPF3_EINT3 (0x02 << 6)
702#define S3C2400_GPF3_TXD1 (0x02 << 6)
703#define S3C2400_GPF3_IICSCL (0x03 << 6)
545 704
546#define S3C2410_GPF4 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 4) 705#define S3C2410_GPF4 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 4)
547#define S3C2410_GPF4_INP (0x00 << 8) 706#define S3C2410_GPF4_INP (0x00 << 8)
548#define S3C2410_GPF4_OUTP (0x01 << 8) 707#define S3C2410_GPF4_OUTP (0x01 << 8)
549#define S3C2410_GPF4_EINT4 (0x02 << 8) 708#define S3C2410_GPF4_EINT4 (0x02 << 8)
709#define S3C2400_GPF4_nRTS0 (0x02 << 8)
710#define S3C2400_GPF4_nXBACK (0x03 << 8)
550 711
551#define S3C2410_GPF5 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 5) 712#define S3C2410_GPF5 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 5)
552#define S3C2410_GPF5_INP (0x00 << 10) 713#define S3C2410_GPF5_INP (0x00 << 10)
553#define S3C2410_GPF5_OUTP (0x01 << 10) 714#define S3C2410_GPF5_OUTP (0x01 << 10)
554#define S3C2410_GPF5_EINT5 (0x02 << 10) 715#define S3C2410_GPF5_EINT5 (0x02 << 10)
716#define S3C2400_GPF5_nCTS0 (0x02 << 10)
717#define S3C2400_GPF5_nXBREQ (0x03 << 10)
555 718
556#define S3C2410_GPF6 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 6) 719#define S3C2410_GPF6 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 6)
557#define S3C2410_GPF6_INP (0x00 << 12) 720#define S3C2410_GPF6_INP (0x00 << 12)
558#define S3C2410_GPF6_OUTP (0x01 << 12) 721#define S3C2410_GPF6_OUTP (0x01 << 12)
559#define S3C2410_GPF6_EINT6 (0x02 << 12) 722#define S3C2410_GPF6_EINT6 (0x02 << 12)
723#define S3C2400_GPF6_CLKOUT (0x02 << 12)
560 724
561#define S3C2410_GPF7 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 7) 725#define S3C2410_GPF7 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 7)
562#define S3C2410_GPF7_INP (0x00 << 14) 726#define S3C2410_GPF7_INP (0x00 << 14)
563#define S3C2410_GPF7_OUTP (0x01 << 14) 727#define S3C2410_GPF7_OUTP (0x01 << 14)
564#define S3C2410_GPF7_EINT7 (0x02 << 14) 728#define S3C2410_GPF7_EINT7 (0x02 << 14)
565 729
566/* Port G consists of 8 GPIO/IRQ/Special function 730#define S3C2410_GPF_PUPDIS(x) (1<<(x))
731
732/* S3C2410:
733 * Port G consists of 8 GPIO/IRQ/Special function
567 * 734 *
568 * GPGCON has 2 bits for each of the input pins on port F 735 * GPGCON has 2 bits for each of the input pins on port F
569 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func 736 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
570 * 737 *
571 * pull up works like all other ports. 738 * pull up works like all other ports.
739 *
740 * S3C2400:
741 * Port G consists of 10 GPIO/Special function
572*/ 742*/
573 743
574#define S3C2410_GPGCON S3C2410_GPIOREG(0x60) 744#define S3C2410_GPGCON S3C2410_GPIOREG(0x60)
575#define S3C2410_GPGDAT S3C2410_GPIOREG(0x64) 745#define S3C2410_GPGDAT S3C2410_GPIOREG(0x64)
576#define S3C2410_GPGUP S3C2410_GPIOREG(0x68) 746#define S3C2410_GPGUP S3C2410_GPIOREG(0x68)
577 747
748#define S3C2400_GPGCON S3C2410_GPIOREG(0x44)
749#define S3C2400_GPGDAT S3C2410_GPIOREG(0x48)
750#define S3C2400_GPGUP S3C2410_GPIOREG(0x4C)
751
578#define S3C2410_GPG0 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 0) 752#define S3C2410_GPG0 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 0)
579#define S3C2410_GPG0_INP (0x00 << 0) 753#define S3C2410_GPG0_INP (0x00 << 0)
580#define S3C2410_GPG0_OUTP (0x01 << 0) 754#define S3C2410_GPG0_OUTP (0x01 << 0)
581#define S3C2410_GPG0_EINT8 (0x02 << 0) 755#define S3C2410_GPG0_EINT8 (0x02 << 0)
756#define S3C2400_GPG0_I2SLRCK (0x02 << 0)
582 757
583#define S3C2410_GPG1 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 1) 758#define S3C2410_GPG1 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 1)
584#define S3C2410_GPG1_INP (0x00 << 2) 759#define S3C2410_GPG1_INP (0x00 << 2)
585#define S3C2410_GPG1_OUTP (0x01 << 2) 760#define S3C2410_GPG1_OUTP (0x01 << 2)
586#define S3C2410_GPG1_EINT9 (0x02 << 2) 761#define S3C2410_GPG1_EINT9 (0x02 << 2)
762#define S3C2400_GPG1_I2SSCLK (0x02 << 2)
587 763
588#define S3C2410_GPG2 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 2) 764#define S3C2410_GPG2 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 2)
589#define S3C2410_GPG2_INP (0x00 << 4) 765#define S3C2410_GPG2_INP (0x00 << 4)
590#define S3C2410_GPG2_OUTP (0x01 << 4) 766#define S3C2410_GPG2_OUTP (0x01 << 4)
591#define S3C2410_GPG2_EINT10 (0x02 << 4) 767#define S3C2410_GPG2_EINT10 (0x02 << 4)
768#define S3C2400_GPG2_CDCLK (0x02 << 4)
592 769
593#define S3C2410_GPG3 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 3) 770#define S3C2410_GPG3 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 3)
594#define S3C2410_GPG3_INP (0x00 << 6) 771#define S3C2410_GPG3_INP (0x00 << 6)
595#define S3C2410_GPG3_OUTP (0x01 << 6) 772#define S3C2410_GPG3_OUTP (0x01 << 6)
596#define S3C2410_GPG3_EINT11 (0x02 << 6) 773#define S3C2410_GPG3_EINT11 (0x02 << 6)
774#define S3C2400_GPG3_I2SSDO (0x02 << 6)
775#define S3C2400_GPG3_I2SSDI (0x03 << 6)
597 776
598#define S3C2410_GPG4 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 4) 777#define S3C2410_GPG4 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 4)
599#define S3C2410_GPG4_INP (0x00 << 8) 778#define S3C2410_GPG4_INP (0x00 << 8)
600#define S3C2410_GPG4_OUTP (0x01 << 8) 779#define S3C2410_GPG4_OUTP (0x01 << 8)
601#define S3C2410_GPG4_EINT12 (0x02 << 8) 780#define S3C2410_GPG4_EINT12 (0x02 << 8)
781#define S3C2400_GPG4_MMCCLK (0x02 << 8)
782#define S3C2400_GPG4_I2SSDI (0x03 << 8)
602#define S3C2410_GPG4_LCDPWREN (0x03 << 8) 783#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
603 784
604#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5) 785#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5)
605#define S3C2410_GPG5_INP (0x00 << 10) 786#define S3C2410_GPG5_INP (0x00 << 10)
606#define S3C2410_GPG5_OUTP (0x01 << 10) 787#define S3C2410_GPG5_OUTP (0x01 << 10)
607#define S3C2410_GPG5_EINT13 (0x02 << 10) 788#define S3C2410_GPG5_EINT13 (0x02 << 10)
789#define S3C2400_GPG5_MMCCMD (0x02 << 10)
790#define S3C2400_GPG5_IICSDA (0x03 << 10)
608#define S3C2410_GPG5_SPIMISO1 (0x03 << 10) 791#define S3C2410_GPG5_SPIMISO1 (0x03 << 10)
609 792
610#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6) 793#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6)
611#define S3C2410_GPG6_INP (0x00 << 12) 794#define S3C2410_GPG6_INP (0x00 << 12)
612#define S3C2410_GPG6_OUTP (0x01 << 12) 795#define S3C2410_GPG6_OUTP (0x01 << 12)
613#define S3C2410_GPG6_EINT14 (0x02 << 12) 796#define S3C2410_GPG6_EINT14 (0x02 << 12)
797#define S3C2400_GPG6_MMCDAT (0x02 << 12)
798#define S3C2400_GPG6_IICSCL (0x03 << 12)
614#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12) 799#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12)
615 800
616#define S3C2410_GPG7 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 7) 801#define S3C2410_GPG7 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 7)
@@ -618,16 +803,22 @@
618#define S3C2410_GPG7_OUTP (0x01 << 14) 803#define S3C2410_GPG7_OUTP (0x01 << 14)
619#define S3C2410_GPG7_EINT15 (0x02 << 14) 804#define S3C2410_GPG7_EINT15 (0x02 << 14)
620#define S3C2410_GPG7_SPICLK1 (0x03 << 14) 805#define S3C2410_GPG7_SPICLK1 (0x03 << 14)
806#define S3C2400_GPG7_SPIMISO (0x02 << 14)
807#define S3C2400_GPG7_IICSDA (0x03 << 14)
621 808
622#define S3C2410_GPG8 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 8) 809#define S3C2410_GPG8 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 8)
623#define S3C2410_GPG8_INP (0x00 << 16) 810#define S3C2410_GPG8_INP (0x00 << 16)
624#define S3C2410_GPG8_OUTP (0x01 << 16) 811#define S3C2410_GPG8_OUTP (0x01 << 16)
625#define S3C2410_GPG8_EINT16 (0x02 << 16) 812#define S3C2410_GPG8_EINT16 (0x02 << 16)
813#define S3C2400_GPG8_SPIMOSI (0x02 << 16)
814#define S3C2400_GPG8_IICSCL (0x03 << 16)
626 815
627#define S3C2410_GPG9 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 9) 816#define S3C2410_GPG9 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 9)
628#define S3C2410_GPG9_INP (0x00 << 18) 817#define S3C2410_GPG9_INP (0x00 << 18)
629#define S3C2410_GPG9_OUTP (0x01 << 18) 818#define S3C2410_GPG9_OUTP (0x01 << 18)
630#define S3C2410_GPG9_EINT17 (0x02 << 18) 819#define S3C2410_GPG9_EINT17 (0x02 << 18)
820#define S3C2400_GPG9_SPICLK (0x02 << 18)
821#define S3C2400_GPG9_MMCCLK (0x03 << 18)
631 822
632#define S3C2410_GPG10 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 10) 823#define S3C2410_GPG10 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 10)
633#define S3C2410_GPG10_INP (0x00 << 20) 824#define S3C2410_GPG10_INP (0x00 << 20)
@@ -737,19 +928,27 @@
737#define S3C2410_GPH10_CLKOUT1 (0x02 << 20) 928#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
738 929
739/* miscellaneous control */ 930/* miscellaneous control */
740 931#define S3C2400_MISCCR S3C2410_GPIOREG(0x54)
741#define S3C2410_MISCCR S3C2410_GPIOREG(0x80) 932#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
742#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84) 933#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
743 934
744/* see clock.h for dclk definitions */ 935/* see clock.h for dclk definitions */
745 936
746/* pullup control on databus */ 937/* pullup control on databus */
747#define S3C2410_MISCCR_SPUCR_HEN (0) 938#define S3C2410_MISCCR_SPUCR_HEN (0<<0)
748#define S3C2410_MISCCR_SPUCR_HDIS (1<<0) 939#define S3C2410_MISCCR_SPUCR_HDIS (1<<0)
749#define S3C2410_MISCCR_SPUCR_LEN (0) 940#define S3C2410_MISCCR_SPUCR_LEN (0<<1)
750#define S3C2410_MISCCR_SPUCR_LDIS (1<<1) 941#define S3C2410_MISCCR_SPUCR_LDIS (1<<1)
751 942
752#define S3C2410_MISCCR_USBDEV (0) 943#define S3C2400_MISCCR_SPUCR_LEN (0<<0)
944#define S3C2400_MISCCR_SPUCR_LDIS (1<<0)
945#define S3C2400_MISCCR_SPUCR_HEN (0<<1)
946#define S3C2400_MISCCR_SPUCR_HDIS (1<<1)
947
948#define S3C2400_MISCCR_HZ_STOPEN (0<<2)
949#define S3C2400_MISCCR_HZ_STOPPREV (1<<2)
950
951#define S3C2410_MISCCR_USBDEV (0<<3)
753#define S3C2410_MISCCR_USBHOST (1<<3) 952#define S3C2410_MISCCR_USBHOST (1<<3)
754 953
755#define S3C2410_MISCCR_CLK0_MPLL (0<<4) 954#define S3C2410_MISCCR_CLK0_MPLL (0<<4)
@@ -785,7 +984,7 @@
785 * 984 *
786 * Samsung datasheet p9-25 985 * Samsung datasheet p9-25
787*/ 986*/
788 987#define S3C2400_EXTINT0 S3C2410_GPIOREG(0x58)
789#define S3C2410_EXTINT0 S3C2410_GPIOREG(0x88) 988#define S3C2410_EXTINT0 S3C2410_GPIOREG(0x88)
790#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C) 989#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
791#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90) 990#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
@@ -833,5 +1032,21 @@
833#define S3C2410_GSTATUS2_OFFRESET (1<<1) 1032#define S3C2410_GSTATUS2_OFFRESET (1<<1)
834#define S3C2410_GSTATUS2_PONRESET (1<<0) 1033#define S3C2410_GSTATUS2_PONRESET (1<<0)
835 1034
1035/* open drain control register */
1036#define S3C2400_OPENCR S3C2410_GPIOREG(0x50)
1037
1038#define S3C2400_OPENCR_OPC_RXD1DIS (0<<0)
1039#define S3C2400_OPENCR_OPC_RXD1EN (1<<0)
1040#define S3C2400_OPENCR_OPC_TXD1DIS (0<<1)
1041#define S3C2400_OPENCR_OPC_TXD1EN (1<<1)
1042#define S3C2400_OPENCR_OPC_CMDDIS (0<<2)
1043#define S3C2400_OPENCR_OPC_CMDEN (1<<2)
1044#define S3C2400_OPENCR_OPC_DATDIS (0<<3)
1045#define S3C2400_OPENCR_OPC_DATEN (1<<3)
1046#define S3C2400_OPENCR_OPC_MISODIS (0<<4)
1047#define S3C2400_OPENCR_OPC_MISOEN (1<<4)
1048#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5)
1049#define S3C2400_OPENCR_OPC_MOSIEN (1<<5)
1050
836#endif /* __ASM_ARCH_REGS_GPIO_H */ 1051#endif /* __ASM_ARCH_REGS_GPIO_H */
837 1052
diff --git a/include/asm-arm/arch-sa1100/io.h b/include/asm-arm/arch-sa1100/io.h
index 9d4fe6cf205b..040ccde7a11e 100644
--- a/include/asm-arm/arch-sa1100/io.h
+++ b/include/asm-arm/arch-sa1100/io.h
@@ -10,8 +10,6 @@
10#ifndef __ASM_ARM_ARCH_IO_H 10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H 11#define __ASM_ARM_ARCH_IO_H
12 12
13#include <asm/hardware.h>
14
15#define IO_SPACE_LIMIT 0xffffffff 13#define IO_SPACE_LIMIT 0xffffffff
16 14
17/* 15/*
diff --git a/include/asm-arm/numnodes.h b/include/asm-arm/numnodes.h
index 5d2a1034a02e..8df36818ebc9 100644
--- a/include/asm-arm/numnodes.h
+++ b/include/asm-arm/numnodes.h
@@ -17,6 +17,8 @@
17#ifndef __ASM_ARM_NUMNODES_H 17#ifndef __ASM_ARM_NUMNODES_H
18#define __ASM_ARM_NUMNODES_H 18#define __ASM_ARM_NUMNODES_H
19 19
20#include <asm/memory.h>
21
20#ifndef NODES_SHIFT 22#ifndef NODES_SHIFT
21# define NODES_SHIFT 2 /* Normally, Max 4 Nodes */ 23# define NODES_SHIFT 2 /* Normally, Max 4 Nodes */
22#endif 24#endif
diff --git a/include/asm-frv/hardirq.h b/include/asm-frv/hardirq.h
index 5248ca054909..685123981e8b 100644
--- a/include/asm-frv/hardirq.h
+++ b/include/asm-frv/hardirq.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/threads.h> 16#include <linux/threads.h>
17#include <linux/irq.h>
17 18
18typedef struct { 19typedef struct {
19 unsigned int __softirq_pending; 20 unsigned int __softirq_pending;
diff --git a/include/asm-frv/ide.h b/include/asm-frv/ide.h
index f9caecf7e3c0..ae031eaa3dd2 100644
--- a/include/asm-frv/ide.h
+++ b/include/asm-frv/ide.h
@@ -33,10 +33,10 @@
33/* 33/*
34 * some bits needed for parts of the IDE subsystem to compile 34 * some bits needed for parts of the IDE subsystem to compile
35 */ 35 */
36#define __ide_mm_insw(port, addr, n) insw(port, addr, n) 36#define __ide_mm_insw(port, addr, n) insw((unsigned long) (port), addr, n)
37#define __ide_mm_insl(port, addr, n) insl(port, addr, n) 37#define __ide_mm_insl(port, addr, n) insl((unsigned long) (port), addr, n)
38#define __ide_mm_outsw(port, addr, n) outsw(port, addr, n) 38#define __ide_mm_outsw(port, addr, n) outsw((unsigned long) (port), addr, n)
39#define __ide_mm_outsl(port, addr, n) outsl(port, addr, n) 39#define __ide_mm_outsl(port, addr, n) outsl((unsigned long) (port), addr, n)
40 40
41 41
42#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index 4feba567e7fd..b8221b611b5c 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -47,8 +47,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
47 47
48#define devmem_is_allowed(pfn) 1 48#define devmem_is_allowed(pfn) 1
49 49
50#define __pa(vaddr) virt_to_phys((void *) vaddr) 50#define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr))
51#define __va(paddr) phys_to_virt((unsigned long) paddr) 51#define __va(paddr) phys_to_virt((unsigned long) (paddr))
52 52
53#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 53#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
54 54
diff --git a/include/asm-frv/semaphore.h b/include/asm-frv/semaphore.h
index b18396288df1..907c5c3643cc 100644
--- a/include/asm-frv/semaphore.h
+++ b/include/asm-frv/semaphore.h
@@ -20,7 +20,7 @@
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/rwsem.h> 21#include <linux/rwsem.h>
22 22
23#define SEMAPHORE_DEBUG WAITQUEUE_DEBUG 23#define SEMAPHORE_DEBUG 0
24 24
25/* 25/*
26 * the semaphore definition 26 * the semaphore definition
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h
index c8cba7836f0d..60f6b2aee76d 100644
--- a/include/asm-frv/thread_info.h
+++ b/include/asm-frv/thread_info.h
@@ -58,7 +58,7 @@ struct thread_info {
58 58
59#endif 59#endif
60 60
61#define PREEMPT_ACTIVE 0x4000000 61#define PREEMPT_ACTIVE 0x10000000
62 62
63/* 63/*
64 * macros/functions for gaining access to the thread information structure 64 * macros/functions for gaining access to the thread information structure
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 3f7564dc0aa9..2a8b0d92a5d6 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -56,6 +56,7 @@
56#define SN_SAL_BUS_CONFIG 0x02000037 56#define SN_SAL_BUS_CONFIG 0x02000037
57#define SN_SAL_SYS_SERIAL_GET 0x02000038 57#define SN_SAL_SYS_SERIAL_GET 0x02000038
58#define SN_SAL_PARTITION_SERIAL_GET 0x02000039 58#define SN_SAL_PARTITION_SERIAL_GET 0x02000039
59#define SN_SAL_SYSCTL_PARTITION_GET 0x0200003a
59#define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b 60#define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b
60#define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c 61#define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c
61#define SN_SAL_COHERENCE 0x0200003d 62#define SN_SAL_COHERENCE 0x0200003d
@@ -581,6 +582,21 @@ sn_partition_serial_number_val(void) {
581} 582}
582 583
583/* 584/*
585 * Returns the partition id of the nasid passed in as an argument,
586 * or INVALID_PARTID if the partition id cannot be retrieved.
587 */
588static inline partid_t
589ia64_sn_sysctl_partition_get(nasid_t nasid)
590{
591 struct ia64_sal_retval ret_stuff;
592 SAL_CALL(ret_stuff, SN_SAL_SYSCTL_PARTITION_GET, nasid,
593 0, 0, 0, 0, 0, 0);
594 if (ret_stuff.status != 0)
595 return -1;
596 return ((partid_t)ret_stuff.v0);
597}
598
599/*
584 * Returns the physical address of the partition's reserved page through 600 * Returns the physical address of the partition's reserved page through
585 * an iterative number of calls. 601 * an iterative number of calls.
586 * 602 *
@@ -1018,6 +1034,24 @@ ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift,
1018 ret_stuff.v2 = 0; 1034 ret_stuff.v2 = 0;
1019 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0); 1035 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0);
1020 1036
1037/***** BEGIN HACK - temp til old proms no longer supported ********/
1038 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
1039 int nasid = get_sapicid() & 0xfff;;
1040#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL
1041#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48
1042 if (shubtype) *shubtype = 0;
1043 if (nasid_bitmask) *nasid_bitmask = 0x7ff;
1044 if (nasid_shift) *nasid_shift = 38;
1045 if (systemsize) *systemsize = 10;
1046 if (sharing_domain_size) *sharing_domain_size = 8;
1047 if (partid) *partid = ia64_sn_sysctl_partition_get(nasid);
1048 if (coher) *coher = nasid >> 9;
1049 if (reg) *reg = (HUB_L((u64 *) LOCAL_MMR_ADDR(SH1_SHUB_ID)) & SH_SHUB_ID_NODES_PER_BIT_MASK) >>
1050 SH_SHUB_ID_NODES_PER_BIT_SHFT;
1051 return 0;
1052 }
1053/***** END HACK *******/
1054
1021 if (ret_stuff.status < 0) 1055 if (ret_stuff.status < 0)
1022 return ret_stuff.status; 1056 return ret_stuff.status;
1023 1057
diff --git a/include/asm-ia64/sn/tioce.h b/include/asm-ia64/sn/tioce.h
index 22879853e46c..ecaddf960086 100644
--- a/include/asm-ia64/sn/tioce.h
+++ b/include/asm-ia64/sn/tioce.h
@@ -1,22 +1,10 @@
1/************************************************************************** 1/*
2 * * 2 * This file is subject to the terms and conditions of the GNU General Public
3 * Unpublished copyright (c) 2005, Silicon Graphics, Inc. * 3 * License. See the file "COPYING" in the main directory of this archive
4 * THIS IS UNPUBLISHED CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF SGI. * 4 * for more details.
5 * * 5 *
6 * The copyright notice above does not evidence any actual or intended * 6 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All rights reserved.
7 * publication or disclosure of this source code, which includes * 7 */
8 * information that is confidential and/or proprietary, and is a trade *
9 * secret, of Silicon Graphics, Inc. ANY REPRODUCTION, MODIFICATION, *
10 * DISTRIBUTION, PUBLIC PERFORMANCE, OR PUBLIC DISPLAY OF OR THROUGH *
11 * USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF *
12 * SILICON GRAPHICS, INC. IS STRICTLY PROHIBITED, AND IN VIOLATION OF *
13 * APPLICABLE LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR *
14 * POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT *
15 * CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS *
16 * CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY *
17 * DESCRIBE, IN WHOLE OR IN PART. *
18 * *
19 **************************************************************************/
20 8
21#ifndef __ASM_IA64_SN_TIOCE_H__ 9#ifndef __ASM_IA64_SN_TIOCE_H__
22#define __ASM_IA64_SN_TIOCE_H__ 10#define __ASM_IA64_SN_TIOCE_H__
diff --git a/include/asm-ia64/sn/tioce_provider.h b/include/asm-ia64/sn/tioce_provider.h
index 7f63dec0a79a..cb414908671d 100644
--- a/include/asm-ia64/sn/tioce_provider.h
+++ b/include/asm-ia64/sn/tioce_provider.h
@@ -1,13 +1,10 @@
1/************************************************************************** 1/*
2 * Copyright (C) 2005, Silicon Graphics, Inc. * 2 * This file is subject to the terms and conditions of the GNU General Public
3 * * 3 * License. See the file "COPYING" in the main directory of this archive
4 * These coded instructions, statements, and computer programs contain * 4 * for more details.
5 * unpublished proprietary information of Silicon Graphics, Inc., and * 5 *
6 * are protected by Federal copyright law. They may not be disclosed * 6 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All rights reserved.
7 * to third parties or copied or duplicated in any form, in whole or * 7 */
8 * in part, without the prior written consent of Silicon Graphics, Inc. *
9 * *
10 **************************************************************************/
11 8
12#ifndef _ASM_IA64_SN_CE_PROVIDER_H 9#ifndef _ASM_IA64_SN_CE_PROVIDER_H
13#define _ASM_IA64_SN_CE_PROVIDER_H 10#define _ASM_IA64_SN_CE_PROVIDER_H
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h
index bfff69a49936..ef1fb8ea4726 100644
--- a/include/asm-m32r/atomic.h
+++ b/include/asm-m32r/atomic.h
@@ -242,6 +242,27 @@ static __inline__ int atomic_dec_return(atomic_t *v)
242 */ 242 */
243#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0) 243#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0)
244 244
245#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
246
247/**
248 * atomic_add_unless - add unless the number is a given value
249 * @v: pointer of type atomic_t
250 * @a: the amount to add to v...
251 * @u: ...unless v is equal to u.
252 *
253 * Atomically adds @a to @v, so long as it was not @u.
254 * Returns non-zero if @v was not @u, and zero otherwise.
255 */
256#define atomic_add_unless(v, a, u) \
257({ \
258 int c, old; \
259 c = atomic_read(v); \
260 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
261 c = old; \
262 c != (u); \
263})
264#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
265
245static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr) 266static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr)
246{ 267{
247 unsigned long flags; 268 unsigned long flags;
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index 194393bd8beb..f7aa96970d18 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -25,18 +25,21 @@
25# endif 25# endif
26#endif 26#endif
27 27
28#if defined(CONFIG_PLAT_M32700UT) 28#include <asm/m32r.h>
29#include <asm/irq.h> 29
30#include <asm/m32700ut/m32700ut_pld.h>
31#endif
32 30
33#define IDE_ARCH_OBSOLETE_DEFAULTS 31#define IDE_ARCH_OBSOLETE_DEFAULTS
34 32
35static __inline__ int ide_default_irq(unsigned long base) 33static __inline__ int ide_default_irq(unsigned long base)
36{ 34{
37 switch (base) { 35 switch (base) {
38#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) 36#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2)
37 case 0x1f0: return PLD_IRQ_CFIREQ;
38 default:
39 return 0;
40#elif defined(CONFIG_PLAT_MAPPI3)
39 case 0x1f0: return PLD_IRQ_CFIREQ; 41 case 0x1f0: return PLD_IRQ_CFIREQ;
42 case 0x170: return PLD_IRQ_IDEIREQ;
40 default: 43 default:
41 return 0; 44 return 0;
42#else 45#else
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
index 3f1551f7f01f..1d3c25d61bcb 100644
--- a/include/asm-m32r/mappi3/mappi3_pld.h
+++ b/include/asm-m32r/mappi3/mappi3_pld.h
@@ -59,7 +59,7 @@
59#define M32R_IRQ_I2C (28) /* I2C-BUS */ 59#define M32R_IRQ_I2C (28) /* I2C-BUS */
60#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ 60#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */
61#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ 61#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */
62#define PLD_IRQ_CFC_EJECT (8) /* INT7 CFC Card Eject */ 62#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */
63#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ 63#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */
64#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ 64#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
65 65
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 73348c3f858b..5eee832b73a0 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#include <asm/assembler.h>
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
16 17
@@ -132,8 +133,6 @@ static inline void local_irq_disable(void)
132 !(flags & 0x40); \ 133 !(flags & 0x40); \
133 }) 134 })
134 135
135#endif /* __KERNEL__ */
136
137#define nop() __asm__ __volatile__ ("nop" : : ) 136#define nop() __asm__ __volatile__ ("nop" : : )
138 137
139#define xchg(ptr,x) \ 138#define xchg(ptr,x) \
@@ -213,6 +212,67 @@ static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr,
213 return (tmp); 212 return (tmp);
214} 213}
215 214
215#define __HAVE_ARCH_CMPXCHG 1
216
217static __inline__ unsigned long
218__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
219{
220 unsigned long flags;
221 unsigned int retval;
222
223 local_irq_save(flags);
224 __asm__ __volatile__ (
225 DCACHE_CLEAR("%0", "r4", "%1")
226 M32R_LOCK" %0, @%1; \n"
227 " bne %0, %2, 1f; \n"
228 M32R_UNLOCK" %3, @%1; \n"
229 " bra 2f; \n"
230 " .fillinsn \n"
231 "1:"
232 M32R_UNLOCK" %2, @%1; \n"
233 " .fillinsn \n"
234 "2:"
235 : "=&r" (retval)
236 : "r" (p), "r" (old), "r" (new)
237 : "cbit", "memory"
238#ifdef CONFIG_CHIP_M32700_TS1
239 , "r4"
240#endif /* CONFIG_CHIP_M32700_TS1 */
241 );
242 local_irq_restore(flags);
243
244 return retval;
245}
246
247/* This function doesn't exist, so you'll get a linker error
248 if something tries to do an invalid cmpxchg(). */
249extern void __cmpxchg_called_with_bad_pointer(void);
250
251static __inline__ unsigned long
252__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
253{
254 switch (size) {
255 case 4:
256 return __cmpxchg_u32(ptr, old, new);
257#if 0 /* we don't have __cmpxchg_u64 */
258 case 8:
259 return __cmpxchg_u64(ptr, old, new);
260#endif /* 0 */
261 }
262 __cmpxchg_called_with_bad_pointer();
263 return old;
264}
265
266#define cmpxchg(ptr,o,n) \
267 ({ \
268 __typeof__(*(ptr)) _o_ = (o); \
269 __typeof__(*(ptr)) _n_ = (n); \
270 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
271 (unsigned long)_n_, sizeof(*(ptr))); \
272 })
273
274#endif /* __KERNEL__ */
275
216/* 276/*
217 * Memory barrier. 277 * Memory barrier.
218 * 278 *
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 6a35e6570ccd..f89f06050893 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * Rewrite, cleanup: 3 * Rewrite, cleanup:
4 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 1e6e7846824f..6642c0125001 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -103,8 +103,9 @@ extern unsigned int HPAGE_SHIFT;
103#define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) 103#define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT)
104#define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) 104#define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT)
105 105
106#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ 106#define LOW_ESID_MASK(addr, len) \
107 - (1U << GET_ESID(addr))) & 0xffff) 107 (((1U << (GET_ESID(min((addr)+(len)-1, 0x100000000UL))+1)) \
108 - (1U << GET_ESID(min((addr), 0x100000000UL)))) & 0xffff)
108#define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ 109#define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \
109 - (1U << GET_HTLB_AREA(addr))) & 0xffff) 110 - (1U << GET_HTLB_AREA(addr))) & 0xffff)
110 111
@@ -113,17 +114,21 @@ extern unsigned int HPAGE_SHIFT;
113#define ARCH_HAS_SETCLEAR_HUGE_PTE 114#define ARCH_HAS_SETCLEAR_HUGE_PTE
114 115
115#define touches_hugepage_low_range(mm, addr, len) \ 116#define touches_hugepage_low_range(mm, addr, len) \
116 (LOW_ESID_MASK((addr), (len)) & (mm)->context.low_htlb_areas) 117 (((addr) < 0x100000000UL) \
118 && (LOW_ESID_MASK((addr), (len)) & (mm)->context.low_htlb_areas))
117#define touches_hugepage_high_range(mm, addr, len) \ 119#define touches_hugepage_high_range(mm, addr, len) \
118 (HTLB_AREA_MASK((addr), (len)) & (mm)->context.high_htlb_areas) 120 ((((addr) + (len)) > 0x100000000UL) \
121 && (HTLB_AREA_MASK((addr), (len)) & (mm)->context.high_htlb_areas))
119 122
120#define __within_hugepage_low_range(addr, len, segmask) \ 123#define __within_hugepage_low_range(addr, len, segmask) \
121 ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) 124 ( (((addr)+(len)) <= 0x100000000UL) \
125 && ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)))
122#define within_hugepage_low_range(addr, len) \ 126#define within_hugepage_low_range(addr, len) \
123 __within_hugepage_low_range((addr), (len), \ 127 __within_hugepage_low_range((addr), (len), \
124 current->mm->context.low_htlb_areas) 128 current->mm->context.low_htlb_areas)
125#define __within_hugepage_high_range(addr, len, zonemask) \ 129#define __within_hugepage_high_range(addr, len, zonemask) \
126 ((HTLB_AREA_MASK((addr), (len)) | (zonemask)) == (zonemask)) 130 ( ((addr) >= 0x100000000UL) \
131 && ((HTLB_AREA_MASK((addr), (len)) | (zonemask)) == (zonemask)))
127#define within_hugepage_high_range(addr, len) \ 132#define within_hugepage_high_range(addr, len) \
128 __within_hugepage_high_range((addr), (len), \ 133 __within_hugepage_high_range((addr), (len), \
129 current->mm->context.high_htlb_areas) 134 current->mm->context.high_htlb_areas)
@@ -135,9 +140,9 @@ extern unsigned int HPAGE_SHIFT;
135 140
136#define in_hugepage_area(context, addr) \ 141#define in_hugepage_area(context, addr) \
137 (cpu_has_feature(CPU_FTR_16M_PAGE) && \ 142 (cpu_has_feature(CPU_FTR_16M_PAGE) && \
138 ( ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) || \ 143 ( ( (addr) >= 0x100000000UL) \
139 ( ((addr) < 0x100000000L) && \ 144 ? ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) \
140 ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) ) 145 : ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) )
141 146
142#else /* !CONFIG_HUGETLB_PAGE */ 147#else /* !CONFIG_HUGETLB_PAGE */
143 148
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h
index d099d5200f9b..980a094fd5a7 100644
--- a/include/asm-powerpc/tce.h
+++ b/include/asm-powerpc/tce.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * Rewrite, cleanup: 3 * Rewrite, cleanup:
4 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation 4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 8198c3d0d007..3789fe315992 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -54,6 +54,7 @@ extern int atomic64_sub_ret(int, atomic64_t *);
54 * other cases. 54 * other cases.
55 */ 55 */
56#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) 56#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
57#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
57 58
58#define atomic_sub_and_test(i, v) (atomic_sub_ret(i, v) == 0) 59#define atomic_sub_and_test(i, v) (atomic_sub_ret(i, v) == 0)
59#define atomic64_sub_and_test(i, v) (atomic64_sub_ret(i, v) == 0) 60#define atomic64_sub_and_test(i, v) (atomic64_sub_ret(i, v) == 0)
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 9a02879b235d..f0a9b44d3eb5 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -348,16 +348,6 @@ extern unsigned long find_ecache_flush_span(unsigned long size);
348struct vm_area_struct; 348struct vm_area_struct;
349extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 349extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
350 350
351/* Make a non-present pseudo-TTE. */
352static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
353{
354 pte_t pte;
355 pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) &
356 ~(unsigned long)_PAGE_CACHE);
357 pte_val(pte) |= (((unsigned long)space) << 32);
358 return pte;
359}
360
361/* Encode and de-code a swap entry */ 351/* Encode and de-code a swap entry */
362#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL) 352#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL)
363#define __swp_offset(entry) ((entry).val >> (PAGE_SHIFT + 8UL)) 353#define __swp_offset(entry) ((entry).val >> (PAGE_SHIFT + 8UL))
diff --git a/include/asm-um/ldt-i386.h b/include/asm-um/ldt-i386.h
index b42662929b6c..175722a91164 100644
--- a/include/asm-um/ldt-i386.h
+++ b/include/asm-um/ldt-i386.h
@@ -35,7 +35,7 @@ typedef struct uml_ldt {
35 union { 35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX]; 36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES]; 37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 }; 38 } u;
39} uml_ldt_t; 39} uml_ldt_t;
40 40
41/* 41/*
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt-x86_64.h
index 4466ff6de0fd..175722a91164 100644
--- a/include/asm-um/ldt.h
+++ b/include/asm-um/ldt-x86_64.h
@@ -35,7 +35,7 @@ typedef struct uml_ldt {
35 union { 35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX]; 36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES]; 37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 }; 38 } u;
39} uml_ldt_t; 39} uml_ldt_t;
40 40
41/* 41/*
@@ -67,8 +67,3 @@ typedef struct uml_ldt {
67 (info)->useable == 0 ) 67 (info)->useable == 0 )
68 68
69#endif 69#endif
70#ifndef __UM_LDT_H
71#define __UM_LDT_H
72
73#include "asm/arch/ldt.h"
74#endif
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 0866ef67f198..50db9f39274f 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -160,8 +160,8 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
160 160
161/** 161/**
162 * atomic_add_negative - add and test if negative 162 * atomic_add_negative - add and test if negative
163 * @v: pointer of type atomic_t
164 * @i: integer value to add 163 * @i: integer value to add
164 * @v: pointer of type atomic_t
165 * 165 *
166 * Atomically adds @i to @v and returns true 166 * Atomically adds @i to @v and returns true
167 * if the result is negative, or false when 167 * if the result is negative, or false when
@@ -178,6 +178,31 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
178 return c; 178 return c;
179} 179}
180 180
181/**
182 * atomic_add_return - add and return
183 * @i: integer value to add
184 * @v: pointer of type atomic_t
185 *
186 * Atomically adds @i to @v and returns @i + @v
187 */
188static __inline__ int atomic_add_return(int i, atomic_t *v)
189{
190 int __i = i;
191 __asm__ __volatile__(
192 LOCK "xaddl %0, %1;"
193 :"=r"(i)
194 :"m"(v->counter), "0"(i));
195 return i + __i;
196}
197
198static __inline__ int atomic_sub_return(int i, atomic_t *v)
199{
200 return atomic_add_return(-i,v);
201}
202
203#define atomic_inc_return(v) (atomic_add_return(1,v))
204#define atomic_dec_return(v) (atomic_sub_return(1,v))
205
181/* An 64bit atomic type */ 206/* An 64bit atomic type */
182 207
183typedef struct { volatile long counter; } atomic64_t; 208typedef struct { volatile long counter; } atomic64_t;
@@ -320,14 +345,14 @@ static __inline__ int atomic64_inc_and_test(atomic64_t *v)
320 345
321/** 346/**
322 * atomic64_add_negative - add and test if negative 347 * atomic64_add_negative - add and test if negative
323 * @v: pointer to atomic64_t
324 * @i: integer value to add 348 * @i: integer value to add
349 * @v: pointer to type atomic64_t
325 * 350 *
326 * Atomically adds @i to @v and returns true 351 * Atomically adds @i to @v and returns true
327 * if the result is negative, or false when 352 * if the result is negative, or false when
328 * result is greater than or equal to zero. 353 * result is greater than or equal to zero.
329 */ 354 */
330static __inline__ long atomic64_add_negative(long i, atomic64_t *v) 355static __inline__ int atomic64_add_negative(long i, atomic64_t *v)
331{ 356{
332 unsigned char c; 357 unsigned char c;
333 358
@@ -339,27 +364,30 @@ static __inline__ long atomic64_add_negative(long i, atomic64_t *v)
339} 364}
340 365
341/** 366/**
342 * atomic_add_return - add and return 367 * atomic64_add_return - add and return
343 * @v: pointer of type atomic_t
344 * @i: integer value to add 368 * @i: integer value to add
369 * @v: pointer to type atomic64_t
345 * 370 *
346 * Atomically adds @i to @v and returns @i + @v 371 * Atomically adds @i to @v and returns @i + @v
347 */ 372 */
348static __inline__ int atomic_add_return(int i, atomic_t *v) 373static __inline__ long atomic64_add_return(long i, atomic64_t *v)
349{ 374{
350 int __i = i; 375 long __i = i;
351 __asm__ __volatile__( 376 __asm__ __volatile__(
352 LOCK "xaddl %0, %1;" 377 LOCK "xaddq %0, %1;"
353 :"=r"(i) 378 :"=r"(i)
354 :"m"(v->counter), "0"(i)); 379 :"m"(v->counter), "0"(i));
355 return i + __i; 380 return i + __i;
356} 381}
357 382
358static __inline__ int atomic_sub_return(int i, atomic_t *v) 383static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
359{ 384{
360 return atomic_add_return(-i,v); 385 return atomic64_add_return(-i,v);
361} 386}
362 387
388#define atomic64_inc_return(v) (atomic64_add_return(1,v))
389#define atomic64_dec_return(v) (atomic64_sub_return(1,v))
390
363#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 391#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
364 392
365/** 393/**
@@ -381,9 +409,6 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
381}) 409})
382#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 410#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
383 411
384#define atomic_inc_return(v) (atomic_add_return(1,v))
385#define atomic_dec_return(v) (atomic_sub_return(1,v))
386
387/* These are x86-specific, used by some header files */ 412/* These are x86-specific, used by some header files */
388#define atomic_clear_mask(mask, addr) \ 413#define atomic_clear_mask(mask, addr) \
389__asm__ __volatile__(LOCK "andl %0,%1" \ 414__asm__ __volatile__(LOCK "andl %0,%1" \
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index 24dc39651bc4..10f8b51cec8b 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -56,7 +56,7 @@
56 ".section __ex_table,\"a\"\n" \ 56 ".section __ex_table,\"a\"\n" \
57 " .align 8\n" \ 57 " .align 8\n" \
58 " .quad 1b,3b\n" \ 58 " .quad 1b,3b\n" \
59 ".previous":"=&bDS" (ret__), "=a"(a), "=d"(b)\ 59 ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\
60 :"c"(msr), "i"(-EIO), "0"(0)); \ 60 :"c"(msr), "i"(-EIO), "0"(0)); \
61 ret__; }) 61 ret__; })
62 62
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 43c44530ef9d..0ed1d4853c69 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -65,10 +65,9 @@ extern struct sysdev_class cpu_sysdev_class;
65 65
66#ifdef CONFIG_HOTPLUG_CPU 66#ifdef CONFIG_HOTPLUG_CPU
67/* Stop CPUs going up and down. */ 67/* Stop CPUs going up and down. */
68extern struct semaphore cpucontrol; 68extern void lock_cpu_hotplug(void);
69#define lock_cpu_hotplug() down(&cpucontrol) 69extern void unlock_cpu_hotplug(void);
70#define unlock_cpu_hotplug() up(&cpucontrol) 70extern int lock_cpu_hotplug_interruptible(void);
71#define lock_cpu_hotplug_interruptible() down_interruptible(&cpucontrol)
72#define hotcpu_notifier(fn, pri) { \ 71#define hotcpu_notifier(fn, pri) { \
73 static struct notifier_block fn##_nb = \ 72 static struct notifier_block fn##_nb = \
74 { .notifier_call = fn, .priority = pri }; \ 73 { .notifier_call = fn, .priority = pri }; \
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 313dfe9b443a..8b2eab90abb6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -11,7 +11,7 @@ struct vm_area_struct;
11/* 11/*
12 * GFP bitmasks.. 12 * GFP bitmasks..
13 */ 13 */
14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ 14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
15#define __GFP_DMA ((__force gfp_t)0x01u) 15#define __GFP_DMA ((__force gfp_t)0x01u)
16#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 16#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
17#ifdef CONFIG_DMA_IS_DMA32 17#ifdef CONFIG_DMA_IS_DMA32
@@ -74,7 +74,12 @@ struct vm_area_struct;
74#define GFP_DMA32 __GFP_DMA32 74#define GFP_DMA32 __GFP_DMA32
75 75
76 76
77#define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK)) 77static inline int gfp_zone(gfp_t gfp)
78{
79 int zone = GFP_ZONEMASK & (__force int) gfp;
80 BUG_ON(zone >= GFP_ZONETYPES);
81 return zone;
82}
78 83
79/* 84/*
80 * There is only one page-allocator function, and two main namespaces to 85 * There is only one page-allocator function, and two main namespaces to
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index aa56172c6fed..dcde7adfdce5 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -16,8 +16,6 @@
16#ifndef _LINUX_JBD_H 16#ifndef _LINUX_JBD_H
17#define _LINUX_JBD_H 17#define _LINUX_JBD_H
18 18
19#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE) || !defined(__KERNEL__)
20
21/* Allow this file to be included directly into e2fsprogs */ 19/* Allow this file to be included directly into e2fsprogs */
22#ifndef __KERNEL__ 20#ifndef __KERNEL__
23#include "jfs_compat.h" 21#include "jfs_compat.h"
@@ -1083,19 +1081,4 @@ extern int jbd_blocks_per_page(struct inode *inode);
1083 1081
1084#endif /* __KERNEL__ */ 1082#endif /* __KERNEL__ */
1085 1083
1086#endif /* CONFIG_JBD || CONFIG_JBD_MODULE || !__KERNEL__ */
1087
1088/*
1089 * Compatibility no-ops which allow the kernel to compile without CONFIG_JBD
1090 * go here.
1091 */
1092
1093#if defined(__KERNEL__) && !(defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE))
1094
1095#define J_ASSERT(expr) do {} while (0)
1096#define J_ASSERT_BH(bh, expr) do {} while (0)
1097#define buffer_jbd(bh) 0
1098#define journal_buffer_journal_lru(bh) 0
1099
1100#endif /* defined(__KERNEL__) && !defined(CONFIG_JBD) */
1101#endif /* _LINUX_JBD_H */ 1084#endif /* _LINUX_JBD_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 9a424383e6c6..dc4081b6f161 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -85,7 +85,6 @@ struct notifier_block;
85extern int register_memory_notifier(struct notifier_block *nb); 85extern int register_memory_notifier(struct notifier_block *nb);
86extern void unregister_memory_notifier(struct notifier_block *nb); 86extern void unregister_memory_notifier(struct notifier_block *nb);
87 87
88extern struct sysdev_class memory_sysdev_class;
89#endif /* CONFIG_MEMORY_HOTPLUG */ 88#endif /* CONFIG_MEMORY_HOTPLUG */
90 89
91#define hotplug_memory_notifier(fn, pri) { \ 90#define hotplug_memory_notifier(fn, pri) { \
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0986d19be0b7..6a75a7a78bf1 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -144,7 +144,8 @@ extern unsigned int kobjsize(const void *objp);
144 144
145#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 145#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
146#define VM_GROWSUP 0x00000200 146#define VM_GROWSUP 0x00000200
147#define VM_SHM 0x00000400 /* shared memory area, don't swap out */ 147#define VM_SHM 0x00000000 /* Means nothing: delete it later */
148#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
148#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 149#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
149 150
150#define VM_EXECUTABLE 0x00001000 151#define VM_EXECUTABLE 0x00001000
@@ -157,7 +158,7 @@ extern unsigned int kobjsize(const void *objp);
157 158
158#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */ 159#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */
159#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ 160#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */
160#define VM_RESERVED 0x00080000 /* Pages managed in a special way */ 161#define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */
161#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ 162#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
162#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 163#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
163#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 164#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
@@ -311,8 +312,6 @@ struct page {
311 312
312extern void FASTCALL(__page_cache_release(struct page *)); 313extern void FASTCALL(__page_cache_release(struct page *));
313 314
314#ifdef CONFIG_HUGETLB_PAGE
315
316static inline int page_count(struct page *page) 315static inline int page_count(struct page *page)
317{ 316{
318 if (PageCompound(page)) 317 if (PageCompound(page))
@@ -329,23 +328,6 @@ static inline void get_page(struct page *page)
329 328
330void put_page(struct page *page); 329void put_page(struct page *page);
331 330
332#else /* CONFIG_HUGETLB_PAGE */
333
334#define page_count(p) (atomic_read(&(p)->_count) + 1)
335
336static inline void get_page(struct page *page)
337{
338 atomic_inc(&page->_count);
339}
340
341static inline void put_page(struct page *page)
342{
343 if (put_page_testzero(page))
344 __page_cache_release(page);
345}
346
347#endif /* CONFIG_HUGETLB_PAGE */
348
349/* 331/*
350 * Multiple processes may "see" the same page. E.g. for untouched 332 * Multiple processes may "see" the same page. E.g. for untouched
351 * mappings of /dev/null, all processes see the same page full of 333 * mappings of /dev/null, all processes see the same page full of
@@ -682,6 +664,7 @@ struct zap_details {
682 unsigned long truncate_count; /* Compare vm_truncate_count */ 664 unsigned long truncate_count; /* Compare vm_truncate_count */
683}; 665};
684 666
667struct page *vm_normal_page(struct vm_area_struct *, unsigned long, pte_t);
685unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 668unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
686 unsigned long size, struct zap_details *); 669 unsigned long size, struct zap_details *);
687unsigned long unmap_vmas(struct mmu_gather **tlb, 670unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -971,7 +954,7 @@ unsigned long vmalloc_to_pfn(void *addr);
971int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 954int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
972 unsigned long pfn, unsigned long size, pgprot_t); 955 unsigned long pfn, unsigned long size, pgprot_t);
973 956
974struct page *follow_page(struct mm_struct *, unsigned long address, 957struct page *follow_page(struct vm_area_struct *, unsigned long address,
975 unsigned int foll_flags); 958 unsigned int foll_flags);
976#define FOLL_WRITE 0x01 /* check pte is writable */ 959#define FOLL_WRITE 0x01 /* check pte is writable */
977#define FOLL_TOUCH 0x02 /* mark page accessed */ 960#define FOLL_TOUCH 0x02 /* mark page accessed */
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index f819cae92266..a14dc306545b 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -63,7 +63,7 @@
63 /* class 5 */ 63 /* class 5 */
64#define MMC_ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */ 64#define MMC_ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */
65#define MMC_ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */ 65#define MMC_ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */
66#define MMC_ERASE 37 /* ac R1b */ 66#define MMC_ERASE 38 /* ac R1b */
67 67
68 /* class 9 */ 68 /* class 9 */
69#define MMC_FAST_IO 39 /* ac <Complex> R4 */ 69#define MMC_FAST_IO 39 /* ac <Complex> R4 */
@@ -74,7 +74,7 @@
74 74
75 /* class 8 */ 75 /* class 8 */
76#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */ 76#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */
77#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1b */ 77#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */
78 78
79/* SD commands type argument response */ 79/* SD commands type argument response */
80 /* class 8 */ 80 /* class 8 */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 2c8edad5dccf..9f22090df7dd 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -91,21 +91,11 @@ struct per_cpu_pageset {
91 * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will 91 * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will
92 * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible 92 * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible
93 * combinations of zone modifiers in "zone modifier space". 93 * combinations of zone modifiers in "zone modifier space".
94 *
95 * NOTE! Make sure this matches the zones in <linux/gfp.h>
94 */ 96 */
95#define GFP_ZONEMASK 0x03 97#define GFP_ZONEMASK 0x07
96/* 98#define GFP_ZONETYPES 5
97 * As an optimisation any zone modifier bits which are only valid when
98 * no other zone modifier bits are set (loners) should be placed in
99 * the highest order bits of this field. This allows us to reduce the
100 * extent of the zonelists thus saving space. For example in the case
101 * of three zone modifier bits, we could require up to eight zonelists.
102 * If the left most zone modifier is a "loner" then the highest valid
103 * zonelist would be four allowing us to allocate only five zonelists.
104 * Use the first form when the left most bit is not a "loner", otherwise
105 * use the second.
106 */
107/* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */
108#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
109 99
110/* 100/*
111 * On machines where it is needed (eg PCs) we divide physical memory 101 * On machines where it is needed (eg PCs) we divide physical memory
diff --git a/include/linux/netfilter_ipv4/ipt_sctp.h b/include/linux/netfilter_ipv4/ipt_sctp.h
index e93a9ec99fc2..80b3dbacd193 100644
--- a/include/linux/netfilter_ipv4/ipt_sctp.h
+++ b/include/linux/netfilter_ipv4/ipt_sctp.h
@@ -7,8 +7,6 @@
7 7
8#define IPT_SCTP_VALID_FLAGS 0x07 8#define IPT_SCTP_VALID_FLAGS 0x07
9 9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12 10
13struct ipt_sctp_flag_info { 11struct ipt_sctp_flag_info {
14 u_int8_t chunktype; 12 u_int8_t chunktype;
@@ -59,21 +57,21 @@ struct ipt_sctp_info {
59#define SCTP_CHUNKMAP_RESET(chunkmap) \ 57#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \ 58 do { \
61 int i; \ 59 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 60 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
63 chunkmap[i] = 0; \ 61 chunkmap[i] = 0; \
64 } while (0) 62 } while (0)
65 63
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 64#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \ 65 do { \
68 int i; \ 66 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 67 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
70 chunkmap[i] = ~0; \ 68 chunkmap[i] = ~0; \
71 } while (0) 69 } while (0)
72 70
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 71#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \ 72 do { \
75 int i; \ 73 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 74 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \ 75 destmap[i] = srcmap[i]; \
78 } while (0) 76 } while (0)
79 77
@@ -81,7 +79,7 @@ struct ipt_sctp_info {
81({ \ 79({ \
82 int i; \ 80 int i; \
83 int flag = 1; \ 81 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 82 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
85 if (chunkmap[i]) { \ 83 if (chunkmap[i]) { \
86 flag = 0; \ 84 flag = 0; \
87 break; \ 85 break; \
@@ -94,7 +92,7 @@ struct ipt_sctp_info {
94({ \ 92({ \
95 int i; \ 93 int i; \
96 int flag = 1; \ 94 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 95 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \ 96 if (chunkmap[i] != ~0) { \
99 flag = 0; \ 97 flag = 0; \
100 break; \ 98 break; \
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f34767c5fc79..343083fec258 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -287,11 +287,7 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta);
287#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) 287#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
288#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) 288#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
289 289
290#ifdef CONFIG_HUGETLB_PAGE
291#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 290#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
292#else
293#define PageCompound(page) 0
294#endif
295#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) 291#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags)
296#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) 292#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags)
297 293
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index efb60d06caab..1e737e269db9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1199,6 +1199,7 @@
1199#define PCI_DEVICE_ID_VIA_3269_0 0x0269 1199#define PCI_DEVICE_ID_VIA_3269_0 0x0269
1200#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 1200#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282
1201#define PCI_DEVICE_ID_VIA_8363_0 0x0305 1201#define PCI_DEVICE_ID_VIA_8363_0 0x0305
1202#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
1202#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1203#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1203#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1204#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1204#define PCI_DEVICE_ID_VIA_82C561 0x0561 1205#define PCI_DEVICE_ID_VIA_82C561 0x0561
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 35b30e6c8cf8..33261f1d2239 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -89,7 +89,7 @@ static inline void page_dup_rmap(struct page *page)
89/* 89/*
90 * Called from mm/vmscan.c to handle paging out 90 * Called from mm/vmscan.c to handle paging out
91 */ 91 */
92int page_referenced(struct page *, int is_locked, int ignore_token); 92int page_referenced(struct page *, int is_locked);
93int try_to_unmap(struct page *); 93int try_to_unmap(struct page *);
94 94
95/* 95/*
@@ -109,7 +109,7 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
109#define anon_vma_prepare(vma) (0) 109#define anon_vma_prepare(vma) (0)
110#define anon_vma_link(vma) do {} while (0) 110#define anon_vma_link(vma) do {} while (0)
111 111
112#define page_referenced(page,l,i) TestClearPageReferenced(page) 112#define page_referenced(page,l) TestClearPageReferenced(page)
113#define try_to_unmap(page) SWAP_FAIL 113#define try_to_unmap(page) SWAP_FAIL
114 114
115#endif /* CONFIG_MMU */ 115#endif /* CONFIG_MMU */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2038bd27b041..b0ad6f30679e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -908,7 +908,6 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
908#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 908#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
909#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 909#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
910#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 910#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
911#define PF_HOTPLUG_CPU 0x01000000 /* Currently performing CPU hotplug */
912 911
913/* 912/*
914 * Only the _current_ task can read/write to tsk->flags, but other 913 * Only the _current_ task can read/write to tsk->flags, but other
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a3ac92b19aca..e3710d7e260a 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -121,6 +121,9 @@
121 121
122#define PORT_IP3106 70 122#define PORT_IP3106 70
123 123
124/* Hilscher netx */
125#define PORT_NETX 71
126
124#ifdef __KERNEL__ 127#ifdef __KERNEL__
125 128
126#include <linux/config.h> 129#include <linux/config.h>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0a8ea8b35816..8c5d6001a923 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -206,6 +206,7 @@ enum {
206 * @nfct: Associated connection, if any 206 * @nfct: Associated connection, if any
207 * @ipvs_property: skbuff is owned by ipvs 207 * @ipvs_property: skbuff is owned by ipvs
208 * @nfctinfo: Relationship of this skb to the connection 208 * @nfctinfo: Relationship of this skb to the connection
209 * @nfct_reasm: netfilter conntrack re-assembly pointer
209 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 210 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
210 * @tc_index: Traffic control index 211 * @tc_index: Traffic control index
211 * @tc_verd: traffic control verdict 212 * @tc_verd: traffic control verdict
@@ -264,16 +265,14 @@ struct sk_buff {
264 nohdr:1, 265 nohdr:1,
265 nfctinfo:3; 266 nfctinfo:3;
266 __u8 pkt_type:3, 267 __u8 pkt_type:3,
267 fclone:2; 268 fclone:2,
269 ipvs_property:1;
268 __be16 protocol; 270 __be16 protocol;
269 271
270 void (*destructor)(struct sk_buff *skb); 272 void (*destructor)(struct sk_buff *skb);
271#ifdef CONFIG_NETFILTER 273#ifdef CONFIG_NETFILTER
272 __u32 nfmark; 274 __u32 nfmark;
273 struct nf_conntrack *nfct; 275 struct nf_conntrack *nfct;
274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
275 __u8 ipvs_property:1;
276#endif
277#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 276#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
278 struct sk_buff *nfct_reasm; 277 struct sk_buff *nfct_reasm;
279#endif 278#endif
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 20c975642cab..508668f840b6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -239,6 +239,11 @@ static inline void put_swap_token(struct mm_struct *mm)
239 __put_swap_token(mm); 239 __put_swap_token(mm);
240} 240}
241 241
242static inline void disable_swap_token(void)
243{
244 put_swap_token(swap_token_mm);
245}
246
242#else /* CONFIG_SWAP */ 247#else /* CONFIG_SWAP */
243 248
244#define total_swap_pages 0 249#define total_swap_pages 0
@@ -283,6 +288,7 @@ static inline swp_entry_t get_swap_page(void)
283#define put_swap_token(x) do { } while(0) 288#define put_swap_token(x) do { } while(0)
284#define grab_swap_token() do { } while(0) 289#define grab_swap_token() do { } while(0)
285#define has_swap_token(x) 0 290#define has_swap_token(x) 0
291#define disable_swap_token() do { } while(0)
286 292
287#endif /* CONFIG_SWAP */ 293#endif /* CONFIG_SWAP */
288#endif /* __KERNEL__*/ 294#endif /* __KERNEL__*/
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 84876077027f..0ff7ca68e5c5 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -34,8 +34,7 @@
34#define UINPUT_BUFFER_SIZE 16 34#define UINPUT_BUFFER_SIZE 16
35#define UINPUT_NUM_REQUESTS 16 35#define UINPUT_NUM_REQUESTS 16
36 36
37/* state flags => bit index for {set|clear|test}_bit ops */ 37enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
38#define UIST_CREATED 0
39 38
40struct uinput_request { 39struct uinput_request {
41 int id; 40 int id;
@@ -52,11 +51,12 @@ struct uinput_request {
52 51
53struct uinput_device { 52struct uinput_device {
54 struct input_dev *dev; 53 struct input_dev *dev;
55 unsigned long state; 54 struct semaphore sem;
55 enum uinput_state state;
56 wait_queue_head_t waitq; 56 wait_queue_head_t waitq;
57 unsigned char ready, 57 unsigned char ready;
58 head, 58 unsigned char head;
59 tail; 59 unsigned char tail;
60 struct input_event buff[UINPUT_BUFFER_SIZE]; 60 struct input_event buff[UINPUT_BUFFER_SIZE];
61 61
62 struct uinput_request *requests[UINPUT_NUM_REQUESTS]; 62 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
@@ -91,6 +91,7 @@ struct uinput_ff_erase {
91#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) 91#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int)
92#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) 92#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
93#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) 93#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
94#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
94 95
95#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) 96#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
96#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) 97#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 856d232c7562..d81b050e5955 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -47,6 +47,7 @@ struct usb_driver;
47 * @urb_list: urbs queued to this endpoint; maintained by usbcore 47 * @urb_list: urbs queued to this endpoint; maintained by usbcore
48 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 48 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
49 * with one or more transfer descriptors (TDs) per urb 49 * with one or more transfer descriptors (TDs) per urb
50 * @kobj: kobject for sysfs info
50 * @extra: descriptors following this endpoint in the configuration 51 * @extra: descriptors following this endpoint in the configuration
51 * @extralen: how many bytes of "extra" are valid 52 * @extralen: how many bytes of "extra" are valid
52 * 53 *
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6addb4d464d6..0a2ad51cff82 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -237,6 +237,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
237 int newtype, 237 int newtype,
238 struct ipv6_opt_hdr __user *newopt, 238 struct ipv6_opt_hdr __user *newopt,
239 int newoptlen); 239 int newoptlen);
240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
241 struct ipv6_txoptions *opt);
240 242
241extern int ip6_frag_nqueues; 243extern int ip6_frag_nqueues;
242extern atomic_t ip6_frag_mem; 244extern atomic_t ip6_frag_mem;
diff --git a/include/net/route.h b/include/net/route.h
index dbe79ca67d31..e3e5436f8017 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -126,6 +126,9 @@ extern int ip_rt_ioctl(unsigned int cmd, void __user *arg);
126extern void ip_rt_get_source(u8 *src, struct rtable *rt); 126extern void ip_rt_get_source(u8 *src, struct rtable *rt);
127extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); 127extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
128 128
129struct in_ifaddr;
130extern void fib_add_ifaddr(struct in_ifaddr *);
131
129static inline void ip_rt_put(struct rtable * rt) 132static inline void ip_rt_put(struct rtable * rt)
130{ 133{
131 if (rt) 134 if (rt)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index d61ba88f34e5..e882c6babf41 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -16,47 +16,76 @@
16#include <asm/semaphore.h> 16#include <asm/semaphore.h>
17 17
18/* This protects CPUs going up and down... */ 18/* This protects CPUs going up and down... */
19DECLARE_MUTEX(cpucontrol); 19static DECLARE_MUTEX(cpucontrol);
20EXPORT_SYMBOL_GPL(cpucontrol);
21 20
22static struct notifier_block *cpu_chain; 21static struct notifier_block *cpu_chain;
23 22
24/* 23#ifdef CONFIG_HOTPLUG_CPU
25 * Used to check by callers if they need to acquire the cpucontrol 24static struct task_struct *lock_cpu_hotplug_owner;
26 * or not to protect a cpu from being removed. Its sometimes required to 25static int lock_cpu_hotplug_depth;
27 * call these functions both for normal operations, and in response to
28 * a cpu being added/removed. If the context of the call is in the same
29 * thread context as a CPU hotplug thread, we dont need to take the lock
30 * since its already protected
31 * check drivers/cpufreq/cpufreq.c for its usage - Ashok Raj
32 */
33 26
34int current_in_cpu_hotplug(void) 27static int __lock_cpu_hotplug(int interruptible)
35{ 28{
36 return (current->flags & PF_HOTPLUG_CPU); 29 int ret = 0;
30
31 if (lock_cpu_hotplug_owner != current) {
32 if (interruptible)
33 ret = down_interruptible(&cpucontrol);
34 else
35 down(&cpucontrol);
36 }
37
38 /*
39 * Set only if we succeed in locking
40 */
41 if (!ret) {
42 lock_cpu_hotplug_depth++;
43 lock_cpu_hotplug_owner = current;
44 }
45
46 return ret;
37} 47}
38 48
39EXPORT_SYMBOL_GPL(current_in_cpu_hotplug); 49void lock_cpu_hotplug(void)
50{
51 __lock_cpu_hotplug(0);
52}
53EXPORT_SYMBOL_GPL(lock_cpu_hotplug);
40 54
55void unlock_cpu_hotplug(void)
56{
57 if (--lock_cpu_hotplug_depth == 0) {
58 lock_cpu_hotplug_owner = NULL;
59 up(&cpucontrol);
60 }
61}
62EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
63
64int lock_cpu_hotplug_interruptible(void)
65{
66 return __lock_cpu_hotplug(1);
67}
68EXPORT_SYMBOL_GPL(lock_cpu_hotplug_interruptible);
69#endif /* CONFIG_HOTPLUG_CPU */
41 70
42/* Need to know about CPUs going up/down? */ 71/* Need to know about CPUs going up/down? */
43int register_cpu_notifier(struct notifier_block *nb) 72int register_cpu_notifier(struct notifier_block *nb)
44{ 73{
45 int ret; 74 int ret;
46 75
47 if ((ret = down_interruptible(&cpucontrol)) != 0) 76 if ((ret = lock_cpu_hotplug_interruptible()) != 0)
48 return ret; 77 return ret;
49 ret = notifier_chain_register(&cpu_chain, nb); 78 ret = notifier_chain_register(&cpu_chain, nb);
50 up(&cpucontrol); 79 unlock_cpu_hotplug();
51 return ret; 80 return ret;
52} 81}
53EXPORT_SYMBOL(register_cpu_notifier); 82EXPORT_SYMBOL(register_cpu_notifier);
54 83
55void unregister_cpu_notifier(struct notifier_block *nb) 84void unregister_cpu_notifier(struct notifier_block *nb)
56{ 85{
57 down(&cpucontrol); 86 lock_cpu_hotplug();
58 notifier_chain_unregister(&cpu_chain, nb); 87 notifier_chain_unregister(&cpu_chain, nb);
59 up(&cpucontrol); 88 unlock_cpu_hotplug();
60} 89}
61EXPORT_SYMBOL(unregister_cpu_notifier); 90EXPORT_SYMBOL(unregister_cpu_notifier);
62 91
@@ -112,13 +141,6 @@ int cpu_down(unsigned int cpu)
112 goto out; 141 goto out;
113 } 142 }
114 143
115 /*
116 * Leave a trace in current->flags indicating we are already in
117 * process of performing CPU hotplug. Callers can check if cpucontrol
118 * is already acquired by current thread, and if so not cause
119 * a dead lock by not acquiring the lock
120 */
121 current->flags |= PF_HOTPLUG_CPU;
122 err = notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, 144 err = notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
123 (void *)(long)cpu); 145 (void *)(long)cpu);
124 if (err == NOTIFY_BAD) { 146 if (err == NOTIFY_BAD) {
@@ -171,7 +193,6 @@ out_thread:
171out_allowed: 193out_allowed:
172 set_cpus_allowed(current, old_allowed); 194 set_cpus_allowed(current, old_allowed);
173out: 195out:
174 current->flags &= ~PF_HOTPLUG_CPU;
175 unlock_cpu_hotplug(); 196 unlock_cpu_hotplug();
176 return err; 197 return err;
177} 198}
@@ -182,7 +203,7 @@ int __devinit cpu_up(unsigned int cpu)
182 int ret; 203 int ret;
183 void *hcpu = (void *)(long)cpu; 204 void *hcpu = (void *)(long)cpu;
184 205
185 if ((ret = down_interruptible(&cpucontrol)) != 0) 206 if ((ret = lock_cpu_hotplug_interruptible()) != 0)
186 return ret; 207 return ret;
187 208
188 if (cpu_online(cpu) || !cpu_present(cpu)) { 209 if (cpu_online(cpu) || !cpu_present(cpu)) {
@@ -190,11 +211,6 @@ int __devinit cpu_up(unsigned int cpu)
190 goto out; 211 goto out;
191 } 212 }
192 213
193 /*
194 * Leave a trace in current->flags indicating we are already in
195 * process of performing CPU hotplug.
196 */
197 current->flags |= PF_HOTPLUG_CPU;
198 ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); 214 ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
199 if (ret == NOTIFY_BAD) { 215 if (ret == NOTIFY_BAD) {
200 printk("%s: attempt to bring up CPU %u failed\n", 216 printk("%s: attempt to bring up CPU %u failed\n",
@@ -217,7 +233,6 @@ out_notify:
217 if (ret != 0) 233 if (ret != 0)
218 notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu); 234 notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu);
219out: 235out:
220 current->flags &= ~PF_HOTPLUG_CPU; 236 unlock_cpu_hotplug();
221 up(&cpucontrol);
222 return ret; 237 return ret;
223} 238}
diff --git a/kernel/fork.c b/kernel/fork.c
index e0d0b77343f8..fb8572a42297 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -263,7 +263,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
263 rb_parent = &tmp->vm_rb; 263 rb_parent = &tmp->vm_rb;
264 264
265 mm->map_count++; 265 mm->map_count++;
266 retval = copy_page_range(mm, oldmm, tmp); 266 retval = copy_page_range(mm, oldmm, mpnt);
267 267
268 if (tmp->vm_ops && tmp->vm_ops->open) 268 if (tmp->vm_ops && tmp->vm_ops->open)
269 tmp->vm_ops->open(tmp); 269 tmp->vm_ops->open(tmp);
@@ -1124,8 +1124,6 @@ static task_t *copy_process(unsigned long clone_flags,
1124 if (unlikely(p->ptrace & PT_PTRACED)) 1124 if (unlikely(p->ptrace & PT_PTRACED))
1125 __ptrace_link(p, current->parent); 1125 __ptrace_link(p, current->parent);
1126 1126
1127 cpuset_fork(p);
1128
1129 attach_pid(p, PIDTYPE_PID, p->pid); 1127 attach_pid(p, PIDTYPE_PID, p->pid);
1130 attach_pid(p, PIDTYPE_TGID, p->tgid); 1128 attach_pid(p, PIDTYPE_TGID, p->tgid);
1131 if (thread_group_leader(p)) { 1129 if (thread_group_leader(p)) {
@@ -1135,13 +1133,14 @@ static task_t *copy_process(unsigned long clone_flags,
1135 __get_cpu_var(process_counts)++; 1133 __get_cpu_var(process_counts)++;
1136 } 1134 }
1137 1135
1138 proc_fork_connector(p);
1139 if (!current->signal->tty && p->signal->tty) 1136 if (!current->signal->tty && p->signal->tty)
1140 p->signal->tty = NULL; 1137 p->signal->tty = NULL;
1141 1138
1142 nr_threads++; 1139 nr_threads++;
1143 total_forks++; 1140 total_forks++;
1144 write_unlock_irq(&tasklist_lock); 1141 write_unlock_irq(&tasklist_lock);
1142 proc_fork_connector(p);
1143 cpuset_fork(p);
1145 retval = 0; 1144 retval = 0;
1146 1145
1147fork_out: 1146fork_out:
diff --git a/kernel/futex.c b/kernel/futex.c
index aca8d10704f6..5872e3507f35 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -201,21 +201,6 @@ static int get_futex_key(unsigned long uaddr, union futex_key *key)
201 * from swap. But that's a lot of code to duplicate here 201 * from swap. But that's a lot of code to duplicate here
202 * for a rare case, so we simply fetch the page. 202 * for a rare case, so we simply fetch the page.
203 */ 203 */
204
205 /*
206 * Do a quick atomic lookup first - this is the fastpath.
207 */
208 page = follow_page(mm, uaddr, FOLL_TOUCH|FOLL_GET);
209 if (likely(page != NULL)) {
210 key->shared.pgoff =
211 page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
212 put_page(page);
213 return 0;
214 }
215
216 /*
217 * Do it the general way.
218 */
219 err = get_user_pages(current, mm, uaddr, 1, 0, 0, &page, NULL); 204 err = get_user_pages(current, mm, uaddr, 1, 0, 0, &page, NULL);
220 if (err >= 0) { 205 if (err >= 0) {
221 key->shared.pgoff = 206 key->shared.pgoff =
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3bd7226d15fa..81c49a4d679e 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -36,6 +36,9 @@ void synchronize_irq(unsigned int irq)
36{ 36{
37 struct irq_desc *desc = irq_desc + irq; 37 struct irq_desc *desc = irq_desc + irq;
38 38
39 if (irq >= NR_IRQS)
40 return;
41
39 while (desc->status & IRQ_INPROGRESS) 42 while (desc->status & IRQ_INPROGRESS)
40 cpu_relax(); 43 cpu_relax();
41} 44}
@@ -60,6 +63,9 @@ void disable_irq_nosync(unsigned int irq)
60 irq_desc_t *desc = irq_desc + irq; 63 irq_desc_t *desc = irq_desc + irq;
61 unsigned long flags; 64 unsigned long flags;
62 65
66 if (irq >= NR_IRQS)
67 return;
68
63 spin_lock_irqsave(&desc->lock, flags); 69 spin_lock_irqsave(&desc->lock, flags);
64 if (!desc->depth++) { 70 if (!desc->depth++) {
65 desc->status |= IRQ_DISABLED; 71 desc->status |= IRQ_DISABLED;
@@ -86,6 +92,9 @@ void disable_irq(unsigned int irq)
86{ 92{
87 irq_desc_t *desc = irq_desc + irq; 93 irq_desc_t *desc = irq_desc + irq;
88 94
95 if (irq >= NR_IRQS)
96 return;
97
89 disable_irq_nosync(irq); 98 disable_irq_nosync(irq);
90 if (desc->action) 99 if (desc->action)
91 synchronize_irq(irq); 100 synchronize_irq(irq);
@@ -108,6 +117,9 @@ void enable_irq(unsigned int irq)
108 irq_desc_t *desc = irq_desc + irq; 117 irq_desc_t *desc = irq_desc + irq;
109 unsigned long flags; 118 unsigned long flags;
110 119
120 if (irq >= NR_IRQS)
121 return;
122
111 spin_lock_irqsave(&desc->lock, flags); 123 spin_lock_irqsave(&desc->lock, flags);
112 switch (desc->depth) { 124 switch (desc->depth) {
113 case 0: 125 case 0:
@@ -163,6 +175,9 @@ int setup_irq(unsigned int irq, struct irqaction * new)
163 unsigned long flags; 175 unsigned long flags;
164 int shared = 0; 176 int shared = 0;
165 177
178 if (irq >= NR_IRQS)
179 return -EINVAL;
180
166 if (desc->handler == &no_irq_type) 181 if (desc->handler == &no_irq_type)
167 return -ENOSYS; 182 return -ENOSYS;
168 /* 183 /*
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 84af54c39e1b..cae4f5728997 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -36,7 +36,7 @@ timespec_to_sample(clockid_t which_clock, const struct timespec *tp)
36 union cpu_time_count ret; 36 union cpu_time_count ret;
37 ret.sched = 0; /* high half always zero when .cpu used */ 37 ret.sched = 0; /* high half always zero when .cpu used */
38 if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) { 38 if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {
39 ret.sched = tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec; 39 ret.sched = (unsigned long long)tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec;
40 } else { 40 } else {
41 ret.cpu = timespec_to_cputime(tp); 41 ret.cpu = timespec_to_cputime(tp);
42 } 42 }
diff --git a/kernel/printk.c b/kernel/printk.c
index ac8a08f36207..5287be83e3e7 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -956,7 +956,7 @@ int unregister_console(struct console *console)
956 if (console_drivers == console) { 956 if (console_drivers == console) {
957 console_drivers=console->next; 957 console_drivers=console->next;
958 res = 0; 958 res = 0;
959 } else { 959 } else if (console_drivers) {
960 for (a=console_drivers->next, b=console_drivers ; 960 for (a=console_drivers->next, b=console_drivers ;
961 a; b=a, a=b->next) { 961 a; b=a, a=b->next) {
962 if (a == console) { 962 if (a == console) {
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 42df83d7fad2..2bd5aee1c736 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -102,7 +102,7 @@ int fastcall queue_work(struct workqueue_struct *wq, struct work_struct *work)
102 102
103 if (!test_and_set_bit(0, &work->pending)) { 103 if (!test_and_set_bit(0, &work->pending)) {
104 if (unlikely(is_single_threaded(wq))) 104 if (unlikely(is_single_threaded(wq)))
105 cpu = 0; 105 cpu = any_online_cpu(cpu_online_map);
106 BUG_ON(!list_empty(&work->entry)); 106 BUG_ON(!list_empty(&work->entry));
107 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work); 107 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
108 ret = 1; 108 ret = 1;
@@ -118,7 +118,7 @@ static void delayed_work_timer_fn(unsigned long __data)
118 int cpu = smp_processor_id(); 118 int cpu = smp_processor_id();
119 119
120 if (unlikely(is_single_threaded(wq))) 120 if (unlikely(is_single_threaded(wq)))
121 cpu = 0; 121 cpu = any_online_cpu(cpu_online_map);
122 122
123 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work); 123 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
124} 124}
@@ -266,8 +266,8 @@ void fastcall flush_workqueue(struct workqueue_struct *wq)
266 might_sleep(); 266 might_sleep();
267 267
268 if (is_single_threaded(wq)) { 268 if (is_single_threaded(wq)) {
269 /* Always use cpu 0's area. */ 269 /* Always use first cpu's area. */
270 flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, 0)); 270 flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, any_online_cpu(cpu_online_map)));
271 } else { 271 } else {
272 int cpu; 272 int cpu;
273 273
@@ -320,7 +320,7 @@ struct workqueue_struct *__create_workqueue(const char *name,
320 lock_cpu_hotplug(); 320 lock_cpu_hotplug();
321 if (singlethread) { 321 if (singlethread) {
322 INIT_LIST_HEAD(&wq->list); 322 INIT_LIST_HEAD(&wq->list);
323 p = create_workqueue_thread(wq, 0); 323 p = create_workqueue_thread(wq, any_online_cpu(cpu_online_map));
324 if (!p) 324 if (!p)
325 destroy = 1; 325 destroy = 1;
326 else 326 else
@@ -374,7 +374,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
374 /* We don't need the distraction of CPUs appearing and vanishing. */ 374 /* We don't need the distraction of CPUs appearing and vanishing. */
375 lock_cpu_hotplug(); 375 lock_cpu_hotplug();
376 if (is_single_threaded(wq)) 376 if (is_single_threaded(wq))
377 cleanup_workqueue_thread(wq, 0); 377 cleanup_workqueue_thread(wq, any_online_cpu(cpu_online_map));
378 else { 378 else {
379 for_each_online_cpu(cpu) 379 for_each_online_cpu(cpu)
380 cleanup_workqueue_thread(wq, cpu); 380 cleanup_workqueue_thread(wq, cpu);
diff --git a/lib/genalloc.c b/lib/genalloc.c
index d6d30d2e7166..9ce0a6a3b85a 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -95,12 +95,10 @@ unsigned long gen_pool_alloc(struct gen_pool *poolp, int size)
95 if (size > max_chunk_size) 95 if (size > max_chunk_size)
96 return 0; 96 return 0;
97 97
98 i = 0;
99
100 size = max(size, 1 << ALLOC_MIN_SHIFT); 98 size = max(size, 1 << ALLOC_MIN_SHIFT);
101 s = roundup_pow_of_two(size); 99 i = fls(size - 1);
102 100 s = 1 << i;
103 j = i; 101 j = i -= ALLOC_MIN_SHIFT;
104 102
105 spin_lock_irqsave(&poolp->lock, flags); 103 spin_lock_irqsave(&poolp->lock, flags);
106 while (!h[j].next) { 104 while (!h[j].next) {
@@ -153,10 +151,10 @@ void gen_pool_free(struct gen_pool *poolp, unsigned long ptr, int size)
153 if (size > max_chunk_size) 151 if (size > max_chunk_size)
154 return; 152 return;
155 153
156 i = 0;
157
158 size = max(size, 1 << ALLOC_MIN_SHIFT); 154 size = max(size, 1 << ALLOC_MIN_SHIFT);
159 s = roundup_pow_of_two(size); 155 i = fls(size - 1);
156 s = 1 << i;
157 i -= ALLOC_MIN_SHIFT;
160 158
161 a = ptr; 159 a = ptr;
162 160
diff --git a/mm/Kconfig b/mm/Kconfig
index ae9ce6b73e8a..21eb51d4da8f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -125,12 +125,10 @@ comment "Memory hotplug is currently incompatible with Software Suspend"
125# space can be handled with less contention: split it at this NR_CPUS. 125# space can be handled with less contention: split it at this NR_CPUS.
126# Default to 4 for wider testing, though 8 might be more appropriate. 126# Default to 4 for wider testing, though 8 might be more appropriate.
127# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock. 127# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
128# PA-RISC's debug spinlock_t is too large for the 32-bit struct page. 128# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
129# ARM26 and SPARC32 and PPC64 may use one page for multiple page tables.
130# 129#
131config SPLIT_PTLOCK_CPUS 130config SPLIT_PTLOCK_CPUS
132 int 131 int
133 default "4096" if ARM && !CPU_CACHE_VIPT 132 default "4096" if ARM && !CPU_CACHE_VIPT
134 default "4096" if PARISC && DEBUG_SPINLOCK && !64BIT 133 default "4096" if PARISC && !PA20
135 default "4096" if ARM26 || SPARC32 || PPC64
136 default "4" 134 default "4"
diff --git a/mm/fremap.c b/mm/fremap.c
index d862be3bc3e3..f851775e09c2 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -27,24 +27,20 @@ static int zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
27 struct page *page = NULL; 27 struct page *page = NULL;
28 28
29 if (pte_present(pte)) { 29 if (pte_present(pte)) {
30 unsigned long pfn = pte_pfn(pte); 30 flush_cache_page(vma, addr, pte_pfn(pte));
31 flush_cache_page(vma, addr, pfn);
32 pte = ptep_clear_flush(vma, addr, ptep); 31 pte = ptep_clear_flush(vma, addr, ptep);
33 if (unlikely(!pfn_valid(pfn))) { 32 page = vm_normal_page(vma, addr, pte);
34 print_bad_pte(vma, pte, addr); 33 if (page) {
35 goto out; 34 if (pte_dirty(pte))
35 set_page_dirty(page);
36 page_remove_rmap(page);
37 page_cache_release(page);
36 } 38 }
37 page = pfn_to_page(pfn);
38 if (pte_dirty(pte))
39 set_page_dirty(page);
40 page_remove_rmap(page);
41 page_cache_release(page);
42 } else { 39 } else {
43 if (!pte_file(pte)) 40 if (!pte_file(pte))
44 free_swap_and_cache(pte_to_swp_entry(pte)); 41 free_swap_and_cache(pte_to_swp_entry(pte));
45 pte_clear(mm, addr, ptep); 42 pte_clear(mm, addr, ptep);
46 } 43 }
47out:
48 return !!page; 44 return !!page;
49} 45}
50 46
@@ -65,8 +61,6 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
65 pte_t pte_val; 61 pte_t pte_val;
66 spinlock_t *ptl; 62 spinlock_t *ptl;
67 63
68 BUG_ON(vma->vm_flags & VM_RESERVED);
69
70 pgd = pgd_offset(mm, addr); 64 pgd = pgd_offset(mm, addr);
71 pud = pud_alloc(mm, pgd, addr); 65 pud = pud_alloc(mm, pgd, addr);
72 if (!pud) 66 if (!pud)
@@ -122,8 +116,6 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma,
122 pte_t pte_val; 116 pte_t pte_val;
123 spinlock_t *ptl; 117 spinlock_t *ptl;
124 118
125 BUG_ON(vma->vm_flags & VM_RESERVED);
126
127 pgd = pgd_offset(mm, addr); 119 pgd = pgd_offset(mm, addr);
128 pud = pud_alloc(mm, pgd, addr); 120 pud = pud_alloc(mm, pgd, addr);
129 if (!pud) 121 if (!pud)
@@ -204,12 +196,10 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
204 * Make sure the vma is shared, that it supports prefaulting, 196 * Make sure the vma is shared, that it supports prefaulting,
205 * and that the remapped range is valid and fully within 197 * and that the remapped range is valid and fully within
206 * the single existing vma. vm_private_data is used as a 198 * the single existing vma. vm_private_data is used as a
207 * swapout cursor in a VM_NONLINEAR vma (unless VM_RESERVED 199 * swapout cursor in a VM_NONLINEAR vma.
208 * or VM_LOCKED, but VM_LOCKED could be revoked later on).
209 */ 200 */
210 if (vma && (vma->vm_flags & VM_SHARED) && 201 if (vma && (vma->vm_flags & VM_SHARED) &&
211 (!vma->vm_private_data || 202 (!vma->vm_private_data || (vma->vm_flags & VM_NONLINEAR)) &&
212 (vma->vm_flags & (VM_NONLINEAR|VM_RESERVED))) &&
213 vma->vm_ops && vma->vm_ops->populate && 203 vma->vm_ops && vma->vm_ops->populate &&
214 end > start && start >= vma->vm_start && 204 end > start && start >= vma->vm_start &&
215 end <= vma->vm_end) { 205 end <= vma->vm_end) {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 728e9bda12ea..3e52df7c471b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -22,6 +22,10 @@ unsigned long max_huge_pages;
22static struct list_head hugepage_freelists[MAX_NUMNODES]; 22static struct list_head hugepage_freelists[MAX_NUMNODES];
23static unsigned int nr_huge_pages_node[MAX_NUMNODES]; 23static unsigned int nr_huge_pages_node[MAX_NUMNODES];
24static unsigned int free_huge_pages_node[MAX_NUMNODES]; 24static unsigned int free_huge_pages_node[MAX_NUMNODES];
25
26/*
27 * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages
28 */
25static DEFINE_SPINLOCK(hugetlb_lock); 29static DEFINE_SPINLOCK(hugetlb_lock);
26 30
27static void enqueue_huge_page(struct page *page) 31static void enqueue_huge_page(struct page *page)
@@ -61,8 +65,10 @@ static struct page *alloc_fresh_huge_page(void)
61 HUGETLB_PAGE_ORDER); 65 HUGETLB_PAGE_ORDER);
62 nid = (nid + 1) % num_online_nodes(); 66 nid = (nid + 1) % num_online_nodes();
63 if (page) { 67 if (page) {
68 spin_lock(&hugetlb_lock);
64 nr_huge_pages++; 69 nr_huge_pages++;
65 nr_huge_pages_node[page_to_nid(page)]++; 70 nr_huge_pages_node[page_to_nid(page)]++;
71 spin_unlock(&hugetlb_lock);
66 } 72 }
67 return page; 73 return page;
68} 74}
diff --git a/mm/madvise.c b/mm/madvise.c
index 17aaf3e16449..2b7cf0400a21 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -126,7 +126,7 @@ static long madvise_dontneed(struct vm_area_struct * vma,
126 unsigned long start, unsigned long end) 126 unsigned long start, unsigned long end)
127{ 127{
128 *prev = vma; 128 *prev = vma;
129 if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_RESERVED)) 129 if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP))
130 return -EINVAL; 130 return -EINVAL;
131 131
132 if (unlikely(vma->vm_flags & VM_NONLINEAR)) { 132 if (unlikely(vma->vm_flags & VM_NONLINEAR)) {
diff --git a/mm/memory.c b/mm/memory.c
index 2998cfc12f5b..9ab206b829a2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -333,9 +333,9 @@ static inline void add_mm_rss(struct mm_struct *mm, int file_rss, int anon_rss)
333} 333}
334 334
335/* 335/*
336 * This function is called to print an error when a pte in a 336 * This function is called to print an error when a bad pte
337 * !VM_RESERVED region is found pointing to an invalid pfn (which 337 * is found. For example, we might have a PFN-mapped pte in
338 * is an error. 338 * a region that doesn't allow it.
339 * 339 *
340 * The calling function must still handle the error. 340 * The calling function must still handle the error.
341 */ 341 */
@@ -350,6 +350,59 @@ void print_bad_pte(struct vm_area_struct *vma, pte_t pte, unsigned long vaddr)
350} 350}
351 351
352/* 352/*
353 * This function gets the "struct page" associated with a pte.
354 *
355 * NOTE! Some mappings do not have "struct pages". A raw PFN mapping
356 * will have each page table entry just pointing to a raw page frame
357 * number, and as far as the VM layer is concerned, those do not have
358 * pages associated with them - even if the PFN might point to memory
359 * that otherwise is perfectly fine and has a "struct page".
360 *
361 * The way we recognize those mappings is through the rules set up
362 * by "remap_pfn_range()": the vma will have the VM_PFNMAP bit set,
363 * and the vm_pgoff will point to the first PFN mapped: thus every
364 * page that is a raw mapping will always honor the rule
365 *
366 * pfn_of_page == vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT)
367 *
368 * and if that isn't true, the page has been COW'ed (in which case it
369 * _does_ have a "struct page" associated with it even if it is in a
370 * VM_PFNMAP range).
371 */
372struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
373{
374 unsigned long pfn = pte_pfn(pte);
375
376 if (vma->vm_flags & VM_PFNMAP) {
377 unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT;
378 if (pfn == vma->vm_pgoff + off)
379 return NULL;
380 }
381
382 /*
383 * Add some anal sanity checks for now. Eventually,
384 * we should just do "return pfn_to_page(pfn)", but
385 * in the meantime we check that we get a valid pfn,
386 * and that the resulting page looks ok.
387 *
388 * Remove this test eventually!
389 */
390 if (unlikely(!pfn_valid(pfn))) {
391 print_bad_pte(vma, pte, addr);
392 return NULL;
393 }
394
395 /*
396 * NOTE! We still have PageReserved() pages in the page
397 * tables.
398 *
399 * The PAGE_ZERO() pages and various VDSO mappings can
400 * cause them to exist.
401 */
402 return pfn_to_page(pfn);
403}
404
405/*
353 * copy one vm_area from one task to the other. Assumes the page tables 406 * copy one vm_area from one task to the other. Assumes the page tables
354 * already present in the new task to be cleared in the whole range 407 * already present in the new task to be cleared in the whole range
355 * covered by this vma. 408 * covered by this vma.
@@ -363,7 +416,6 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
363 unsigned long vm_flags = vma->vm_flags; 416 unsigned long vm_flags = vma->vm_flags;
364 pte_t pte = *src_pte; 417 pte_t pte = *src_pte;
365 struct page *page; 418 struct page *page;
366 unsigned long pfn;
367 419
368 /* pte contains position in swap or file, so copy. */ 420 /* pte contains position in swap or file, so copy. */
369 if (unlikely(!pte_present(pte))) { 421 if (unlikely(!pte_present(pte))) {
@@ -381,23 +433,6 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
381 goto out_set_pte; 433 goto out_set_pte;
382 } 434 }
383 435
384 /* If the region is VM_RESERVED, the mapping is not
385 * mapped via rmap - duplicate the pte as is.
386 */
387 if (vm_flags & VM_RESERVED)
388 goto out_set_pte;
389
390 pfn = pte_pfn(pte);
391 /* If the pte points outside of valid memory but
392 * the region is not VM_RESERVED, we have a problem.
393 */
394 if (unlikely(!pfn_valid(pfn))) {
395 print_bad_pte(vma, pte, addr);
396 goto out_set_pte; /* try to do something sane */
397 }
398
399 page = pfn_to_page(pfn);
400
401 /* 436 /*
402 * If it's a COW mapping, write protect it both 437 * If it's a COW mapping, write protect it both
403 * in the parent and the child 438 * in the parent and the child
@@ -414,9 +449,13 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
414 if (vm_flags & VM_SHARED) 449 if (vm_flags & VM_SHARED)
415 pte = pte_mkclean(pte); 450 pte = pte_mkclean(pte);
416 pte = pte_mkold(pte); 451 pte = pte_mkold(pte);
417 get_page(page); 452
418 page_dup_rmap(page); 453 page = vm_normal_page(vma, addr, pte);
419 rss[!!PageAnon(page)]++; 454 if (page) {
455 get_page(page);
456 page_dup_rmap(page);
457 rss[!!PageAnon(page)]++;
458 }
420 459
421out_set_pte: 460out_set_pte:
422 set_pte_at(dst_mm, addr, dst_pte, pte); 461 set_pte_at(dst_mm, addr, dst_pte, pte);
@@ -528,7 +567,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
528 * readonly mappings. The tradeoff is that copy_page_range is more 567 * readonly mappings. The tradeoff is that copy_page_range is more
529 * efficient than faulting. 568 * efficient than faulting.
530 */ 569 */
531 if (!(vma->vm_flags & (VM_HUGETLB|VM_NONLINEAR|VM_RESERVED))) { 570 if (!(vma->vm_flags & (VM_HUGETLB|VM_NONLINEAR|VM_PFNMAP))) {
532 if (!vma->anon_vma) 571 if (!vma->anon_vma)
533 return 0; 572 return 0;
534 } 573 }
@@ -568,17 +607,11 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
568 continue; 607 continue;
569 } 608 }
570 if (pte_present(ptent)) { 609 if (pte_present(ptent)) {
571 struct page *page = NULL; 610 struct page *page;
572 611
573 (*zap_work) -= PAGE_SIZE; 612 (*zap_work) -= PAGE_SIZE;
574 613
575 if (!(vma->vm_flags & VM_RESERVED)) { 614 page = vm_normal_page(vma, addr, ptent);
576 unsigned long pfn = pte_pfn(ptent);
577 if (unlikely(!pfn_valid(pfn)))
578 print_bad_pte(vma, ptent, addr);
579 else
580 page = pfn_to_page(pfn);
581 }
582 if (unlikely(details) && page) { 615 if (unlikely(details) && page) {
583 /* 616 /*
584 * unmap_shared_mapping_pages() wants to 617 * unmap_shared_mapping_pages() wants to
@@ -834,7 +867,7 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
834/* 867/*
835 * Do a quick page-table lookup for a single page. 868 * Do a quick page-table lookup for a single page.
836 */ 869 */
837struct page *follow_page(struct mm_struct *mm, unsigned long address, 870struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
838 unsigned int flags) 871 unsigned int flags)
839{ 872{
840 pgd_t *pgd; 873 pgd_t *pgd;
@@ -842,8 +875,8 @@ struct page *follow_page(struct mm_struct *mm, unsigned long address,
842 pmd_t *pmd; 875 pmd_t *pmd;
843 pte_t *ptep, pte; 876 pte_t *ptep, pte;
844 spinlock_t *ptl; 877 spinlock_t *ptl;
845 unsigned long pfn;
846 struct page *page; 878 struct page *page;
879 struct mm_struct *mm = vma->vm_mm;
847 880
848 page = follow_huge_addr(mm, address, flags & FOLL_WRITE); 881 page = follow_huge_addr(mm, address, flags & FOLL_WRITE);
849 if (!IS_ERR(page)) { 882 if (!IS_ERR(page)) {
@@ -879,11 +912,10 @@ struct page *follow_page(struct mm_struct *mm, unsigned long address,
879 goto unlock; 912 goto unlock;
880 if ((flags & FOLL_WRITE) && !pte_write(pte)) 913 if ((flags & FOLL_WRITE) && !pte_write(pte))
881 goto unlock; 914 goto unlock;
882 pfn = pte_pfn(pte); 915 page = vm_normal_page(vma, address, pte);
883 if (!pfn_valid(pfn)) 916 if (unlikely(!page))
884 goto unlock; 917 goto unlock;
885 918
886 page = pfn_to_page(pfn);
887 if (flags & FOLL_GET) 919 if (flags & FOLL_GET)
888 get_page(page); 920 get_page(page);
889 if (flags & FOLL_TOUCH) { 921 if (flags & FOLL_TOUCH) {
@@ -956,8 +988,10 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
956 return i ? : -EFAULT; 988 return i ? : -EFAULT;
957 } 989 }
958 if (pages) { 990 if (pages) {
959 pages[i] = pte_page(*pte); 991 struct page *page = vm_normal_page(vma, start, *pte);
960 get_page(pages[i]); 992 pages[i] = page;
993 if (page)
994 get_page(page);
961 } 995 }
962 pte_unmap(pte); 996 pte_unmap(pte);
963 if (vmas) 997 if (vmas)
@@ -968,7 +1002,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
968 continue; 1002 continue;
969 } 1003 }
970 1004
971 if (!vma || (vma->vm_flags & (VM_IO | VM_RESERVED)) 1005 if (!vma || (vma->vm_flags & VM_IO)
972 || !(vm_flags & vma->vm_flags)) 1006 || !(vm_flags & vma->vm_flags))
973 return i ? : -EFAULT; 1007 return i ? : -EFAULT;
974 1008
@@ -992,7 +1026,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
992 foll_flags |= FOLL_WRITE; 1026 foll_flags |= FOLL_WRITE;
993 1027
994 cond_resched(); 1028 cond_resched();
995 while (!(page = follow_page(mm, start, foll_flags))) { 1029 while (!(page = follow_page(vma, start, foll_flags))) {
996 int ret; 1030 int ret;
997 ret = __handle_mm_fault(mm, vma, start, 1031 ret = __handle_mm_fault(mm, vma, start,
998 foll_flags & FOLL_WRITE); 1032 foll_flags & FOLL_WRITE);
@@ -1191,10 +1225,17 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
1191 * rest of the world about it: 1225 * rest of the world about it:
1192 * VM_IO tells people not to look at these pages 1226 * VM_IO tells people not to look at these pages
1193 * (accesses can have side effects). 1227 * (accesses can have side effects).
1194 * VM_RESERVED tells the core MM not to "manage" these pages 1228 * VM_RESERVED is specified all over the place, because
1195 * (e.g. refcount, mapcount, try to swap them out). 1229 * in 2.4 it kept swapout's vma scan off this vma; but
1230 * in 2.6 the LRU scan won't even find its pages, so this
1231 * flag means no more than count its pages in reserved_vm,
1232 * and omit it from core dump, even when VM_IO turned off.
1233 * VM_PFNMAP tells the core MM that the base pages are just
1234 * raw PFN mappings, and do not have a "struct page" associated
1235 * with them.
1196 */ 1236 */
1197 vma->vm_flags |= VM_IO | VM_RESERVED; 1237 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
1238 vma->vm_pgoff = pfn;
1198 1239
1199 BUG_ON(addr >= end); 1240 BUG_ON(addr >= end);
1200 pfn -= addr >> PAGE_SHIFT; 1241 pfn -= addr >> PAGE_SHIFT;
@@ -1249,6 +1290,26 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
1249 return pte; 1290 return pte;
1250} 1291}
1251 1292
1293static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va)
1294{
1295 /*
1296 * If the source page was a PFN mapping, we don't have
1297 * a "struct page" for it. We do a best-effort copy by
1298 * just copying from the original user address. If that
1299 * fails, we just zero-fill it. Live with it.
1300 */
1301 if (unlikely(!src)) {
1302 void *kaddr = kmap_atomic(dst, KM_USER0);
1303 unsigned long left = __copy_from_user_inatomic(kaddr, (void __user *)va, PAGE_SIZE);
1304 if (left)
1305 memset(kaddr, 0, PAGE_SIZE);
1306 kunmap_atomic(kaddr, KM_USER0);
1307 return;
1308
1309 }
1310 copy_user_highpage(dst, src, va);
1311}
1312
1252/* 1313/*
1253 * This routine handles present pages, when users try to write 1314 * This routine handles present pages, when users try to write
1254 * to a shared page. It is done by copying the page to a new address 1315 * to a shared page. It is done by copying the page to a new address
@@ -1271,22 +1332,14 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1271 unsigned long address, pte_t *page_table, pmd_t *pmd, 1332 unsigned long address, pte_t *page_table, pmd_t *pmd,
1272 spinlock_t *ptl, pte_t orig_pte) 1333 spinlock_t *ptl, pte_t orig_pte)
1273{ 1334{
1274 struct page *old_page, *new_page; 1335 struct page *old_page, *src_page, *new_page;
1275 unsigned long pfn = pte_pfn(orig_pte);
1276 pte_t entry; 1336 pte_t entry;
1277 int ret = VM_FAULT_MINOR; 1337 int ret = VM_FAULT_MINOR;
1278 1338
1279 BUG_ON(vma->vm_flags & VM_RESERVED); 1339 old_page = vm_normal_page(vma, address, orig_pte);
1280 1340 src_page = old_page;
1281 if (unlikely(!pfn_valid(pfn))) { 1341 if (!old_page)
1282 /* 1342 goto gotten;
1283 * Page table corrupted: show pte and kill process.
1284 */
1285 print_bad_pte(vma, orig_pte, address);
1286 ret = VM_FAULT_OOM;
1287 goto unlock;
1288 }
1289 old_page = pfn_to_page(pfn);
1290 1343
1291 if (PageAnon(old_page) && !TestSetPageLocked(old_page)) { 1344 if (PageAnon(old_page) && !TestSetPageLocked(old_page)) {
1292 int reuse = can_share_swap_page(old_page); 1345 int reuse = can_share_swap_page(old_page);
@@ -1307,11 +1360,12 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1307 * Ok, we need to copy. Oh, well.. 1360 * Ok, we need to copy. Oh, well..
1308 */ 1361 */
1309 page_cache_get(old_page); 1362 page_cache_get(old_page);
1363gotten:
1310 pte_unmap_unlock(page_table, ptl); 1364 pte_unmap_unlock(page_table, ptl);
1311 1365
1312 if (unlikely(anon_vma_prepare(vma))) 1366 if (unlikely(anon_vma_prepare(vma)))
1313 goto oom; 1367 goto oom;
1314 if (old_page == ZERO_PAGE(address)) { 1368 if (src_page == ZERO_PAGE(address)) {
1315 new_page = alloc_zeroed_user_highpage(vma, address); 1369 new_page = alloc_zeroed_user_highpage(vma, address);
1316 if (!new_page) 1370 if (!new_page)
1317 goto oom; 1371 goto oom;
@@ -1319,7 +1373,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1319 new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); 1373 new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
1320 if (!new_page) 1374 if (!new_page)
1321 goto oom; 1375 goto oom;
1322 copy_user_highpage(new_page, old_page, address); 1376 cow_user_page(new_page, src_page, address);
1323 } 1377 }
1324 1378
1325 /* 1379 /*
@@ -1327,11 +1381,14 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1327 */ 1381 */
1328 page_table = pte_offset_map_lock(mm, pmd, address, &ptl); 1382 page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
1329 if (likely(pte_same(*page_table, orig_pte))) { 1383 if (likely(pte_same(*page_table, orig_pte))) {
1330 page_remove_rmap(old_page); 1384 if (old_page) {
1331 if (!PageAnon(old_page)) { 1385 page_remove_rmap(old_page);
1386 if (!PageAnon(old_page)) {
1387 dec_mm_counter(mm, file_rss);
1388 inc_mm_counter(mm, anon_rss);
1389 }
1390 } else
1332 inc_mm_counter(mm, anon_rss); 1391 inc_mm_counter(mm, anon_rss);
1333 dec_mm_counter(mm, file_rss);
1334 }
1335 flush_cache_page(vma, address, pfn); 1392 flush_cache_page(vma, address, pfn);
1336 entry = mk_pte(new_page, vma->vm_page_prot); 1393 entry = mk_pte(new_page, vma->vm_page_prot);
1337 entry = maybe_mkwrite(pte_mkdirty(entry), vma); 1394 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
@@ -1345,13 +1402,16 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1345 new_page = old_page; 1402 new_page = old_page;
1346 ret |= VM_FAULT_WRITE; 1403 ret |= VM_FAULT_WRITE;
1347 } 1404 }
1348 page_cache_release(new_page); 1405 if (new_page)
1349 page_cache_release(old_page); 1406 page_cache_release(new_page);
1407 if (old_page)
1408 page_cache_release(old_page);
1350unlock: 1409unlock:
1351 pte_unmap_unlock(page_table, ptl); 1410 pte_unmap_unlock(page_table, ptl);
1352 return ret; 1411 return ret;
1353oom: 1412oom:
1354 page_cache_release(old_page); 1413 if (old_page)
1414 page_cache_release(old_page);
1355 return VM_FAULT_OOM; 1415 return VM_FAULT_OOM;
1356} 1416}
1357 1417
@@ -1849,7 +1909,6 @@ static int do_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
1849 int anon = 0; 1909 int anon = 0;
1850 1910
1851 pte_unmap(page_table); 1911 pte_unmap(page_table);
1852
1853 if (vma->vm_file) { 1912 if (vma->vm_file) {
1854 mapping = vma->vm_file->f_mapping; 1913 mapping = vma->vm_file->f_mapping;
1855 sequence = mapping->truncate_count; 1914 sequence = mapping->truncate_count;
@@ -1882,7 +1941,7 @@ retry:
1882 page = alloc_page_vma(GFP_HIGHUSER, vma, address); 1941 page = alloc_page_vma(GFP_HIGHUSER, vma, address);
1883 if (!page) 1942 if (!page)
1884 goto oom; 1943 goto oom;
1885 copy_user_highpage(page, new_page, address); 1944 cow_user_page(page, new_page, address);
1886 page_cache_release(new_page); 1945 page_cache_release(new_page);
1887 new_page = page; 1946 new_page = page;
1888 anon = 1; 1947 anon = 1;
@@ -1924,7 +1983,7 @@ retry:
1924 inc_mm_counter(mm, anon_rss); 1983 inc_mm_counter(mm, anon_rss);
1925 lru_cache_add_active(new_page); 1984 lru_cache_add_active(new_page);
1926 page_add_anon_rmap(new_page, vma, address); 1985 page_add_anon_rmap(new_page, vma, address);
1927 } else if (!(vma->vm_flags & VM_RESERVED)) { 1986 } else {
1928 inc_mm_counter(mm, file_rss); 1987 inc_mm_counter(mm, file_rss);
1929 page_add_file_rmap(new_page); 1988 page_add_file_rmap(new_page);
1930 } 1989 }
@@ -2101,6 +2160,12 @@ int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
2101 spin_unlock(&mm->page_table_lock); 2160 spin_unlock(&mm->page_table_lock);
2102 return 0; 2161 return 0;
2103} 2162}
2163#else
2164/* Workaround for gcc 2.96 */
2165int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
2166{
2167 return 0;
2168}
2104#endif /* __PAGETABLE_PUD_FOLDED */ 2169#endif /* __PAGETABLE_PUD_FOLDED */
2105 2170
2106#ifndef __PAGETABLE_PMD_FOLDED 2171#ifndef __PAGETABLE_PMD_FOLDED
@@ -2129,6 +2194,12 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
2129 spin_unlock(&mm->page_table_lock); 2194 spin_unlock(&mm->page_table_lock);
2130 return 0; 2195 return 0;
2131} 2196}
2197#else
2198/* Workaround for gcc 2.96 */
2199int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
2200{
2201 return 0;
2202}
2132#endif /* __PAGETABLE_PMD_FOLDED */ 2203#endif /* __PAGETABLE_PMD_FOLDED */
2133 2204
2134int make_pages_present(unsigned long addr, unsigned long end) 2205int make_pages_present(unsigned long addr, unsigned long end)
@@ -2203,7 +2274,7 @@ static int __init gate_vma_init(void)
2203 gate_vma.vm_start = FIXADDR_USER_START; 2274 gate_vma.vm_start = FIXADDR_USER_START;
2204 gate_vma.vm_end = FIXADDR_USER_END; 2275 gate_vma.vm_end = FIXADDR_USER_END;
2205 gate_vma.vm_page_prot = PAGE_READONLY; 2276 gate_vma.vm_page_prot = PAGE_READONLY;
2206 gate_vma.vm_flags = VM_RESERVED; 2277 gate_vma.vm_flags = 0;
2207 return 0; 2278 return 0;
2208} 2279}
2209__initcall(gate_vma_init); 2280__initcall(gate_vma_init);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 5abc57c2b8bd..bec88c81244e 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -189,17 +189,15 @@ static int check_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
189 189
190 orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); 190 orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
191 do { 191 do {
192 unsigned long pfn; 192 struct page *page;
193 unsigned int nid; 193 unsigned int nid;
194 194
195 if (!pte_present(*pte)) 195 if (!pte_present(*pte))
196 continue; 196 continue;
197 pfn = pte_pfn(*pte); 197 page = vm_normal_page(vma, addr, *pte);
198 if (!pfn_valid(pfn)) { 198 if (!page)
199 print_bad_pte(vma, *pte, addr);
200 continue; 199 continue;
201 } 200 nid = page_to_nid(page);
202 nid = pfn_to_nid(pfn);
203 if (!node_isset(nid, *nodes)) 201 if (!node_isset(nid, *nodes))
204 break; 202 break;
205 } while (pte++, addr += PAGE_SIZE, addr != end); 203 } while (pte++, addr += PAGE_SIZE, addr != end);
@@ -269,8 +267,6 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
269 first = find_vma(mm, start); 267 first = find_vma(mm, start);
270 if (!first) 268 if (!first)
271 return ERR_PTR(-EFAULT); 269 return ERR_PTR(-EFAULT);
272 if (first->vm_flags & VM_RESERVED)
273 return ERR_PTR(-EACCES);
274 prev = NULL; 270 prev = NULL;
275 for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) { 271 for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
276 if (!vma->vm_next && vma->vm_end < end) 272 if (!vma->vm_next && vma->vm_end < end)
diff --git a/mm/mmap.c b/mm/mmap.c
index 4f8def03428c..11ca5927d5ff 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1076,17 +1076,6 @@ munmap_back:
1076 error = file->f_op->mmap(file, vma); 1076 error = file->f_op->mmap(file, vma);
1077 if (error) 1077 if (error)
1078 goto unmap_and_free_vma; 1078 goto unmap_and_free_vma;
1079 if ((vma->vm_flags & (VM_SHARED | VM_WRITE | VM_RESERVED))
1080 == (VM_WRITE | VM_RESERVED)) {
1081 printk(KERN_WARNING "program %s is using MAP_PRIVATE, "
1082 "PROT_WRITE mmap of VM_RESERVED memory, which "
1083 "is deprecated. Please report this to "
1084 "linux-kernel@vger.kernel.org\n",current->comm);
1085 if (vma->vm_ops && vma->vm_ops->close)
1086 vma->vm_ops->close(vma);
1087 error = -EACCES;
1088 goto unmap_and_free_vma;
1089 }
1090 } else if (vm_flags & VM_SHARED) { 1079 } else if (vm_flags & VM_SHARED) {
1091 error = shmem_zero_setup(vma); 1080 error = shmem_zero_setup(vma);
1092 if (error) 1081 if (error)
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 17a2b52b753b..653b8571c1ed 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -124,14 +124,6 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
124 * a MAP_NORESERVE private mapping to writable will now reserve. 124 * a MAP_NORESERVE private mapping to writable will now reserve.
125 */ 125 */
126 if (newflags & VM_WRITE) { 126 if (newflags & VM_WRITE) {
127 if (oldflags & VM_RESERVED) {
128 BUG_ON(oldflags & VM_WRITE);
129 printk(KERN_WARNING "program %s is using MAP_PRIVATE, "
130 "PROT_WRITE mprotect of VM_RESERVED memory, "
131 "which is deprecated. Please report this to "
132 "linux-kernel@vger.kernel.org\n",current->comm);
133 return -EACCES;
134 }
135 if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) { 127 if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) {
136 charged = nrpages; 128 charged = nrpages;
137 if (security_vm_enough_memory(charged)) 129 if (security_vm_enough_memory(charged))
diff --git a/mm/msync.c b/mm/msync.c
index 0e040e9c39d8..1b5b6f662dcf 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -27,7 +27,6 @@ static void msync_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
27again: 27again:
28 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); 28 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
29 do { 29 do {
30 unsigned long pfn;
31 struct page *page; 30 struct page *page;
32 31
33 if (progress >= 64) { 32 if (progress >= 64) {
@@ -40,13 +39,9 @@ again:
40 continue; 39 continue;
41 if (!pte_maybe_dirty(*pte)) 40 if (!pte_maybe_dirty(*pte))
42 continue; 41 continue;
43 pfn = pte_pfn(*pte); 42 page = vm_normal_page(vma, addr, *pte);
44 if (unlikely(!pfn_valid(pfn))) { 43 if (!page)
45 print_bad_pte(vma, *pte, addr);
46 continue; 44 continue;
47 }
48 page = pfn_to_page(pfn);
49
50 if (ptep_clear_flush_dirty(vma, addr, pte) || 45 if (ptep_clear_flush_dirty(vma, addr, pte) ||
51 page_test_and_clear_dirty(page)) 46 page_test_and_clear_dirty(page))
52 set_page_dirty(page); 47 set_page_dirty(page);
@@ -97,9 +92,8 @@ static void msync_page_range(struct vm_area_struct *vma,
97 /* For hugepages we can't go walking the page table normally, 92 /* For hugepages we can't go walking the page table normally,
98 * but that's ok, hugetlbfs is memory based, so we don't need 93 * but that's ok, hugetlbfs is memory based, so we don't need
99 * to do anything more on an msync(). 94 * to do anything more on an msync().
100 * Can't do anything with VM_RESERVED regions either.
101 */ 95 */
102 if (vma->vm_flags & (VM_HUGETLB|VM_RESERVED)) 96 if (vma->vm_flags & VM_HUGETLB)
103 return; 97 return;
104 98
105 BUG_ON(addr >= end); 99 BUG_ON(addr >= end);
diff --git a/mm/nommu.c b/mm/nommu.c
index 6deb6ab3d6ad..c1196812876b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1045,7 +1045,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
1045 1045
1046EXPORT_SYMBOL(find_vma); 1046EXPORT_SYMBOL(find_vma);
1047 1047
1048struct page *follow_page(struct mm_struct *mm, unsigned long address, 1048struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
1049 unsigned int foll_flags) 1049 unsigned int foll_flags)
1050{ 1050{
1051 return NULL; 1051 return NULL;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bd4de592dc23..b257720edfc8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -140,18 +140,13 @@ static void bad_page(const char *function, struct page *page)
140 1 << PG_reclaim | 140 1 << PG_reclaim |
141 1 << PG_slab | 141 1 << PG_slab |
142 1 << PG_swapcache | 142 1 << PG_swapcache |
143 1 << PG_writeback | 143 1 << PG_writeback );
144 1 << PG_reserved );
145 set_page_count(page, 0); 144 set_page_count(page, 0);
146 reset_page_mapcount(page); 145 reset_page_mapcount(page);
147 page->mapping = NULL; 146 page->mapping = NULL;
148 add_taint(TAINT_BAD_PAGE); 147 add_taint(TAINT_BAD_PAGE);
149} 148}
150 149
151#ifndef CONFIG_HUGETLB_PAGE
152#define prep_compound_page(page, order) do { } while (0)
153#define destroy_compound_page(page, order) do { } while (0)
154#else
155/* 150/*
156 * Higher-order pages are called "compound pages". They are structured thusly: 151 * Higher-order pages are called "compound pages". They are structured thusly:
157 * 152 *
@@ -205,7 +200,6 @@ static void destroy_compound_page(struct page *page, unsigned long order)
205 ClearPageCompound(p); 200 ClearPageCompound(p);
206 } 201 }
207} 202}
208#endif /* CONFIG_HUGETLB_PAGE */
209 203
210/* 204/*
211 * function for dealing with page's order in buddy system. 205 * function for dealing with page's order in buddy system.
@@ -340,7 +334,7 @@ static inline void __free_pages_bulk (struct page *page,
340 zone->free_area[order].nr_free++; 334 zone->free_area[order].nr_free++;
341} 335}
342 336
343static inline void free_pages_check(const char *function, struct page *page) 337static inline int free_pages_check(const char *function, struct page *page)
344{ 338{
345 if ( page_mapcount(page) || 339 if ( page_mapcount(page) ||
346 page->mapping != NULL || 340 page->mapping != NULL ||
@@ -358,6 +352,12 @@ static inline void free_pages_check(const char *function, struct page *page)
358 bad_page(function, page); 352 bad_page(function, page);
359 if (PageDirty(page)) 353 if (PageDirty(page))
360 __ClearPageDirty(page); 354 __ClearPageDirty(page);
355 /*
356 * For now, we report if PG_reserved was found set, but do not
357 * clear it, and do not free the page. But we shall soon need
358 * to do more, for when the ZERO_PAGE count wraps negative.
359 */
360 return PageReserved(page);
361} 361}
362 362
363/* 363/*
@@ -397,11 +397,10 @@ void __free_pages_ok(struct page *page, unsigned int order)
397{ 397{
398 LIST_HEAD(list); 398 LIST_HEAD(list);
399 int i; 399 int i;
400 int reserved = 0;
400 401
401 arch_free_page(page, order); 402 arch_free_page(page, order);
402 403
403 mod_page_state(pgfree, 1 << order);
404
405#ifndef CONFIG_MMU 404#ifndef CONFIG_MMU
406 if (order > 0) 405 if (order > 0)
407 for (i = 1 ; i < (1 << order) ; ++i) 406 for (i = 1 ; i < (1 << order) ; ++i)
@@ -409,8 +408,12 @@ void __free_pages_ok(struct page *page, unsigned int order)
409#endif 408#endif
410 409
411 for (i = 0 ; i < (1 << order) ; ++i) 410 for (i = 0 ; i < (1 << order) ; ++i)
412 free_pages_check(__FUNCTION__, page + i); 411 reserved += free_pages_check(__FUNCTION__, page + i);
412 if (reserved)
413 return;
414
413 list_add(&page->lru, &list); 415 list_add(&page->lru, &list);
416 mod_page_state(pgfree, 1 << order);
414 kernel_map_pages(page, 1<<order, 0); 417 kernel_map_pages(page, 1<<order, 0);
415 free_pages_bulk(page_zone(page), 1, &list, order); 418 free_pages_bulk(page_zone(page), 1, &list, order);
416} 419}
@@ -468,7 +471,7 @@ void set_page_refs(struct page *page, int order)
468/* 471/*
469 * This page is about to be returned from the page allocator 472 * This page is about to be returned from the page allocator
470 */ 473 */
471static void prep_new_page(struct page *page, int order) 474static int prep_new_page(struct page *page, int order)
472{ 475{
473 if ( page_mapcount(page) || 476 if ( page_mapcount(page) ||
474 page->mapping != NULL || 477 page->mapping != NULL ||
@@ -486,12 +489,20 @@ static void prep_new_page(struct page *page, int order)
486 1 << PG_reserved ))) 489 1 << PG_reserved )))
487 bad_page(__FUNCTION__, page); 490 bad_page(__FUNCTION__, page);
488 491
492 /*
493 * For now, we report if PG_reserved was found set, but do not
494 * clear it, and do not allocate the page: as a safety net.
495 */
496 if (PageReserved(page))
497 return 1;
498
489 page->flags &= ~(1 << PG_uptodate | 1 << PG_error | 499 page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
490 1 << PG_referenced | 1 << PG_arch_1 | 500 1 << PG_referenced | 1 << PG_arch_1 |
491 1 << PG_checked | 1 << PG_mappedtodisk); 501 1 << PG_checked | 1 << PG_mappedtodisk);
492 set_page_private(page, 0); 502 set_page_private(page, 0);
493 set_page_refs(page, order); 503 set_page_refs(page, order);
494 kernel_map_pages(page, 1 << order, 1); 504 kernel_map_pages(page, 1 << order, 1);
505 return 0;
495} 506}
496 507
497/* 508/*
@@ -674,11 +685,14 @@ static void fastcall free_hot_cold_page(struct page *page, int cold)
674 685
675 arch_free_page(page, 0); 686 arch_free_page(page, 0);
676 687
677 kernel_map_pages(page, 1, 0);
678 inc_page_state(pgfree);
679 if (PageAnon(page)) 688 if (PageAnon(page))
680 page->mapping = NULL; 689 page->mapping = NULL;
681 free_pages_check(__FUNCTION__, page); 690 if (free_pages_check(__FUNCTION__, page))
691 return;
692
693 inc_page_state(pgfree);
694 kernel_map_pages(page, 1, 0);
695
682 pcp = &zone_pcp(zone, get_cpu())->pcp[cold]; 696 pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
683 local_irq_save(flags); 697 local_irq_save(flags);
684 list_add(&page->lru, &pcp->list); 698 list_add(&page->lru, &pcp->list);
@@ -717,12 +731,14 @@ static struct page *
717buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags) 731buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags)
718{ 732{
719 unsigned long flags; 733 unsigned long flags;
720 struct page *page = NULL; 734 struct page *page;
721 int cold = !!(gfp_flags & __GFP_COLD); 735 int cold = !!(gfp_flags & __GFP_COLD);
722 736
737again:
723 if (order == 0) { 738 if (order == 0) {
724 struct per_cpu_pages *pcp; 739 struct per_cpu_pages *pcp;
725 740
741 page = NULL;
726 pcp = &zone_pcp(zone, get_cpu())->pcp[cold]; 742 pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
727 local_irq_save(flags); 743 local_irq_save(flags);
728 if (pcp->count <= pcp->low) 744 if (pcp->count <= pcp->low)
@@ -744,7 +760,8 @@ buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags)
744 if (page != NULL) { 760 if (page != NULL) {
745 BUG_ON(bad_range(zone, page)); 761 BUG_ON(bad_range(zone, page));
746 mod_page_state_zone(zone, pgalloc, 1 << order); 762 mod_page_state_zone(zone, pgalloc, 1 << order);
747 prep_new_page(page, order); 763 if (prep_new_page(page, order))
764 goto again;
748 765
749 if (gfp_flags & __GFP_ZERO) 766 if (gfp_flags & __GFP_ZERO)
750 prep_zero_page(page, order, gfp_flags); 767 prep_zero_page(page, order, gfp_flags);
@@ -756,9 +773,12 @@ buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags)
756} 773}
757 774
758#define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */ 775#define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */
759#define ALLOC_HARDER 0x02 /* try to alloc harder */ 776#define ALLOC_WMARK_MIN 0x02 /* use pages_min watermark */
760#define ALLOC_HIGH 0x04 /* __GFP_HIGH set */ 777#define ALLOC_WMARK_LOW 0x04 /* use pages_low watermark */
761#define ALLOC_CPUSET 0x08 /* check for correct cpuset */ 778#define ALLOC_WMARK_HIGH 0x08 /* use pages_high watermark */
779#define ALLOC_HARDER 0x10 /* try to alloc harder */
780#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */
781#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
762 782
763/* 783/*
764 * Return 1 if free pages are above 'mark'. This takes into account the order 784 * Return 1 if free pages are above 'mark'. This takes into account the order
@@ -813,7 +833,14 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order,
813 continue; 833 continue;
814 834
815 if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { 835 if (!(alloc_flags & ALLOC_NO_WATERMARKS)) {
816 if (!zone_watermark_ok(*z, order, (*z)->pages_low, 836 unsigned long mark;
837 if (alloc_flags & ALLOC_WMARK_MIN)
838 mark = (*z)->pages_min;
839 else if (alloc_flags & ALLOC_WMARK_LOW)
840 mark = (*z)->pages_low;
841 else
842 mark = (*z)->pages_high;
843 if (!zone_watermark_ok(*z, order, mark,
817 classzone_idx, alloc_flags)) 844 classzone_idx, alloc_flags))
818 continue; 845 continue;
819 } 846 }
@@ -854,7 +881,7 @@ restart:
854 } 881 }
855 882
856 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, 883 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order,
857 zonelist, ALLOC_CPUSET); 884 zonelist, ALLOC_WMARK_LOW|ALLOC_CPUSET);
858 if (page) 885 if (page)
859 goto got_pg; 886 goto got_pg;
860 887
@@ -871,7 +898,7 @@ restart:
871 * cannot run direct reclaim, or if the caller has realtime scheduling 898 * cannot run direct reclaim, or if the caller has realtime scheduling
872 * policy. 899 * policy.
873 */ 900 */
874 alloc_flags = 0; 901 alloc_flags = ALLOC_WMARK_MIN;
875 if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) 902 if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait)
876 alloc_flags |= ALLOC_HARDER; 903 alloc_flags |= ALLOC_HARDER;
877 if (gfp_mask & __GFP_HIGH) 904 if (gfp_mask & __GFP_HIGH)
@@ -942,7 +969,7 @@ rebalance:
942 * under heavy pressure. 969 * under heavy pressure.
943 */ 970 */
944 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, 971 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order,
945 zonelist, ALLOC_CPUSET); 972 zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET);
946 if (page) 973 if (page)
947 goto got_pg; 974 goto got_pg;
948 975
diff --git a/mm/rmap.c b/mm/rmap.c
index 914d04b98bee..491ac350048f 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -225,7 +225,7 @@ vma_address(struct page *page, struct vm_area_struct *vma)
225 225
226/* 226/*
227 * At what user virtual address is page expected in vma? checking that the 227 * At what user virtual address is page expected in vma? checking that the
228 * page matches the vma: currently only used by unuse_process, on anon pages. 228 * page matches the vma: currently only used on anon pages, by unuse_vma;
229 */ 229 */
230unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) 230unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
231{ 231{
@@ -234,7 +234,8 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
234 (void *)page->mapping - PAGE_MAPPING_ANON) 234 (void *)page->mapping - PAGE_MAPPING_ANON)
235 return -EFAULT; 235 return -EFAULT;
236 } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { 236 } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) {
237 if (vma->vm_file->f_mapping != page->mapping) 237 if (!vma->vm_file ||
238 vma->vm_file->f_mapping != page->mapping)
238 return -EFAULT; 239 return -EFAULT;
239 } else 240 } else
240 return -EFAULT; 241 return -EFAULT;
@@ -289,7 +290,7 @@ pte_t *page_check_address(struct page *page, struct mm_struct *mm,
289 * repeatedly from either page_referenced_anon or page_referenced_file. 290 * repeatedly from either page_referenced_anon or page_referenced_file.
290 */ 291 */
291static int page_referenced_one(struct page *page, 292static int page_referenced_one(struct page *page,
292 struct vm_area_struct *vma, unsigned int *mapcount, int ignore_token) 293 struct vm_area_struct *vma, unsigned int *mapcount)
293{ 294{
294 struct mm_struct *mm = vma->vm_mm; 295 struct mm_struct *mm = vma->vm_mm;
295 unsigned long address; 296 unsigned long address;
@@ -310,7 +311,7 @@ static int page_referenced_one(struct page *page,
310 311
311 /* Pretend the page is referenced if the task has the 312 /* Pretend the page is referenced if the task has the
312 swap token and is in the middle of a page fault. */ 313 swap token and is in the middle of a page fault. */
313 if (mm != current->mm && !ignore_token && has_swap_token(mm) && 314 if (mm != current->mm && has_swap_token(mm) &&
314 rwsem_is_locked(&mm->mmap_sem)) 315 rwsem_is_locked(&mm->mmap_sem))
315 referenced++; 316 referenced++;
316 317
@@ -320,7 +321,7 @@ out:
320 return referenced; 321 return referenced;
321} 322}
322 323
323static int page_referenced_anon(struct page *page, int ignore_token) 324static int page_referenced_anon(struct page *page)
324{ 325{
325 unsigned int mapcount; 326 unsigned int mapcount;
326 struct anon_vma *anon_vma; 327 struct anon_vma *anon_vma;
@@ -333,8 +334,7 @@ static int page_referenced_anon(struct page *page, int ignore_token)
333 334
334 mapcount = page_mapcount(page); 335 mapcount = page_mapcount(page);
335 list_for_each_entry(vma, &anon_vma->head, anon_vma_node) { 336 list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
336 referenced += page_referenced_one(page, vma, &mapcount, 337 referenced += page_referenced_one(page, vma, &mapcount);
337 ignore_token);
338 if (!mapcount) 338 if (!mapcount)
339 break; 339 break;
340 } 340 }
@@ -353,7 +353,7 @@ static int page_referenced_anon(struct page *page, int ignore_token)
353 * 353 *
354 * This function is only called from page_referenced for object-based pages. 354 * This function is only called from page_referenced for object-based pages.
355 */ 355 */
356static int page_referenced_file(struct page *page, int ignore_token) 356static int page_referenced_file(struct page *page)
357{ 357{
358 unsigned int mapcount; 358 unsigned int mapcount;
359 struct address_space *mapping = page->mapping; 359 struct address_space *mapping = page->mapping;
@@ -391,8 +391,7 @@ static int page_referenced_file(struct page *page, int ignore_token)
391 referenced++; 391 referenced++;
392 break; 392 break;
393 } 393 }
394 referenced += page_referenced_one(page, vma, &mapcount, 394 referenced += page_referenced_one(page, vma, &mapcount);
395 ignore_token);
396 if (!mapcount) 395 if (!mapcount)
397 break; 396 break;
398 } 397 }
@@ -409,13 +408,10 @@ static int page_referenced_file(struct page *page, int ignore_token)
409 * Quick test_and_clear_referenced for all mappings to a page, 408 * Quick test_and_clear_referenced for all mappings to a page,
410 * returns the number of ptes which referenced the page. 409 * returns the number of ptes which referenced the page.
411 */ 410 */
412int page_referenced(struct page *page, int is_locked, int ignore_token) 411int page_referenced(struct page *page, int is_locked)
413{ 412{
414 int referenced = 0; 413 int referenced = 0;
415 414
416 if (!swap_token_default_timeout)
417 ignore_token = 1;
418
419 if (page_test_and_clear_young(page)) 415 if (page_test_and_clear_young(page))
420 referenced++; 416 referenced++;
421 417
@@ -424,15 +420,14 @@ int page_referenced(struct page *page, int is_locked, int ignore_token)
424 420
425 if (page_mapped(page) && page->mapping) { 421 if (page_mapped(page) && page->mapping) {
426 if (PageAnon(page)) 422 if (PageAnon(page))
427 referenced += page_referenced_anon(page, ignore_token); 423 referenced += page_referenced_anon(page);
428 else if (is_locked) 424 else if (is_locked)
429 referenced += page_referenced_file(page, ignore_token); 425 referenced += page_referenced_file(page);
430 else if (TestSetPageLocked(page)) 426 else if (TestSetPageLocked(page))
431 referenced++; 427 referenced++;
432 else { 428 else {
433 if (page->mapping) 429 if (page->mapping)
434 referenced += page_referenced_file(page, 430 referenced += page_referenced_file(page);
435 ignore_token);
436 unlock_page(page); 431 unlock_page(page);
437 } 432 }
438 } 433 }
@@ -529,10 +524,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma)
529 * If the page is mlock()d, we cannot swap it out. 524 * If the page is mlock()d, we cannot swap it out.
530 * If it's recently referenced (perhaps page_referenced 525 * If it's recently referenced (perhaps page_referenced
531 * skipped over this mm) then we should reactivate it. 526 * skipped over this mm) then we should reactivate it.
532 *
533 * Pages belonging to VM_RESERVED regions should not happen here.
534 */ 527 */
535 if ((vma->vm_flags & (VM_LOCKED|VM_RESERVED)) || 528 if ((vma->vm_flags & VM_LOCKED) ||
536 ptep_clear_flush_young(vma, address, pte)) { 529 ptep_clear_flush_young(vma, address, pte)) {
537 ret = SWAP_FAIL; 530 ret = SWAP_FAIL;
538 goto out_unmap; 531 goto out_unmap;
@@ -613,7 +606,6 @@ static void try_to_unmap_cluster(unsigned long cursor,
613 struct page *page; 606 struct page *page;
614 unsigned long address; 607 unsigned long address;
615 unsigned long end; 608 unsigned long end;
616 unsigned long pfn;
617 609
618 address = (vma->vm_start + cursor) & CLUSTER_MASK; 610 address = (vma->vm_start + cursor) & CLUSTER_MASK;
619 end = address + CLUSTER_SIZE; 611 end = address + CLUSTER_SIZE;
@@ -642,15 +634,8 @@ static void try_to_unmap_cluster(unsigned long cursor,
642 for (; address < end; pte++, address += PAGE_SIZE) { 634 for (; address < end; pte++, address += PAGE_SIZE) {
643 if (!pte_present(*pte)) 635 if (!pte_present(*pte))
644 continue; 636 continue;
645 637 page = vm_normal_page(vma, address, *pte);
646 pfn = pte_pfn(*pte); 638 BUG_ON(!page || PageAnon(page));
647 if (unlikely(!pfn_valid(pfn))) {
648 print_bad_pte(vma, *pte, address);
649 continue;
650 }
651
652 page = pfn_to_page(pfn);
653 BUG_ON(PageAnon(page));
654 639
655 if (ptep_clear_flush_young(vma, address, pte)) 640 if (ptep_clear_flush_young(vma, address, pte))
656 continue; 641 continue;
@@ -727,7 +712,7 @@ static int try_to_unmap_file(struct page *page)
727 712
728 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, 713 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
729 shared.vm_set.list) { 714 shared.vm_set.list) {
730 if (vma->vm_flags & (VM_LOCKED|VM_RESERVED)) 715 if (vma->vm_flags & VM_LOCKED)
731 continue; 716 continue;
732 cursor = (unsigned long) vma->vm_private_data; 717 cursor = (unsigned long) vma->vm_private_data;
733 if (cursor > max_nl_cursor) 718 if (cursor > max_nl_cursor)
@@ -761,7 +746,7 @@ static int try_to_unmap_file(struct page *page)
761 do { 746 do {
762 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, 747 list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
763 shared.vm_set.list) { 748 shared.vm_set.list) {
764 if (vma->vm_flags & (VM_LOCKED|VM_RESERVED)) 749 if (vma->vm_flags & VM_LOCKED)
765 continue; 750 continue;
766 cursor = (unsigned long) vma->vm_private_data; 751 cursor = (unsigned long) vma->vm_private_data;
767 while ( cursor < max_nl_cursor && 752 while ( cursor < max_nl_cursor &&
@@ -783,11 +768,8 @@ static int try_to_unmap_file(struct page *page)
783 * in locked vmas). Reset cursor on all unreserved nonlinear 768 * in locked vmas). Reset cursor on all unreserved nonlinear
784 * vmas, now forgetting on which ones it had fallen behind. 769 * vmas, now forgetting on which ones it had fallen behind.
785 */ 770 */
786 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, 771 list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared.vm_set.list)
787 shared.vm_set.list) { 772 vma->vm_private_data = NULL;
788 if (!(vma->vm_flags & VM_RESERVED))
789 vma->vm_private_data = NULL;
790 }
791out: 773out:
792 spin_unlock(&mapping->i_mmap_lock); 774 spin_unlock(&mapping->i_mmap_lock);
793 return ret; 775 return ret;
diff --git a/mm/swap.c b/mm/swap.c
index d09cf7f03e76..73d351439ef6 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -34,8 +34,6 @@
34/* How many pages do we try to swap or page in/out together? */ 34/* How many pages do we try to swap or page in/out together? */
35int page_cluster; 35int page_cluster;
36 36
37#ifdef CONFIG_HUGETLB_PAGE
38
39void put_page(struct page *page) 37void put_page(struct page *page)
40{ 38{
41 if (unlikely(PageCompound(page))) { 39 if (unlikely(PageCompound(page))) {
@@ -52,7 +50,6 @@ void put_page(struct page *page)
52 __page_cache_release(page); 50 __page_cache_release(page);
53} 51}
54EXPORT_SYMBOL(put_page); 52EXPORT_SYMBOL(put_page);
55#endif
56 53
57/* 54/*
58 * Writeback is about to end against a page which has been marked for immediate 55 * Writeback is about to end against a page which has been marked for immediate
diff --git a/mm/thrash.c b/mm/thrash.c
index eff3c18c33a1..f4c560b4a2b7 100644
--- a/mm/thrash.c
+++ b/mm/thrash.c
@@ -57,14 +57,17 @@ void grab_swap_token(void)
57 /* We have the token. Let others know we still need it. */ 57 /* We have the token. Let others know we still need it. */
58 if (has_swap_token(current->mm)) { 58 if (has_swap_token(current->mm)) {
59 current->mm->recent_pagein = 1; 59 current->mm->recent_pagein = 1;
60 if (unlikely(!swap_token_default_timeout))
61 disable_swap_token();
60 return; 62 return;
61 } 63 }
62 64
63 if (time_after(jiffies, swap_token_check)) { 65 if (time_after(jiffies, swap_token_check)) {
64 66
65 /* Can't get swapout protection if we exceed our RSS limit. */ 67 if (!swap_token_default_timeout) {
66 // if (current->mm->rss > current->mm->rlimit_rss) 68 swap_token_check = jiffies + SWAP_TOKEN_CHECK_INTERVAL;
67 // return; 69 return;
70 }
68 71
69 /* ... or if we recently held the token. */ 72 /* ... or if we recently held the token. */
70 if (time_before(jiffies, current->mm->swap_token_time)) 73 if (time_before(jiffies, current->mm->swap_token_time))
@@ -95,6 +98,7 @@ void __put_swap_token(struct mm_struct *mm)
95{ 98{
96 spin_lock(&swap_token_lock); 99 spin_lock(&swap_token_lock);
97 if (likely(mm == swap_token_mm)) { 100 if (likely(mm == swap_token_mm)) {
101 mm->swap_token_time = jiffies + SWAP_TOKEN_CHECK_INTERVAL;
98 swap_token_mm = &init_mm; 102 swap_token_mm = &init_mm;
99 swap_token_check = jiffies; 103 swap_token_check = jiffies;
100 } 104 }
diff --git a/mm/truncate.c b/mm/truncate.c
index 29c18f68dc35..9173ab500604 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -282,8 +282,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
282 * Zap the rest of the file in one hit. 282 * Zap the rest of the file in one hit.
283 */ 283 */
284 unmap_mapping_range(mapping, 284 unmap_mapping_range(mapping,
285 page_index << PAGE_CACHE_SHIFT, 285 (loff_t)page_index<<PAGE_CACHE_SHIFT,
286 (end - page_index + 1) 286 (loff_t)(end - page_index + 1)
287 << PAGE_CACHE_SHIFT, 287 << PAGE_CACHE_SHIFT,
288 0); 288 0);
289 did_range_unmap = 1; 289 did_range_unmap = 1;
@@ -292,7 +292,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
292 * Just zap this page 292 * Just zap this page
293 */ 293 */
294 unmap_mapping_range(mapping, 294 unmap_mapping_range(mapping,
295 page_index << PAGE_CACHE_SHIFT, 295 (loff_t)page_index<<PAGE_CACHE_SHIFT,
296 PAGE_CACHE_SIZE, 0); 296 PAGE_CACHE_SIZE, 0);
297 } 297 }
298 } 298 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 28130541270f..b0cd81c32de6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -201,13 +201,25 @@ static int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
201 list_for_each_entry(shrinker, &shrinker_list, list) { 201 list_for_each_entry(shrinker, &shrinker_list, list) {
202 unsigned long long delta; 202 unsigned long long delta;
203 unsigned long total_scan; 203 unsigned long total_scan;
204 unsigned long max_pass = (*shrinker->shrinker)(0, gfp_mask);
204 205
205 delta = (4 * scanned) / shrinker->seeks; 206 delta = (4 * scanned) / shrinker->seeks;
206 delta *= (*shrinker->shrinker)(0, gfp_mask); 207 delta *= max_pass;
207 do_div(delta, lru_pages + 1); 208 do_div(delta, lru_pages + 1);
208 shrinker->nr += delta; 209 shrinker->nr += delta;
209 if (shrinker->nr < 0) 210 if (shrinker->nr < 0) {
210 shrinker->nr = LONG_MAX; /* It wrapped! */ 211 printk(KERN_ERR "%s: nr=%ld\n",
212 __FUNCTION__, shrinker->nr);
213 shrinker->nr = max_pass;
214 }
215
216 /*
217 * Avoid risking looping forever due to too large nr value:
218 * never try to free more than twice the estimate number of
219 * freeable entries.
220 */
221 if (shrinker->nr > max_pass * 2)
222 shrinker->nr = max_pass * 2;
211 223
212 total_scan = shrinker->nr; 224 total_scan = shrinker->nr;
213 shrinker->nr = 0; 225 shrinker->nr = 0;
@@ -407,7 +419,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
407 if (PageWriteback(page)) 419 if (PageWriteback(page))
408 goto keep_locked; 420 goto keep_locked;
409 421
410 referenced = page_referenced(page, 1, sc->priority <= 0); 422 referenced = page_referenced(page, 1);
411 /* In active use or really unfreeable? Activate it. */ 423 /* In active use or really unfreeable? Activate it. */
412 if (referenced && page_mapping_inuse(page)) 424 if (referenced && page_mapping_inuse(page))
413 goto activate_locked; 425 goto activate_locked;
@@ -756,7 +768,7 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
756 if (page_mapped(page)) { 768 if (page_mapped(page)) {
757 if (!reclaim_mapped || 769 if (!reclaim_mapped ||
758 (total_swap_pages == 0 && PageAnon(page)) || 770 (total_swap_pages == 0 && PageAnon(page)) ||
759 page_referenced(page, 0, sc->priority <= 0)) { 771 page_referenced(page, 0)) {
760 list_add(&page->lru, &l_active); 772 list_add(&page->lru, &l_active);
761 continue; 773 continue;
762 } 774 }
@@ -960,6 +972,8 @@ int try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
960 sc.nr_reclaimed = 0; 972 sc.nr_reclaimed = 0;
961 sc.priority = priority; 973 sc.priority = priority;
962 sc.swap_cluster_max = SWAP_CLUSTER_MAX; 974 sc.swap_cluster_max = SWAP_CLUSTER_MAX;
975 if (!priority)
976 disable_swap_token();
963 shrink_caches(zones, &sc); 977 shrink_caches(zones, &sc);
964 shrink_slab(sc.nr_scanned, gfp_mask, lru_pages); 978 shrink_slab(sc.nr_scanned, gfp_mask, lru_pages);
965 if (reclaim_state) { 979 if (reclaim_state) {
@@ -1056,6 +1070,10 @@ loop_again:
1056 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 1070 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
1057 unsigned long lru_pages = 0; 1071 unsigned long lru_pages = 0;
1058 1072
1073 /* The swap token gets in the way of swapout... */
1074 if (!priority)
1075 disable_swap_token();
1076
1059 all_zones_ok = 1; 1077 all_zones_ok = 1;
1060 1078
1061 if (nr_pages == 0) { 1079 if (nr_pages == 0) {
@@ -1360,6 +1378,7 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1360 sc.nr_reclaimed = 0; 1378 sc.nr_reclaimed = 0;
1361 /* scan at the highest priority */ 1379 /* scan at the highest priority */
1362 sc.priority = 0; 1380 sc.priority = 0;
1381 disable_swap_token();
1363 1382
1364 if (nr_pages > SWAP_CLUSTER_MAX) 1383 if (nr_pages > SWAP_CLUSTER_MAX)
1365 sc.swap_cluster_max = nr_pages; 1384 sc.swap_cluster_max = nr_pages;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index defcf6a8607c..975abe254b7a 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,6 +366,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 366
367 spin_lock_bh(&br->lock); 367 spin_lock_bh(&br->lock);
368 br_stp_recalculate_bridge_id(br); 368 br_stp_recalculate_bridge_id(br);
369 br_features_recompute(br);
369 if ((br->dev->flags & IFF_UP) 370 if ((br->dev->flags & IFF_UP)
370 && (dev->flags & IFF_UP) && netif_carrier_ok(dev)) 371 && (dev->flags & IFF_UP) && netif_carrier_ok(dev))
371 br_stp_enable_port(p); 372 br_stp_enable_port(p);
diff --git a/net/core/filter.c b/net/core/filter.c
index 079c2edff789..2841bfce29d6 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -116,8 +116,6 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
116 A /= X; 116 A /= X;
117 continue; 117 continue;
118 case BPF_ALU|BPF_DIV|BPF_K: 118 case BPF_ALU|BPF_DIV|BPF_K:
119 if (fentry->k == 0)
120 return 0;
121 A /= fentry->k; 119 A /= fentry->k;
122 continue; 120 continue;
123 case BPF_ALU|BPF_AND|BPF_X: 121 case BPF_ALU|BPF_AND|BPF_X:
@@ -320,6 +318,10 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
320 } 318 }
321 } 319 }
322 320
321 /* check for division by zero -Kris Katterjohn 2005-10-30 */
322 if (ftest->code == (BPF_ALU|BPF_DIV|BPF_K) && ftest->k == 0)
323 return -EINVAL;
324
323 /* check that memory operations use valid addresses. */ 325 /* check that memory operations use valid addresses. */
324 if (ftest->k >= BPF_MEMWORDS) { 326 if (ftest->k >= BPF_MEMWORDS) {
325 /* but it might not be a memory operation... */ 327 /* but it might not be a memory operation... */
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index e0ace7cbb996..8a6b2a9e4581 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -46,6 +46,7 @@ atomic_t dccp_orphan_count = ATOMIC_INIT(0);
46static struct net_protocol dccp_protocol = { 46static struct net_protocol dccp_protocol = {
47 .handler = dccp_v4_rcv, 47 .handler = dccp_v4_rcv,
48 .err_handler = dccp_v4_err, 48 .err_handler = dccp_v4_err,
49 .no_policy = 1,
49}; 50};
50 51
51const char *dccp_packet_name(const int type) 52const char *dccp_packet_name(const int type)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 4ec4b2ca6ab1..04a6fe3e95a2 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -234,7 +234,10 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
234 int destroy) 234 int destroy)
235{ 235{
236 struct in_ifaddr *promote = NULL; 236 struct in_ifaddr *promote = NULL;
237 struct in_ifaddr *ifa1 = *ifap; 237 struct in_ifaddr *ifa, *ifa1 = *ifap;
238 struct in_ifaddr *last_prim = in_dev->ifa_list;
239 struct in_ifaddr *prev_prom = NULL;
240 int do_promote = IN_DEV_PROMOTE_SECONDARIES(in_dev);
238 241
239 ASSERT_RTNL(); 242 ASSERT_RTNL();
240 243
@@ -243,18 +246,22 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
243 **/ 246 **/
244 247
245 if (!(ifa1->ifa_flags & IFA_F_SECONDARY)) { 248 if (!(ifa1->ifa_flags & IFA_F_SECONDARY)) {
246 struct in_ifaddr *ifa;
247 struct in_ifaddr **ifap1 = &ifa1->ifa_next; 249 struct in_ifaddr **ifap1 = &ifa1->ifa_next;
248 250
249 while ((ifa = *ifap1) != NULL) { 251 while ((ifa = *ifap1) != NULL) {
252 if (!(ifa->ifa_flags & IFA_F_SECONDARY) &&
253 ifa1->ifa_scope <= ifa->ifa_scope)
254 last_prim = ifa;
255
250 if (!(ifa->ifa_flags & IFA_F_SECONDARY) || 256 if (!(ifa->ifa_flags & IFA_F_SECONDARY) ||
251 ifa1->ifa_mask != ifa->ifa_mask || 257 ifa1->ifa_mask != ifa->ifa_mask ||
252 !inet_ifa_match(ifa1->ifa_address, ifa)) { 258 !inet_ifa_match(ifa1->ifa_address, ifa)) {
253 ifap1 = &ifa->ifa_next; 259 ifap1 = &ifa->ifa_next;
260 prev_prom = ifa;
254 continue; 261 continue;
255 } 262 }
256 263
257 if (!IN_DEV_PROMOTE_SECONDARIES(in_dev)) { 264 if (!do_promote) {
258 *ifap1 = ifa->ifa_next; 265 *ifap1 = ifa->ifa_next;
259 266
260 rtmsg_ifa(RTM_DELADDR, ifa); 267 rtmsg_ifa(RTM_DELADDR, ifa);
@@ -283,18 +290,31 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
283 */ 290 */
284 rtmsg_ifa(RTM_DELADDR, ifa1); 291 rtmsg_ifa(RTM_DELADDR, ifa1);
285 notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1); 292 notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1);
286 if (destroy) {
287 inet_free_ifa(ifa1);
288 293
289 if (!in_dev->ifa_list) 294 if (promote) {
290 inetdev_destroy(in_dev); 295
291 } 296 if (prev_prom) {
297 prev_prom->ifa_next = promote->ifa_next;
298 promote->ifa_next = last_prim->ifa_next;
299 last_prim->ifa_next = promote;
300 }
292 301
293 if (promote && IN_DEV_PROMOTE_SECONDARIES(in_dev)) {
294 /* not sure if we should send a delete notify first? */
295 promote->ifa_flags &= ~IFA_F_SECONDARY; 302 promote->ifa_flags &= ~IFA_F_SECONDARY;
296 rtmsg_ifa(RTM_NEWADDR, promote); 303 rtmsg_ifa(RTM_NEWADDR, promote);
297 notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote); 304 notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote);
305 for (ifa = promote->ifa_next; ifa; ifa = ifa->ifa_next) {
306 if (ifa1->ifa_mask != ifa->ifa_mask ||
307 !inet_ifa_match(ifa1->ifa_address, ifa))
308 continue;
309 fib_add_ifaddr(ifa);
310 }
311
312 }
313 if (destroy) {
314 inet_free_ifa(ifa1);
315
316 if (!in_dev->ifa_list)
317 inetdev_destroy(in_dev);
298 } 318 }
299} 319}
300 320
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 2267c1fad879..882f88f6d13b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -407,7 +407,7 @@ static void fib_magic(int cmd, int type, u32 dst, int dst_len, struct in_ifaddr
407 tb->tb_delete(tb, &req.rtm, &rta, &req.nlh, NULL); 407 tb->tb_delete(tb, &req.rtm, &rta, &req.nlh, NULL);
408} 408}
409 409
410static void fib_add_ifaddr(struct in_ifaddr *ifa) 410void fib_add_ifaddr(struct in_ifaddr *ifa)
411{ 411{
412 struct in_device *in_dev = ifa->ifa_dev; 412 struct in_device *in_dev = ifa->ifa_dev;
413 struct net_device *dev = in_dev->dev; 413 struct net_device *dev = in_dev->dev;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 66247f38b371..705e3ce86df9 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2378,6 +2378,7 @@ static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi)
2378 */ 2378 */
2379static int fib_route_seq_show(struct seq_file *seq, void *v) 2379static int fib_route_seq_show(struct seq_file *seq, void *v)
2380{ 2380{
2381 const struct fib_trie_iter *iter = seq->private;
2381 struct leaf *l = v; 2382 struct leaf *l = v;
2382 int i; 2383 int i;
2383 char bf[128]; 2384 char bf[128];
@@ -2389,6 +2390,8 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2389 return 0; 2390 return 0;
2390 } 2391 }
2391 2392
2393 if (iter->trie == trie_local)
2394 return 0;
2392 if (IS_TNODE(l)) 2395 if (IS_TNODE(l))
2393 return 0; 2396 return 0;
2394 2397
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 9d3c8b5f327e..0bc00528d888 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -440,7 +440,7 @@ config IP_NF_MATCH_COMMENT
440config IP_NF_MATCH_CONNMARK 440config IP_NF_MATCH_CONNMARK
441 tristate 'Connection mark match support' 441 tristate 'Connection mark match support'
442 depends on IP_NF_IPTABLES 442 depends on IP_NF_IPTABLES
443 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 443 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
444 help 444 help
445 This option adds a `connmark' match, which allows you to match the 445 This option adds a `connmark' match, which allows you to match the
446 connection mark value previously set for the session by `CONNMARK'. 446 connection mark value previously set for the session by `CONNMARK'.
@@ -452,7 +452,7 @@ config IP_NF_MATCH_CONNMARK
452config IP_NF_MATCH_CONNBYTES 452config IP_NF_MATCH_CONNBYTES
453 tristate 'Connection byte/packet counter match support' 453 tristate 'Connection byte/packet counter match support'
454 depends on IP_NF_IPTABLES 454 depends on IP_NF_IPTABLES
455 depends on IP_NF_CT_ACCT || (NF_CT_ACCT && NF_CONNTRACK_IPV4) 455 depends on (IP_NF_CONNTRACK && IP_NF_CT_ACCT) || (NF_CT_ACCT && NF_CONNTRACK_IPV4)
456 help 456 help
457 This option adds a `connbytes' match, which allows you to match the 457 This option adds a `connbytes' match, which allows you to match the
458 number of bytes and/or packets for each direction within a connection. 458 number of bytes and/or packets for each direction within a connection.
@@ -767,7 +767,7 @@ config IP_NF_TARGET_TTL
767config IP_NF_TARGET_CONNMARK 767config IP_NF_TARGET_CONNMARK
768 tristate 'CONNMARK target support' 768 tristate 'CONNMARK target support'
769 depends on IP_NF_MANGLE 769 depends on IP_NF_MANGLE
770 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 770 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
771 help 771 help
772 This option adds a `CONNMARK' target, which allows one to manipulate 772 This option adds a `CONNMARK' target, which allows one to manipulate
773 the connection mark value. Similar to the MARK target, but 773 the connection mark value. Similar to the MARK target, but
@@ -779,8 +779,8 @@ config IP_NF_TARGET_CONNMARK
779 779
780config IP_NF_TARGET_CLUSTERIP 780config IP_NF_TARGET_CLUSTERIP
781 tristate "CLUSTERIP target support (EXPERIMENTAL)" 781 tristate "CLUSTERIP target support (EXPERIMENTAL)"
782 depends on IP_NF_IPTABLES && EXPERIMENTAL 782 depends on IP_NF_MANGLE && EXPERIMENTAL
783 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 783 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
784 help 784 help
785 The CLUSTERIP target allows you to build load-balancing clusters of 785 The CLUSTERIP target allows you to build load-balancing clusters of
786 network servers without having a dedicated load-balancing 786 network servers without having a dedicated load-balancing
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index de9f4464438d..3fce91bcc0ba 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -27,6 +27,7 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/netlink.h> 28#include <linux/netlink.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/interrupt.h>
30#include <linux/notifier.h> 31#include <linux/notifier.h>
31 32
32#include <linux/netfilter.h> 33#include <linux/netfilter.h>
@@ -59,11 +60,13 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb,
59 60
60 NFA_PUT(skb, CTA_PROTO_NUM, sizeof(u_int8_t), &tuple->dst.protonum); 61 NFA_PUT(skb, CTA_PROTO_NUM, sizeof(u_int8_t), &tuple->dst.protonum);
61 62
63 /* If no protocol helper is found, this function will return the
64 * generic protocol helper, so proto won't *ever* be NULL */
62 proto = ip_conntrack_proto_find_get(tuple->dst.protonum); 65 proto = ip_conntrack_proto_find_get(tuple->dst.protonum);
63 if (likely(proto && proto->tuple_to_nfattr)) { 66 if (likely(proto->tuple_to_nfattr))
64 ret = proto->tuple_to_nfattr(skb, tuple); 67 ret = proto->tuple_to_nfattr(skb, tuple);
65 ip_conntrack_proto_put(proto); 68
66 } 69 ip_conntrack_proto_put(proto);
67 70
68 return ret; 71 return ret;
69 72
@@ -128,9 +131,11 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct ip_conntrack *ct)
128 131
129 struct nfattr *nest_proto; 132 struct nfattr *nest_proto;
130 int ret; 133 int ret;
131 134
132 if (!proto || !proto->to_nfattr) 135 if (!proto->to_nfattr) {
136 ip_conntrack_proto_put(proto);
133 return 0; 137 return 0;
138 }
134 139
135 nest_proto = NFA_NEST(skb, CTA_PROTOINFO); 140 nest_proto = NFA_NEST(skb, CTA_PROTOINFO);
136 141
@@ -527,10 +532,10 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
527 532
528 proto = ip_conntrack_proto_find_get(tuple->dst.protonum); 533 proto = ip_conntrack_proto_find_get(tuple->dst.protonum);
529 534
530 if (likely(proto && proto->nfattr_to_tuple)) { 535 if (likely(proto->nfattr_to_tuple))
531 ret = proto->nfattr_to_tuple(tb, tuple); 536 ret = proto->nfattr_to_tuple(tb, tuple);
532 ip_conntrack_proto_put(proto); 537
533 } 538 ip_conntrack_proto_put(proto);
534 539
535 return ret; 540 return ret;
536} 541}
@@ -596,8 +601,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
596 return -EINVAL; 601 return -EINVAL;
597 602
598 npt = ip_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum); 603 npt = ip_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum);
599 if (!npt)
600 return 0;
601 604
602 if (!npt->nfattr_to_range) { 605 if (!npt->nfattr_to_range) {
603 ip_nat_proto_put(npt); 606 ip_nat_proto_put(npt);
@@ -957,8 +960,6 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
957 nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr); 960 nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr);
958 961
959 proto = ip_conntrack_proto_find_get(npt); 962 proto = ip_conntrack_proto_find_get(npt);
960 if (!proto)
961 return -EINVAL;
962 963
963 if (proto->from_nfattr) 964 if (proto->from_nfattr)
964 err = proto->from_nfattr(tb, ct); 965 err = proto->from_nfattr(tb, ct);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 56a09a4ac410..a16064ba0caf 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2627,7 +2627,7 @@ static void addrconf_verify(unsigned long foo)
2627 for (i=0; i < IN6_ADDR_HSIZE; i++) { 2627 for (i=0; i < IN6_ADDR_HSIZE; i++) {
2628 2628
2629restart: 2629restart:
2630 write_lock(&addrconf_hash_lock); 2630 read_lock(&addrconf_hash_lock);
2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) { 2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) {
2632 unsigned long age; 2632 unsigned long age;
2633#ifdef CONFIG_IPV6_PRIVACY 2633#ifdef CONFIG_IPV6_PRIVACY
@@ -2649,7 +2649,7 @@ restart:
2649 if (age >= ifp->valid_lft) { 2649 if (age >= ifp->valid_lft) {
2650 spin_unlock(&ifp->lock); 2650 spin_unlock(&ifp->lock);
2651 in6_ifa_hold(ifp); 2651 in6_ifa_hold(ifp);
2652 write_unlock(&addrconf_hash_lock); 2652 read_unlock(&addrconf_hash_lock);
2653 ipv6_del_addr(ifp); 2653 ipv6_del_addr(ifp);
2654 goto restart; 2654 goto restart;
2655 } else if (age >= ifp->prefered_lft) { 2655 } else if (age >= ifp->prefered_lft) {
@@ -2668,7 +2668,7 @@ restart:
2668 2668
2669 if (deprecate) { 2669 if (deprecate) {
2670 in6_ifa_hold(ifp); 2670 in6_ifa_hold(ifp);
2671 write_unlock(&addrconf_hash_lock); 2671 read_unlock(&addrconf_hash_lock);
2672 2672
2673 ipv6_ifa_notify(0, ifp); 2673 ipv6_ifa_notify(0, ifp);
2674 in6_ifa_put(ifp); 2674 in6_ifa_put(ifp);
@@ -2686,7 +2686,7 @@ restart:
2686 in6_ifa_hold(ifp); 2686 in6_ifa_hold(ifp);
2687 in6_ifa_hold(ifpub); 2687 in6_ifa_hold(ifpub);
2688 spin_unlock(&ifp->lock); 2688 spin_unlock(&ifp->lock);
2689 write_unlock(&addrconf_hash_lock); 2689 read_unlock(&addrconf_hash_lock);
2690 ipv6_create_tempaddr(ifpub, ifp); 2690 ipv6_create_tempaddr(ifpub, ifp);
2691 in6_ifa_put(ifpub); 2691 in6_ifa_put(ifpub);
2692 in6_ifa_put(ifp); 2692 in6_ifa_put(ifp);
@@ -2703,7 +2703,7 @@ restart:
2703 spin_unlock(&ifp->lock); 2703 spin_unlock(&ifp->lock);
2704 } 2704 }
2705 } 2705 }
2706 write_unlock(&addrconf_hash_lock); 2706 read_unlock(&addrconf_hash_lock);
2707 } 2707 }
2708 2708
2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next; 2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next;
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index cc518405b3e1..c4a3a993acb7 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -437,7 +437,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
437 break; 437 break;
438 case IPPROTO_AH: 438 case IPPROTO_AH:
439 nexthdr = ptr[0]; 439 nexthdr = ptr[0];
440 len = (ptr[1] + 1) << 2; 440 len = (ptr[1] + 2) << 2;
441 break; 441 break;
442 default: 442 default:
443 nexthdr = ptr[0]; 443 nexthdr = ptr[0];
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 922549581abc..be6faf311387 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -628,6 +628,7 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
628 if (!tot_len) 628 if (!tot_len)
629 return NULL; 629 return NULL;
630 630
631 tot_len += sizeof(*opt2);
631 opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC); 632 opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC);
632 if (!opt2) 633 if (!opt2)
633 return ERR_PTR(-ENOBUFS); 634 return ERR_PTR(-ENOBUFS);
@@ -668,7 +669,26 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
668 669
669 return opt2; 670 return opt2;
670out: 671out:
671 sock_kfree_s(sk, p, tot_len); 672 sock_kfree_s(sk, opt2, opt2->tot_len);
672 return ERR_PTR(err); 673 return ERR_PTR(err);
673} 674}
674 675
676struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
677 struct ipv6_txoptions *opt)
678{
679 /*
680 * ignore the dest before srcrt unless srcrt is being included.
681 * --yoshfuji
682 */
683 if (opt && opt->dst0opt && !opt->srcrt) {
684 if (opt_space != opt) {
685 memcpy(opt_space, opt, sizeof(*opt_space));
686 opt = opt_space;
687 }
688 opt->opt_nflen -= ipv6_optlen(opt->dst0opt);
689 opt->dst0opt = NULL;
690 }
691
692 return opt;
693}
694
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index bbbe80cdaf72..1cf02765fb5c 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -225,20 +225,16 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
225 struct ip6_flowlabel * fl, 225 struct ip6_flowlabel * fl,
226 struct ipv6_txoptions * fopt) 226 struct ipv6_txoptions * fopt)
227{ 227{
228 struct ipv6_txoptions * fl_opt = fl ? fl->opt : NULL; 228 struct ipv6_txoptions * fl_opt = fl->opt;
229 229
230 if (fopt == NULL || fopt->opt_flen == 0) { 230 if (fopt == NULL || fopt->opt_flen == 0)
231 if (!fl_opt || !fl_opt->dst0opt || fl_opt->srcrt) 231 return fl_opt;
232 return fl_opt; 232
233 }
234
235 if (fl_opt != NULL) { 233 if (fl_opt != NULL) {
236 opt_space->hopopt = fl_opt->hopopt; 234 opt_space->hopopt = fl_opt->hopopt;
237 opt_space->dst0opt = fl_opt->srcrt ? fl_opt->dst0opt : NULL; 235 opt_space->dst0opt = fl_opt->dst0opt;
238 opt_space->srcrt = fl_opt->srcrt; 236 opt_space->srcrt = fl_opt->srcrt;
239 opt_space->opt_nflen = fl_opt->opt_nflen; 237 opt_space->opt_nflen = fl_opt->opt_nflen;
240 if (fl_opt->dst0opt && !fl_opt->srcrt)
241 opt_space->opt_nflen -= ipv6_optlen(fl_opt->dst0opt);
242 } else { 238 } else {
243 if (fopt->opt_nflen == 0) 239 if (fopt->opt_nflen == 0)
244 return fopt; 240 return fopt;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8e9628f1c4c5..a66900cda2af 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -748,7 +748,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
748 } 748 }
749 if (opt == NULL) 749 if (opt == NULL)
750 opt = np->opt; 750 opt = np->opt;
751 opt = fl6_merge_options(&opt_space, flowlabel, opt); 751 if (flowlabel)
752 opt = fl6_merge_options(&opt_space, flowlabel, opt);
753 opt = ipv6_fixup_options(&opt_space, opt);
752 754
753 fl.proto = proto; 755 fl.proto = proto;
754 rawv6_probe_proto_opt(&fl, msg); 756 rawv6_probe_proto_opt(&fl, msg);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e671153b47b2..5cc8731eb55b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -771,7 +771,9 @@ do_udp_sendmsg:
771 } 771 }
772 if (opt == NULL) 772 if (opt == NULL)
773 opt = np->opt; 773 opt = np->opt;
774 opt = fl6_merge_options(&opt_space, flowlabel, opt); 774 if (flowlabel)
775 opt = fl6_merge_options(&opt_space, flowlabel, opt);
776 opt = ipv6_fixup_options(&opt_space, opt);
775 777
776 fl->proto = IPPROTO_UDP; 778 fl->proto = IPPROTO_UDP;
777 ipv6_addr_copy(&fl->fl6_dst, daddr); 779 ipv6_addr_copy(&fl->fl6_dst, daddr);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 8c38ee6d255e..96020d7087e8 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -476,7 +476,7 @@ static int netlink_autobind(struct socket *sock)
476 struct hlist_head *head; 476 struct hlist_head *head;
477 struct sock *osk; 477 struct sock *osk;
478 struct hlist_node *node; 478 struct hlist_node *node;
479 s32 pid = current->pid; 479 s32 pid = current->tgid;
480 int err; 480 int err;
481 static s32 rover = -4097; 481 static s32 rover = -4097;
482 482
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index cdc8d283791c..82fb07aa06a5 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -464,7 +464,7 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
464 const struct netem_skb_cb *cb 464 const struct netem_skb_cb *cb
465 = (const struct netem_skb_cb *)skb->cb; 465 = (const struct netem_skb_cb *)skb->cb;
466 466
467 if (PSCHED_TLESS(cb->time_to_send, ncb->time_to_send)) 467 if (!PSCHED_TLESS(ncb->time_to_send, cb->time_to_send))
468 break; 468 break;
469 } 469 }
470 470
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 81e00a6c19de..e3b242daf53c 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -39,23 +39,27 @@ static kmem_cache_t *rpc_inode_cachep __read_mostly;
39#define RPC_UPCALL_TIMEOUT (30*HZ) 39#define RPC_UPCALL_TIMEOUT (30*HZ)
40 40
41static void 41static void
42__rpc_purge_upcall(struct inode *inode, int err) 42__rpc_purge_list(struct rpc_inode *rpci, struct list_head *head, int err)
43{ 43{
44 struct rpc_inode *rpci = RPC_I(inode);
45 struct rpc_pipe_msg *msg; 44 struct rpc_pipe_msg *msg;
45 void (*destroy_msg)(struct rpc_pipe_msg *);
46 46
47 while (!list_empty(&rpci->pipe)) { 47 destroy_msg = rpci->ops->destroy_msg;
48 msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list); 48 while (!list_empty(head)) {
49 msg = list_entry(head->next, struct rpc_pipe_msg, list);
49 list_del_init(&msg->list); 50 list_del_init(&msg->list);
50 msg->errno = err; 51 msg->errno = err;
51 rpci->ops->destroy_msg(msg); 52 destroy_msg(msg);
52 }
53 while (!list_empty(&rpci->in_upcall)) {
54 msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list);
55 list_del_init(&msg->list);
56 msg->errno = err;
57 rpci->ops->destroy_msg(msg);
58 } 53 }
54}
55
56static void
57__rpc_purge_upcall(struct inode *inode, int err)
58{
59 struct rpc_inode *rpci = RPC_I(inode);
60
61 __rpc_purge_list(rpci, &rpci->pipe, err);
62 __rpc_purge_list(rpci, &rpci->in_upcall, err);
59 rpci->pipelen = 0; 63 rpci->pipelen = 0;
60 wake_up(&rpci->waitq); 64 wake_up(&rpci->waitq);
61} 65}
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 9d67782b812f..a96153fc793f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -129,8 +129,8 @@ endif
129HOSTCFLAGS_lex.zconf.o := -I$(src) 129HOSTCFLAGS_lex.zconf.o := -I$(src)
130HOSTCFLAGS_zconf.tab.o := -I$(src) 130HOSTCFLAGS_zconf.tab.o := -I$(src)
131 131
132HOSTLOADLIBES_qconf = -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(LIBS_QT) -ldl 132HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
133HOSTCXXFLAGS_qconf.o = -I$(QTDIR)/include -D LKC_DIRECT_LINK 133HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
134 134
135HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs` 135HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
136HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ 136HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
@@ -139,40 +139,50 @@ HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
139$(obj)/qconf.o: $(obj)/.tmp_qtcheck 139$(obj)/qconf.o: $(obj)/.tmp_qtcheck
140 140
141ifeq ($(qconf-target),1) 141ifeq ($(qconf-target),1)
142MOC = $(QTDIR)/bin/moc 142$(obj)/.tmp_qtcheck: $(src)/Makefile
143QTLIBPATH = $(QTDIR)/lib
144-include $(obj)/.tmp_qtcheck 143-include $(obj)/.tmp_qtcheck
145 144
146# QT needs some extra effort... 145# QT needs some extra effort...
147$(obj)/.tmp_qtcheck: 146$(obj)/.tmp_qtcheck:
148 @set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ 147 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
149 if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \ 148 pkg-config --exists qt 2> /dev/null && pkg=qt; \
150 done; \ 149 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
151 if [ -z "$$DIR" ]; then \ 150 if [ -n "$$pkg" ]; then \
152 echo "*"; \ 151 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
153 echo "* Unable to find the QT installation. Please make sure that the"; \ 152 libs="\$$(shell pkg-config $$pkg --libs)"; \
154 echo "* QT development package is correctly installed and the QTDIR"; \ 153 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
155 echo "* environment variable is set to the correct location."; \ 154 dir="$$(pkg-config $$pkg --variable=prefix)"; \
156 echo "*"; \
157 false; \
158 fi; \
159 LIBPATH=$$DIR/lib; LIB=qt; \
160 if [ -f $$QTLIB/libqt-mt.so ] ; then \
161 LIB=qt-mt; \
162 LIBPATH=$$QTLIB; \
163 else \ 155 else \
164 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ 156 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
165 LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \ 157 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
166 if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \ 158 done; \
159 if [ -z "$$dir" ]; then \
160 echo "*"; \
161 echo "* Unable to find the QT installation. Please make sure that"; \
162 echo "* the QT development package is correctly installed and"; \
163 echo "* either install pkg-config or set the QTDIR environment"; \
164 echo "* variable to the correct location."; \
165 echo "*"; \
166 false; \
167 fi; \
168 libpath=$$dir/lib; lib=qt; osdir=""; \
169 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
170 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
171 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
172 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
173 cflags="-I$$dir/include"; \
174 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
175 moc="$$dir/bin/moc"; \
167 fi; \ 176 fi; \
168 echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \ 177 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
169 echo "LIBS_QT=$$LIB" >> $@; \
170 if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
171 echo "*"; \ 178 echo "*"; \
172 echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \ 179 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
173 echo "*"; \ 180 echo "*"; \
174 echo "MOC=/usr/bin/moc" >> $@; \ 181 moc="/usr/bin/moc"; \
175 fi 182 fi; \
183 echo "KC_QT_CFLAGS=$$cflags" > $@; \
184 echo "KC_QT_LIBS=$$libs" >> $@; \
185 echo "KC_QT_MOC=$$moc" >> $@
176endif 186endif
177 187
178$(obj)/gconf.o: $(obj)/.tmp_gtkcheck 188$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
@@ -210,7 +220,7 @@ $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
210$(obj)/gconf.o: $(obj)/lkc_defs.h 220$(obj)/gconf.o: $(obj)/lkc_defs.h
211 221
212$(obj)/%.moc: $(src)/%.h 222$(obj)/%.moc: $(src)/%.h
213 $(MOC) -i $< -o $@ 223 $(KC_QT_MOC) -i $< -o $@
214 224
215$(obj)/lkc_defs.h: $(src)/lkc_proto.h 225$(obj)/lkc_defs.h: $(src)/lkc_proto.h
216 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 226 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 129abab5ce98..e4b8959dd4bb 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -197,6 +197,7 @@ void *snd_malloc_pages(size_t size, gfp_t gfp_flags)
197 197
198 snd_assert(size > 0, return NULL); 198 snd_assert(size > 0, return NULL);
199 snd_assert(gfp_flags != 0, return NULL); 199 snd_assert(gfp_flags != 0, return NULL);
200 gfp_flags |= __GFP_COMP; /* compound page lets parts be mapped */
200 pg = get_order(size); 201 pg = get_order(size);
201 if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) { 202 if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) {
202 mark_pages(virt_to_page(res), pg); 203 mark_pages(virt_to_page(res), pg);
@@ -241,6 +242,7 @@ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *d
241 snd_assert(dma != NULL, return NULL); 242 snd_assert(dma != NULL, return NULL);
242 pg = get_order(size); 243 pg = get_order(size);
243 gfp_flags = GFP_KERNEL 244 gfp_flags = GFP_KERNEL
245 | __GFP_COMP /* compound page lets parts be mapped */
244 | __GFP_NORETRY /* don't trigger OOM-killer */ 246 | __GFP_NORETRY /* don't trigger OOM-killer */
245 | __GFP_NOWARN; /* no stack trace print - this call is non-critical */ 247 | __GFP_NOWARN; /* no stack trace print - this call is non-critical */
246 res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); 248 res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags);
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 0dc828ff9e94..c9136a98755f 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -691,6 +691,7 @@ static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area,
691 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 691 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM);
692 vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->hwdep_pcm_shm + offset; 692 vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->hwdep_pcm_shm + offset;
693 page = virt_to_page(vaddr); 693 page = virt_to_page(vaddr);
694 get_page(page);
694 695
695 if (type) 696 if (type)
696 *type = VM_FAULT_MINOR; 697 *type = VM_FAULT_MINOR;