aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/hwmon/f71805f105
-rw-r--r--Documentation/hwmon/it872
-rw-r--r--Documentation/hwmon/sysfs-interface18
-rw-r--r--Documentation/i2c/busses/i2c-sis96x (renamed from Documentation/i2c/busses/i2c-sis69x)4
-rw-r--r--Documentation/powerpc/booting-without-of.txt8
-rw-r--r--Documentation/spi/butterfly23
-rw-r--r--Documentation/unshare.txt295
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/alpha/kernel/smp.c25
-rw-r--r--arch/arm/Kconfig49
-rw-r--r--arch/arm/configs/enp2611_defconfig2
-rw-r--r--arch/arm/configs/ixdp2400_defconfig2
-rw-r--r--arch/arm/configs/ixdp2401_defconfig2
-rw-r--r--arch/arm/configs/ixdp2801_defconfig2
-rw-r--r--arch/arm/configs/s3c2410_defconfig51
-rw-r--r--arch/arm/kernel/calls.S8
-rw-r--r--arch/arm/kernel/entry-armv.S17
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c71
-rw-r--r--arch/arm/mach-clps711x/Kconfig2
-rw-r--r--arch/arm/mach-imx/mx1ads.c1
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c5
-rw-r--r--arch/arm/mach-omap1/board-generic.c3
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c3
-rw-r--r--arch/arm/mach-omap1/board-innovator.c3
-rw-r--r--arch/arm/mach-omap1/board-netstar.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c3
-rw-r--r--arch/arm/mach-omap1/io.c42
-rw-r--r--arch/arm/mach-omap2/board-generic.c3
-rw-r--r--arch/arm/mach-omap2/board-h4.c3
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-s3c2410/clock.c43
-rw-r--r--arch/arm/mach-s3c2410/clock.h1
-rw-r--r--arch/arm/mach-s3c2410/devs.c5
-rw-r--r--arch/arm/plat-omap/sram.c9
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c8
-rw-r--r--arch/cris/kernel/setup.c1
-rw-r--r--arch/i386/kernel/syscall_table.S1
-rw-r--r--arch/ia64/dig/setup.c10
-rw-r--r--arch/ia64/kernel/efi.c16
-rw-r--r--arch/ia64/kernel/head.S1
-rw-r--r--arch/ia64/kernel/setup.c4
-rw-r--r--arch/ia64/kernel/time.c27
-rw-r--r--arch/ia64/sn/kernel/mca.c5
-rw-r--r--arch/ia64/sn/kernel/setup.c54
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c5
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c5
-rw-r--r--arch/m32r/kernel/setup.c6
-rw-r--r--arch/m68knommu/kernel/process.c8
-rw-r--r--arch/mips/cobalt/setup.c2
-rw-r--r--arch/mips/kernel/process.c5
-rw-r--r--arch/mips/kernel/scall32-o32.S17
-rw-r--r--arch/mips/kernel/scall64-64.S17
-rw-r--r--arch/mips/kernel/scall64-n32.S17
-rw-r--r--arch/mips/kernel/scall64-o32.S17
-rw-r--r--arch/mips/kernel/signal.c88
-rw-r--r--arch/mips/kernel/signal32.c8
-rw-r--r--arch/mips/kernel/signal_n32.c4
-rw-r--r--arch/mips/kernel/syscall.c48
-rw-r--r--arch/mips/lasat/setup.c4
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c4
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c4
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c4
-rw-r--r--arch/mips/momentum/jaguar_atx/ja-console.c2
-rw-r--r--arch/mips/philips/pnx8550/common/platform.c8
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c13
-rw-r--r--arch/parisc/hpux/sys_hpux.c10
-rw-r--r--arch/powerpc/kernel/fpu.S2
-rw-r--r--arch/powerpc/kernel/head_64.S5
-rw-r--r--arch/powerpc/kernel/iommu.c9
-rw-r--r--arch/powerpc/kernel/prom.c38
-rw-r--r--arch/powerpc/kernel/prom_init.c4
-rw-r--r--arch/powerpc/kernel/prom_parse.c4
-rw-r--r--arch/powerpc/kernel/rtas.c12
-rw-r--r--arch/powerpc/kernel/rtas_flash.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/signal_32.c18
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/kernel/smp.c3
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/powerpc/kernel/udbg_16550.c2
-rw-r--r--arch/powerpc/mm/lmb.c4
-rw-r--r--arch/powerpc/mm/mem.c14
-rw-r--r--arch/powerpc/platforms/cell/Makefile2
-rw-r--r--arch/powerpc/platforms/chrp/chrp.h1
-rw-r--r--arch/powerpc/platforms/chrp/pci.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/chrp/time.c21
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c3
-rw-r--r--arch/powerpc/platforms/powermac/pci.c89
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c8
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/ppc/kernel/head_8xx.S7
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c4
-rw-r--r--arch/ppc/platforms/4xx/bamboo.c4
-rw-r--r--arch/ppc/platforms/4xx/bubinga.c4
-rw-r--r--arch/ppc/platforms/4xx/ebony.c4
-rw-r--r--arch/ppc/platforms/4xx/luan.c4
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c4
-rw-r--r--arch/ppc/platforms/4xx/xilinx_ml300.c4
-rw-r--r--arch/ppc/platforms/4xx/yucca.c4
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c4
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c4
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c4
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c2
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.c4
-rw-r--r--arch/ppc/platforms/chestnut.c2
-rw-r--r--arch/ppc/platforms/ev64260.c2
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c2
-rw-r--r--arch/ppc/platforms/spruce.c4
-rw-r--r--arch/ppc/syslib/ocp.c4
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.c2
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c2
-rw-r--r--arch/s390/kernel/compat_linux.c83
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/s390/mm/cmm.c10
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/io.c30
-rw-r--r--arch/sh64/kernel/sh_ksyms.c8
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/kernel/process.c2
-rw-r--r--arch/sparc/kernel/systbls.S3
-rw-r--r--arch/sparc64/defconfig5
-rw-r--r--arch/sparc64/kernel/entry.S2
-rw-r--r--arch/sparc64/kernel/systbls.S5
-rw-r--r--arch/sparc64/solaris/systbl.S29
-rw-r--r--arch/um/drivers/chan_user.c15
-rw-r--r--arch/um/drivers/net_kern.c29
-rw-r--r--arch/um/include/registers.h2
-rw-r--r--arch/um/kernel/skas/process.c569
-rw-r--r--arch/um/kernel/um_arch.c18
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c4
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c21
-rw-r--r--arch/um/os-Linux/start_up.c1
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c5
-rw-r--r--arch/um/sys-x86_64/ptrace_user.c7
-rw-r--r--arch/um/sys-x86_64/user-offsets.c2
-rw-r--r--arch/x86_64/ia32/ia32entry.S3
-rw-r--r--arch/x86_64/kernel/setup.c2
-rw-r--r--arch/x86_64/kernel/smpboot.c3
-rw-r--r--arch/x86_64/kernel/time.c2
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c5
-rw-r--r--arch/x86_64/pci/mmconfig.c2
-rw-r--r--block/elevator.c70
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--block/scsi_ioctl.c3
-rw-r--r--crypto/scatterwalk.c1
-rw-r--r--drivers/base/base.h4
-rw-r--r--drivers/base/bus.c3
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/power/resume.c3
-rw-r--r--drivers/base/power/shutdown.c2
-rw-r--r--drivers/base/power/suspend.c3
-rw-r--r--drivers/base/power/sysfs.c24
-rw-r--r--drivers/base/sys.c3
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/drm/drmP.h10
-rw-r--r--drivers/char/drm/drm_stub.c2
-rw-r--r--drivers/char/drm/drm_sysfs.c131
-rw-r--r--drivers/char/ser_a2232.c1
-rw-r--r--drivers/char/watchdog/sbc_epx_c3.c15
-rw-r--r--drivers/edac/i82875p_edac.c2
-rw-r--r--drivers/hwmon/Kconfig10
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/f71805f.c908
-rw-r--r--drivers/hwmon/it87.c8
-rw-r--r--drivers/hwmon/lm77.c8
-rw-r--r--drivers/hwmon/w83792d.c31
-rw-r--r--drivers/i2c/algos/i2c-algo-sibyte.c2
-rw-r--r--drivers/i2c/busses/Kconfig1
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.c7
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
-rw-r--r--drivers/i2c/i2c-core.c15
-rw-r--r--drivers/ide/ide-disk.c6
-rw-r--r--drivers/infiniband/core/ucm.c13
-rw-r--r--drivers/isdn/hisax/Kconfig2
-rw-r--r--drivers/macintosh/Kconfig8
-rw-r--r--drivers/macintosh/Makefile5
-rw-r--r--drivers/macintosh/windfarm.h3
-rw-r--r--drivers/macintosh/windfarm_core.c122
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c169
-rw-r--r--drivers/macintosh/windfarm_pid.c8
-rw-r--r--drivers/macintosh/windfarm_pid.h1
-rw-r--r--drivers/macintosh/windfarm_pm112.c698
-rw-r--r--drivers/macintosh/windfarm_pm81.c87
-rw-r--r--drivers/macintosh/windfarm_pm91.c95
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c69
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c418
-rw-r--r--drivers/macintosh/windfarm_smu_sensors.c43
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c4
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c2
-rw-r--r--drivers/media/video/compat_ioctl32.c89
-rw-r--r--drivers/mmc/Kconfig2
-rw-r--r--drivers/mtd/chips/Kconfig2
-rw-r--r--drivers/net/7990.c2
-rw-r--r--drivers/net/82596.c2
-rw-r--r--drivers/net/appletalk/cops.h2
-rw-r--r--drivers/net/arcnet/arc-rimi.c68
-rw-r--r--drivers/net/arcnet/com90xx.c132
-rw-r--r--drivers/net/hamradio/baycom_par.c1
-rw-r--r--drivers/net/hp100.c30
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c40
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.h2
-rw-r--r--drivers/net/ibm_emac/ibm_emac_debug.c2
-rw-r--r--drivers/net/ibm_emac/ibm_emac_rgmii.h2
-rw-r--r--drivers/net/ibm_emac/ibm_emac_zmii.c7
-rw-r--r--drivers/net/ibm_emac/ibm_emac_zmii.h2
-rw-r--r--drivers/net/macsonic.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/tulip/xircom_cb.c3
-rw-r--r--drivers/net/wan/hostess_sv11.c1
-rw-r--r--drivers/net/wan/pci200syn.c2
-rw-r--r--drivers/net/wan/sealevel.c1
-rw-r--r--drivers/net/wan/wanxl.c2
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/scsi/aacraid/commsup.c2
-rw-r--r--drivers/scsi/mac53c94.c4
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/serial/21285.c2
-rw-r--r--drivers/serial/68328serial.c4
-rw-r--r--drivers/serial/68360serial.c4
-rw-r--r--drivers/serial/8250.c1
-rw-r--r--drivers/serial/8250_au1x00.c1
-rw-r--r--drivers/serial/8250_pci.c4
-rw-r--r--drivers/serial/amba-pl010.c4
-rw-r--r--drivers/serial/au1x00_uart.c12
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c25
-rw-r--r--drivers/serial/dz.c3
-rw-r--r--drivers/serial/imx.c4
-rw-r--r--drivers/serial/ip22zilog.c8
-rw-r--r--drivers/serial/m32r_sio.c2
-rw-r--r--drivers/serial/m32r_sio.h2
-rw-r--r--drivers/serial/mcfserial.c16
-rw-r--r--drivers/serial/mux.c2
-rw-r--r--drivers/serial/pmac_zilog.c2
-rw-r--r--drivers/serial/s3c2410.c4
-rw-r--r--drivers/serial/sa1100.c2
-rw-r--r--drivers/serial/serial_lh7a40x.c6
-rw-r--r--drivers/serial/sh-sci.c20
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/serial/sunsu.c10
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/serial/v850e_uart.c2
-rw-r--r--drivers/sn/ioc3.c18
-rw-r--r--drivers/spi/Kconfig10
-rw-r--r--drivers/spi/spi_butterfly.c36
-rw-r--r--drivers/tc/tc.c1
-rw-r--r--drivers/video/backlight/backlight.c1
-rw-r--r--drivers/video/backlight/lcd.c1
-rw-r--r--drivers/video/pmag-ba-fb.c1
-rw-r--r--drivers/video/pmagb-b-fb.c1
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--fs/debugfs/file.c6
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/namei.c6
-rw-r--r--fs/namespace.c58
-rw-r--r--fs/nfs/nfsroot.c3
-rw-r--r--fs/nfsd/nfs4proc.c6
-rw-r--r--fs/reiserfs/hashes.c1
-rw-r--r--fs/select.c4
-rw-r--r--fs/super.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c2
-rw-r--r--include/asm-alpha/system.h2
-rw-r--r--include/asm-arm/arch-omap/io.h6
-rw-r--r--include/asm-arm/mutex.h131
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-m68knommu/hardirq.h1
-rw-r--r--include/asm-mips/abi.h4
-rw-r--r--include/asm-mips/io.h35
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-mips/unistd.h64
-rw-r--r--include/asm-powerpc/compat.h5
-rw-r--r--include/asm-powerpc/dma-mapping.h1
-rw-r--r--include/asm-powerpc/prom.h2
-rw-r--r--include/asm-powerpc/smu.h5
-rw-r--r--include/asm-powerpc/thread_info.h2
-rw-r--r--include/asm-s390/uaccess.h10
-rw-r--r--include/asm-sparc/unistd.h7
-rw-r--r--include/asm-sparc64/unistd.h7
-rw-r--r--include/asm-x86_64/ia32_unistd.h5
-rw-r--r--include/asm-x86_64/numa.h7
-rw-r--r--include/asm-x86_64/unistd.h10
-rw-r--r--include/linux/cpumask.h1
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/dvb/video.h2
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/ioc3.h2
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/namespace.h1
-rw-r--r--include/linux/nodemask.h1
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/suspend.h10
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/compat.c1
-rw-r--r--kernel/fork.c394
-rw-r--r--kernel/module.c3
-rw-r--r--kernel/power/console.c4
-rw-r--r--kernel/power/power.h16
-rw-r--r--kernel/power/swsusp.c6
-rw-r--r--kernel/sys.c2
-rw-r--r--kernel/timer.c2
-rw-r--r--lib/kobject.c9
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/spinlock_debug.c6
-rw-r--r--mm/hugetlb.c19
-rw-r--r--mm/slob.c2
-rw-r--r--mm/swap.c32
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c1
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/xfrm4_policy.c1
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/ipv6/mcast.c2
-rw-r--r--net/ipv6/raw.c1
-rw-r--r--net/ipv6/xfrm6_policy.c1
-rw-r--r--net/xfrm/xfrm_policy.c1
-rw-r--r--security/selinux/Kconfig2
-rw-r--r--security/selinux/avc.c2
-rw-r--r--sound/oss/dmasound/tas_common.h16
-rw-r--r--sound/oss/emu10k1/recmgr.c2
-rw-r--r--sound/ppc/pmac.c3
-rw-r--r--sound/ppc/tumbler.c19
342 files changed, 4981 insertions, 2179 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index b47fba58d201..79f0ed9f60de 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -169,3 +169,12 @@ What: pci_module_init(driver)
169When: January 2007 169When: January 2007
170Why: Is replaced by pci_register_driver(pci_driver). 170Why: Is replaced by pci_register_driver(pci_driver).
171Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de> 171Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de>
172
173---------------------------
174
175What: I2C interface of the it87 driver
176When: January 2007
177Why: The ISA interface is faster and should be always available. The I2C
178 probing is also known to cause trouble in at least one case (see
179 bug #5889.)
180Who: Jean Delvare <khali@linux-fr.org>
diff --git a/Documentation/hwmon/f71805f b/Documentation/hwmon/f71805f
new file mode 100644
index 000000000000..28c5b7d1eb90
--- /dev/null
+++ b/Documentation/hwmon/f71805f
@@ -0,0 +1,105 @@
1Kernel driver f71805f
2=====================
3
4Supported chips:
5 * Fintek F71805F/FG
6 Prefix: 'f71805f'
7 Addresses scanned: none, address read from Super I/O config space
8 Datasheet: Provided by Fintek on request
9
10Author: Jean Delvare <khali@linux-fr.org>
11
12Thanks to Denis Kieft from Barracuda Networks for the donation of a
13test system (custom Jetway K8M8MS motherboard, with CPU and RAM) and
14for providing initial documentation.
15
16Thanks to Kris Chen from Fintek for answering technical questions and
17providing additional documentation.
18
19Thanks to Chris Lin from Jetway for providing wiring schematics and
20anwsering technical questions.
21
22
23Description
24-----------
25
26The Fintek F71805F/FG Super I/O chip includes complete hardware monitoring
27capabilities. It can monitor up to 9 voltages (counting its own power
28source), 3 fans and 3 temperature sensors.
29
30This chip also has fan controlling features, using either DC or PWM, in
31three different modes (one manual, two automatic). The driver doesn't
32support these features yet.
33
34The driver assumes that no more than one chip is present, which seems
35reasonable.
36
37
38Voltage Monitoring
39------------------
40
41Voltages are sampled by an 8-bit ADC with a LSB of 8 mV. The supported
42range is thus from 0 to 2.040 V. Voltage values outside of this range
43need external resistors. An exception is in0, which is used to monitor
44the chip's own power source (+3.3V), and is divided internally by a
45factor 2.
46
47The two LSB of the voltage limit registers are not used (always 0), so
48you can only set the limits in steps of 32 mV (before scaling).
49
50The wirings and resistor values suggested by Fintek are as follow:
51
52 pin expected
53 name use R1 R2 divider raw val.
54
55in0 VCC VCC3.3V int. int. 2.00 1.65 V
56in1 VIN1 VTT1.2V 10K - 1.00 1.20 V
57in2 VIN2 VRAM 100K 100K 2.00 ~1.25 V (1)
58in3 VIN3 VCHIPSET 47K 100K 1.47 2.24 V (2)
59in4 VIN4 VCC5V 200K 47K 5.25 0.95 V
60in5 VIN5 +12V 200K 20K 11.00 1.05 V
61in6 VIN6 VCC1.5V 10K - 1.00 1.50 V
62in7 VIN7 VCORE 10K - 1.00 ~1.40 V (1)
63in8 VIN8 VSB5V 200K 47K 1.00 0.95 V
64
65(1) Depends on your hardware setup.
66(2) Obviously not correct, swapping R1 and R2 would make more sense.
67
68These values can be used as hints at best, as motherboard manufacturers
69are free to use a completely different setup. As a matter of fact, the
70Jetway K8M8MS uses a significantly different setup. You will have to
71find out documentation about your own motherboard, and edit sensors.conf
72accordingly.
73
74Each voltage measured has associated low and high limits, each of which
75triggers an alarm when crossed.
76
77
78Fan Monitoring
79--------------
80
81Fan rotation speeds are reported as 12-bit values from a gated clock
82signal. Speeds down to 366 RPM can be measured. There is no theoretical
83high limit, but values over 6000 RPM seem to cause problem. The effective
84resolution is much lower than you would expect, the step between different
85register values being 10 rather than 1.
86
87The chip assumes 2 pulse-per-revolution fans.
88
89An alarm is triggered if the rotation speed drops below a programmable
90limit or is too low to be measured.
91
92
93Temperature Monitoring
94----------------------
95
96Temperatures are reported in degrees Celsius. Each temperature measured
97has a high limit, those crossing triggers an alarm. There is an associated
98hysteresis value, below which the temperature has to drop before the
99alarm is cleared.
100
101All temperature channels are external, there is no embedded temperature
102sensor. Each channel can be used for connecting either a thermal diode
103or a thermistor. The driver reports the currently selected mode, but
104doesn't allow changing it. In theory, the BIOS should have configured
105everything properly.
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87
index 7f42e441c645..9555be1ed999 100644
--- a/Documentation/hwmon/it87
+++ b/Documentation/hwmon/it87
@@ -9,7 +9,7 @@ Supported chips:
9 http://www.ite.com.tw/ 9 http://www.ite.com.tw/
10 * IT8712F 10 * IT8712F
11 Prefix: 'it8712' 11 Prefix: 'it8712'
12 Addresses scanned: I2C 0x28 - 0x2f 12 Addresses scanned: I2C 0x2d
13 from Super I/O config space (8 I/O ports) 13 from Super I/O config space (8 I/O ports)
14 Datasheet: Publicly available at the ITE website 14 Datasheet: Publicly available at the ITE website
15 http://www.ite.com.tw/ 15 http://www.ite.com.tw/
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index 764cdc5480e7..a0d0ab24288e 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -179,11 +179,12 @@ temp[1-*]_auto_point[1-*]_temp_hyst
179**************** 179****************
180 180
181temp[1-3]_type Sensor type selection. 181temp[1-3]_type Sensor type selection.
182 Integers 1, 2, 3 or thermistor Beta value (3435) 182 Integers 1 to 4 or thermistor Beta value (typically 3435)
183 Read/Write. 183 Read/Write.
184 1: PII/Celeron Diode 184 1: PII/Celeron Diode
185 2: 3904 transistor 185 2: 3904 transistor
186 3: thermal diode 186 3: thermal diode
187 4: thermistor (default/unknown Beta)
187 Not all types are supported by all chips 188 Not all types are supported by all chips
188 189
189temp[1-4]_max Temperature max value. 190temp[1-4]_max Temperature max value.
@@ -261,6 +262,21 @@ alarms Alarm bitmask.
261 of individual bits. 262 of individual bits.
262 Bits are defined in kernel/include/sensors.h. 263 Bits are defined in kernel/include/sensors.h.
263 264
265alarms_in Alarm bitmask relative to in (voltage) channels
266 Read only
267 A '1' bit means an alarm, LSB corresponds to in0 and so on
268 Prefered to 'alarms' for newer chips
269
270alarms_fan Alarm bitmask relative to fan channels
271 Read only
272 A '1' bit means an alarm, LSB corresponds to fan1 and so on
273 Prefered to 'alarms' for newer chips
274
275alarms_temp Alarm bitmask relative to temp (temperature) channels
276 Read only
277 A '1' bit means an alarm, LSB corresponds to temp1 and so on
278 Prefered to 'alarms' for newer chips
279
264beep_enable Beep/interrupt enable 280beep_enable Beep/interrupt enable
265 0 to disable. 281 0 to disable.
266 1 to enable. 282 1 to enable.
diff --git a/Documentation/i2c/busses/i2c-sis69x b/Documentation/i2c/busses/i2c-sis96x
index b88953dfd580..00a009b977e9 100644
--- a/Documentation/i2c/busses/i2c-sis69x
+++ b/Documentation/i2c/busses/i2c-sis96x
@@ -7,7 +7,7 @@ Supported adapters:
7 Any combination of these host bridges: 7 Any combination of these host bridges:
8 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746 8 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746
9 and these south bridges: 9 and these south bridges:
10 961, 962, 963(L) 10 961, 962, 963(L)
11 11
12Author: Mark M. Hoffman <mhoffman@lightlink.com> 12Author: Mark M. Hoffman <mhoffman@lightlink.com>
13 13
@@ -29,7 +29,7 @@ The command "lspci" as root should produce something like these lines:
29 29
30or perhaps this... 30or perhaps this...
31 31
3200:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 3200:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645
3300:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961 3300:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961
3400:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016 3400:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016
35 35
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 1284498e847c..54e5f9b1536d 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -880,6 +880,10 @@ address which can extend beyond that limit.
880 - device_type : Should be "soc" 880 - device_type : Should be "soc"
881 - ranges : Should be defined as specified in 1) to describe the 881 - ranges : Should be defined as specified in 1) to describe the
882 translation of SOC addresses for memory mapped SOC registers. 882 translation of SOC addresses for memory mapped SOC registers.
883 - bus-frequency: Contains the bus frequency for the SOC node.
884 Typically, the value of this field is filled in by the boot
885 loader.
886
883 887
884 Recommended properties: 888 Recommended properties:
885 889
@@ -919,6 +923,7 @@ SOC.
919 device_type = "soc"; 923 device_type = "soc";
920 ranges = <00000000 e0000000 00100000> 924 ranges = <00000000 e0000000 00100000>
921 reg = <e0000000 00003000>; 925 reg = <e0000000 00003000>;
926 bus-frequency = <0>;
922 } 927 }
923 928
924 929
@@ -1170,6 +1175,8 @@ platforms are moved over to use the flattened-device-tree model.
1170 1175
1171 mdio@24520 { 1176 mdio@24520 {
1172 reg = <24520 20>; 1177 reg = <24520 20>;
1178 device_type = "mdio";
1179 compatible = "gianfar";
1173 1180
1174 ethernet-phy@0 { 1181 ethernet-phy@0 {
1175 ...... 1182 ......
@@ -1317,6 +1324,7 @@ not necessary as they are usually the same as the root node.
1317 device_type = "soc"; 1324 device_type = "soc";
1318 ranges = <00000000 e0000000 00100000> 1325 ranges = <00000000 e0000000 00100000>
1319 reg = <e0000000 00003000>; 1326 reg = <e0000000 00003000>;
1327 bus-frequency = <0>;
1320 1328
1321 mdio@24520 { 1329 mdio@24520 {
1322 reg = <24520 20>; 1330 reg = <24520 20>;
diff --git a/Documentation/spi/butterfly b/Documentation/spi/butterfly
index a2e8c8d90e35..9927af7a629c 100644
--- a/Documentation/spi/butterfly
+++ b/Documentation/spi/butterfly
@@ -12,13 +12,20 @@ You can make this adapter from an old printer cable and solder things
12directly to the Butterfly. Or (if you have the parts and skills) you 12directly to the Butterfly. Or (if you have the parts and skills) you
13can come up with something fancier, providing ciruit protection to the 13can come up with something fancier, providing ciruit protection to the
14Butterfly and the printer port, or with a better power supply than two 14Butterfly and the printer port, or with a better power supply than two
15signal pins from the printer port. 15signal pins from the printer port. Or for that matter, you can use
16similar cables to talk to many AVR boards, even a breadboard.
17
18This is more powerful than "ISP programming" cables since it lets kernel
19SPI protocol drivers interact with the AVR, and could even let the AVR
20issue interrupts to them. Later, your protocol driver should work
21easily with a "real SPI controller", instead of this bitbanger.
16 22
17 23
18The first cable connections will hook Linux up to one SPI bus, with the 24The first cable connections will hook Linux up to one SPI bus, with the
19AVR and a DataFlash chip; and to the AVR reset line. This is all you 25AVR and a DataFlash chip; and to the AVR reset line. This is all you
20need to reflash the firmware, and the pins are the standard Atmel "ISP" 26need to reflash the firmware, and the pins are the standard Atmel "ISP"
21connector pins (used also on non-Butterfly AVR boards). 27connector pins (used also on non-Butterfly AVR boards). On the parport
28side this is like "sp12" programming cables.
22 29
23 Signal Butterfly Parport (DB-25) 30 Signal Butterfly Parport (DB-25)
24 ------ --------- --------------- 31 ------ --------- ---------------
@@ -40,10 +47,14 @@ by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and
40 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT 47 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT
41 GND = J400.GND = pin 24/GND 48 GND = J400.GND = pin 24/GND
42 49
43The "USI" controller, using J405, can be used for a second SPI bus. That 50Or you could flash firmware making the AVR into an SPI slave (keeping the
44would let you talk to the AVR over SPI, running firmware that makes it act 51DataFlash in reset) and tweak the spi_butterfly driver to make it bind to
45as an SPI slave, while letting either Linux or the AVR use the DataFlash. 52the driver for your custom SPI-based protocol.
46There are plenty of spare parport pins to wire this one up, such as: 53
54The "USI" controller, using J405, can also be used for a second SPI bus.
55That would let you talk to the AVR using custom SPI-with-USI firmware,
56while letting either Linux or the AVR use the DataFlash. There are plenty
57of spare parport pins to wire this one up, such as:
47 58
48 Signal Butterfly Parport (DB-25) 59 Signal Butterfly Parport (DB-25)
49 ------ --------- --------------- 60 ------ --------- ---------------
diff --git a/Documentation/unshare.txt b/Documentation/unshare.txt
new file mode 100644
index 000000000000..90a5e9e5bef1
--- /dev/null
+++ b/Documentation/unshare.txt
@@ -0,0 +1,295 @@
1
2unshare system call:
3--------------------
4This document describes the new system call, unshare. The document
5provides an overview of the feature, why it is needed, how it can
6be used, its interface specification, design, implementation and
7how it can be tested.
8
9Change Log:
10-----------
11version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006
12
13Contents:
14---------
15 1) Overview
16 2) Benefits
17 3) Cost
18 4) Requirements
19 5) Functional Specification
20 6) High Level Design
21 7) Low Level Design
22 8) Test Specification
23 9) Future Work
24
251) Overview
26-----------
27Most legacy operating system kernels support an abstraction of threads
28as multiple execution contexts within a process. These kernels provide
29special resources and mechanisms to maintain these "threads". The Linux
30kernel, in a clever and simple manner, does not make distinction
31between processes and "threads". The kernel allows processes to share
32resources and thus they can achieve legacy "threads" behavior without
33requiring additional data structures and mechanisms in the kernel. The
34power of implementing threads in this manner comes not only from
35its simplicity but also from allowing application programmers to work
36outside the confinement of all-or-nothing shared resources of legacy
37threads. On Linux, at the time of thread creation using the clone system
38call, applications can selectively choose which resources to share
39between threads.
40
41unshare system call adds a primitive to the Linux thread model that
42allows threads to selectively 'unshare' any resources that were being
43shared at the time of their creation. unshare was conceptualized by
44Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part
45of the discussion on POSIX threads on Linux. unshare augments the
46usefulness of Linux threads for applications that would like to control
47shared resources without creating a new process. unshare is a natural
48addition to the set of available primitives on Linux that implement
49the concept of process/thread as a virtual machine.
50
512) Benefits
52-----------
53unshare would be useful to large application frameworks such as PAM
54where creating a new process to control sharing/unsharing of process
55resources is not possible. Since namespaces are shared by default
56when creating a new process using fork or clone, unshare can benefit
57even non-threaded applications if they have a need to disassociate
58from default shared namespace. The following lists two use-cases
59where unshare can be used.
60
612.1 Per-security context namespaces
62-----------------------------------
63unshare can be used to implement polyinstantiated directories using
64the kernel's per-process namespace mechanism. Polyinstantiated directories,
65such as per-user and/or per-security context instance of /tmp, /var/tmp or
66per-security context instance of a user's home directory, isolate user
67processes when working with these directories. Using unshare, a PAM
68module can easily setup a private namespace for a user at login.
69Polyinstantiated directories are required for Common Criteria certification
70with Labeled System Protection Profile, however, with the availability
71of shared-tree feature in the Linux kernel, even regular Linux systems
72can benefit from setting up private namespaces at login and
73polyinstantiating /tmp, /var/tmp and other directories deemed
74appropriate by system administrators.
75
762.2 unsharing of virtual memory and/or open files
77-------------------------------------------------
78Consider a client/server application where the server is processing
79client requests by creating processes that share resources such as
80virtual memory and open files. Without unshare, the server has to
81decide what needs to be shared at the time of creating the process
82which services the request. unshare allows the server an ability to
83disassociate parts of the context during the servicing of the
84request. For large and complex middleware application frameworks, this
85ability to unshare after the process was created can be very
86useful.
87
883) Cost
89-------
90In order to not duplicate code and to handle the fact that unshare
91works on an active task (as opposed to clone/fork working on a newly
92allocated inactive task) unshare had to make minor reorganizational
93changes to copy_* functions utilized by clone/fork system call.
94There is a cost associated with altering existing, well tested and
95stable code to implement a new feature that may not get exercised
96extensively in the beginning. However, with proper design and code
97review of the changes and creation of an unshare test for the LTP
98the benefits of this new feature can exceed its cost.
99
1004) Requirements
101---------------
102unshare reverses sharing that was done using clone(2) system call,
103so unshare should have a similar interface as clone(2). That is,
104since flags in clone(int flags, void *stack) specifies what should
105be shared, similar flags in unshare(int flags) should specify
106what should be unshared. Unfortunately, this may appear to invert
107the meaning of the flags from the way they are used in clone(2).
108However, there was no easy solution that was less confusing and that
109allowed incremental context unsharing in future without an ABI change.
110
111unshare interface should accommodate possible future addition of
112new context flags without requiring a rebuild of old applications.
113If and when new context flags are added, unshare design should allow
114incremental unsharing of those resources on an as needed basis.
115
1165) Functional Specification
117---------------------------
118NAME
119 unshare - disassociate parts of the process execution context
120
121SYNOPSIS
122 #include <sched.h>
123
124 int unshare(int flags);
125
126DESCRIPTION
127 unshare allows a process to disassociate parts of its execution
128 context that are currently being shared with other processes. Part
129 of execution context, such as the namespace, is shared by default
130 when a new process is created using fork(2), while other parts,
131 such as the virtual memory, open file descriptors, etc, may be
132 shared by explicit request to share them when creating a process
133 using clone(2).
134
135 The main use of unshare is to allow a process to control its
136 shared execution context without creating a new process.
137
138 The flags argument specifies one or bitwise-or'ed of several of
139 the following constants.
140
141 CLONE_FS
142 If CLONE_FS is set, file system information of the caller
143 is disassociated from the shared file system information.
144
145 CLONE_FILES
146 If CLONE_FILES is set, the file descriptor table of the
147 caller is disassociated from the shared file descriptor
148 table.
149
150 CLONE_NEWNS
151 If CLONE_NEWNS is set, the namespace of the caller is
152 disassociated from the shared namespace.
153
154 CLONE_VM
155 If CLONE_VM is set, the virtual memory of the caller is
156 disassociated from the shared virtual memory.
157
158RETURN VALUE
159 On success, zero returned. On failure, -1 is returned and errno is
160
161ERRORS
162 EPERM CLONE_NEWNS was specified by a non-root process (process
163 without CAP_SYS_ADMIN).
164
165 ENOMEM Cannot allocate sufficient memory to copy parts of caller's
166 context that need to be unshared.
167
168 EINVAL Invalid flag was specified as an argument.
169
170CONFORMING TO
171 The unshare() call is Linux-specific and should not be used
172 in programs intended to be portable.
173
174SEE ALSO
175 clone(2), fork(2)
176
1776) High Level Design
178--------------------
179Depending on the flags argument, the unshare system call allocates
180appropriate process context structures, populates it with values from
181the current shared version, associates newly duplicated structures
182with the current task structure and releases corresponding shared
183versions. Helper functions of clone (copy_*) could not be used
184directly by unshare because of the following two reasons.
185 1) clone operates on a newly allocated not-yet-active task
186 structure, where as unshare operates on the current active
187 task. Therefore unshare has to take appropriate task_lock()
188 before associating newly duplicated context structures
189 2) unshare has to allocate and duplicate all context structures
190 that are being unshared, before associating them with the
191 current task and releasing older shared structures. Failure
192 do so will create race conditions and/or oops when trying
193 to backout due to an error. Consider the case of unsharing
194 both virtual memory and namespace. After successfully unsharing
195 vm, if the system call encounters an error while allocating
196 new namespace structure, the error return code will have to
197 reverse the unsharing of vm. As part of the reversal the
198 system call will have to go back to older, shared, vm
199 structure, which may not exist anymore.
200
201Therefore code from copy_* functions that allocated and duplicated
202current context structure was moved into new dup_* functions. Now,
203copy_* functions call dup_* functions to allocate and duplicate
204appropriate context structures and then associate them with the
205task structure that is being constructed. unshare system call on
206the other hand performs the following:
207 1) Check flags to force missing, but implied, flags
208 2) For each context structure, call the corresponding unshare
209 helper function to allocate and duplicate a new context
210 structure, if the appropriate bit is set in the flags argument.
211 3) If there is no error in allocation and duplication and there
212 are new context structures then lock the current task structure,
213 associate new context structures with the current task structure,
214 and release the lock on the current task structure.
215 4) Appropriately release older, shared, context structures.
216
2177) Low Level Design
218-------------------
219Implementation of unshare can be grouped in the following 4 different
220items:
221 a) Reorganization of existing copy_* functions
222 b) unshare system call service function
223 c) unshare helper functions for each different process context
224 d) Registration of system call number for different architectures
225
226 7.1) Reorganization of copy_* functions
227 Each copy function such as copy_mm, copy_namespace, copy_files,
228 etc, had roughly two components. The first component allocated
229 and duplicated the appropriate structure and the second component
230 linked it to the task structure passed in as an argument to the copy
231 function. The first component was split into its own function.
232 These dup_* functions allocated and duplicated the appropriate
233 context structure. The reorganized copy_* functions invoked
234 their corresponding dup_* functions and then linked the newly
235 duplicated structures to the task structure with which the
236 copy function was called.
237
238 7.2) unshare system call service function
239 * Check flags
240 Force implied flags. If CLONE_THREAD is set force CLONE_VM.
241 If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is
242 set and signals are also being shared, force CLONE_THREAD. If
243 CLONE_NEWNS is set, force CLONE_FS.
244 * For each context flag, invoke the corresponding unshare_*
245 helper routine with flags passed into the system call and a
246 reference to pointer pointing the new unshared structure
247 * If any new structures are created by unshare_* helper
248 functions, take the task_lock() on the current task,
249 modify appropriate context pointers, and release the
250 task lock.
251 * For all newly unshared structures, release the corresponding
252 older, shared, structures.
253
254 7.3) unshare_* helper functions
255 For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND,
256 and CLONE_THREAD, return -EINVAL since they are not implemented yet.
257 For others, check the flag value to see if the unsharing is
258 required for that structure. If it is, invoke the corresponding
259 dup_* function to allocate and duplicate the structure and return
260 a pointer to it.
261
262 7.4) Appropriately modify architecture specific code to register the
263 the new system call.
264
2658) Test Specification
266---------------------
267The test for unshare should test the following:
268 1) Valid flags: Test to check that clone flags for signal and
269 signal handlers, for which unsharing is not implemented
270 yet, return -EINVAL.
271 2) Missing/implied flags: Test to make sure that if unsharing
272 namespace without specifying unsharing of filesystem, correctly
273 unshares both namespace and filesystem information.
274 3) For each of the four (namespace, filesystem, files and vm)
275 supported unsharing, verify that the system call correctly
276 unshares the appropriate structure. Verify that unsharing
277 them individually as well as in combination with each
278 other works as expected.
279 4) Concurrent execution: Use shared memory segments and futex on
280 an address in the shm segment to synchronize execution of
281 about 10 threads. Have a couple of threads execute execve,
282 a couple _exit and the rest unshare with different combination
283 of flags. Verify that unsharing is performed as expected and
284 that there are no oops or hangs.
285
2869) Future Work
287--------------
288The current implementation of unshare does not allow unsharing of
289signals and signal handlers. Signals are complex to begin with and
290to unshare signals and/or signal handlers of a currently running
291process is even more complex. If in the future there is a specific
292need to allow unsharing of signals and/or signal handlers, it can
293be incrementally added to unshare without affecting legacy
294applications using unshare.
295
diff --git a/MAINTAINERS b/MAINTAINERS
index a05aefdea602..b22db521cec1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -931,6 +931,12 @@ M: sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com
931L: ext3-users@redhat.com 931L: ext3-users@redhat.com
932S: Maintained 932S: Maintained
933 933
934F71805F HARDWARE MONITORING DRIVER
935P: Jean Delvare
936M: khali@linux-fr.org
937L: lm-sensors@lm-sensors.org
938S: Maintained
939
934FARSYNC SYNCHRONOUS DRIVER 940FARSYNC SYNCHRONOUS DRIVER
935P: Kevin Curtis 941P: Kevin Curtis
936M: kevin.curtis@farsite.co.uk 942M: kevin.curtis@farsite.co.uk
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 4b873527ce1c..02c2db08114a 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -73,9 +73,6 @@ cpumask_t cpu_online_map;
73 73
74EXPORT_SYMBOL(cpu_online_map); 74EXPORT_SYMBOL(cpu_online_map);
75 75
76/* cpus reported in the hwrpb */
77static unsigned long hwrpb_cpu_present_mask __initdata = 0;
78
79int smp_num_probed; /* Internal processor count */ 76int smp_num_probed; /* Internal processor count */
80int smp_num_cpus = 1; /* Number that came online. */ 77int smp_num_cpus = 1; /* Number that came online. */
81 78
@@ -442,7 +439,7 @@ setup_smp(void)
442 if ((cpu->flags & 0x1cc) == 0x1cc) { 439 if ((cpu->flags & 0x1cc) == 0x1cc) {
443 smp_num_probed++; 440 smp_num_probed++;
444 /* Assume here that "whami" == index */ 441 /* Assume here that "whami" == index */
445 hwrpb_cpu_present_mask |= (1UL << i); 442 cpu_set(i, cpu_possible_map);
446 cpu->pal_revision = boot_cpu_palrev; 443 cpu->pal_revision = boot_cpu_palrev;
447 } 444 }
448 445
@@ -453,12 +450,12 @@ setup_smp(void)
453 } 450 }
454 } else { 451 } else {
455 smp_num_probed = 1; 452 smp_num_probed = 1;
456 hwrpb_cpu_present_mask = (1UL << boot_cpuid); 453 cpu_set(boot_cpuid, cpu_possible_map);
457 } 454 }
458 cpu_present_mask = cpumask_of_cpu(boot_cpuid); 455 cpu_present_mask = cpumask_of_cpu(boot_cpuid);
459 456
460 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 457 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
461 smp_num_probed, hwrpb_cpu_present_mask); 458 smp_num_probed, cpu_possible_map.bits[0]);
462} 459}
463 460
464/* 461/*
@@ -467,8 +464,6 @@ setup_smp(void)
467void __init 464void __init
468smp_prepare_cpus(unsigned int max_cpus) 465smp_prepare_cpus(unsigned int max_cpus)
469{ 466{
470 int cpu_count, i;
471
472 /* Take care of some initial bookkeeping. */ 467 /* Take care of some initial bookkeeping. */
473 memset(ipi_data, 0, sizeof(ipi_data)); 468 memset(ipi_data, 0, sizeof(ipi_data));
474 469
@@ -486,19 +481,7 @@ smp_prepare_cpus(unsigned int max_cpus)
486 481
487 printk(KERN_INFO "SMP starting up secondaries.\n"); 482 printk(KERN_INFO "SMP starting up secondaries.\n");
488 483
489 cpu_count = 1; 484 smp_num_cpus = smp_num_probed;
490 for (i = 0; (i < NR_CPUS) && (cpu_count < max_cpus); i++) {
491 if (i == boot_cpuid)
492 continue;
493
494 if (((hwrpb_cpu_present_mask >> i) & 1) == 0)
495 continue;
496
497 cpu_set(i, cpu_possible_map);
498 cpu_count++;
499 }
500
501 smp_num_cpus = cpu_count;
502} 485}
503 486
504void __devinit 487void __devinit
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5959e36c3b4c..15dc1a0dffbb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,9 +10,9 @@ config ARM
10 default y 10 default y
11 help 11 help
12 The ARM series is a line of low-power-consumption RISC chip designs 12 The ARM series is a line of low-power-consumption RISC chip designs
13 licensed by ARM ltd and targeted at embedded applications and 13 licensed by ARM Ltd and targeted at embedded applications and
14 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer 14 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer
15 manufactured, but legacy ARM-based PC hardware remains popular in 15 manufactured, but legacy ARM-based PC hardware remains popular in
16 Europe. There is an ARM Linux project with a web page at 16 Europe. There is an ARM Linux project with a web page at
17 <http://www.arm.linux.org.uk/>. 17 <http://www.arm.linux.org.uk/>.
18 18
@@ -69,6 +69,9 @@ config GENERIC_ISA_DMA
69config FIQ 69config FIQ
70 bool 70 bool
71 71
72config ARCH_MTD_XIP
73 bool
74
72source "init/Kconfig" 75source "init/Kconfig"
73 76
74menu "System Type" 77menu "System Type"
@@ -81,45 +84,62 @@ config ARCH_CLPS7500
81 bool "Cirrus-CL-PS7500FE" 84 bool "Cirrus-CL-PS7500FE"
82 select TIMER_ACORN 85 select TIMER_ACORN
83 select ISA 86 select ISA
87 help
88 Support for the Cirrus Logic PS7500FE system-on-a-chip.
84 89
85config ARCH_CLPS711X 90config ARCH_CLPS711X
86 bool "CLPS711x/EP721x-based" 91 bool "CLPS711x/EP721x-based"
92 help
93 Support for Cirrus Logic 711x/721x based boards.
87 94
88config ARCH_CO285 95config ARCH_CO285
89 bool "Co-EBSA285" 96 bool "Co-EBSA285"
90 select FOOTBRIDGE 97 select FOOTBRIDGE
91 select FOOTBRIDGE_ADDIN 98 select FOOTBRIDGE_ADDIN
99 help
100 Support for Intel's EBSA285 companion chip.
92 101
93config ARCH_EBSA110 102config ARCH_EBSA110
94 bool "EBSA-110" 103 bool "EBSA-110"
95 select ISA 104 select ISA
96 help 105 help
97 This is an evaluation board for the StrongARM processor available 106 This is an evaluation board for the StrongARM processor available
98 from Digital. It has limited hardware on-board, including an onboard 107 from Digital. It has limited hardware on-board, including an
99 Ethernet interface, two PCMCIA sockets, two serial ports and a 108 Ethernet interface, two PCMCIA sockets, two serial ports and a
100 parallel port. 109 parallel port.
101 110
102config ARCH_FOOTBRIDGE 111config ARCH_FOOTBRIDGE
103 bool "FootBridge" 112 bool "FootBridge"
104 select FOOTBRIDGE 113 select FOOTBRIDGE
114 help
115 Support for systems based on the DC21285 companion chip
116 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
105 117
106config ARCH_INTEGRATOR 118config ARCH_INTEGRATOR
107 bool "Integrator" 119 bool "Integrator"
108 select ARM_AMBA 120 select ARM_AMBA
109 select ICST525 121 select ICST525
122 help
123 Support for ARM's Integrator platform.
110 124
111config ARCH_IOP3XX 125config ARCH_IOP3XX
112 bool "IOP3xx-based" 126 bool "IOP3xx-based"
113 select PCI 127 select PCI
128 help
129 Support for Intel's IOP3XX (XScale) family of processors.
114 130
115config ARCH_IXP4XX 131config ARCH_IXP4XX
116 bool "IXP4xx-based" 132 bool "IXP4xx-based"
117 select DMABOUNCE 133 select DMABOUNCE
118 select PCI 134 select PCI
135 help
136 Support for Intel's IXP4XX (XScale) family of processors.
119 137
120config ARCH_IXP2000 138config ARCH_IXP2000
121 bool "IXP2400/2800-based" 139 bool "IXP2400/2800-based"
122 select PCI 140 select PCI
141 help
142 Support for Intel's IXP2400/2800 (XScale) family of processors.
123 143
124config ARCH_L7200 144config ARCH_L7200
125 bool "LinkUp-L7200" 145 bool "LinkUp-L7200"
@@ -136,6 +156,9 @@ config ARCH_L7200
136 156
137config ARCH_PXA 157config ARCH_PXA
138 bool "PXA2xx-based" 158 bool "PXA2xx-based"
159 select ARCH_MTD_XIP
160 help
161 Support for Intel's PXA2XX processor line.
139 162
140config ARCH_RPC 163config ARCH_RPC
141 bool "RiscPC" 164 bool "RiscPC"
@@ -152,19 +175,25 @@ config ARCH_SA1100
152 bool "SA1100-based" 175 bool "SA1100-based"
153 select ISA 176 select ISA
154 select ARCH_DISCONTIGMEM_ENABLE 177 select ARCH_DISCONTIGMEM_ENABLE
178 select ARCH_MTD_XIP
179 help
180 Support for StrongARM 11x0 based boards.
155 181
156config ARCH_S3C2410 182config ARCH_S3C2410
157 bool "Samsung S3C2410" 183 bool "Samsung S3C2410"
158 help 184 help
159 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 185 Samsung S3C2410X CPU based systems, such as the Simtec Electronics
160 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 186 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
161 the Samsung SMDK2410 development board (and derviatives). 187 the Samsung SMDK2410 development board (and derivatives).
162 188
163config ARCH_SHARK 189config ARCH_SHARK
164 bool "Shark" 190 bool "Shark"
165 select ISA 191 select ISA
166 select ISA_DMA 192 select ISA_DMA
167 select PCI 193 select PCI
194 help
195 Support for the StrongARM based Digital DNARD machine, also known
196 as "Shark" (<http://www.shark-linux.de/shark.html>).
168 197
169config ARCH_LH7A40X 198config ARCH_LH7A40X
170 bool "Sharp LH7A40X" 199 bool "Sharp LH7A40X"
@@ -176,6 +205,8 @@ config ARCH_LH7A40X
176 205
177config ARCH_OMAP 206config ARCH_OMAP
178 bool "TI OMAP" 207 bool "TI OMAP"
208 help
209 Support for TI's OMAP platform (OMAP1 and OMAP2).
179 210
180config ARCH_VERSATILE 211config ARCH_VERSATILE
181 bool "Versatile" 212 bool "Versatile"
@@ -194,6 +225,8 @@ config ARCH_REALVIEW
194 225
195config ARCH_IMX 226config ARCH_IMX
196 bool "IMX" 227 bool "IMX"
228 help
229 Support for Motorola's i.MX family of processors (MX1, MXL).
197 230
198config ARCH_H720X 231config ARCH_H720X
199 bool "Hynix-HMS720x-based" 232 bool "Hynix-HMS720x-based"
@@ -210,8 +243,8 @@ config ARCH_AAEC2000
210config ARCH_AT91RM9200 243config ARCH_AT91RM9200
211 bool "AT91RM9200" 244 bool "AT91RM9200"
212 help 245 help
213 Say Y here if you intend to run this kernel on an AT91RM9200-based 246 Say Y here if you intend to run this kernel on an Atmel
214 board. 247 AT91RM9200-based board.
215 248
216endchoice 249endchoice
217 250
@@ -417,8 +450,8 @@ config AEABI
417 To use this you need GCC version 4.0.0 or later. 450 To use this you need GCC version 4.0.0 or later.
418 451
419config OABI_COMPAT 452config OABI_COMPAT
420 bool "Allow old ABI binaries to run with this kernel" 453 bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)"
421 depends on AEABI 454 depends on AEABI && EXPERIMENTAL
422 default y 455 default y
423 help 456 help
424 This option preserves the old syscall interface along with the 457 This option preserves the old syscall interface along with the
diff --git a/arch/arm/configs/enp2611_defconfig b/arch/arm/configs/enp2611_defconfig
index 9592e3925c79..5fdaf3ce9d56 100644
--- a/arch/arm/configs/enp2611_defconfig
+++ b/arch/arm/configs/enp2611_defconfig
@@ -171,7 +171,7 @@ CONFIG_ALIGNMENT_TRAP=y
171# 171#
172CONFIG_ZBOOT_ROM_TEXT=0x0 172CONFIG_ZBOOT_ROM_TEXT=0x0
173CONFIG_ZBOOT_ROM_BSS=0x0 173CONFIG_ZBOOT_ROM_BSS=0x0
174CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 174CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"
175# CONFIG_XIP_KERNEL is not set 175# CONFIG_XIP_KERNEL is not set
176 176
177# 177#
diff --git a/arch/arm/configs/ixdp2400_defconfig b/arch/arm/configs/ixdp2400_defconfig
index d9d6bb86a6fa..c67fc449a11f 100644
--- a/arch/arm/configs/ixdp2400_defconfig
+++ b/arch/arm/configs/ixdp2400_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/ixdp2401_defconfig b/arch/arm/configs/ixdp2401_defconfig
index 2dc9d499c7d7..60d66e82c51f 100644
--- a/arch/arm/configs/ixdp2401_defconfig
+++ b/arch/arm/configs/ixdp2401_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/ixdp2801_defconfig b/arch/arm/configs/ixdp2801_defconfig
index ea8f4b478fa3..f54f3dcc5b33 100644
--- a/arch/arm/configs/ixdp2801_defconfig
+++ b/arch/arm/configs/ixdp2801_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware ixdp2x01_clock=50000000" 175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 1964ccd8a71f..6695b07cf1ba 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -1,11 +1,10 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.16-rc2
4# Sun Nov 13 17:41:24 2005 4# Mon Feb 6 11:17:23 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 9CONFIG_GENERIC_CALIBRATE_DELAY=y
11 10
@@ -28,27 +27,31 @@ CONFIG_SYSVIPC=y
28# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 28CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
31# CONFIG_HOTPLUG is not set
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set 30# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE="" 31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y
35# CONFIG_EMBEDDED is not set 34# CONFIG_EMBEDDED is not set
36CONFIG_KALLSYMS=y 35CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_ALL is not set 36# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_HOTPLUG=y
39CONFIG_PRINTK=y 39CONFIG_PRINTK=y
40CONFIG_BUG=y 40CONFIG_BUG=y
41CONFIG_ELF_CORE=y
41CONFIG_BASE_FULL=y 42CONFIG_BASE_FULL=y
42CONFIG_FUTEX=y 43CONFIG_FUTEX=y
43CONFIG_EPOLL=y 44CONFIG_EPOLL=y
44CONFIG_CC_OPTIMIZE_FOR_SIZE=y
45CONFIG_SHMEM=y 45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0 46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0 47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0 48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0 49CONFIG_CC_ALIGN_JUMPS=0
50CONFIG_SLAB=y
50# CONFIG_TINY_SHMEM is not set 51# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0 52CONFIG_BASE_SMALL=0
53# CONFIG_SLOB is not set
54CONFIG_OBSOLETE_INTERMODULE=y
52 55
53# 56#
54# Loadable module support 57# Loadable module support
@@ -102,6 +105,7 @@ CONFIG_ARCH_S3C2410=y
102# CONFIG_ARCH_IMX is not set 105# CONFIG_ARCH_IMX is not set
103# CONFIG_ARCH_H720X is not set 106# CONFIG_ARCH_H720X is not set
104# CONFIG_ARCH_AAEC2000 is not set 107# CONFIG_ARCH_AAEC2000 is not set
108# CONFIG_ARCH_AT91RM9200 is not set
105 109
106# 110#
107# S3C24XX Implementations 111# S3C24XX Implementations
@@ -160,7 +164,6 @@ CONFIG_CPU_TLB_V4WBI=y
160# Bus support 164# Bus support
161# 165#
162CONFIG_ISA=y 166CONFIG_ISA=y
163CONFIG_ISA_DMA_API=y
164 167
165# 168#
166# PCCARD (PCMCIA/CardBus) support 169# PCCARD (PCMCIA/CardBus) support
@@ -172,6 +175,7 @@ CONFIG_ISA_DMA_API=y
172# 175#
173# CONFIG_PREEMPT is not set 176# CONFIG_PREEMPT is not set
174# CONFIG_NO_IDLE_HZ is not set 177# CONFIG_NO_IDLE_HZ is not set
178# CONFIG_AEABI is not set
175# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
176CONFIG_SELECT_MEMORY_MODEL=y 180CONFIG_SELECT_MEMORY_MODEL=y
177CONFIG_FLATMEM_MANUAL=y 181CONFIG_FLATMEM_MANUAL=y
@@ -214,6 +218,8 @@ CONFIG_BINFMT_AOUT=y
214# Power management options 218# Power management options
215# 219#
216CONFIG_PM=y 220CONFIG_PM=y
221CONFIG_PM_LEGACY=y
222# CONFIG_PM_DEBUG is not set
217CONFIG_APM=y 223CONFIG_APM=y
218 224
219# 225#
@@ -259,6 +265,11 @@ CONFIG_TCP_CONG_BIC=y
259# SCTP Configuration (EXPERIMENTAL) 265# SCTP Configuration (EXPERIMENTAL)
260# 266#
261# CONFIG_IP_SCTP is not set 267# CONFIG_IP_SCTP is not set
268
269#
270# TIPC Configuration (EXPERIMENTAL)
271#
272# CONFIG_TIPC is not set
262# CONFIG_ATM is not set 273# CONFIG_ATM is not set
263# CONFIG_BRIDGE is not set 274# CONFIG_BRIDGE is not set
264# CONFIG_VLAN_8021Q is not set 275# CONFIG_VLAN_8021Q is not set
@@ -276,7 +287,6 @@ CONFIG_TCP_CONG_BIC=y
276# QoS and/or fair queueing 287# QoS and/or fair queueing
277# 288#
278# CONFIG_NET_SCHED is not set 289# CONFIG_NET_SCHED is not set
279# CONFIG_NET_CLS_ROUTE is not set
280 290
281# 291#
282# Network testing 292# Network testing
@@ -300,6 +310,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
300# CONFIG_DEBUG_DRIVER is not set 310# CONFIG_DEBUG_DRIVER is not set
301 311
302# 312#
313# Connector - unified userspace <-> kernelspace linker
314#
315# CONFIG_CONNECTOR is not set
316
317#
303# Memory Technology Devices (MTD) 318# Memory Technology Devices (MTD)
304# 319#
305CONFIG_MTD=y 320CONFIG_MTD=y
@@ -412,8 +427,6 @@ CONFIG_PARPORT_1284=y
412# 427#
413# Block devices 428# Block devices
414# 429#
415# CONFIG_BLK_DEV_XD is not set
416# CONFIG_PARIDE is not set
417# CONFIG_BLK_DEV_COW_COMMON is not set 430# CONFIG_BLK_DEV_COW_COMMON is not set
418CONFIG_BLK_DEV_LOOP=y 431CONFIG_BLK_DEV_LOOP=y
419# CONFIG_BLK_DEV_CRYPTOLOOP is not set 432# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -502,7 +515,6 @@ CONFIG_NETDEVICES=y
502CONFIG_NET_ETHERNET=y 515CONFIG_NET_ETHERNET=y
503CONFIG_MII=y 516CONFIG_MII=y
504# CONFIG_NET_VENDOR_3COM is not set 517# CONFIG_NET_VENDOR_3COM is not set
505# CONFIG_LANCE is not set
506# CONFIG_NET_VENDOR_SMC is not set 518# CONFIG_NET_VENDOR_SMC is not set
507# CONFIG_SMC91X is not set 519# CONFIG_SMC91X is not set
508CONFIG_DM9000=y 520CONFIG_DM9000=y
@@ -607,11 +619,11 @@ CONFIG_SERIAL_NONSTANDARD=y
607# CONFIG_ROCKETPORT is not set 619# CONFIG_ROCKETPORT is not set
608# CONFIG_CYCLADES is not set 620# CONFIG_CYCLADES is not set
609# CONFIG_DIGIEPCA is not set 621# CONFIG_DIGIEPCA is not set
610# CONFIG_ESPSERIAL is not set
611# CONFIG_MOXA_INTELLIO is not set 622# CONFIG_MOXA_INTELLIO is not set
612# CONFIG_MOXA_SMARTIO is not set 623# CONFIG_MOXA_SMARTIO is not set
613# CONFIG_ISI is not set 624# CONFIG_ISI is not set
614# CONFIG_SYNCLINKMP is not set 625# CONFIG_SYNCLINKMP is not set
626# CONFIG_SYNCLINK_GT is not set
615# CONFIG_N_HDLC is not set 627# CONFIG_N_HDLC is not set
616# CONFIG_RISCOM8 is not set 628# CONFIG_RISCOM8 is not set
617# CONFIG_SPECIALIX is not set 629# CONFIG_SPECIALIX is not set
@@ -625,6 +637,7 @@ CONFIG_SERIAL_NONSTANDARD=y
625CONFIG_SERIAL_8250=y 637CONFIG_SERIAL_8250=y
626CONFIG_SERIAL_8250_CONSOLE=y 638CONFIG_SERIAL_8250_CONSOLE=y
627CONFIG_SERIAL_8250_NR_UARTS=8 639CONFIG_SERIAL_8250_NR_UARTS=8
640CONFIG_SERIAL_8250_RUNTIME_UARTS=4
628CONFIG_SERIAL_8250_EXTENDED=y 641CONFIG_SERIAL_8250_EXTENDED=y
629CONFIG_SERIAL_8250_MANY_PORTS=y 642CONFIG_SERIAL_8250_MANY_PORTS=y
630CONFIG_SERIAL_8250_SHARE_IRQ=y 643CONFIG_SERIAL_8250_SHARE_IRQ=y
@@ -687,6 +700,7 @@ CONFIG_S3C2410_RTC=y
687# 700#
688# TPM devices 701# TPM devices
689# 702#
703# CONFIG_TCG_TPM is not set
690# CONFIG_TELCLOCK is not set 704# CONFIG_TELCLOCK is not set
691 705
692# 706#
@@ -731,6 +745,12 @@ CONFIG_SENSORS_EEPROM=m
731# CONFIG_I2C_DEBUG_CHIP is not set 745# CONFIG_I2C_DEBUG_CHIP is not set
732 746
733# 747#
748# SPI support
749#
750# CONFIG_SPI is not set
751# CONFIG_SPI_MASTER is not set
752
753#
734# Hardware Monitoring support 754# Hardware Monitoring support
735# 755#
736CONFIG_HWMON=y 756CONFIG_HWMON=y
@@ -863,6 +883,7 @@ CONFIG_FS_MBCACHE=y
863# CONFIG_JFS_FS is not set 883# CONFIG_JFS_FS is not set
864# CONFIG_FS_POSIX_ACL is not set 884# CONFIG_FS_POSIX_ACL is not set
865# CONFIG_XFS_FS is not set 885# CONFIG_XFS_FS is not set
886# CONFIG_OCFS2_FS is not set
866# CONFIG_MINIX_FS is not set 887# CONFIG_MINIX_FS is not set
867CONFIG_ROMFS_FS=y 888CONFIG_ROMFS_FS=y
868CONFIG_INOTIFY=y 889CONFIG_INOTIFY=y
@@ -897,6 +918,7 @@ CONFIG_SYSFS=y
897# CONFIG_HUGETLB_PAGE is not set 918# CONFIG_HUGETLB_PAGE is not set
898CONFIG_RAMFS=y 919CONFIG_RAMFS=y
899# CONFIG_RELAYFS_FS is not set 920# CONFIG_RELAYFS_FS is not set
921# CONFIG_CONFIGFS_FS is not set
900 922
901# 923#
902# Miscellaneous filesystems 924# Miscellaneous filesystems
@@ -965,6 +987,7 @@ CONFIG_SOLARIS_X86_PARTITION=y
965# CONFIG_SGI_PARTITION is not set 987# CONFIG_SGI_PARTITION is not set
966# CONFIG_ULTRIX_PARTITION is not set 988# CONFIG_ULTRIX_PARTITION is not set
967# CONFIG_SUN_PARTITION is not set 989# CONFIG_SUN_PARTITION is not set
990# CONFIG_KARMA_PARTITION is not set
968# CONFIG_EFI_PARTITION is not set 991# CONFIG_EFI_PARTITION is not set
969 992
970# 993#
@@ -1020,12 +1043,13 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1020# Kernel hacking 1043# Kernel hacking
1021# 1044#
1022# CONFIG_PRINTK_TIME is not set 1045# CONFIG_PRINTK_TIME is not set
1023CONFIG_DEBUG_KERNEL=y
1024CONFIG_MAGIC_SYSRQ=y 1046CONFIG_MAGIC_SYSRQ=y
1047CONFIG_DEBUG_KERNEL=y
1025CONFIG_LOG_BUF_SHIFT=16 1048CONFIG_LOG_BUF_SHIFT=16
1026CONFIG_DETECT_SOFTLOCKUP=y 1049CONFIG_DETECT_SOFTLOCKUP=y
1027# CONFIG_SCHEDSTATS is not set 1050# CONFIG_SCHEDSTATS is not set
1028# CONFIG_DEBUG_SLAB is not set 1051# CONFIG_DEBUG_SLAB is not set
1052CONFIG_DEBUG_MUTEXES=y
1029# CONFIG_DEBUG_SPINLOCK is not set 1053# CONFIG_DEBUG_SPINLOCK is not set
1030# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1054# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1031# CONFIG_DEBUG_KOBJECT is not set 1055# CONFIG_DEBUG_KOBJECT is not set
@@ -1034,6 +1058,7 @@ CONFIG_DEBUG_INFO=y
1034# CONFIG_DEBUG_FS is not set 1058# CONFIG_DEBUG_FS is not set
1035# CONFIG_DEBUG_VM is not set 1059# CONFIG_DEBUG_VM is not set
1036CONFIG_FRAME_POINTER=y 1060CONFIG_FRAME_POINTER=y
1061CONFIG_FORCED_INLINING=y
1037# CONFIG_RCU_TORTURE_TEST is not set 1062# CONFIG_RCU_TORTURE_TEST is not set
1038CONFIG_DEBUG_USER=y 1063CONFIG_DEBUG_USER=y
1039# CONFIG_DEBUG_WAITQ is not set 1064# CONFIG_DEBUG_WAITQ is not set
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index d058e7c12568..8c3035d5ffc9 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -291,21 +291,21 @@
291 CALL(sys_mq_getsetattr) 291 CALL(sys_mq_getsetattr)
292/* 280 */ CALL(sys_waitid) 292/* 280 */ CALL(sys_waitid)
293 CALL(sys_socket) 293 CALL(sys_socket)
294 CALL(sys_bind) 294 CALL(ABI(sys_bind, sys_oabi_bind))
295 CALL(sys_connect) 295 CALL(ABI(sys_connect, sys_oabi_connect))
296 CALL(sys_listen) 296 CALL(sys_listen)
297/* 285 */ CALL(sys_accept) 297/* 285 */ CALL(sys_accept)
298 CALL(sys_getsockname) 298 CALL(sys_getsockname)
299 CALL(sys_getpeername) 299 CALL(sys_getpeername)
300 CALL(sys_socketpair) 300 CALL(sys_socketpair)
301 CALL(sys_send) 301 CALL(sys_send)
302/* 290 */ CALL(sys_sendto) 302/* 290 */ CALL(ABI(sys_sendto, sys_oabi_sendto))
303 CALL(sys_recv) 303 CALL(sys_recv)
304 CALL(sys_recvfrom) 304 CALL(sys_recvfrom)
305 CALL(sys_shutdown) 305 CALL(sys_shutdown)
306 CALL(sys_setsockopt) 306 CALL(sys_setsockopt)
307/* 295 */ CALL(sys_getsockopt) 307/* 295 */ CALL(sys_getsockopt)
308 CALL(sys_sendmsg) 308 CALL(ABI(sys_sendmsg, sys_oabi_sendmsg))
309 CALL(sys_recvmsg) 309 CALL(sys_recvmsg)
310 CALL(ABI(sys_semop, sys_oabi_semop)) 310 CALL(ABI(sys_semop, sys_oabi_semop))
311 CALL(sys_semget) 311 CALL(sys_semget)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d401d908c463..964cd717506b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -333,10 +333,14 @@ __pabt_svc:
333 @ from the exception stack 333 @ from the exception stack
334 334
335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
336#ifndef CONFIG_MMU
337#warning "NPTL on non MMU needs fixing"
338#else
336 @ make sure our user space atomic helper is aborted 339 @ make sure our user space atomic helper is aborted
337 cmp r2, #TASK_SIZE 340 cmp r2, #TASK_SIZE
338 bichs r3, r3, #PSR_Z_BIT 341 bichs r3, r3, #PSR_Z_BIT
339#endif 342#endif
343#endif
340 344
341 @ 345 @
342 @ We are now ready to fill in the remaining blanks on the stack: 346 @ We are now ready to fill in the remaining blanks on the stack:
@@ -705,7 +709,12 @@ __kuser_memory_barrier: @ 0xffff0fa0
705 * The C flag is also set if *ptr was changed to allow for assembly 709 * The C flag is also set if *ptr was changed to allow for assembly
706 * optimization in the calling code. 710 * optimization in the calling code.
707 * 711 *
708 * Note: this routine already includes memory barriers as needed. 712 * Notes:
713 *
714 * - This routine already includes memory barriers as needed.
715 *
716 * - A failure might be transient, i.e. it is possible, although unlikely,
717 * that "failure" be returned even if *ptr == oldval.
709 * 718 *
710 * For example, a user space atomic_add implementation could look like this: 719 * For example, a user space atomic_add implementation could look like this:
711 * 720 *
@@ -756,12 +765,18 @@ __kuser_cmpxchg: @ 0xffff0fc0
756 * exception happening just after the str instruction which would 765 * exception happening just after the str instruction which would
757 * clear the Z flag although the exchange was done. 766 * clear the Z flag although the exchange was done.
758 */ 767 */
768#ifdef CONFIG_MMU
759 teq ip, ip @ set Z flag 769 teq ip, ip @ set Z flag
760 ldr ip, [r2] @ load current val 770 ldr ip, [r2] @ load current val
761 add r3, r2, #1 @ prepare store ptr 771 add r3, r2, #1 @ prepare store ptr
762 teqeq ip, r0 @ compare with oldval if still allowed 772 teqeq ip, r0 @ compare with oldval if still allowed
763 streq r1, [r3, #-1]! @ store newval if still allowed 773 streq r1, [r3, #-1]! @ store newval if still allowed
764 subs r0, r2, r3 @ if r2 == r3 the str occured 774 subs r0, r2, r3 @ if r2 == r3 the str occured
775#else
776#warning "NPTL on non MMU needs fixing"
777 mov r0, #-1
778 adds r0, r0, #0
779#endif
765 mov pc, lr 780 mov pc, lr
766 781
767#else 782#else
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index eafa8e5284af..9d4b76409c64 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -59,6 +59,16 @@
59 * struct sembuf loses its padding with EABI. Since arrays of them are 59 * struct sembuf loses its padding with EABI. Since arrays of them are
60 * used they have to be copyed to remove the padding. Compatibility wrappers 60 * used they have to be copyed to remove the padding. Compatibility wrappers
61 * provided below. 61 * provided below.
62 *
63 * sys_bind:
64 * sys_connect:
65 * sys_sendmsg:
66 * sys_sendto:
67 *
68 * struct sockaddr_un loses its padding with EABI. Since the size of the
69 * structure is used as a validation test in unix_mkname(), we need to
70 * change the length argument to 110 whenever it is 112. Compatibility
71 * wrappers provided below.
62 */ 72 */
63 73
64#include <linux/syscalls.h> 74#include <linux/syscalls.h>
@@ -67,6 +77,7 @@
67#include <linux/fcntl.h> 77#include <linux/fcntl.h>
68#include <linux/eventpoll.h> 78#include <linux/eventpoll.h>
69#include <linux/sem.h> 79#include <linux/sem.h>
80#include <linux/socket.h>
70#include <asm/ipc.h> 81#include <asm/ipc.h>
71#include <asm/uaccess.h> 82#include <asm/uaccess.h>
72 83
@@ -337,3 +348,63 @@ asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
337 return sys_ipc(call, first, second, third, ptr, fifth); 348 return sys_ipc(call, first, second, third, ptr, fifth);
338 } 349 }
339} 350}
351
352asmlinkage long sys_oabi_bind(int fd, struct sockaddr __user *addr, int addrlen)
353{
354 sa_family_t sa_family;
355 if (addrlen == 112 &&
356 get_user(sa_family, &addr->sa_family) == 0 &&
357 sa_family == AF_UNIX)
358 addrlen = 110;
359 return sys_bind(fd, addr, addrlen);
360}
361
362asmlinkage long sys_oabi_connect(int fd, struct sockaddr __user *addr, int addrlen)
363{
364 sa_family_t sa_family;
365 if (addrlen == 112 &&
366 get_user(sa_family, &addr->sa_family) == 0 &&
367 sa_family == AF_UNIX)
368 addrlen = 110;
369 return sys_connect(fd, addr, addrlen);
370}
371
372asmlinkage long sys_oabi_sendto(int fd, void __user *buff,
373 size_t len, unsigned flags,
374 struct sockaddr __user *addr,
375 int addrlen)
376{
377 sa_family_t sa_family;
378 if (addrlen == 112 &&
379 get_user(sa_family, &addr->sa_family) == 0 &&
380 sa_family == AF_UNIX)
381 addrlen = 110;
382 return sys_sendto(fd, buff, len, flags, addr, addrlen);
383}
384
385asmlinkage long sys_oabi_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
386{
387 struct sockaddr __user *addr;
388 int msg_namelen;
389 sa_family_t sa_family;
390 if (msg &&
391 get_user(msg_namelen, &msg->msg_namelen) == 0 &&
392 msg_namelen == 112 &&
393 get_user(addr, &msg->msg_name) == 0 &&
394 get_user(sa_family, &addr->sa_family) == 0 &&
395 sa_family == AF_UNIX)
396 {
397 /*
398 * HACK ALERT: there is a limit to how much backward bending
399 * we should do for what is actually a transitional
400 * compatibility layer. This already has known flaws with
401 * a few ioctls that we don't intend to fix. Therefore
402 * consider this blatent hack as another one... and take care
403 * to run for cover. In most cases it will "just work fine".
404 * If it doesn't, well, tough.
405 */
406 put_user(110, &msg->msg_namelen);
407 }
408 return sys_sendmsg(fd, msg, flags);
409}
410
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 0793dcf54f2e..0e2b641268ad 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -24,6 +24,8 @@ config ARCH_CEIVA
24 24
25config ARCH_CLEP7312 25config ARCH_CLEP7312
26 bool "CLEP7312" 26 bool "CLEP7312"
27 help
28 Boards based on the Cirrus Logic 7212/7312 chips.
27 29
28config ARCH_EDB7211 30config ARCH_EDB7211
29 bool "EDB7211" 31 bool "EDB7211"
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index dc31e3fd6c57..8ab1b040288c 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -27,7 +27,6 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include "generic.h" 29#include "generic.h"
30#include <asm/serial.h>
31 30
32static struct resource cs89x0_resources[] = { 31static struct resource cs89x0_resources[] = {
33 [0] = { 32 [0] = {
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index 9e5a13bb39d0..52fac89e95b5 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -106,6 +106,7 @@ static void __init enp2611_pci_preinit(void)
106{ 106{
107 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 107 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
108 ixp2000_pci_preinit(); 108 ixp2000_pci_preinit();
109 pcibios_setup("firmware");
109} 110}
110 111
111static inline int enp2611_pci_valid_device(struct pci_bus *bus, 112static inline int enp2611_pci_valid_device(struct pci_bus *bus,
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index 7c782403042a..09101271298e 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -68,6 +68,7 @@ void __init ixdp2400_pci_preinit(void)
68{ 68{
69 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 69 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
70 ixp2000_pci_preinit(); 70 ixp2000_pci_preinit();
71 pcibios_setup("firmware");
71} 72}
72 73
73int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys) 74int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys)
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index 10f06606d460..150519fb38ec 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -212,6 +212,7 @@ void __init ixdp2x01_pci_preinit(void)
212{ 212{
213 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000); 213 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000);
214 ixp2000_pci_preinit(); 214 ixp2000_pci_preinit();
215 pcibios_setup("firmware");
215} 216}
216 217
217#define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) 218#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
@@ -299,7 +300,9 @@ struct hw_pci ixdp2x01_pci __initdata = {
299 300
300int __init ixdp2x01_pci_init(void) 301int __init ixdp2x01_pci_init(void)
301{ 302{
302 pci_common_init(&ixdp2x01_pci); 303 if (machine_is_ixdp2401() || machine_is_ixdp2801())
304 pci_common_init(&ixdp2x01_pci);
305
303 return 0; 306 return 0;
304} 307}
305 308
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index bdc20b51b076..a177e78b2b87 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -30,6 +30,7 @@
30 30
31static void __init omap_generic_init_irq(void) 31static void __init omap_generic_init_irq(void)
32{ 32{
33 omap1_init_common_hw();
33 omap_init_irq(); 34 omap_init_irq();
34} 35}
35 36
@@ -104,7 +105,7 @@ static void __init omap_generic_init(void)
104 105
105static void __init omap_generic_map_io(void) 106static void __init omap_generic_map_io(void)
106{ 107{
107 omap_map_common_io(); 108 omap1_map_common_io();
108} 109}
109 110
110MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 111MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 9533c36a92df..89f0cc74a519 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -128,6 +128,7 @@ static void __init h2_init_smc91x(void)
128 128
129static void __init h2_init_irq(void) 129static void __init h2_init_irq(void)
130{ 130{
131 omap1_init_common_hw();
131 omap_init_irq(); 132 omap_init_irq();
132 omap_gpio_init(); 133 omap_gpio_init();
133 h2_init_smc91x(); 134 h2_init_smc91x();
@@ -194,7 +195,7 @@ static void __init h2_init(void)
194 195
195static void __init h2_map_io(void) 196static void __init h2_map_io(void)
196{ 197{
197 omap_map_common_io(); 198 omap1_map_common_io();
198} 199}
199 200
200MACHINE_START(OMAP_H2, "TI-H2") 201MACHINE_START(OMAP_H2, "TI-H2")
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index d665efc1c344..d9f386265996 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -203,6 +203,7 @@ static void __init h3_init_smc91x(void)
203 203
204void h3_init_irq(void) 204void h3_init_irq(void)
205{ 205{
206 omap1_init_common_hw();
206 omap_init_irq(); 207 omap_init_irq();
207 omap_gpio_init(); 208 omap_gpio_init();
208 h3_init_smc91x(); 209 h3_init_smc91x();
@@ -210,7 +211,7 @@ void h3_init_irq(void)
210 211
211static void __init h3_map_io(void) 212static void __init h3_map_io(void)
212{ 213{
213 omap_map_common_io(); 214 omap1_map_common_io();
214} 215}
215 216
216MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 217MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 652f37c7f906..a04e4332915e 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -181,6 +181,7 @@ static void __init innovator_init_smc91x(void)
181 181
182void innovator_init_irq(void) 182void innovator_init_irq(void)
183{ 183{
184 omap1_init_common_hw();
184 omap_init_irq(); 185 omap_init_irq();
185 omap_gpio_init(); 186 omap_gpio_init();
186#ifdef CONFIG_ARCH_OMAP15XX 187#ifdef CONFIG_ARCH_OMAP15XX
@@ -285,7 +286,7 @@ static void __init innovator_init(void)
285 286
286static void __init innovator_map_io(void) 287static void __init innovator_map_io(void)
287{ 288{
288 omap_map_common_io(); 289 omap1_map_common_io();
289 290
290#ifdef CONFIG_ARCH_OMAP15XX 291#ifdef CONFIG_ARCH_OMAP15XX
291 if (cpu_is_omap1510()) { 292 if (cpu_is_omap1510()) {
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 58f783930d45..60d5f8a3339c 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -65,6 +65,7 @@ static struct omap_board_config_kernel netstar_config[] = {
65 65
66static void __init netstar_init_irq(void) 66static void __init netstar_init_irq(void)
67{ 67{
68 omap1_init_common_hw();
68 omap_init_irq(); 69 omap_init_irq();
69 omap_gpio_init(); 70 omap_gpio_init();
70} 71}
@@ -108,7 +109,7 @@ static void __init netstar_init(void)
108 109
109static void __init netstar_map_io(void) 110static void __init netstar_map_io(void)
110{ 111{
111 omap_map_common_io(); 112 omap1_map_common_io();
112} 113}
113 114
114#define MACHINE_PANICED 1 115#define MACHINE_PANICED 1
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index e5d126e8f276..543fa136106d 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -169,6 +169,7 @@ static void __init osk_init_cf(void)
169 169
170static void __init osk_init_irq(void) 170static void __init osk_init_irq(void)
171{ 171{
172 omap1_init_common_hw();
172 omap_init_irq(); 173 omap_init_irq();
173 omap_gpio_init(); 174 omap_gpio_init();
174 osk_init_smc91x(); 175 osk_init_smc91x();
@@ -269,7 +270,7 @@ static void __init osk_init(void)
269 270
270static void __init osk_map_io(void) 271static void __init osk_map_io(void)
271{ 272{
272 omap_map_common_io(); 273 omap1_map_common_io();
273} 274}
274 275
275MACHINE_START(OMAP_OSK, "TI-OSK") 276MACHINE_START(OMAP_OSK, "TI-OSK")
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 67fada207622..e488f7236775 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -34,6 +34,7 @@
34 34
35static void __init omap_generic_init_irq(void) 35static void __init omap_generic_init_irq(void)
36{ 36{
37 omap1_init_common_hw();
37 omap_init_irq(); 38 omap_init_irq();
38} 39}
39 40
@@ -72,7 +73,7 @@ static void __init omap_generic_init(void)
72 73
73static void __init omap_generic_map_io(void) 74static void __init omap_generic_map_io(void)
74{ 75{
75 omap_map_common_io(); 76 omap1_map_common_io();
76} 77}
77 78
78MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") 79MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 88708a0c52a2..3913a3cc0ce6 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -144,6 +144,7 @@ static void __init perseus2_init_smc91x(void)
144 144
145void omap_perseus2_init_irq(void) 145void omap_perseus2_init_irq(void)
146{ 146{
147 omap1_init_common_hw();
147 omap_init_irq(); 148 omap_init_irq();
148 omap_gpio_init(); 149 omap_gpio_init();
149 perseus2_init_smc91x(); 150 perseus2_init_smc91x();
@@ -160,7 +161,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
160 161
161static void __init omap_perseus2_map_io(void) 162static void __init omap_perseus2_map_io(void)
162{ 163{
163 omap_map_common_io(); 164 omap1_map_common_io();
164 iotable_init(omap_perseus2_io_desc, 165 iotable_init(omap_perseus2_io_desc,
165 ARRAY_SIZE(omap_perseus2_io_desc)); 166 ARRAY_SIZE(omap_perseus2_io_desc));
166 167
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 959b4b847c87..bfd5fdd1a875 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -162,6 +162,7 @@ static struct omap_board_config_kernel voiceblue_config[] = {
162 162
163static void __init voiceblue_init_irq(void) 163static void __init voiceblue_init_irq(void)
164{ 164{
165 omap1_init_common_hw();
165 omap_init_irq(); 166 omap_init_irq();
166 omap_gpio_init(); 167 omap_gpio_init();
167} 168}
@@ -206,7 +207,7 @@ static void __init voiceblue_init(void)
206 207
207static void __init voiceblue_map_io(void) 208static void __init voiceblue_map_io(void)
208{ 209{
209 omap_map_common_io(); 210 omap1_map_common_io();
210} 211}
211 212
212#define MACHINE_PANICED 1 213#define MACHINE_PANICED 1
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index a7a19f75b9e1..82d556be79c5 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16#include <asm/tlb.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/arch/mux.h> 19#include <asm/arch/mux.h>
@@ -83,15 +84,24 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
83}; 84};
84#endif 85#endif
85 86
86static int initialized = 0; 87/*
87 88 * Maps common IO regions for omap1. This should only get called from
88static void __init _omap_map_io(void) 89 * board specific init.
90 */
91void __init omap1_map_common_io(void)
89{ 92{
90 initialized = 1;
91
92 /* We have to initialize the IO space mapping before we can run
93 * cpu_is_omapxxx() macros. */
94 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); 93 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
94
95 /* Normally devicemaps_init() would flush caches and tlb after
96 * mdesc->map_io(), but we must also do it here because of the CPU
97 * revision check below.
98 */
99 local_flush_tlb_all();
100 flush_cache_all();
101
102 /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
103 * IO space mapping must be initialized before we can do that.
104 */
95 omap_check_revision(); 105 omap_check_revision();
96 106
97#ifdef CONFIG_ARCH_OMAP730 107#ifdef CONFIG_ARCH_OMAP730
@@ -111,7 +121,14 @@ static void __init _omap_map_io(void)
111#endif 121#endif
112 122
113 omap_sram_init(); 123 omap_sram_init();
124}
114 125
126/*
127 * Common low-level hardware init for omap1. This should only get called from
128 * board specific init.
129 */
130void __init omap1_init_common_hw()
131{
115 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 132 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
116 * on a Posted Write in the TIPB Bridge". 133 * on a Posted Write in the TIPB Bridge".
117 */ 134 */
@@ -121,16 +138,7 @@ static void __init _omap_map_io(void)
121 /* Must init clocks early to assure that timer interrupt works 138 /* Must init clocks early to assure that timer interrupt works
122 */ 139 */
123 omap1_clk_init(); 140 omap1_clk_init();
124}
125 141
126/* 142 omap1_mux_init();
127 * This should only get called from board specific init
128 */
129void __init omap_map_common_io(void)
130{
131 if (!initialized) {
132 _omap_map_io();
133 omap1_mux_init();
134 }
135} 143}
136 144
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index b937123e5c65..eaecbf422d8c 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -33,6 +33,7 @@
33 33
34static void __init omap_generic_init_irq(void) 34static void __init omap_generic_init_irq(void)
35{ 35{
36 omap2_init_common_hw();
36 omap_init_irq(); 37 omap_init_irq();
37} 38}
38 39
@@ -64,7 +65,7 @@ static void __init omap_generic_init(void)
64 65
65static void __init omap_generic_map_io(void) 66static void __init omap_generic_map_io(void)
66{ 67{
67 omap_map_common_io(); 68 omap2_map_common_io();
68} 69}
69 70
70MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 71MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index c3c35d40378a..a300d634d8a5 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -136,6 +136,7 @@ static inline void __init h4_init_smc91x(void)
136 136
137static void __init omap_h4_init_irq(void) 137static void __init omap_h4_init_irq(void)
138{ 138{
139 omap2_init_common_hw();
139 omap_init_irq(); 140 omap_init_irq();
140 omap_gpio_init(); 141 omap_gpio_init();
141 h4_init_smc91x(); 142 h4_init_smc91x();
@@ -181,7 +182,7 @@ static void __init omap_h4_init(void)
181 182
182static void __init omap_h4_map_io(void) 183static void __init omap_h4_map_io(void)
183{ 184{
184 omap_map_common_io(); 185 omap2_map_common_io();
185} 186}
186 187
187MACHINE_START(OMAP_H4, "OMAP2420 H4 board") 188MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 4a222f59f2cf..4303d988c4bf 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -182,7 +182,7 @@ static const struct icst307_params realview_oscvco_params = {
182static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) 182static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
183{ 183{
184 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 184 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
185 void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC1_OFFSET; 185 void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
186 u32 val; 186 u32 val;
187 187
188 val = readl(sys_osc) & ~0x7ffff; 188 val = readl(sys_osc) & ~0x7ffff;
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index af2f3d52b61b..08489efdaf06 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -40,7 +40,6 @@
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41 41
42#include <asm/hardware.h> 42#include <asm/hardware.h>
43#include <asm/atomic.h>
44#include <asm/irq.h> 43#include <asm/irq.h>
45#include <asm/io.h> 44#include <asm/io.h>
46 45
@@ -59,22 +58,18 @@ static DEFINE_MUTEX(clocks_mutex);
59void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable) 58void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable)
60{ 59{
61 unsigned long clkcon; 60 unsigned long clkcon;
62 unsigned long flags;
63
64 local_irq_save(flags);
65 61
66 clkcon = __raw_readl(S3C2410_CLKCON); 62 clkcon = __raw_readl(S3C2410_CLKCON);
67 clkcon &= ~clocks;
68 63
69 if (enable) 64 if (enable)
70 clkcon |= clocks; 65 clkcon |= clocks;
66 else
67 clkcon &= ~clocks;
71 68
72 /* ensure none of the special function bits set */ 69 /* ensure none of the special function bits set */
73 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER); 70 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
74 71
75 __raw_writel(clkcon, S3C2410_CLKCON); 72 __raw_writel(clkcon, S3C2410_CLKCON);
76
77 local_irq_restore(flags);
78} 73}
79 74
80/* enable and disable calls for use with the clk struct */ 75/* enable and disable calls for use with the clk struct */
@@ -138,16 +133,32 @@ void clk_put(struct clk *clk)
138 133
139int clk_enable(struct clk *clk) 134int clk_enable(struct clk *clk)
140{ 135{
141 if (IS_ERR(clk)) 136 if (IS_ERR(clk) || clk == NULL)
142 return -EINVAL; 137 return -EINVAL;
143 138
144 return (clk->enable)(clk, 1); 139 clk_enable(clk->parent);
140
141 mutex_lock(&clocks_mutex);
142
143 if ((clk->usage++) == 0)
144 (clk->enable)(clk, 1);
145
146 mutex_unlock(&clocks_mutex);
147 return 0;
145} 148}
146 149
147void clk_disable(struct clk *clk) 150void clk_disable(struct clk *clk)
148{ 151{
149 if (!IS_ERR(clk)) 152 if (IS_ERR(clk) || clk == NULL)
153 return;
154
155 mutex_lock(&clocks_mutex);
156
157 if ((--clk->usage) == 0)
150 (clk->enable)(clk, 0); 158 (clk->enable)(clk, 0);
159
160 mutex_unlock(&clocks_mutex);
161 clk_disable(clk->parent);
151} 162}
152 163
153 164
@@ -361,6 +372,14 @@ int s3c24xx_register_clock(struct clk *clk)
361 if (clk->enable == NULL) 372 if (clk->enable == NULL)
362 clk->enable = clk_null_enable; 373 clk->enable = clk_null_enable;
363 374
375 /* if this is a standard clock, set the usage state */
376
377 if (clk->ctrlbit) {
378 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
379
380 clk->usage = (clkcon & clk->ctrlbit) ? 1 : 0;
381 }
382
364 /* add to the list of available clocks */ 383 /* add to the list of available clocks */
365 384
366 mutex_lock(&clocks_mutex); 385 mutex_lock(&clocks_mutex);
@@ -402,6 +421,8 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
402 * the LCD clock if it is not needed. 421 * the LCD clock if it is not needed.
403 */ 422 */
404 423
424 mutex_lock(&clocks_mutex);
425
405 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0); 426 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0);
406 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0); 427 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0);
407 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0); 428 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0);
@@ -409,6 +430,8 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
409 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0); 430 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0);
410 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0); 431 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0);
411 432
433 mutex_unlock(&clocks_mutex);
434
412 /* assume uart clocks are correctly setup */ 435 /* assume uart clocks are correctly setup */
413 436
414 /* register our clocks */ 437 /* register our clocks */
diff --git a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
index 177d5c8decf7..eb5c95d1e7f2 100644
--- a/arch/arm/mach-s3c2410/clock.h
+++ b/arch/arm/mach-s3c2410/clock.h
@@ -16,6 +16,7 @@ struct clk {
16 struct clk *parent; 16 struct clk *parent;
17 const char *name; 17 const char *name;
18 int id; 18 int id;
19 int usage;
19 unsigned long rate; 20 unsigned long rate;
20 unsigned long ctrlbit; 21 unsigned long ctrlbit;
21 int (*enable)(struct clk *, int enable); 22 int (*enable)(struct clk *, int enable);
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
index b8d994a24d1c..0a47d38789a5 100644
--- a/arch/arm/mach-s3c2410/devs.c
+++ b/arch/arm/mach-s3c2410/devs.c
@@ -275,6 +275,11 @@ static struct resource s3c_adc_resource[] = {
275 }, 275 },
276 [1] = { 276 [1] = {
277 .start = IRQ_TC, 277 .start = IRQ_TC,
278 .end = IRQ_TC,
279 .flags = IORESOURCE_IRQ,
280 },
281 [2] = {
282 .start = IRQ_ADC,
278 .end = IRQ_ADC, 283 .end = IRQ_ADC,
279 .flags = IORESOURCE_IRQ, 284 .flags = IORESOURCE_IRQ,
280 } 285 }
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 792f66375830..ee82763b02b8 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/tlb.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
22 23
@@ -96,6 +97,14 @@ void __init omap_map_sram(void)
96 omap_sram_io_desc[0].length); 97 omap_sram_io_desc[0].length);
97 98
98 /* 99 /*
100 * Normally devicemaps_init() would flush caches and tlb after
101 * mdesc->map_io(), but since we're called from map_io(), we
102 * must do it here.
103 */
104 local_flush_tlb_all();
105 flush_cache_all();
106
107 /*
99 * Looks like we need to preserve some bootloader code at the 108 * Looks like we need to preserve some bootloader code at the
100 * beginning of SRAM for jumping to flash for reboot to work... 109 * beginning of SRAM for jumping to flash for reboot to work...
101 */ 110 */
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index f214f74f264e..961c0d58ded4 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -202,18 +202,18 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
202 int i; 202 int i;
203 unsigned long tmp; 203 unsigned long tmp;
204 204
205 ret = 0;
205 for (i = 0; i <= PT_MAX; i++) { 206 for (i = 0; i <= PT_MAX; i++) {
206 tmp = get_reg(child, i); 207 tmp = get_reg(child, i);
207 208
208 if (put_user(tmp, datap)) { 209 if (put_user(tmp, datap)) {
209 ret = -EFAULT; 210 ret = -EFAULT;
210 goto out_tsk; 211 break;
211 } 212 }
212 213
213 data += sizeof(long); 214 data += sizeof(long);
214 } 215 }
215 216
216 ret = 0;
217 break; 217 break;
218 } 218 }
219 219
@@ -222,10 +222,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
222 int i; 222 int i;
223 unsigned long tmp; 223 unsigned long tmp;
224 224
225 ret = 0;
225 for (i = 0; i <= PT_MAX; i++) { 226 for (i = 0; i <= PT_MAX; i++) {
226 if (get_user(tmp, datap)) { 227 if (get_user(tmp, datap)) {
227 ret = -EFAULT; 228 ret = -EFAULT;
228 goto out_tsk; 229 break;
229 } 230 }
230 231
231 if (i == PT_DCCR) { 232 if (i == PT_DCCR) {
@@ -237,7 +238,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
237 data += sizeof(long); 238 data += sizeof(long);
238 } 239 }
239 240
240 ret = 0;
241 break; 241 break;
242 } 242 }
243 243
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index d11206e467ab..1ba57efff60d 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -24,7 +24,6 @@
24/* 24/*
25 * Setup options 25 * Setup options
26 */ 26 */
27struct drive_info_struct { char dummy[32]; } drive_info;
28struct screen_info screen_info; 27struct screen_info screen_info;
29 28
30extern int root_mountflags; 29extern int root_mountflags;
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 1b665928336b..5a8b3fb6d27b 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -309,3 +309,4 @@ ENTRY(sys_call_table)
309 .long sys_faccessat 309 .long sys_faccessat
310 .long sys_pselect6 310 .long sys_pselect6
311 .long sys_ppoll 311 .long sys_ppoll
312 .long sys_unshare /* 310 */
diff --git a/arch/ia64/dig/setup.c b/arch/ia64/dig/setup.c
index d58003f1ad02..c9104bfff667 100644
--- a/arch/ia64/dig/setup.c
+++ b/arch/ia64/dig/setup.c
@@ -25,16 +25,6 @@
25#include <asm/machvec.h> 25#include <asm/machvec.h>
26#include <asm/system.h> 26#include <asm/system.h>
27 27
28/*
29 * This is here so we can use the CMOS detection in ide-probe.c to
30 * determine what drives are present. In theory, we don't need this
31 * as the auto-detection could be done via ide-probe.c:do_probe() but
32 * in practice that would be much slower, which is painful when
33 * running in the simulator. Note that passing zeroes in DRIVE_INFO
34 * is sufficient (the IDE driver will autodetect the drive geometry).
35 */
36char drive_info[4*16];
37
38void __init 28void __init
39dig_setup (char **cmdline_p) 29dig_setup (char **cmdline_p)
40{ 30{
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index c485a3b32ba8..9990320b6f9a 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -410,24 +410,16 @@ efi_init (void)
410 efi_config_table_t *config_tables; 410 efi_config_table_t *config_tables;
411 efi_char16_t *c16; 411 efi_char16_t *c16;
412 u64 efi_desc_size; 412 u64 efi_desc_size;
413 char *cp, *end, vendor[100] = "unknown"; 413 char *cp, vendor[100] = "unknown";
414 extern char saved_command_line[]; 414 extern char saved_command_line[];
415 int i; 415 int i;
416 416
417 /* it's too early to be able to use the standard kernel command line support... */ 417 /* it's too early to be able to use the standard kernel command line support... */
418 for (cp = saved_command_line; *cp; ) { 418 for (cp = saved_command_line; *cp; ) {
419 if (memcmp(cp, "mem=", 4) == 0) { 419 if (memcmp(cp, "mem=", 4) == 0) {
420 cp += 4; 420 mem_limit = memparse(cp + 4, &cp);
421 mem_limit = memparse(cp, &end);
422 if (end != cp)
423 break;
424 cp = end;
425 } else if (memcmp(cp, "max_addr=", 9) == 0) { 421 } else if (memcmp(cp, "max_addr=", 9) == 0) {
426 cp += 9; 422 max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
427 max_addr = GRANULEROUNDDOWN(memparse(cp, &end));
428 if (end != cp)
429 break;
430 cp = end;
431 } else { 423 } else {
432 while (*cp != ' ' && *cp) 424 while (*cp != ' ' && *cp)
433 ++cp; 425 ++cp;
@@ -458,7 +450,7 @@ efi_init (void)
458 /* Show what we know for posterity */ 450 /* Show what we know for posterity */
459 c16 = __va(efi.systab->fw_vendor); 451 c16 = __va(efi.systab->fw_vendor);
460 if (c16) { 452 if (c16) {
461 for (i = 0;i < (int) sizeof(vendor) && *c16; ++i) 453 for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
462 vendor[i] = *c16++; 454 vendor[i] = *c16++;
463 vendor[i] = '\0'; 455 vendor[i] = '\0';
464 } 456 }
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index fbc7ea35dd57..f1778a84ea61 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -352,6 +352,7 @@ start_ap:
352 mov ar.rsc=0 // place RSE in enforced lazy mode 352 mov ar.rsc=0 // place RSE in enforced lazy mode
353 ;; 353 ;;
354 loadrs // clear the dirty partition 354 loadrs // clear the dirty partition
355 mov IA64_KR(PER_CPU_DATA)=r0 // clear physical per-CPU base
355 ;; 356 ;;
356 mov ar.bspstore=r2 // establish the new RSE stack 357 mov ar.bspstore=r2 // establish the new RSE stack
357 ;; 358 ;;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c0766575a3a2..35f7835294a3 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -71,6 +71,8 @@ unsigned long __per_cpu_offset[NR_CPUS];
71EXPORT_SYMBOL(__per_cpu_offset); 71EXPORT_SYMBOL(__per_cpu_offset);
72#endif 72#endif
73 73
74extern void ia64_setup_printk_clock(void);
75
74DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 76DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
75DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 77DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
76DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); 78DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
@@ -445,6 +447,8 @@ setup_arch (char **cmdline_p)
445 /* process SAL system table: */ 447 /* process SAL system table: */
446 ia64_sal_init(efi.sal_systab); 448 ia64_sal_init(efi.sal_systab);
447 449
450 ia64_setup_printk_clock();
451
448#ifdef CONFIG_SMP 452#ifdef CONFIG_SMP
449 cpu_physical_id(0) = hard_smp_processor_id(); 453 cpu_physical_id(0) = hard_smp_processor_id();
450 454
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 028a2b95936c..a094ec49ccfa 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -278,3 +278,30 @@ udelay (unsigned long usecs)
278 } 278 }
279} 279}
280EXPORT_SYMBOL(udelay); 280EXPORT_SYMBOL(udelay);
281
282static unsigned long long ia64_itc_printk_clock(void)
283{
284 if (ia64_get_kr(IA64_KR_PER_CPU_DATA))
285 return sched_clock();
286 return 0;
287}
288
289static unsigned long long ia64_default_printk_clock(void)
290{
291 return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) *
292 (1000000000/HZ);
293}
294
295unsigned long long (*ia64_printk_clock)(void) = &ia64_default_printk_clock;
296
297unsigned long long printk_clock(void)
298{
299 return ia64_printk_clock();
300}
301
302void __init
303ia64_setup_printk_clock(void)
304{
305 if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT))
306 ia64_printk_clock = ia64_itc_printk_clock;
307}
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c
index 9ab684d1bb55..3db62f24596c 100644
--- a/arch/ia64/sn/kernel/mca.c
+++ b/arch/ia64/sn/kernel/mca.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -137,7 +137,8 @@ int sn_salinfo_platform_oemdata(const u8 *sect_header, u8 **oemdata, u64 *oemdat
137 137
138static int __init sn_salinfo_init(void) 138static int __init sn_salinfo_init(void)
139{ 139{
140 salinfo_platform_oemdata = &sn_salinfo_platform_oemdata; 140 if (ia64_platform_is("sn2"))
141 salinfo_platform_oemdata = &sn_salinfo_platform_oemdata;
141 return 0; 142 return 0;
142} 143}
143 144
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index ee36bff93c30..48645ac120fc 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -67,6 +67,7 @@ extern unsigned long last_time_offset;
67extern void (*ia64_mark_idle) (int); 67extern void (*ia64_mark_idle) (int);
68extern void snidle(int); 68extern void snidle(int);
69extern unsigned char acpi_kbd_controller_present; 69extern unsigned char acpi_kbd_controller_present;
70extern unsigned long long (*ia64_printk_clock)(void);
70 71
71unsigned long sn_rtc_cycles_per_second; 72unsigned long sn_rtc_cycles_per_second;
72EXPORT_SYMBOL(sn_rtc_cycles_per_second); 73EXPORT_SYMBOL(sn_rtc_cycles_per_second);
@@ -125,20 +126,6 @@ struct screen_info sn_screen_info = {
125}; 126};
126 127
127/* 128/*
128 * This is here so we can use the CMOS detection in ide-probe.c to
129 * determine what drives are present. In theory, we don't need this
130 * as the auto-detection could be done via ide-probe.c:do_probe() but
131 * in practice that would be much slower, which is painful when
132 * running in the simulator. Note that passing zeroes in DRIVE_INFO
133 * is sufficient (the IDE driver will autodetect the drive geometry).
134 */
135#ifdef CONFIG_IA64_GENERIC
136extern char drive_info[4 * 16];
137#else
138char drive_info[4 * 16];
139#endif
140
141/*
142 * This routine can only be used during init, since 129 * This routine can only be used during init, since
143 * smp_boot_data is an init data structure. 130 * smp_boot_data is an init data structure.
144 * We have to use smp_boot_data.cpu_phys_id to find 131 * We have to use smp_boot_data.cpu_phys_id to find
@@ -372,6 +359,16 @@ sn_scan_pcdp(void)
372 } 359 }
373} 360}
374 361
362static unsigned long sn2_rtc_initial;
363
364static unsigned long long ia64_sn2_printk_clock(void)
365{
366 unsigned long rtc_now = rtc_time();
367
368 return (rtc_now - sn2_rtc_initial) *
369 (1000000000 / sn_rtc_cycles_per_second);
370}
371
375/** 372/**
376 * sn_setup - SN platform setup routine 373 * sn_setup - SN platform setup routine
377 * @cmdline_p: kernel command line 374 * @cmdline_p: kernel command line
@@ -386,6 +383,7 @@ void __init sn_setup(char **cmdline_p)
386 u32 version = sn_sal_rev(); 383 u32 version = sn_sal_rev();
387 extern void sn_cpu_init(void); 384 extern void sn_cpu_init(void);
388 385
386 sn2_rtc_initial = rtc_time();
389 ia64_sn_plat_set_error_handling_features(); // obsolete 387 ia64_sn_plat_set_error_handling_features(); // obsolete
390 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV); 388 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV);
391 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES); 389 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES);
@@ -437,19 +435,6 @@ void __init sn_setup(char **cmdline_p)
437 */ 435 */
438 build_cnode_tables(); 436 build_cnode_tables();
439 437
440 /*
441 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
442 * support here so we don't have to listen to failed keyboard probe
443 * messages.
444 */
445 if (version <= 0x0209 && acpi_kbd_controller_present) {
446 printk(KERN_INFO "Disabling legacy keyboard support as prom "
447 "is too old and doesn't provide FADT\n");
448 acpi_kbd_controller_present = 0;
449 }
450
451 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
452
453 status = 438 status =
454 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, 439 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec,
455 &drift); 440 &drift);
@@ -463,6 +448,21 @@ void __init sn_setup(char **cmdline_p)
463 448
464 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR; 449 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;
465 450
451 ia64_printk_clock = ia64_sn2_printk_clock;
452
453 /*
454 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
455 * support here so we don't have to listen to failed keyboard probe
456 * messages.
457 */
458 if (version <= 0x0209 && acpi_kbd_controller_present) {
459 printk(KERN_INFO "Disabling legacy keyboard support as prom "
460 "is too old and doesn't provide FADT\n");
461 acpi_kbd_controller_present = 0;
462 }
463
464 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
465
466 /* 466 /*
467 * we set the default root device to /dev/hda 467 * we set the default root device to /dev/hda
468 * to make simulation easy 468 * to make simulation easy
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 19b54fbcd7ea..70db21f3df21 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.
7 * 7 *
8 * SGI Altix topology and hardware performance monitoring API. 8 * SGI Altix topology and hardware performance monitoring API.
9 * Mark Goodwin <markgw@sgi.com>. 9 * Mark Goodwin <markgw@sgi.com>.
@@ -973,6 +973,9 @@ static int __devinit sn_hwperf_misc_register_init(void)
973{ 973{
974 int e; 974 int e;
975 975
976 if (!ia64_platform_is("sn2"))
977 return 0;
978
976 sn_hwperf_init(); 979 sn_hwperf_init();
977 980
978 /* 981 /*
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index dbc8a392105f..be8b711367ec 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -18,11 +18,6 @@
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20 20
21#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
22extern struct drive_info_struct drive_info;
23EXPORT_SYMBOL(drive_info);
24#endif
25
26/* platform dependent support */ 21/* platform dependent support */
27EXPORT_SYMBOL(boot_cpu_data); 22EXPORT_SYMBOL(boot_cpu_data);
28EXPORT_SYMBOL(dump_fpu); 23EXPORT_SYMBOL(dump_fpu);
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index c2e4dccf0112..d742037a7ccb 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -37,12 +37,6 @@
37extern void init_mmu(void); 37extern void init_mmu(void);
38#endif 38#endif
39 39
40#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) \
41 || defined(CONFIG_BLK_DEV_IDE_MODULE) \
42 || defined(CONFIG_BLK_DEV_HD_MODULE)
43struct drive_info_struct { char dummy[32]; } drive_info;
44#endif
45
46extern char _end[]; 40extern char _end[];
47 41
48/* 42/*
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 99bf43824795..63c117dae0c3 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -39,6 +39,14 @@
39 39
40asmlinkage void ret_from_fork(void); 40asmlinkage void ret_from_fork(void);
41 41
42/*
43 * The following aren't currently used.
44 */
45void (*pm_idle)(void);
46EXPORT_SYMBOL(pm_idle);
47
48void (*pm_power_off)(void);
49EXPORT_SYMBOL(pm_power_off);
42 50
43/* 51/*
44 * The idle loop on an m68knommu.. 52 * The idle loop on an m68knommu..
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index 050685b87a3c..b9713a723053 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -140,7 +140,7 @@ void __init plat_setup(void)
140 uart.type = PORT_UNKNOWN; 140 uart.type = PORT_UNKNOWN;
141 uart.uartclk = 18432000; 141 uart.uartclk = 18432000;
142 uart.irq = COBALT_SERIAL_IRQ; 142 uart.irq = COBALT_SERIAL_IRQ;
143 uart.flags = STD_COM_FLAGS; 143 uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
144 uart.iobase = 0xc800000; 144 uart.iobase = 0xc800000;
145 uart.iotype = UPIO_PORT; 145 uart.iotype = UPIO_PORT;
146 146
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index fa98f10d0132..5232fc752935 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others. 6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
7 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2004 Thiemo Seufer 9 * Copyright (C) 2004 Thiemo Seufer
9 */ 10 */
@@ -58,8 +59,8 @@ ATTRIB_NORET void cpu_idle(void)
58 } 59 }
59} 60}
60 61
61extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 62extern void do_signal(struct pt_regs *regs);
62extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 63extern void do_signal32(struct pt_regs *regs);
63 64
64/* 65/*
65 * Native o32 and N64 ABI without DSP ASE 66 * Native o32 and N64 ABI without DSP ASE
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index a42e0e8caa7b..d7c4a38ed5ae 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -617,6 +617,23 @@ einval: li v0, -EINVAL
617 sys sys_inotify_init 0 617 sys sys_inotify_init 0
618 sys sys_inotify_add_watch 3 /* 4285 */ 618 sys sys_inotify_add_watch 3 /* 4285 */
619 sys sys_inotify_rm_watch 2 619 sys sys_inotify_rm_watch 2
620 sys sys_migrate_pages 4
621 sys sys_openat 4
622 sys sys_mkdirat 3
623 sys sys_mknodat 4 /* 4290 */
624 sys sys_fchownat 5
625 sys sys_futimesat 3
626 sys sys_newfstatat 4
627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4
630 sys sys_symlinkat 3
631 sys sys_readlinkat 4
632 sys sys_fchmodat 3
633 sys sys_faccessat 3 /* 4300 */
634 sys sys_pselect6 6
635 sys sys_ppoll 5
636 sys sys_unshare 1
620 .endm 637 .endm
621 638
622 /* We pre-compute the number of _instruction_ bytes needed to 639 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 47bfbd416709..98bf25df56f3 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -443,3 +443,20 @@ sys_call_table:
443 PTR sys_inotify_init 443 PTR sys_inotify_init
444 PTR sys_inotify_add_watch 444 PTR sys_inotify_add_watch
445 PTR sys_inotify_rm_watch /* 5245 */ 445 PTR sys_inotify_rm_watch /* 5245 */
446 PTR sys_migrate_pages
447 PTR sys_openat
448 PTR sys_mkdirat
449 PTR sys_mknodat
450 PTR sys_fchownat /* 5250 */
451 PTR sys_futimesat
452 PTR sys_newfstatat
453 PTR sys_unlinkat
454 PTR sys_renameat
455 PTR sys_linkat /* 5255 */
456 PTR sys_symlinkat
457 PTR sys_readlinkat
458 PTR sys_fchmodat
459 PTR sys_faccessat
460 PTR sys_pselect6 /* 5260 */
461 PTR sys_ppoll
462 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index b465ced1758f..bc4980cefc8b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -369,3 +369,20 @@ EXPORT(sysn32_call_table)
369 PTR sys_inotify_init 369 PTR sys_inotify_init
370 PTR sys_inotify_add_watch 370 PTR sys_inotify_add_watch
371 PTR sys_inotify_rm_watch 371 PTR sys_inotify_rm_watch
372 PTR sys_migrate_pages /* 6250 */
373 PTR sys_openat
374 PTR sys_mkdirat
375 PTR sys_mknodat
376 PTR sys_fchownat
377 PTR sys_futimesat /* 6255 */
378 PTR sys_newfstatat
379 PTR sys_unlinkat
380 PTR sys_renameat
381 PTR sys_linkat
382 PTR sys_symlinkat /* 6260 */
383 PTR sys_readlinkat
384 PTR sys_fchmodat
385 PTR sys_faccessat
386 PTR sys_pselect6
387 PTR sys_ppoll /* 6265 */
388 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 3d338ca7eeeb..5b0414018c9a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -491,4 +491,21 @@ sys_call_table:
491 PTR sys_inotify_init 491 PTR sys_inotify_init
492 PTR sys_inotify_add_watch /* 4285 */ 492 PTR sys_inotify_add_watch /* 4285 */
493 PTR sys_inotify_rm_watch 493 PTR sys_inotify_rm_watch
494 PTR sys_migrate_pages
495 PTR compat_sys_openat
496 PTR sys_mkdirat
497 PTR sys_mknodat /* 4290 */
498 PTR sys_fchownat
499 PTR compat_sys_futimesat
500 PTR compat_sys_newfstatat
501 PTR sys_unlinkat
502 PTR sys_renameat /* 4295 */
503 PTR sys_linkat
504 PTR sys_symlinkat
505 PTR sys_readlinkat
506 PTR sys_fchmodat
507 PTR sys_faccessat /* 4300 */
508 PTR sys_pselect6
509 PTR sys_ppoll
510 PTR sys_unshare
494 .size sys_call_table,.-sys_call_table 511 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index aaec4785e9a6..c974cc9b30eb 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -39,8 +39,6 @@
39 39
40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
41 41
42int do_signal(sigset_t *oldset, struct pt_regs *regs);
43
44/* 42/*
45 * Atomically swap in the new signal mask, and wait for a signal. 43 * Atomically swap in the new signal mask, and wait for a signal.
46 */ 44 */
@@ -50,7 +48,7 @@ save_static_function(sys_sigsuspend);
50__attribute_used__ noinline static int 48__attribute_used__ noinline static int
51_sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 49_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
52{ 50{
53 sigset_t saveset, newset; 51 sigset_t newset;
54 sigset_t __user *uset; 52 sigset_t __user *uset;
55 53
56 uset = (sigset_t __user *) regs.regs[4]; 54 uset = (sigset_t __user *) regs.regs[4];
@@ -59,19 +57,15 @@ _sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
59 sigdelsetmask(&newset, ~_BLOCKABLE); 57 sigdelsetmask(&newset, ~_BLOCKABLE);
60 58
61 spin_lock_irq(&current->sighand->siglock); 59 spin_lock_irq(&current->sighand->siglock);
62 saveset = current->blocked; 60 current->saved_sigmask = current->blocked;
63 current->blocked = newset; 61 current->blocked = newset;
64 recalc_sigpending(); 62 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 63 spin_unlock_irq(&current->sighand->siglock);
66 64
67 regs.regs[2] = EINTR; 65 current->state = TASK_INTERRUPTIBLE;
68 regs.regs[7] = 1; 66 schedule();
69 while (1) { 67 set_thread_flag(TIF_RESTORE_SIGMASK);
70 current->state = TASK_INTERRUPTIBLE; 68 return -ERESTARTNOHAND;
71 schedule();
72 if (do_signal(&saveset, &regs))
73 return -EINTR;
74 }
75} 69}
76#endif 70#endif
77 71
@@ -79,7 +73,7 @@ save_static_function(sys_rt_sigsuspend);
79__attribute_used__ noinline static int 73__attribute_used__ noinline static int
80_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 74_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
81{ 75{
82 sigset_t saveset, newset; 76 sigset_t newset;
83 sigset_t __user *unewset; 77 sigset_t __user *unewset;
84 size_t sigsetsize; 78 size_t sigsetsize;
85 79
@@ -94,19 +88,15 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
94 sigdelsetmask(&newset, ~_BLOCKABLE); 88 sigdelsetmask(&newset, ~_BLOCKABLE);
95 89
96 spin_lock_irq(&current->sighand->siglock); 90 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked; 91 current->saved_sigmask = current->blocked;
98 current->blocked = newset; 92 current->blocked = newset;
99 recalc_sigpending(); 93 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock); 94 spin_unlock_irq(&current->sighand->siglock);
101 95
102 regs.regs[2] = EINTR; 96 current->state = TASK_INTERRUPTIBLE;
103 regs.regs[7] = 1; 97 schedule();
104 while (1) { 98 set_thread_flag(TIF_RESTORE_SIGMASK);
105 current->state = TASK_INTERRUPTIBLE; 99 return -ERESTARTNOHAND;
106 schedule();
107 if (do_signal(&saveset, &regs))
108 return -EINTR;
109 }
110} 100}
111 101
112#ifdef CONFIG_TRAD_SIGNALS 102#ifdef CONFIG_TRAD_SIGNALS
@@ -315,11 +305,11 @@ int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
315 current->comm, current->pid, 305 current->comm, current->pid,
316 frame, regs->cp0_epc, frame->regs[31]); 306 frame, regs->cp0_epc, frame->regs[31]);
317#endif 307#endif
318 return 1; 308 return 0;
319 309
320give_sigsegv: 310give_sigsegv:
321 force_sigsegv(signr, current); 311 force_sigsegv(signr, current);
322 return 0; 312 return -EFAULT;
323} 313}
324#endif 314#endif
325 315
@@ -375,11 +365,11 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
375 current->comm, current->pid, 365 current->comm, current->pid,
376 frame, regs->cp0_epc, regs->regs[31]); 366 frame, regs->cp0_epc, regs->regs[31]);
377#endif 367#endif
378 return 1; 368 return 0;
379 369
380give_sigsegv: 370give_sigsegv:
381 force_sigsegv(signr, current); 371 force_sigsegv(signr, current);
382 return 0; 372 return -EFAULT;
383} 373}
384 374
385static inline int handle_signal(unsigned long sig, siginfo_t *info, 375static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -393,7 +383,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
393 regs->regs[2] = EINTR; 383 regs->regs[2] = EINTR;
394 break; 384 break;
395 case ERESTARTSYS: 385 case ERESTARTSYS:
396 if(!(ka->sa.sa_flags & SA_RESTART)) { 386 if (!(ka->sa.sa_flags & SA_RESTART)) {
397 regs->regs[2] = EINTR; 387 regs->regs[2] = EINTR;
398 break; 388 break;
399 } 389 }
@@ -420,9 +410,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
420 return ret; 410 return ret;
421} 411}
422 412
423int do_signal(sigset_t *oldset, struct pt_regs *regs) 413void do_signal(struct pt_regs *regs)
424{ 414{
425 struct k_sigaction ka; 415 struct k_sigaction ka;
416 sigset_t *oldset;
426 siginfo_t info; 417 siginfo_t info;
427 int signr; 418 int signr;
428 419
@@ -432,17 +423,31 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
432 * if so. 423 * if so.
433 */ 424 */
434 if (!user_mode(regs)) 425 if (!user_mode(regs))
435 return 1; 426 return;
436 427
437 if (try_to_freeze()) 428 if (try_to_freeze())
438 goto no_signal; 429 goto no_signal;
439 430
440 if (!oldset) 431 if (test_thread_flag(TIF_RESTORE_SIGMASK))
432 oldset = &current->saved_sigmask;
433 else
441 oldset = &current->blocked; 434 oldset = &current->blocked;
442 435
436
443 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 437 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
444 if (signr > 0) 438 if (signr > 0) {
445 return handle_signal(signr, &info, &ka, oldset, regs); 439 /* Whee! Actually deliver the signal. */
440 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
441 /*
442 * A signal was successfully delivered; the saved
443 * sigmask will have been stored in the signal frame,
444 * and will be restored by sigreturn, so we can simply
445 * clear the TIF_RESTORE_SIGMASK flag.
446 */
447 if (test_thread_flag(TIF_RESTORE_SIGMASK))
448 clear_thread_flag(TIF_RESTORE_SIGMASK);
449 }
450 }
446 451
447no_signal: 452no_signal:
448 /* 453 /*
@@ -463,18 +468,25 @@ no_signal:
463 regs->cp0_epc -= 4; 468 regs->cp0_epc -= 4;
464 } 469 }
465 } 470 }
466 return 0; 471
472 /*
473 * If there's no signal to deliver, we just put the saved sigmask
474 * back
475 */
476 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
477 clear_thread_flag(TIF_RESTORE_SIGMASK);
478 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
479 }
467} 480}
468 481
469/* 482/*
470 * notification of userspace execution resumption 483 * notification of userspace execution resumption
471 * - triggered by current->work.notify_resume 484 * - triggered by the TIF_WORK_MASK flags
472 */ 485 */
473asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 486asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
474 __u32 thread_info_flags) 487 __u32 thread_info_flags)
475{ 488{
476 /* deal with pending signal delivery */ 489 /* deal with pending signal delivery */
477 if (thread_info_flags & _TIF_SIGPENDING) { 490 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
478 current->thread.abi->do_signal(oldset, regs); 491 current->thread.abi->do_signal(regs);
479 }
480} 492}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 136260c8f756..da3271e1fdac 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -694,11 +694,11 @@ int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
694 current->comm, current->pid, 694 current->comm, current->pid,
695 frame, regs->cp0_epc, frame->sf_code); 695 frame, regs->cp0_epc, frame->sf_code);
696#endif 696#endif
697 return 1; 697 return 0;
698 698
699give_sigsegv: 699give_sigsegv:
700 force_sigsegv(signr, current); 700 force_sigsegv(signr, current);
701 return 0; 701 return -EFAULT;
702} 702}
703 703
704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
@@ -765,11 +765,11 @@ int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
765 current->comm, current->pid, 765 current->comm, current->pid,
766 frame, regs->cp0_epc, frame->rs_code); 766 frame, regs->cp0_epc, frame->rs_code);
767#endif 767#endif
768 return 1; 768 return 0;
769 769
770give_sigsegv: 770give_sigsegv:
771 force_sigsegv(signr, current); 771 force_sigsegv(signr, current);
772 return 0; 772 return -EFAULT;
773} 773}
774 774
775static inline int handle_signal(unsigned long sig, siginfo_t *info, 775static inline int handle_signal(unsigned long sig, siginfo_t *info,
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 9156863c1a5d..384fc4a639a4 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -186,9 +186,9 @@ int setup_rt_frame_n32(struct k_sigaction * ka,
186 current->comm, current->pid, 186 current->comm, current->pid,
187 frame, regs->cp0_epc, regs->regs[31]); 187 frame, regs->cp0_epc, regs->regs[31]);
188#endif 188#endif
189 return 1; 189 return 0;
190 190
191give_sigsegv: 191give_sigsegv:
192 force_sigsegv(signr, current); 192 force_sigsegv(signr, current);
193 return 0; 193 return -EFAULT;
194} 194}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 332358430ff5..1da2eeb3ef9e 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
212 int error; 212 int error;
213 char * filename; 213 char * filename;
214 214
215 filename = getname((char *) (long)regs.regs[4]); 215 filename = getname((char __user *) (long)regs.regs[4]);
216 error = PTR_ERR(filename); 216 error = PTR_ERR(filename);
217 if (IS_ERR(filename)) 217 if (IS_ERR(filename))
218 goto out; 218 goto out;
219 error = do_execve(filename, (char **) (long)regs.regs[5], 219 error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
220 (char **) (long)regs.regs[6], &regs); 220 (char __user *__user *) (long)regs.regs[6], &regs);
221 putname(filename); 221 putname(filename);
222 222
223out: 223out:
@@ -227,7 +227,7 @@ out:
227/* 227/*
228 * Compacrapability ... 228 * Compacrapability ...
229 */ 229 */
230asmlinkage int sys_uname(struct old_utsname * name) 230asmlinkage int sys_uname(struct old_utsname __user * name)
231{ 231{
232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
233 return 0; 233 return 0;
@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
237/* 237/*
238 * Compacrapability ... 238 * Compacrapability ...
239 */ 239 */
240asmlinkage int sys_olduname(struct oldold_utsname * name) 240asmlinkage int sys_olduname(struct oldold_utsname __user * name)
241{ 241{
242 int error; 242 int error;
243 243
@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr)
274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
275{ 275{
276 int tmp, len; 276 int tmp, len;
277 char *name; 277 char __user *name;
278 278
279 switch(cmd) { 279 switch(cmd) {
280 case SETNAME: { 280 case SETNAME: {
@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
283 if (!capable(CAP_SYS_ADMIN)) 283 if (!capable(CAP_SYS_ADMIN))
284 return -EPERM; 284 return -EPERM;
285 285
286 name = (char *) arg1; 286 name = (char __user *) arg1;
287 287
288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); 288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
289 if (len < 0) 289 if (len < 0)
@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
324 * This is really horribly ugly. 324 * This is really horribly ugly.
325 */ 325 */
326asmlinkage int sys_ipc (uint call, int first, int second, 326asmlinkage int sys_ipc (uint call, int first, int second,
327 unsigned long third, void *ptr, long fifth) 327 unsigned long third, void __user *ptr, long fifth)
328{ 328{
329 int version, ret; 329 int version, ret;
330 330
@@ -333,24 +333,25 @@ asmlinkage int sys_ipc (uint call, int first, int second,
333 333
334 switch (call) { 334 switch (call) {
335 case SEMOP: 335 case SEMOP:
336 return sys_semtimedop (first, (struct sembuf *)ptr, second, 336 return sys_semtimedop (first, (struct sembuf __user *)ptr,
337 NULL); 337 second, NULL);
338 case SEMTIMEDOP: 338 case SEMTIMEDOP:
339 return sys_semtimedop (first, (struct sembuf *)ptr, second, 339 return sys_semtimedop (first, (struct sembuf __user *)ptr,
340 (const struct timespec __user *)fifth); 340 second,
341 (const struct timespec __user *)fifth);
341 case SEMGET: 342 case SEMGET:
342 return sys_semget (first, second, third); 343 return sys_semget (first, second, third);
343 case SEMCTL: { 344 case SEMCTL: {
344 union semun fourth; 345 union semun fourth;
345 if (!ptr) 346 if (!ptr)
346 return -EINVAL; 347 return -EINVAL;
347 if (get_user(fourth.__pad, (void **) ptr)) 348 if (get_user(fourth.__pad, (void *__user *) ptr))
348 return -EFAULT; 349 return -EFAULT;
349 return sys_semctl (first, second, third, fourth); 350 return sys_semctl (first, second, third, fourth);
350 } 351 }
351 352
352 case MSGSND: 353 case MSGSND:
353 return sys_msgsnd (first, (struct msgbuf *) ptr, 354 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
354 second, third); 355 second, third);
355 case MSGRCV: 356 case MSGRCV:
356 switch (version) { 357 switch (version) {
@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
360 return -EINVAL; 361 return -EINVAL;
361 362
362 if (copy_from_user(&tmp, 363 if (copy_from_user(&tmp,
363 (struct ipc_kludge *) ptr, 364 (struct ipc_kludge __user *) ptr,
364 sizeof (tmp))) 365 sizeof (tmp)))
365 return -EFAULT; 366 return -EFAULT;
366 return sys_msgrcv (first, tmp.msgp, second, 367 return sys_msgrcv (first, tmp.msgp, second,
@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second,
368 } 369 }
369 default: 370 default:
370 return sys_msgrcv (first, 371 return sys_msgrcv (first,
371 (struct msgbuf *) ptr, 372 (struct msgbuf __user *) ptr,
372 second, fifth, third); 373 second, fifth, third);
373 } 374 }
374 case MSGGET: 375 case MSGGET:
375 return sys_msgget ((key_t) first, second); 376 return sys_msgget ((key_t) first, second);
376 case MSGCTL: 377 case MSGCTL:
377 return sys_msgctl (first, second, (struct msqid_ds *) ptr); 378 return sys_msgctl (first, second,
379 (struct msqid_ds __user *) ptr);
378 380
379 case SHMAT: 381 case SHMAT:
380 switch (version) { 382 switch (version) {
381 default: { 383 default: {
382 ulong raddr; 384 ulong raddr;
383 ret = do_shmat (first, (char *) ptr, second, &raddr); 385 ret = do_shmat (first, (char __user *) ptr, second,
386 &raddr);
384 if (ret) 387 if (ret)
385 return ret; 388 return ret;
386 return put_user (raddr, (ulong *) third); 389 return put_user (raddr, (ulong __user *) third);
387 } 390 }
388 case 1: /* iBCS2 emulator entry point */ 391 case 1: /* iBCS2 emulator entry point */
389 if (!segment_eq(get_fs(), get_ds())) 392 if (!segment_eq(get_fs(), get_ds()))
390 return -EINVAL; 393 return -EINVAL;
391 return do_shmat (first, (char *) ptr, second, (ulong *) third); 394 return do_shmat (first, (char __user *) ptr, second,
395 (ulong *) third);
392 } 396 }
393 case SHMDT: 397 case SHMDT:
394 return sys_shmdt ((char *)ptr); 398 return sys_shmdt ((char __user *)ptr);
395 case SHMGET: 399 case SHMGET:
396 return sys_shmget (first, second, third); 400 return sys_shmget (first, second, third);
397 case SHMCTL: 401 case SHMCTL:
398 return sys_shmctl (first, second, 402 return sys_shmctl (first, second,
399 (struct shmid_ds *) ptr); 403 (struct shmid_ds __user *) ptr);
400 default: 404 default:
401 return -ENOSYS; 405 return -ENOSYS;
402 } 406 }
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index dcd819d57dae..83eb08b7a072 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -134,8 +134,8 @@ void __init serial_init(void)
134 134
135 memset(&s, 0, sizeof(s)); 135 memset(&s, 0, sizeof(s));
136 136
137 s.flags = STD_COM_FLAGS; 137 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
138 s.iotype = SERIAL_IO_MEM; 138 s.iotype = UPIO_MEM;
139 139
140 if (mips_machtype == MACH_LASAT_100) { 140 if (mips_machtype == MACH_LASAT_100) {
141 s.uartclk = LASAT_BASE_BAUD_100 * 16; 141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 625843b30bed..873cf3141a31 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -82,8 +82,8 @@ static void __init serial_init(void)
82#endif 82#endif
83 s.irq = ATLASINT_UART; 83 s.irq = ATLASINT_UART;
84 s.uartclk = ATLAS_BASE_BAUD * 16; 84 s.uartclk = ATLAS_BASE_BAUD * 16;
85 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 85 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
86 s.iotype = SERIAL_IO_PORT; 86 s.iotype = UPIO_PORT;
87 s.regshift = 3; 87 s.regshift = 3;
88 88
89 if (early_serial_setup(&s) != 0) { 89 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index f966bc161dfa..4266ce445174 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -71,8 +71,8 @@ static void __init serial_init(void)
71#endif 71#endif
72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0; 72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
73 s.uartclk = SEAD_BASE_BAUD * 16; 73 s.uartclk = SEAD_BASE_BAUD * 16;
74 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 74 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
75 s.iotype = 0; 75 s.iotype = UPIO_PORT;
76 s.regshift = 3; 76 s.regshift = 3;
77 77
78 if (early_serial_setup(&s) != 0) { 78 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index 485d5a58d9cf..a2fd62997ca3 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -88,8 +88,8 @@ static void __init serial_init(void)
88 but poll for now */ 88 but poll for now */
89 s.irq = 0; 89 s.irq = 0;
90 s.uartclk = BASE_BAUD * 16; 90 s.uartclk = BASE_BAUD * 16;
91 s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST; 91 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
92 s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST; 92 s.iotype = UPIO_PORT;
93 s.regshift = 0; 93 s.regshift = 0;
94 s.timeout = 4; 94 s.timeout = 4;
95 95
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
index da6e1ed34db1..2292d0ec47fc 100644
--- a/arch/mips/momentum/jaguar_atx/ja-console.c
+++ b/arch/mips/momentum/jaguar_atx/ja-console.c
@@ -93,7 +93,7 @@ static void inline ja_console_probe(void)
93 up.uartclk = JAGUAR_ATX_UART_CLK; 93 up.uartclk = JAGUAR_ATX_UART_CLK;
94 up.regshift = 2; 94 up.regshift = 2;
95 up.iotype = UPIO_MEM; 95 up.iotype = UPIO_MEM;
96 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 96 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
97 up.line = 0; 97 up.line = 0;
98 98
99 if (early_serial_setup(&up)) 99 if (early_serial_setup(&up))
diff --git a/arch/mips/philips/pnx8550/common/platform.c b/arch/mips/philips/pnx8550/common/platform.c
index 8aa9bd65b45e..a592260fd673 100644
--- a/arch/mips/philips/pnx8550/common/platform.c
+++ b/arch/mips/philips/pnx8550/common/platform.c
@@ -66,28 +66,28 @@ struct ip3106_port ip3106_ports[] = {
66 [0] = { 66 [0] = {
67 .port = { 67 .port = {
68 .type = PORT_IP3106, 68 .type = PORT_IP3106,
69 .iotype = SERIAL_IO_MEM, 69 .iotype = UPIO_MEM,
70 .membase = (void __iomem *)PNX8550_UART_PORT0, 70 .membase = (void __iomem *)PNX8550_UART_PORT0,
71 .mapbase = PNX8550_UART_PORT0, 71 .mapbase = PNX8550_UART_PORT0,
72 .irq = PNX8550_UART_INT(0), 72 .irq = PNX8550_UART_INT(0),
73 .uartclk = 3692300, 73 .uartclk = 3692300,
74 .fifosize = 16, 74 .fifosize = 16,
75 .ops = &ip3106_pops, 75 .ops = &ip3106_pops,
76 .flags = ASYNC_BOOT_AUTOCONF, 76 .flags = UPF_BOOT_AUTOCONF,
77 .line = 0, 77 .line = 0,
78 }, 78 },
79 }, 79 },
80 [1] = { 80 [1] = {
81 .port = { 81 .port = {
82 .type = PORT_IP3106, 82 .type = PORT_IP3106,
83 .iotype = SERIAL_IO_MEM, 83 .iotype = UPIO_MEM,
84 .membase = (void __iomem *)PNX8550_UART_PORT1, 84 .membase = (void __iomem *)PNX8550_UART_PORT1,
85 .mapbase = PNX8550_UART_PORT1, 85 .mapbase = PNX8550_UART_PORT1,
86 .irq = PNX8550_UART_INT(1), 86 .irq = PNX8550_UART_INT(1),
87 .uartclk = 3692300, 87 .uartclk = 3692300,
88 .fifosize = 16, 88 .fifosize = 16,
89 .ops = &ip3106_pops, 89 .ops = &ip3106_pops,
90 .flags = ASYNC_BOOT_AUTOCONF, 90 .flags = UPF_BOOT_AUTOCONF,
91 .line = 1, 91 .line = 1,
92 }, 92 },
93 }, 93 },
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 059755b5ed57..8bce711575de 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -185,7 +185,7 @@ static void __init py_uart_setup(void)
185 up.uartclk = TITAN_UART_CLK; 185 up.uartclk = TITAN_UART_CLK;
186 up.regshift = 0; 186 up.regshift = 0;
187 up.iotype = UPIO_MEM; 187 up.iotype = UPIO_MEM;
188 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 188 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
189 up.line = 0; 189 up.line = 0;
190 190
191 if (early_serial_setup(&up)) 191 if (early_serial_setup(&up))
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index d10a269aeae1..2c38770b1e1b 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -66,11 +66,6 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
66#include <linux/tty.h> 66#include <linux/tty.h>
67#include <linux/serial.h> 67#include <linux/serial.h>
68#include <linux/serial_core.h> 68#include <linux/serial_core.h>
69extern int early_serial_setup(struct uart_port *port);
70
71#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
72#define BASE_BAUD (1843200 / 16)
73
74#endif /* CONFIG_SERIAL_8250 */ 69#endif /* CONFIG_SERIAL_8250 */
75 70
76/* An arbitrary time; this can be decreased if reliability looks good */ 71/* An arbitrary time; this can be decreased if reliability looks good */
@@ -110,8 +105,8 @@ void __init plat_setup(void)
110 o2_serial[0].type = PORT_16550A; 105 o2_serial[0].type = PORT_16550A;
111 o2_serial[0].line = 0; 106 o2_serial[0].line = 0;
112 o2_serial[0].irq = MACEISA_SERIAL1_IRQ; 107 o2_serial[0].irq = MACEISA_SERIAL1_IRQ;
113 o2_serial[0].flags = STD_COM_FLAGS; 108 o2_serial[0].flags = UPF_SKIP_TEST;
114 o2_serial[0].uartclk = BASE_BAUD * 16; 109 o2_serial[0].uartclk = 1843200;
115 o2_serial[0].iotype = UPIO_MEM; 110 o2_serial[0].iotype = UPIO_MEM;
116 o2_serial[0].membase = (char *)&mace->isa.serial1; 111 o2_serial[0].membase = (char *)&mace->isa.serial1;
117 o2_serial[0].fifosize = 14; 112 o2_serial[0].fifosize = 14;
@@ -121,8 +116,8 @@ void __init plat_setup(void)
121 o2_serial[1].type = PORT_16550A; 116 o2_serial[1].type = PORT_16550A;
122 o2_serial[1].line = 1; 117 o2_serial[1].line = 1;
123 o2_serial[1].irq = MACEISA_SERIAL2_IRQ; 118 o2_serial[1].irq = MACEISA_SERIAL2_IRQ;
124 o2_serial[1].flags = STD_COM_FLAGS; 119 o2_serial[1].flags = UPF_SKIP_TEST;
125 o2_serial[1].uartclk = BASE_BAUD * 16; 120 o2_serial[1].uartclk = 1843200;
126 o2_serial[1].iotype = UPIO_MEM; 121 o2_serial[1].iotype = UPIO_MEM;
127 o2_serial[1].membase = (char *)&mace->isa.serial2; 122 o2_serial[1].membase = (char *)&mace->isa.serial2;
128 o2_serial[1].fifosize = 14; 123 o2_serial[1].fifosize = 14;
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 29b4d61898f2..05273ccced0e 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -468,19 +468,23 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
468 if ( opcode == 1 ) { /* GETFSIND */ 468 if ( opcode == 1 ) { /* GETFSIND */
469 len = strlen_user((char *)arg1); 469 len = strlen_user((char *)arg1);
470 printk(KERN_DEBUG "len of arg1 = %d\n", len); 470 printk(KERN_DEBUG "len of arg1 = %d\n", len);
471 471 if (len == 0)
472 fsname = (char *) kmalloc(len+1, GFP_KERNEL); 472 return 0;
473 fsname = (char *) kmalloc(len, GFP_KERNEL);
473 if ( !fsname ) { 474 if ( !fsname ) {
474 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 475 printk(KERN_DEBUG "failed to kmalloc fsname\n");
475 return 0; 476 return 0;
476 } 477 }
477 478
478 if ( copy_from_user(fsname, (char *)arg1, len+1) ) { 479 if ( copy_from_user(fsname, (char *)arg1, len) ) {
479 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 480 printk(KERN_DEBUG "failed to copy_from_user fsname\n");
480 kfree(fsname); 481 kfree(fsname);
481 return 0; 482 return 0;
482 } 483 }
483 484
485 /* String could be altered by userspace after strlen_user() */
486 fsname[len] = '\0';
487
484 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); 488 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname);
485 if ( !strcmp(fsname, "hfs") ) { 489 if ( !strcmp(fsname, "hfs") ) {
486 fstype = 0; 490 fstype = 0;
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index e4362dfa37fb..340730fb8c91 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -66,7 +66,7 @@ _GLOBAL(load_up_fpu)
66#else 66#else
67 ld r4,PACACURRENT(r13) 67 ld r4,PACACURRENT(r13)
68 addi r5,r4,THREAD /* Get THREAD */ 68 addi r5,r4,THREAD /* Get THREAD */
69 ld r4,THREAD_FPEXC_MODE(r5) 69 lwz r4,THREAD_FPEXC_MODE(r5)
70 ori r12,r12,MSR_FP 70 ori r12,r12,MSR_FP
71 or r12,r12,r4 71 or r12,r12,r4
72 std r12,_MSR(r1) 72 std r12,_MSR(r1)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 308268466342..415659629394 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -749,11 +749,12 @@ iSeries_secondary_smp_loop:
749 749
750 .globl decrementer_iSeries_masked 750 .globl decrementer_iSeries_masked
751decrementer_iSeries_masked: 751decrementer_iSeries_masked:
752 /* We may not have a valid TOC pointer in here. */
752 li r11,1 753 li r11,1
753 ld r12,PACALPPACAPTR(r13) 754 ld r12,PACALPPACAPTR(r13)
754 stb r11,LPPACADECRINT(r12) 755 stb r11,LPPACADECRINT(r12)
755 LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy) 756 LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy)
756 lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12) 757 lwz r12,0(r12)
757 mtspr SPRN_DEC,r12 758 mtspr SPRN_DEC,r12
758 /* fall through */ 759 /* fall through */
759 760
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 4d9b4388918b..946f3219fd29 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -334,9 +334,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
334 334
335 spin_unlock_irqrestore(&(tbl->it_lock), flags); 335 spin_unlock_irqrestore(&(tbl->it_lock), flags);
336 336
337 /* Make sure updates are seen by hardware */
338 mb();
339
340 DBG("mapped %d elements:\n", outcount); 337 DBG("mapped %d elements:\n", outcount);
341 338
342 /* For the sake of iommu_unmap_sg, we clear out the length in the 339 /* For the sake of iommu_unmap_sg, we clear out the length in the
@@ -347,6 +344,10 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
347 outs->dma_address = DMA_ERROR_CODE; 344 outs->dma_address = DMA_ERROR_CODE;
348 outs->dma_length = 0; 345 outs->dma_length = 0;
349 } 346 }
347
348 /* Make sure updates are seen by hardware */
349 mb();
350
350 return outcount; 351 return outcount;
351 352
352 failure: 353 failure:
@@ -358,6 +359,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
358 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr) 359 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr)
359 >> PAGE_SHIFT; 360 >> PAGE_SHIFT;
360 __iommu_free(tbl, vaddr, npages); 361 __iommu_free(tbl, vaddr, npages);
362 s->dma_address = DMA_ERROR_CODE;
363 s->dma_length = 0;
361 } 364 }
362 } 365 }
363 spin_unlock_irqrestore(&(tbl->it_lock), flags); 366 spin_unlock_irqrestore(&(tbl->it_lock), flags);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d50c8df0183e..294832a7e0a6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -491,7 +491,12 @@ void __init finish_device_tree(void)
491 size = 16; 491 size = 16;
492 finish_node(allnodes, &size, 1); 492 finish_node(allnodes, &size, 1);
493 size -= 16; 493 size -= 16;
494 end = start = (unsigned long) __va(lmb_alloc(size, 128)); 494
495 if (0 == size)
496 end = start = 0;
497 else
498 end = start = (unsigned long)__va(lmb_alloc(size, 128));
499
495 finish_node(allnodes, &end, 0); 500 finish_node(allnodes, &end, 0);
496 BUG_ON(end != start + size); 501 BUG_ON(end != start + size);
497 502
@@ -1398,8 +1403,8 @@ struct device_node *of_find_node_by_name(struct device_node *from,
1398 1403
1399 read_lock(&devtree_lock); 1404 read_lock(&devtree_lock);
1400 np = from ? from->allnext : allnodes; 1405 np = from ? from->allnext : allnodes;
1401 for (; np != 0; np = np->allnext) 1406 for (; np != NULL; np = np->allnext)
1402 if (np->name != 0 && strcasecmp(np->name, name) == 0 1407 if (np->name != NULL && strcasecmp(np->name, name) == 0
1403 && of_node_get(np)) 1408 && of_node_get(np))
1404 break; 1409 break;
1405 if (from) 1410 if (from)
@@ -1917,3 +1922,30 @@ int prom_update_property(struct device_node *np,
1917 1922
1918 return 0; 1923 return 0;
1919} 1924}
1925
1926#ifdef CONFIG_KEXEC
1927/* We may have allocated the flat device tree inside the crash kernel region
1928 * in prom_init. If so we need to move it out into regular memory. */
1929void kdump_move_device_tree(void)
1930{
1931 unsigned long start, end;
1932 struct boot_param_header *new;
1933
1934 start = __pa((unsigned long)initial_boot_params);
1935 end = start + initial_boot_params->totalsize;
1936
1937 if (end < crashk_res.start || start > crashk_res.end)
1938 return;
1939
1940 new = (struct boot_param_header*)
1941 __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));
1942
1943 memcpy(new, initial_boot_params, initial_boot_params->totalsize);
1944
1945 initial_boot_params = new;
1946
1947 DBG("Flat device tree blob moved to %p\n", initial_boot_params);
1948
1949 /* XXX should we unreserve the old DT? */
1950}
1951#endif /* CONFIG_KEXEC */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7881ec96ef11..ec7153f4d47c 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2098,6 +2098,10 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2098 */ 2098 */
2099 prom_init_stdout(); 2099 prom_init_stdout();
2100 2100
2101 /* Bail if this is a kdump kernel. */
2102 if (PHYSICAL_START > 0)
2103 prom_panic("Error: You can't boot a kdump kernel from OF!\n");
2104
2101 /* 2105 /*
2102 * Check for an initrd 2106 * Check for an initrd
2103 */ 2107 */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index a8099c806150..3934c227549b 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -465,8 +465,10 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
465 if (parent == NULL) 465 if (parent == NULL)
466 return NULL; 466 return NULL;
467 bus = of_match_bus(parent); 467 bus = of_match_bus(parent);
468 if (strcmp(bus->name, "pci")) 468 if (strcmp(bus->name, "pci")) {
469 of_node_put(parent);
469 return NULL; 470 return NULL;
471 }
470 bus->count_cells(dev, &na, &ns); 472 bus->count_cells(dev, &na, &ns);
471 of_node_put(parent); 473 of_node_put(parent);
472 if (!OF_CHECK_COUNTS(na, ns)) 474 if (!OF_CHECK_COUNTS(na, ns))
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7fe4a5c944c9..b5b2add7ad1e 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -22,6 +22,7 @@
22 22
23#include <asm/prom.h> 23#include <asm/prom.h>
24#include <asm/rtas.h> 24#include <asm/rtas.h>
25#include <asm/hvcall.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
26#include <asm/machdep.h> 27#include <asm/machdep.h>
27#include <asm/page.h> 28#include <asm/page.h>
@@ -565,6 +566,7 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
565#ifdef CONFIG_PPC_PSERIES 566#ifdef CONFIG_PPC_PSERIES
566static void rtas_percpu_suspend_me(void *info) 567static void rtas_percpu_suspend_me(void *info)
567{ 568{
569 int i;
568 long rc; 570 long rc;
569 long flags; 571 long flags;
570 struct rtas_suspend_me_data *data = 572 struct rtas_suspend_me_data *data =
@@ -587,18 +589,16 @@ static void rtas_percpu_suspend_me(void *info)
587 589
588 if (rc == H_Continue) { 590 if (rc == H_Continue) {
589 data->waiting = 0; 591 data->waiting = 0;
590 rtas_call(ibm_suspend_me_token, 0, 1, 592 data->args->args[data->args->nargs] =
591 data->args->args); 593 rtas_call(ibm_suspend_me_token, 0, 1, NULL);
594 for_each_cpu(i)
595 plpar_hcall_norets(H_PROD,i);
592 } else { 596 } else {
593 data->waiting = -EBUSY; 597 data->waiting = -EBUSY;
594 printk(KERN_ERR "Error on H_Join hypervisor call\n"); 598 printk(KERN_ERR "Error on H_Join hypervisor call\n");
595 } 599 }
596 600
597out: 601out:
598 /* before we restore interrupts, make sure we don't
599 * generate a spurious soft lockup errors
600 */
601 touch_softlockup_watchdog();
602 local_irq_restore(flags); 602 local_irq_restore(flags);
603 return; 603 return;
604} 604}
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 50500093c97f..aaf384c3f04a 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -672,8 +672,7 @@ static void rtas_flash_firmware(int reboot_type)
672static void remove_flash_pde(struct proc_dir_entry *dp) 672static void remove_flash_pde(struct proc_dir_entry *dp)
673{ 673{
674 if (dp) { 674 if (dp) {
675 if (dp->data != NULL) 675 kfree(dp->data);
676 kfree(dp->data);
677 dp->owner = NULL; 676 dp->owner = NULL;
678 remove_proc_entry(dp->name, dp->parent); 677 remove_proc_entry(dp->name, dp->parent);
679 } 678 }
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index e29b275e09e0..a717dff695ef 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -398,6 +398,9 @@ void __init setup_system(void)
398{ 398{
399 DBG(" -> setup_system()\n"); 399 DBG(" -> setup_system()\n");
400 400
401#ifdef CONFIG_KEXEC
402 kdump_move_device_tree();
403#endif
401 /* 404 /*
402 * Unflatten the device-tree passed by prom_init or kexec 405 * Unflatten the device-tree passed by prom_init or kexec
403 */ 406 */
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index c6d0595da6b5..bd837b5dbf06 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -142,11 +142,7 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
142 return 0; 142 return 0;
143} 143}
144 144
145static inline compat_uptr_t to_user_ptr(void *kp) 145#define to_user_ptr(p) ptr_to_compat(p)
146{
147 return (compat_uptr_t)(u64)kp;
148}
149
150#define from_user_ptr(p) compat_ptr(p) 146#define from_user_ptr(p) compat_ptr(p)
151 147
152static inline int save_general_regs(struct pt_regs *regs, 148static inline int save_general_regs(struct pt_regs *regs,
@@ -213,8 +209,8 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
213 return 0; 209 return 0;
214} 210}
215 211
216#define to_user_ptr(p) (p) 212#define to_user_ptr(p) ((unsigned long)(p))
217#define from_user_ptr(p) (p) 213#define from_user_ptr(p) ((void __user *)(p))
218 214
219static inline int save_general_regs(struct pt_regs *regs, 215static inline int save_general_regs(struct pt_regs *regs,
220 struct mcontext __user *frame) 216 struct mcontext __user *frame)
@@ -526,7 +522,7 @@ long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
526 522
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 523 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528 if (!ret && oact) { 524 if (!ret && oact) {
529 ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 525 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 526 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 527 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
532 } 528 }
@@ -675,8 +671,8 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 671int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
676 int r6, int r7, int r8, struct pt_regs *regs) 672 int r6, int r7, int r8, struct pt_regs *regs)
677{ 673{
678 stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 674 stack_32_t __user * newstack = compat_ptr(__new);
679 stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 675 stack_32_t __user * oldstack = compat_ptr(__old);
680 stack_t uss, uoss; 676 stack_t uss, uoss;
681 int ret; 677 int ret;
682 mm_segment_t old_fs; 678 mm_segment_t old_fs;
@@ -708,7 +704,7 @@ int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
708 set_fs(old_fs); 704 set_fs(old_fs);
709 /* Copy the stack information to the user output buffer */ 705 /* Copy the stack information to the user output buffer */
710 if (!ret && oldstack && 706 if (!ret && oldstack &&
711 (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 707 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 708 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
713 __put_user(uoss.ss_size, &oldstack->ss_size))) 709 __put_user(uoss.ss_size, &oldstack->ss_size)))
714 return -EFAULT; 710 return -EFAULT;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3193116e686..497a5d3df359 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -60,8 +60,8 @@ struct rt_sigframe {
60 struct ucontext uc; 60 struct ucontext uc;
61 unsigned long _unused[2]; 61 unsigned long _unused[2];
62 unsigned int tramp[TRAMP_SIZE]; 62 unsigned int tramp[TRAMP_SIZE];
63 struct siginfo *pinfo; 63 struct siginfo __user *pinfo;
64 void *puc; 64 void __user *puc;
65 struct siginfo info; 65 struct siginfo info;
66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ 66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */
67 char abigap[288]; 67 char abigap[288];
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c8458c531b25..13595a64f013 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -540,6 +540,9 @@ int __devinit start_secondary(void *unused)
540 if (smp_ops->take_timebase) 540 if (smp_ops->take_timebase)
541 smp_ops->take_timebase(); 541 smp_ops->take_timebase();
542 542
543 if (system_state > SYSTEM_BOOTING)
544 per_cpu(last_jiffy, cpu) = get_tb();
545
543 spin_lock(&call_lock); 546 spin_lock(&call_lock);
544 cpu_set(cpu, cpu_online_map); 547 cpu_set(cpu, cpu_online_map);
545 spin_unlock(&call_lock); 548 spin_unlock(&call_lock);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c4a294d657b9..1886045a2fd8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -612,10 +612,10 @@ void __init generic_calibrate_decr(void)
612 612
613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ 613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
614 node_found = 0; 614 node_found = 0;
615 if (cpu != 0) { 615 if (cpu) {
616 fp = (unsigned int *)get_property(cpu, "timebase-frequency", 616 fp = (unsigned int *)get_property(cpu, "timebase-frequency",
617 NULL); 617 NULL);
618 if (fp != 0) { 618 if (fp) {
619 node_found = 1; 619 node_found = 1;
620 ppc_tb_freq = *fp; 620 ppc_tb_freq = *fp;
621 } 621 }
@@ -626,10 +626,10 @@ void __init generic_calibrate_decr(void)
626 626
627 ppc_proc_freq = DEFAULT_PROC_FREQ; 627 ppc_proc_freq = DEFAULT_PROC_FREQ;
628 node_found = 0; 628 node_found = 0;
629 if (cpu != 0) { 629 if (cpu) {
630 fp = (unsigned int *)get_property(cpu, "clock-frequency", 630 fp = (unsigned int *)get_property(cpu, "clock-frequency",
631 NULL); 631 NULL);
632 if (fp != 0) { 632 if (fp) {
633 node_found = 1; 633 node_found = 1;
634 ppc_proc_freq = *fp; 634 ppc_proc_freq = *fp;
635 } 635 }
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 2da65a9c93f6..5d29dcca523c 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -144,7 +144,7 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
144} 144}
145 145
146#ifdef CONFIG_PPC_MAPLE 146#ifdef CONFIG_PPC_MAPLE
147void udbg_maple_real_putc(unsigned char c) 147void udbg_maple_real_putc(char c)
148{ 148{
149 if (udbg_comport) { 149 if (udbg_comport) {
150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0) 150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 9584608fd768..bbe3eac918e8 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -197,6 +197,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
197{ 197{
198 struct lmb_region *_rgn = &(lmb.reserved); 198 struct lmb_region *_rgn = &(lmb.reserved);
199 199
200 BUG_ON(0 == size);
201
200 return lmb_add_region(_rgn, base, size); 202 return lmb_add_region(_rgn, base, size);
201} 203}
202 204
@@ -227,6 +229,8 @@ unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
227 long i, j; 229 long i, j;
228 unsigned long base = 0; 230 unsigned long base = 0;
229 231
232 BUG_ON(0 == size);
233
230#ifdef CONFIG_PPC32 234#ifdef CONFIG_PPC32
231 /* On 32-bit, make sure we allocate lowmem */ 235 /* On 32-bit, make sure we allocate lowmem */
232 if (max_addr == LMB_ALLOC_ANYWHERE) 236 if (max_addr == LMB_ALLOC_ANYWHERE)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 15aac0d78dfa..550517c2dd42 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -435,17 +435,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
435{ 435{
436 clear_page(page); 436 clear_page(page);
437 437
438 if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
439 return;
440 /* 438 /*
441 * We shouldnt have to do this, but some versions of glibc 439 * We shouldnt have to do this, but some versions of glibc
442 * require it (ld.so assumes zero filled pages are icache clean) 440 * require it (ld.so assumes zero filled pages are icache clean)
443 * - Anton 441 * - Anton
444 */ 442 */
445 443 flush_dcache_page(pg);
446 /* avoid an atomic op if possible */
447 if (test_bit(PG_arch_1, &pg->flags))
448 clear_bit(PG_arch_1, &pg->flags);
449} 444}
450EXPORT_SYMBOL(clear_user_page); 445EXPORT_SYMBOL(clear_user_page);
451 446
@@ -469,12 +464,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
469 return; 464 return;
470#endif 465#endif
471 466
472 if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) 467 flush_dcache_page(pg);
473 return;
474
475 /* avoid an atomic op if possible */
476 if (test_bit(PG_arch_1, &pg->flags))
477 clear_bit(PG_arch_1, &pg->flags);
478} 468}
479 469
480void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, 470void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 16031b565be4..3b998a393e3f 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -2,7 +2,7 @@ obj-y += interrupt.o iommu.o setup.o spider-pic.o
2obj-y += pervasive.o 2obj-y += pervasive.o
3 3
4obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_SPU_FS) += spufs/ spu-base.o 5obj-$(CONFIG_SPU_FS) += spu-base.o spufs/
6 6
7spu-base-y += spu_base.o spu_priv1.o 7spu-base-y += spu_base.o spu_priv1.o
8 8
diff --git a/arch/powerpc/platforms/chrp/chrp.h b/arch/powerpc/platforms/chrp/chrp.h
index 3a2057fa314a..814f54742e0f 100644
--- a/arch/powerpc/platforms/chrp/chrp.h
+++ b/arch/powerpc/platforms/chrp/chrp.h
@@ -5,7 +5,6 @@
5extern void chrp_nvram_init(void); 5extern void chrp_nvram_init(void);
6extern void chrp_get_rtc_time(struct rtc_time *); 6extern void chrp_get_rtc_time(struct rtc_time *);
7extern int chrp_set_rtc_time(struct rtc_time *); 7extern int chrp_set_rtc_time(struct rtc_time *);
8extern void chrp_calibrate_decr(void);
9extern long chrp_time_init(void); 8extern long chrp_time_init(void);
10 9
11extern void chrp_find_bridges(void); 10extern void chrp_find_bridges(void);
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 00c52f27ef4f..8ef279ad36ad 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -204,9 +204,11 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
204 struct device_node *root = find_path_device("/"); 204 struct device_node *root = find_path_device("/");
205 struct device_node *rtas; 205 struct device_node *rtas;
206 206
207 of_node_get(root);
207 rtas = of_find_node_by_name (root, "rtas"); 208 rtas = of_find_node_by_name (root, "rtas");
208 if (rtas) { 209 if (rtas) {
209 hose->ops = &rtas_pci_ops; 210 hose->ops = &rtas_pci_ops;
211 of_node_put(rtas);
210 } else { 212 } else {
211 printk ("RTAS supporting Pegasos OF not found, please upgrade" 213 printk ("RTAS supporting Pegasos OF not found, please upgrade"
212 " your firmware\n"); 214 " your firmware\n");
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 2dc87aa5962f..e1fadbf49150 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -506,7 +506,7 @@ void __init chrp_init(void)
506 ppc_md.halt = rtas_halt; 506 ppc_md.halt = rtas_halt;
507 507
508 ppc_md.time_init = chrp_time_init; 508 ppc_md.time_init = chrp_time_init;
509 ppc_md.calibrate_decr = chrp_calibrate_decr; 509 ppc_md.calibrate_decr = generic_calibrate_decr;
510 510
511 /* this may get overridden with rtas routines later... */ 511 /* this may get overridden with rtas routines later... */
512 ppc_md.set_rtc_time = chrp_set_rtc_time; 512 ppc_md.set_rtc_time = chrp_set_rtc_time;
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 36a0f97bb7b1..78df2e7ca88a 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -167,24 +167,3 @@ void chrp_get_rtc_time(struct rtc_time *tm)
167 tm->tm_mon = mon; 167 tm->tm_mon = mon;
168 tm->tm_year = year; 168 tm->tm_year = year;
169} 169}
170
171
172void __init chrp_calibrate_decr(void)
173{
174 struct device_node *cpu;
175 unsigned int freq, *fp;
176
177 /*
178 * The cpu node should have a timebase-frequency property
179 * to tell us the rate at which the decrementer counts.
180 */
181 freq = 16666000; /* hardcoded default */
182 cpu = find_type_devices("cpu");
183 if (cpu != 0) {
184 fp = (unsigned int *)
185 get_property(cpu, "timebase-frequency", NULL);
186 if (fp != 0)
187 freq = *fp;
188 }
189 ppc_tb_freq = freq;
190}
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 535c802b369f..87eb6bb7f0e7 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1052,8 +1052,7 @@ struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter)
1052} 1052}
1053EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus); 1053EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus);
1054 1054
1055extern int pmac_i2c_match_adapter(struct device_node *dev, 1055int pmac_i2c_match_adapter(struct device_node *dev, struct i2c_adapter *adapter)
1056 struct i2c_adapter *adapter)
1057{ 1056{
1058 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev); 1057 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev);
1059 1058
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f671ed253901..de3f30e6b333 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -136,14 +136,14 @@ static void __init fixup_bus_range(struct device_node *bridge)
136 |(((unsigned int)(off)) & 0xFCUL) \ 136 |(((unsigned int)(off)) & 0xFCUL) \
137 |1UL) 137 |1UL)
138 138
139static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose,
140 u8 bus, u8 dev_fn, u8 offset) 140 u8 bus, u8 dev_fn, u8 offset)
141{ 141{
142 unsigned int caddr; 142 unsigned int caddr;
143 143
144 if (bus == hose->first_busno) { 144 if (bus == hose->first_busno) {
145 if (dev_fn < (11 << 3)) 145 if (dev_fn < (11 << 3))
146 return 0; 146 return NULL;
147 caddr = MACRISC_CFA0(dev_fn, offset); 147 caddr = MACRISC_CFA0(dev_fn, offset);
148 } else 148 } else
149 caddr = MACRISC_CFA1(bus, dev_fn, offset); 149 caddr = MACRISC_CFA1(bus, dev_fn, offset);
@@ -154,14 +154,14 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose,
154 } while (in_le32(hose->cfg_addr) != caddr); 154 } while (in_le32(hose->cfg_addr) != caddr);
155 155
156 offset &= has_uninorth ? 0x07 : 0x03; 156 offset &= has_uninorth ? 0x07 : 0x03;
157 return ((unsigned long)hose->cfg_data) + offset; 157 return hose->cfg_data + offset;
158} 158}
159 159
160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
161 int offset, int len, u32 *val) 161 int offset, int len, u32 *val)
162{ 162{
163 struct pci_controller *hose; 163 struct pci_controller *hose;
164 unsigned long addr; 164 volatile void __iomem *addr;
165 165
166 hose = pci_bus_to_host(bus); 166 hose = pci_bus_to_host(bus);
167 if (hose == NULL) 167 if (hose == NULL)
@@ -177,13 +177,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
177 */ 177 */
178 switch (len) { 178 switch (len) {
179 case 1: 179 case 1:
180 *val = in_8((u8 *)addr); 180 *val = in_8(addr);
181 break; 181 break;
182 case 2: 182 case 2:
183 *val = in_le16((u16 *)addr); 183 *val = in_le16(addr);
184 break; 184 break;
185 default: 185 default:
186 *val = in_le32((u32 *)addr); 186 *val = in_le32(addr);
187 break; 187 break;
188 } 188 }
189 return PCIBIOS_SUCCESSFUL; 189 return PCIBIOS_SUCCESSFUL;
@@ -193,7 +193,7 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
193 int offset, int len, u32 val) 193 int offset, int len, u32 val)
194{ 194{
195 struct pci_controller *hose; 195 struct pci_controller *hose;
196 unsigned long addr; 196 volatile void __iomem *addr;
197 197
198 hose = pci_bus_to_host(bus); 198 hose = pci_bus_to_host(bus);
199 if (hose == NULL) 199 if (hose == NULL)
@@ -209,16 +209,16 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
209 */ 209 */
210 switch (len) { 210 switch (len) {
211 case 1: 211 case 1:
212 out_8((u8 *)addr, val); 212 out_8(addr, val);
213 (void) in_8((u8 *)addr); 213 (void) in_8(addr);
214 break; 214 break;
215 case 2: 215 case 2:
216 out_le16((u16 *)addr, val); 216 out_le16(addr, val);
217 (void) in_le16((u16 *)addr); 217 (void) in_le16(addr);
218 break; 218 break;
219 default: 219 default:
220 out_le32((u32 *)addr, val); 220 out_le32(addr, val);
221 (void) in_le32((u32 *)addr); 221 (void) in_le32(addr);
222 break; 222 break;
223 } 223 }
224 return PCIBIOS_SUCCESSFUL; 224 return PCIBIOS_SUCCESSFUL;
@@ -348,25 +348,23 @@ static int u3_ht_skip_device(struct pci_controller *hose,
348 + (((unsigned int)bus) << 16) \ 348 + (((unsigned int)bus) << 16) \
349 + 0x01000000UL) 349 + 0x01000000UL)
350 350
351static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
352 u8 bus, u8 devfn, u8 offset) 352 u8 bus, u8 devfn, u8 offset)
353{ 353{
354 if (bus == hose->first_busno) { 354 if (bus == hose->first_busno) {
355 /* For now, we don't self probe U3 HT bridge */ 355 /* For now, we don't self probe U3 HT bridge */
356 if (PCI_SLOT(devfn) == 0) 356 if (PCI_SLOT(devfn) == 0)
357 return 0; 357 return NULL;
358 return ((unsigned long)hose->cfg_data) + 358 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
359 U3_HT_CFA0(devfn, offset);
360 } else 359 } else
361 return ((unsigned long)hose->cfg_data) + 360 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
362 U3_HT_CFA1(bus, devfn, offset);
363} 361}
364 362
365static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 363static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
366 int offset, int len, u32 *val) 364 int offset, int len, u32 *val)
367{ 365{
368 struct pci_controller *hose; 366 struct pci_controller *hose;
369 unsigned long addr; 367 volatile void __iomem *addr;
370 368
371 hose = pci_bus_to_host(bus); 369 hose = pci_bus_to_host(bus);
372 if (hose == NULL) 370 if (hose == NULL)
@@ -400,13 +398,13 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
400 */ 398 */
401 switch (len) { 399 switch (len) {
402 case 1: 400 case 1:
403 *val = in_8((u8 *)addr); 401 *val = in_8(addr);
404 break; 402 break;
405 case 2: 403 case 2:
406 *val = in_le16((u16 *)addr); 404 *val = in_le16(addr);
407 break; 405 break;
408 default: 406 default:
409 *val = in_le32((u32 *)addr); 407 *val = in_le32(addr);
410 break; 408 break;
411 } 409 }
412 return PCIBIOS_SUCCESSFUL; 410 return PCIBIOS_SUCCESSFUL;
@@ -416,7 +414,7 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
416 int offset, int len, u32 val) 414 int offset, int len, u32 val)
417{ 415{
418 struct pci_controller *hose; 416 struct pci_controller *hose;
419 unsigned long addr; 417 volatile void __iomem *addr;
420 418
421 hose = pci_bus_to_host(bus); 419 hose = pci_bus_to_host(bus);
422 if (hose == NULL) 420 if (hose == NULL)
@@ -442,16 +440,16 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
442 */ 440 */
443 switch (len) { 441 switch (len) {
444 case 1: 442 case 1:
445 out_8((u8 *)addr, val); 443 out_8(addr, val);
446 (void) in_8((u8 *)addr); 444 (void) in_8(addr);
447 break; 445 break;
448 case 2: 446 case 2:
449 out_le16((u16 *)addr, val); 447 out_le16(addr, val);
450 (void) in_le16((u16 *)addr); 448 (void) in_le16(addr);
451 break; 449 break;
452 default: 450 default:
453 out_le32((u32 *)addr, val); 451 out_le32((u32 __iomem *)addr, val);
454 (void) in_le32((u32 *)addr); 452 (void) in_le32(addr);
455 break; 453 break;
456 } 454 }
457 return PCIBIOS_SUCCESSFUL; 455 return PCIBIOS_SUCCESSFUL;
@@ -476,7 +474,7 @@ static struct pci_ops u3_ht_pci_ops =
476 |(((unsigned int)(off)) & 0xfcU) \ 474 |(((unsigned int)(off)) & 0xfcU) \
477 |1UL) 475 |1UL)
478 476
479static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, 477static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose,
480 u8 bus, u8 dev_fn, int offset) 478 u8 bus, u8 dev_fn, int offset)
481{ 479{
482 unsigned int caddr; 480 unsigned int caddr;
@@ -492,14 +490,14 @@ static unsigned long u4_pcie_cfg_access(struct pci_controller* hose,
492 } while (in_le32(hose->cfg_addr) != caddr); 490 } while (in_le32(hose->cfg_addr) != caddr);
493 491
494 offset &= 0x03; 492 offset &= 0x03;
495 return ((unsigned long)hose->cfg_data) + offset; 493 return hose->cfg_data + offset;
496} 494}
497 495
498static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 496static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
499 int offset, int len, u32 *val) 497 int offset, int len, u32 *val)
500{ 498{
501 struct pci_controller *hose; 499 struct pci_controller *hose;
502 unsigned long addr; 500 volatile void __iomem *addr;
503 501
504 hose = pci_bus_to_host(bus); 502 hose = pci_bus_to_host(bus);
505 if (hose == NULL) 503 if (hose == NULL)
@@ -515,13 +513,13 @@ static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
515 */ 513 */
516 switch (len) { 514 switch (len) {
517 case 1: 515 case 1:
518 *val = in_8((u8 *)addr); 516 *val = in_8(addr);
519 break; 517 break;
520 case 2: 518 case 2:
521 *val = in_le16((u16 *)addr); 519 *val = in_le16(addr);
522 break; 520 break;
523 default: 521 default:
524 *val = in_le32((u32 *)addr); 522 *val = in_le32(addr);
525 break; 523 break;
526 } 524 }
527 return PCIBIOS_SUCCESSFUL; 525 return PCIBIOS_SUCCESSFUL;
@@ -531,7 +529,7 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
531 int offset, int len, u32 val) 529 int offset, int len, u32 val)
532{ 530{
533 struct pci_controller *hose; 531 struct pci_controller *hose;
534 unsigned long addr; 532 volatile void __iomem *addr;
535 533
536 hose = pci_bus_to_host(bus); 534 hose = pci_bus_to_host(bus);
537 if (hose == NULL) 535 if (hose == NULL)
@@ -547,16 +545,16 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
547 */ 545 */
548 switch (len) { 546 switch (len) {
549 case 1: 547 case 1:
550 out_8((u8 *)addr, val); 548 out_8(addr, val);
551 (void) in_8((u8 *)addr); 549 (void) in_8(addr);
552 break; 550 break;
553 case 2: 551 case 2:
554 out_le16((u16 *)addr, val); 552 out_le16(addr, val);
555 (void) in_le16((u16 *)addr); 553 (void) in_le16(addr);
556 break; 554 break;
557 default: 555 default:
558 out_le32((u32 *)addr, val); 556 out_le32(addr, val);
559 (void) in_le32((u32 *)addr); 557 (void) in_le32(addr);
560 break; 558 break;
561 } 559 }
562 return PCIBIOS_SUCCESSFUL; 560 return PCIBIOS_SUCCESSFUL;
@@ -773,8 +771,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
773 * the reg address cell, we shall fix that by killing struct 771 * the reg address cell, we shall fix that by killing struct
774 * reg_property and using some accessor functions instead 772 * reg_property and using some accessor functions instead
775 */ 773 */
776 hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 774 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
777 0x02000000);
778 775
779 /* 776 /*
780 * /ht node doesn't expose a "ranges" property, so we "remove" 777 * /ht node doesn't expose a "ranges" property, so we "remove"
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 89c4c3636161..1955462f4082 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -82,8 +82,6 @@
82 82
83#undef SHOW_GATWICK_IRQS 83#undef SHOW_GATWICK_IRQS
84 84
85unsigned char drive_info;
86
87int ppc_override_l2cr = 0; 85int ppc_override_l2cr = 0;
88int ppc_override_l2cr_value; 86int ppc_override_l2cr_value;
89int has_l2cache = 0; 87int has_l2cache = 0;
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 6373372932ba..e3cbba49fd6e 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -333,7 +333,7 @@ void handle_eeh_events (struct eeh_event *event)
333 rc = eeh_reset_device(frozen_pdn, NULL); 333 rc = eeh_reset_device(frozen_pdn, NULL);
334 if (rc) 334 if (rc)
335 goto hard_fail; 335 goto hard_fail;
336 pci_walk_bus(frozen_bus, eeh_report_reset, 0); 336 pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
337 } 337 }
338 338
339 /* If all devices reported they can proceed, the re-enable PIO */ 339 /* If all devices reported they can proceed, the re-enable PIO */
@@ -342,11 +342,11 @@ void handle_eeh_events (struct eeh_event *event)
342 rc = eeh_reset_device(frozen_pdn, NULL); 342 rc = eeh_reset_device(frozen_pdn, NULL);
343 if (rc) 343 if (rc)
344 goto hard_fail; 344 goto hard_fail;
345 pci_walk_bus(frozen_bus, eeh_report_reset, 0); 345 pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
346 } 346 }
347 347
348 /* Tell all device drivers that they can resume operations */ 348 /* Tell all device drivers that they can resume operations */
349 pci_walk_bus(frozen_bus, eeh_report_resume, 0); 349 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
350 350
351 return; 351 return;
352 352
@@ -367,7 +367,7 @@ hard_fail:
367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
368 368
369 /* Notify all devices that they're about to go down. */ 369 /* Notify all devices that they're about to go down. */
370 pci_walk_bus(frozen_bus, eeh_report_failure, 0); 370 pci_walk_bus(frozen_bus, eeh_report_failure, NULL);
371 371
372 /* Shut down the device drivers for good. */ 372 /* Shut down the device drivers for good. */
373 pcibios_remove_pci_devices(frozen_bus); 373 pcibios_remove_pci_devices(frozen_bus);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index da6cebaf72cd..9edeca83f434 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -585,7 +585,7 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
585static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) 585static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
586{ 586{
587 /* Don't risk a hypervisor call if we're crashing */ 587 /* Don't risk a hypervisor call if we're crashing */
588 if (!crash_shutdown) { 588 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
589 unsigned long vpa = __pa(get_lppaca()); 589 unsigned long vpa = __pa(get_lppaca());
590 590
591 if (unregister_vpa(hard_smp_processor_id(), vpa)) { 591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 977de9db8754..6298264efe36 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -59,7 +59,7 @@ static unsigned long dart_tablesize;
59static u32 *dart_vbase; 59static u32 *dart_vbase;
60 60
61/* Mapped base address for the dart */ 61/* Mapped base address for the dart */
62static unsigned int *__iomem dart; 62static unsigned int __iomem *dart;
63 63
64/* Dummy val that entries are set to when unused */ 64/* Dummy val that entries are set to when unused */
65static unsigned int dart_emptyval; 65static unsigned int dart_emptyval;
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index 3e6ca7f5843f..c1e89ad0684d 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -810,13 +810,16 @@ initial_mmu:
810 mtspr SPRN_MD_TWC, r9 810 mtspr SPRN_MD_TWC, r9
811 li r11, MI_BOOTINIT /* Create RPN for address 0 */ 811 li r11, MI_BOOTINIT /* Create RPN for address 0 */
812 addis r11, r11, 0x0080 /* Add 8M */ 812 addis r11, r11, 0x0080 /* Add 8M */
813 mtspr SPRN_MD_RPN, r8 813 mtspr SPRN_MD_RPN, r11
814
815 addi r10, r10, 0x0100
816 mtspr SPRN_MD_CTR, r10
814 817
815 addis r8, r8, 0x0080 /* Add 8M */ 818 addis r8, r8, 0x0080 /* Add 8M */
816 mtspr SPRN_MD_EPN, r8 819 mtspr SPRN_MD_EPN, r8
817 mtspr SPRN_MD_TWC, r9 820 mtspr SPRN_MD_TWC, r9
818 addis r11, r11, 0x0080 /* Add 8M */ 821 addis r11, r11, 0x0080 /* Add 8M */
819 mtspr SPRN_MD_RPN, r8 822 mtspr SPRN_MD_RPN, r11
820#endif 823#endif
821 824
822 /* Since the cache is enabled according to the information we 825 /* Since the cache is enabled according to the information we
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 3a6e4bcb3c53..15bd9b448a48 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -186,11 +186,15 @@ EXPORT_SYMBOL(flush_tlb_kernel_range);
186EXPORT_SYMBOL(flush_tlb_page); 186EXPORT_SYMBOL(flush_tlb_page);
187EXPORT_SYMBOL(_tlbie); 187EXPORT_SYMBOL(_tlbie);
188#ifdef CONFIG_ALTIVEC 188#ifdef CONFIG_ALTIVEC
189#ifndef CONFIG_SMP
189EXPORT_SYMBOL(last_task_used_altivec); 190EXPORT_SYMBOL(last_task_used_altivec);
191#endif
190EXPORT_SYMBOL(giveup_altivec); 192EXPORT_SYMBOL(giveup_altivec);
191#endif /* CONFIG_ALTIVEC */ 193#endif /* CONFIG_ALTIVEC */
192#ifdef CONFIG_SPE 194#ifdef CONFIG_SPE
195#ifndef CONFIG_SMP
193EXPORT_SYMBOL(last_task_used_spe); 196EXPORT_SYMBOL(last_task_used_spe);
197#endif
194EXPORT_SYMBOL(giveup_spe); 198EXPORT_SYMBOL(giveup_spe);
195#endif /* CONFIG_SPE */ 199#endif /* CONFIG_SPE */
196#ifdef CONFIG_SMP 200#ifdef CONFIG_SMP
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
index 159b228eca1e..0ec53f049338 100644
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -332,8 +332,8 @@ bamboo_early_serial_map(void)
332 port.irq = 0; 332 port.irq = 0;
333 port.uartclk = clocks.uart0; 333 port.uartclk = clocks.uart0;
334 port.regshift = 0; 334 port.regshift = 0;
335 port.iotype = SERIAL_IO_MEM; 335 port.iotype = UPIO_MEM;
336 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 336 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
337 port.line = 0; 337 port.line = 0;
338 338
339 if (early_serial_setup(&port) != 0) { 339 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
index 8110f55668c5..ce48a4f08cbb 100644
--- a/arch/ppc/platforms/4xx/bubinga.c
+++ b/arch/ppc/platforms/4xx/bubinga.c
@@ -97,8 +97,8 @@ bubinga_early_serial_map(void)
97 port.irq = ACTING_UART0_INT; 97 port.irq = ACTING_UART0_INT;
98 port.uartclk = uart_clock; 98 port.uartclk = uart_clock;
99 port.regshift = 0; 99 port.regshift = 0;
100 port.iotype = SERIAL_IO_MEM; 100 port.iotype = UPIO_MEM;
101 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 101 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
102 port.line = 0; 102 port.line = 0;
103 103
104 if (early_serial_setup(&port) != 0) { 104 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index 64ebae19cdbb..9a828b623417 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -225,8 +225,8 @@ ebony_early_serial_map(void)
225 port.irq = 0; 225 port.irq = 0;
226 port.uartclk = clocks.uart0; 226 port.uartclk = clocks.uart0;
227 port.regshift = 0; 227 port.regshift = 0;
228 port.iotype = SERIAL_IO_MEM; 228 port.iotype = UPIO_MEM;
229 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 229 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
230 port.line = 0; 230 port.line = 0;
231 231
232 if (early_serial_setup(&port) != 0) { 232 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
index d810b736d9bf..21d29132aebd 100644
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -279,8 +279,8 @@ luan_early_serial_map(void)
279 port.irq = UART0_INT; 279 port.irq = UART0_INT;
280 port.uartclk = clocks.uart0; 280 port.uartclk = clocks.uart0;
281 port.regshift = 0; 281 port.regshift = 0;
282 port.iotype = SERIAL_IO_MEM; 282 port.iotype = UPIO_MEM;
283 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 283 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
284 port.line = 0; 284 port.line = 0;
285 285
286 if (early_serial_setup(&port) != 0) { 286 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index 73b2c98158f6..4f355b6acab2 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -248,8 +248,8 @@ ocotea_early_serial_map(void)
248 port.irq = UART0_INT; 248 port.irq = UART0_INT;
249 port.uartclk = clocks.uart0; 249 port.uartclk = clocks.uart0;
250 port.regshift = 0; 250 port.regshift = 0;
251 port.iotype = SERIAL_IO_MEM; 251 port.iotype = UPIO_MEM;
252 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 252 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
253 port.line = 0; 253 port.line = 0;
254 254
255 if (early_serial_setup(&port) != 0) { 255 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
index 0b1b77d986bf..e90d97f64f76 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -95,8 +95,8 @@ ml300_early_serial_map(void)
95 port.irq = old_ports[i].irq; 95 port.irq = old_ports[i].irq;
96 port.uartclk = old_ports[i].baud_base * 16; 96 port.uartclk = old_ports[i].baud_base * 16;
97 port.regshift = old_ports[i].iomem_reg_shift; 97 port.regshift = old_ports[i].iomem_reg_shift;
98 port.iotype = SERIAL_IO_MEM; 98 port.iotype = UPIO_MEM;
99 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 99 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
100 port.line = i; 100 port.line = i;
101 101
102 if (early_serial_setup(&port) != 0) { 102 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
index e60f4bd437ec..b065b8babcd3 100644
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -305,8 +305,8 @@ yucca_early_serial_map(void)
305 port.irq = UART0_INT; 305 port.irq = UART0_INT;
306 port.uartclk = clocks.uart0; 306 port.uartclk = clocks.uart0;
307 port.regshift = 0; 307 port.regshift = 0;
308 port.iotype = SERIAL_IO_MEM; 308 port.iotype = UPIO_MEM;
309 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 309 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
310 port.line = 0; 310 port.line = 0;
311 311
312 if (early_serial_setup(&port) != 0) { 312 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 012e1e652c03..1a659bbc1860 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -301,14 +301,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
301 struct uart_port p; 301 struct uart_port p;
302 302
303 memset(&p, 0, sizeof (p)); 303 memset(&p, 0, sizeof (p));
304 p.iotype = SERIAL_IO_MEM; 304 p.iotype = UPIO_MEM;
305 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500); 305 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500);
306 p.uartclk = binfo->bi_busfreq; 306 p.uartclk = binfo->bi_busfreq;
307 307
308 gen550_init(0, &p); 308 gen550_init(0, &p);
309 309
310 memset(&p, 0, sizeof (p)); 310 memset(&p, 0, sizeof (p));
311 p.iotype = SERIAL_IO_MEM; 311 p.iotype = UPIO_MEM;
312 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600); 312 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600);
313 p.uartclk = binfo->bi_busfreq; 313 p.uartclk = binfo->bi_busfreq;
314 314
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index 2eceb1e6f4eb..408d64f18e1a 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -162,14 +162,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
162 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 162 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
163 163
164 memset(&p, 0, sizeof (p)); 164 memset(&p, 0, sizeof (p));
165 p.iotype = SERIAL_IO_MEM; 165 p.iotype = UPIO_MEM;
166 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 166 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
167 p.uartclk = binfo->bi_busfreq; 167 p.uartclk = binfo->bi_busfreq;
168 168
169 gen550_init(0, &p); 169 gen550_init(0, &p);
170 170
171 memset(&p, 0, sizeof (p)); 171 memset(&p, 0, sizeof (p));
172 p.iotype = SERIAL_IO_MEM; 172 p.iotype = UPIO_MEM;
173 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 173 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
174 p.uartclk = binfo->bi_busfreq; 174 p.uartclk = binfo->bi_busfreq;
175 175
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index b332ebae6bd3..1801ab392e22 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -534,14 +534,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
534 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 534 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
535 535
536 memset(&p, 0, sizeof (p)); 536 memset(&p, 0, sizeof (p));
537 p.iotype = SERIAL_IO_MEM; 537 p.iotype = UPIO_MEM;
538 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 538 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
539 p.uartclk = binfo->bi_busfreq; 539 p.uartclk = binfo->bi_busfreq;
540 540
541 gen550_init(0, &p); 541 gen550_init(0, &p);
542 542
543 memset(&p, 0, sizeof (p)); 543 memset(&p, 0, sizeof (p));
544 p.iotype = SERIAL_IO_MEM; 544 p.iotype = UPIO_MEM;
545 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 545 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
546 p.uartclk = binfo->bi_busfreq; 546 p.uartclk = binfo->bi_busfreq;
547 547
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index e777ba824aa9..8a72221f816c 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -64,7 +64,7 @@ sbc8560_early_serial_map(void)
64 uart_req.irq = MPC85xx_IRQ_EXT9; 64 uart_req.irq = MPC85xx_IRQ_EXT9;
65 uart_req.flags = STD_COM_FLAGS; 65 uart_req.flags = STD_COM_FLAGS;
66 uart_req.uartclk = BASE_BAUD * 16; 66 uart_req.uartclk = BASE_BAUD * 16;
67 uart_req.iotype = SERIAL_IO_MEM; 67 uart_req.iotype = UPIO_MEM;
68 uart_req.mapbase = UARTA_ADDR; 68 uart_req.mapbase = UARTA_ADDR;
69 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE); 69 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE);
70 uart_req.type = PORT_16650; 70 uart_req.type = PORT_16650;
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index b436f4d0a3fa..a5e38ba62732 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -346,14 +346,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
347 347
348 memset(&p, 0, sizeof (p)); 348 memset(&p, 0, sizeof (p));
349 p.iotype = SERIAL_IO_MEM; 349 p.iotype = UPIO_MEM;
350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
351 p.uartclk = binfo->bi_busfreq; 351 p.uartclk = binfo->bi_busfreq;
352 352
353 gen550_init(0, &p); 353 gen550_init(0, &p);
354 354
355 memset(&p, 0, sizeof (p)); 355 memset(&p, 0, sizeof (p));
356 p.iotype = SERIAL_IO_MEM; 356 p.iotype = UPIO_MEM;
357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
358 p.uartclk = binfo->bi_busfreq; 358 p.uartclk = binfo->bi_busfreq;
359 359
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index 48a4a510d598..aefcc0e7be57 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -116,7 +116,7 @@ chestnut_early_serial_map(void)
116 port.uartclk = BASE_BAUD * 16; 116 port.uartclk = BASE_BAUD * 16;
117 port.irq = UART0_INT; 117 port.irq = UART0_INT;
118 port.flags = STD_COM_FLAGS | UPF_IOREMAP; 118 port.flags = STD_COM_FLAGS | UPF_IOREMAP;
119 port.iotype = SERIAL_IO_MEM; 119 port.iotype = UPIO_MEM;
120 port.mapbase = CHESTNUT_UART0_IO_BASE; 120 port.mapbase = CHESTNUT_UART0_IO_BASE;
121 port.regshift = 0; 121 port.regshift = 0;
122 122
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c
index 32358b3fb236..ffde8f6f6302 100644
--- a/arch/ppc/platforms/ev64260.c
+++ b/arch/ppc/platforms/ev64260.c
@@ -330,7 +330,7 @@ ev64260_early_serial_map(void)
330 port.irq = EV64260_UART_0_IRQ; 330 port.irq = EV64260_UART_0_IRQ;
331 port.uartclk = BASE_BAUD * 16; 331 port.uartclk = BASE_BAUD * 16;
332 port.regshift = 2; 332 port.regshift = 2;
333 port.iotype = SERIAL_IO_MEM; 333 port.iotype = UPIO_MEM;
334 port.flags = STD_COM_FLAGS; 334 port.flags = STD_COM_FLAGS;
335 335
336#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 336#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
index 708b8739ecdd..872c0a3ba3c7 100644
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -100,7 +100,7 @@ static void __init ppc7d_early_serial_map(void)
100 serial_req.uartclk = UART_CLK; 100 serial_req.uartclk = UART_CLK;
101 serial_req.irq = 4; 101 serial_req.irq = 4;
102 serial_req.flags = STD_COM_FLAGS; 102 serial_req.flags = STD_COM_FLAGS;
103 serial_req.iotype = SERIAL_IO_MEM; 103 serial_req.iotype = UPIO_MEM;
104 serial_req.membase = (u_char *) PPC7D_SERIAL_0; 104 serial_req.membase = (u_char *) PPC7D_SERIAL_0;
105 105
106 gen550_init(0, &serial_req); 106 gen550_init(0, &serial_req);
diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c
index 5ad70d357cb9..69e1de7971f2 100644
--- a/arch/ppc/platforms/spruce.c
+++ b/arch/ppc/platforms/spruce.c
@@ -176,8 +176,8 @@ spruce_early_serial_map(void)
176 memset(&serial_req, 0, sizeof(serial_req)); 176 memset(&serial_req, 0, sizeof(serial_req));
177 serial_req.uartclk = uart_clk; 177 serial_req.uartclk = uart_clk;
178 serial_req.irq = UART0_INT; 178 serial_req.irq = UART0_INT;
179 serial_req.flags = ASYNC_BOOT_AUTOCONF; 179 serial_req.flags = UPF_BOOT_AUTOCONF;
180 serial_req.iotype = SERIAL_IO_MEM; 180 serial_req.iotype = UPIO_MEM;
181 serial_req.membase = (u_char *)UART0_IO_BASE; 181 serial_req.membase = (u_char *)UART0_IO_BASE;
182 serial_req.regshift = 0; 182 serial_req.regshift = 0;
183 183
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
index ab34b1d6072f..2fe28ded2c60 100644
--- a/arch/ppc/syslib/ocp.c
+++ b/arch/ppc/syslib/ocp.c
@@ -189,8 +189,8 @@ ocp_device_resume(struct device *dev)
189struct bus_type ocp_bus_type = { 189struct bus_type ocp_bus_type = {
190 .name = "ocp", 190 .name = "ocp",
191 .match = ocp_device_match, 191 .match = ocp_device_match,
192 .probe = ocp_driver_probe, 192 .probe = ocp_device_probe,
193 .remove = ocp_driver_remove, 193 .remove = ocp_device_remove,
194 .suspend = ocp_device_suspend, 194 .suspend = ocp_device_suspend,
195 .resume = ocp_device_resume, 195 .resume = ocp_device_resume,
196}; 196};
diff --git a/arch/ppc/syslib/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
index 1b5fe9e398d4..7bada82527a8 100644
--- a/arch/ppc/syslib/ppc83xx_setup.c
+++ b/arch/ppc/syslib/ppc83xx_setup.c
@@ -108,7 +108,7 @@ mpc83xx_early_serial_map(void)
108 108
109#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 109#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
110 memset(&serial_req, 0, sizeof (serial_req)); 110 memset(&serial_req, 0, sizeof (serial_req));
111 serial_req.iotype = SERIAL_IO_MEM; 111 serial_req.iotype = UPIO_MEM;
112 serial_req.mapbase = pdata[0].mapbase; 112 serial_req.mapbase = pdata[0].mapbase;
113 serial_req.membase = pdata[0].membase; 113 serial_req.membase = pdata[0].membase;
114 serial_req.regshift = 0; 114 serial_req.regshift = 0;
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index 1a47ff4b831d..e4dda43fdaa7 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -90,7 +90,7 @@ mpc85xx_early_serial_map(void)
90 90
91#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 91#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
92 memset(&serial_req, 0, sizeof (serial_req)); 92 memset(&serial_req, 0, sizeof (serial_req));
93 serial_req.iotype = SERIAL_IO_MEM; 93 serial_req.iotype = UPIO_MEM;
94 serial_req.mapbase = pdata[0].mapbase; 94 serial_req.mapbase = pdata[0].mapbase;
95 serial_req.membase = pdata[0].membase; 95 serial_req.membase = pdata[0].membase;
96 serial_req.regshift = 0; 96 serial_req.regshift = 0;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index bf9a7a361b34..cc20f0e3a7d3 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -100,12 +100,12 @@
100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
102 102
103asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
104{ 104{
105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 105 return sys_chown(filename, low2highuid(user), low2highgid(group));
106} 106}
107 107
108asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
109{ 109{
110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 110 return sys_lchown(filename, low2highuid(user), low2highgid(group));
111} 111}
@@ -141,7 +141,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
141 low2highuid(suid)); 141 low2highuid(suid));
142} 142}
143 143
144asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
145{ 145{
146 int retval; 146 int retval;
147 147
@@ -158,7 +158,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
158 low2highgid(sgid)); 158 low2highgid(sgid));
159} 159}
160 160
161asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
162{ 162{
163 int retval; 163 int retval;
164 164
@@ -179,7 +179,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
179 return sys_setfsgid((gid_t)gid); 179 return sys_setfsgid((gid_t)gid);
180} 180}
181 181
182static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
183{ 183{
184 int i; 184 int i;
185 u16 group; 185 u16 group;
@@ -193,7 +193,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
193 return 0; 193 return 0;
194} 194}
195 195
196static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
197{ 197{
198 int i; 198 int i;
199 u16 group; 199 u16 group;
@@ -207,7 +207,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
207 return 0; 207 return 0;
208} 208}
209 209
210asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
211{ 211{
212 int i; 212 int i;
213 213
@@ -231,7 +231,7 @@ out:
231 return i; 231 return i;
232} 232}
233 233
234asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
235{ 235{
236 struct group_info *group_info; 236 struct group_info *group_info;
237 int retval; 237 int retval;
@@ -278,14 +278,14 @@ asmlinkage long sys32_getegid16(void)
278 278
279/* 32-bit timeval and related flotsam. */ 279/* 32-bit timeval and related flotsam. */
280 280
281static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
282{ 282{
283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
284 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
285 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
286} 286}
287 287
288static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) || 291 (__put_user(i->tv_sec, &o->tv_sec) ||
@@ -341,7 +341,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
341 return -ENOSYS; 341 return -ENOSYS;
342} 342}
343 343
344asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
345{ 345{
346 if ((int)high < 0) 346 if ((int)high < 0)
347 return -EINVAL; 347 return -EINVAL;
@@ -357,7 +357,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 return sys_ftruncate(fd, (high << 32) | low); 357 return sys_ftruncate(fd, (high << 32) | low);
358} 358}
359 359
360int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
361{ 361{
362 int err; 362 int err;
363 363
@@ -591,7 +591,7 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
591 591
592extern struct timezone sys_tz; 592extern struct timezone sys_tz;
593 593
594asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{ 595{
596 if (tv) { 596 if (tv) {
597 struct timeval ktv; 597 struct timeval ktv;
@@ -606,7 +606,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *t
606 return 0; 606 return 0;
607} 607}
608 608
609static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
610{ 610{
611 long usec; 611 long usec;
612 612
@@ -620,7 +620,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
620 return 0; 620 return 0;
621} 621}
622 622
623asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
624{ 624{
625 struct timespec kts; 625 struct timespec kts;
626 struct timezone ktz; 626 struct timezone ktz;
@@ -645,7 +645,7 @@ asmlinkage long sys32_pause(void)
645 return -ERESTARTNOHAND; 645 return -ERESTARTNOHAND;
646} 646}
647 647
648asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
649 size_t count, u32 poshi, u32 poslo) 649 size_t count, u32 poshi, u32 poslo)
650{ 650{
651 if ((compat_ssize_t) count < 0) 651 if ((compat_ssize_t) count < 0)
@@ -653,7 +653,7 @@ asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
654} 654}
655 655
656asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
657 size_t count, u32 poshi, u32 poslo) 657 size_t count, u32 poshi, u32 poslo)
658{ 658{
659 if ((compat_ssize_t) count < 0) 659 if ((compat_ssize_t) count < 0)
@@ -666,7 +666,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
667} 667}
668 668
669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
670{ 670{
671 mm_segment_t old_fs = get_fs(); 671 mm_segment_t old_fs = get_fs();
672 int ret; 672 int ret;
@@ -686,7 +686,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
686} 686}
687 687
688asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 688asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
689 compat_loff_t *offset, s32 count) 689 compat_loff_t __user *offset, s32 count)
690{ 690{
691 mm_segment_t old_fs = get_fs(); 691 mm_segment_t old_fs = get_fs();
692 int ret; 692 int ret;
@@ -722,7 +722,7 @@ struct timex32 {
722 722
723extern int do_adjtimex(struct timex *); 723extern int do_adjtimex(struct timex *);
724 724
725asmlinkage long sys32_adjtimex(struct timex32 *utp) 725asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
726{ 726{
727 struct timex txc; 727 struct timex txc;
728 int ret; 728 int ret;
@@ -789,12 +789,13 @@ struct __sysctl_args32 {
789 u32 __unused[4]; 789 u32 __unused[4];
790}; 790};
791 791
792asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
793{ 793{
794 struct __sysctl_args32 tmp; 794 struct __sysctl_args32 tmp;
795 int error; 795 int error;
796 size_t oldlen, *oldlenp = NULL; 796 size_t oldlen;
797 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 797 size_t __user *oldlenp = NULL;
798 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
798 799
799 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 if (copy_from_user(&tmp, args, sizeof(tmp)))
800 return -EFAULT; 801 return -EFAULT;
@@ -806,20 +807,20 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
806 basically copy the whole sysctl.c here, and 807 basically copy the whole sysctl.c here, and
807 glibc's __sysctl uses rw memory for the structure 808 glibc's __sysctl uses rw memory for the structure
808 anyway. */ 809 anyway. */
809 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 810 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
810 put_user(oldlen, (size_t *)addr)) 811 put_user(oldlen, (size_t __user *)addr))
811 return -EFAULT; 812 return -EFAULT;
812 oldlenp = (size_t *)addr; 813 oldlenp = (size_t __user *)addr;
813 } 814 }
814 815
815 lock_kernel(); 816 lock_kernel();
816 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 817 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
817 oldlenp, (void *)A(tmp.newval), tmp.newlen); 818 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
818 unlock_kernel(); 819 unlock_kernel();
819 if (oldlenp) { 820 if (oldlenp) {
820 if (!error) { 821 if (!error) {
821 if (get_user(oldlen, (size_t *)addr) || 822 if (get_user(oldlen, (size_t __user *)addr) ||
822 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 823 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
823 error = -EFAULT; 824 error = -EFAULT;
824 } 825 }
825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 826 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -853,7 +854,7 @@ struct stat64_emu31 {
853 unsigned long st_ino; 854 unsigned long st_ino;
854}; 855};
855 856
856static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 857static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
857{ 858{
858 struct stat64_emu31 tmp; 859 struct stat64_emu31 tmp;
859 860
@@ -877,7 +878,7 @@ static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat)
877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 878 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
878} 879}
879 880
880asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 881asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
881{ 882{
882 struct kstat stat; 883 struct kstat stat;
883 int ret = vfs_stat(filename, &stat); 884 int ret = vfs_stat(filename, &stat);
@@ -886,7 +887,7 @@ asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
886 return ret; 887 return ret;
887} 888}
888 889
889asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 890asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
890{ 891{
891 struct kstat stat; 892 struct kstat stat;
892 int ret = vfs_lstat(filename, &stat); 893 int ret = vfs_lstat(filename, &stat);
@@ -895,7 +896,7 @@ asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
895 return ret; 896 return ret;
896} 897}
897 898
898asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 899asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf)
899{ 900{
900 struct kstat stat; 901 struct kstat stat;
901 int ret = vfs_fstat(fd, &stat); 902 int ret = vfs_fstat(fd, &stat);
@@ -952,7 +953,7 @@ out:
952 953
953 954
954asmlinkage unsigned long 955asmlinkage unsigned long
955old32_mmap(struct mmap_arg_struct_emu31 *arg) 956old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
956{ 957{
957 struct mmap_arg_struct_emu31 a; 958 struct mmap_arg_struct_emu31 a;
958 int error = -EFAULT; 959 int error = -EFAULT;
@@ -970,7 +971,7 @@ out:
970} 971}
971 972
972asmlinkage long 973asmlinkage long
973sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 974sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
974{ 975{
975 struct mmap_arg_struct_emu31 a; 976 struct mmap_arg_struct_emu31 a;
976 int error = -EFAULT; 977 int error = -EFAULT;
@@ -982,7 +983,7 @@ out:
982 return error; 983 return error;
983} 984}
984 985
985asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 986asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
986{ 987{
987 if ((compat_ssize_t) count < 0) 988 if ((compat_ssize_t) count < 0)
988 return -EINVAL; 989 return -EINVAL;
@@ -990,7 +991,7 @@ asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
990 return sys_read(fd, buf, count); 991 return sys_read(fd, buf, count);
991} 992}
992 993
993asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 994asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
994{ 995{
995 if ((compat_ssize_t) count < 0) 996 if ((compat_ssize_t) count < 0)
996 return -EINVAL; 997 return -EINVAL;
@@ -1002,12 +1003,12 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1002{ 1003{
1003 unsigned long clone_flags; 1004 unsigned long clone_flags;
1004 unsigned long newsp; 1005 unsigned long newsp;
1005 int *parent_tidptr, *child_tidptr; 1006 int __user *parent_tidptr, *child_tidptr;
1006 1007
1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1008 clone_flags = regs.gprs[3] & 0xffffffffUL;
1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1009 newsp = regs.orig_gpr2 & 0x7fffffffUL;
1009 parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1010 parent_tidptr = compat_ptr(regs.gprs[4]);
1010 child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1011 child_tidptr = compat_ptr(regs.gprs[5]);
1011 if (!newsp) 1012 if (!newsp)
1012 newsp = regs.gprs[15]; 1013 newsp = regs.gprs[15];
1013 return do_fork(clone_flags, newsp, &regs, 0, 1014 return do_fork(clone_flags, newsp, &regs, 0,
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6a63553493c5..e351780bb660 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -122,8 +122,8 @@ out:
122#ifndef CONFIG_64BIT 122#ifndef CONFIG_64BIT
123struct sel_arg_struct { 123struct sel_arg_struct {
124 unsigned long n; 124 unsigned long n;
125 fd_set *inp, *outp, *exp; 125 fd_set __user *inp, *outp, *exp;
126 struct timeval *tvp; 126 struct timeval __user *tvp;
127}; 127};
128 128
129asmlinkage long old_select(struct sel_arg_struct __user *arg) 129asmlinkage long old_select(struct sel_arg_struct __user *arg)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5d21e9e6e7b4..a46793beeddd 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -486,7 +486,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
486 info.si_signo = signal; 486 info.si_signo = signal;
487 info.si_errno = 0; 487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC; 488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *) location; 489 info.si_addr = (void __user *) location;
490 do_trap(interruption_code, signal, 490 do_trap(interruption_code, signal,
491 "illegal operation", regs, &info); 491 "illegal operation", regs, &info);
492 } 492 }
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 2d5cb1385753..b075ab499d05 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -42,8 +42,8 @@ static volatile long cmm_timed_pages_target = 0;
42static long cmm_timeout_pages = 0; 42static long cmm_timeout_pages = 0;
43static long cmm_timeout_seconds = 0; 43static long cmm_timeout_seconds = 0;
44 44
45static struct cmm_page_array *cmm_page_list = 0; 45static struct cmm_page_array *cmm_page_list = NULL;
46static struct cmm_page_array *cmm_timed_page_list = 0; 46static struct cmm_page_array *cmm_timed_page_list = NULL;
47 47
48static unsigned long cmm_thread_active = 0; 48static unsigned long cmm_thread_active = 0;
49static struct work_struct cmm_thread_starter; 49static struct work_struct cmm_thread_starter;
@@ -259,7 +259,7 @@ static struct ctl_table cmm_table[];
259 259
260static int 260static int
261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp, 261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
262 void *buffer, size_t *lenp, loff_t *ppos) 262 void __user *buffer, size_t *lenp, loff_t *ppos)
263{ 263{
264 char buf[16], *p; 264 char buf[16], *p;
265 long pages; 265 long pages;
@@ -300,7 +300,7 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
300 300
301static int 301static int
302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp, 302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
303 void *buffer, size_t *lenp, loff_t *ppos) 303 void __user *buffer, size_t *lenp, loff_t *ppos)
304{ 304{
305 char buf[64], *p; 305 char buf[64], *p;
306 long pages, seconds; 306 long pages, seconds;
@@ -419,7 +419,7 @@ cmm_init (void)
419#ifdef CONFIG_CMM_IUCV 419#ifdef CONFIG_CMM_IUCV
420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
421#endif 421#endif
422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, 0); 422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, NULL);
423 init_waitqueue_head(&cmm_thread_wait); 423 init_waitqueue_head(&cmm_thread_wait);
424 init_timer(&cmm_timer); 424 init_timer(&cmm_timer);
425 return 0; 425 return 0;
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c
index c46f9154cfd5..123abbbc91e0 100644
--- a/arch/sh/boards/renesas/rts7751r2d/io.c
+++ b/arch/sh/boards/renesas/rts7751r2d/io.c
@@ -216,24 +216,26 @@ void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count)
216{ 216{
217 volatile __u8 *bp; 217 volatile __u8 *bp;
218 volatile __u16 *p; 218 volatile __u16 *p;
219 unsigned char *s = addr;
219 220
220 if (CHECK_AX88796L_PORT(port)) { 221 if (CHECK_AX88796L_PORT(port)) {
221 p = (volatile unsigned short *)port88796l(port, 0); 222 p = (volatile unsigned short *)port88796l(port, 0);
222 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 223 while (count--) *s++ = *p & 0xff;
223 } else if (PXSEG(port)) 224 } else if (PXSEG(port))
224 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 225 while (count--) *s++ = *(volatile unsigned char *)port;
225 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
226 bp = (__u8 *)PCI_IOMAP(port); 227 bp = (__u8 *)PCI_IOMAP(port);
227 while (count--) *((volatile unsigned char *) addr)++ = *bp; 228 while (count--) *s++ = *bp;
228 } else { 229 } else {
229 p = (volatile unsigned short *)port2adr(port); 230 p = (volatile unsigned short *)port2adr(port);
230 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 231 while (count--) *s++ = *p & 0xff;
231 } 232 }
232} 233}
233 234
234void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) 235void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
235{ 236{
236 volatile __u16 *p; 237 volatile __u16 *p;
238 __u16 *s = addr;
237 239
238 if (CHECK_AX88796L_PORT(port)) 240 if (CHECK_AX88796L_PORT(port))
239 p = (volatile unsigned short *)port88796l(port, 1); 241 p = (volatile unsigned short *)port88796l(port, 1);
@@ -243,7 +245,7 @@ void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
243 p = (volatile unsigned short *)PCI_IOMAP(port); 245 p = (volatile unsigned short *)PCI_IOMAP(port);
244 else 246 else
245 p = (volatile unsigned short *)port2adr(port); 247 p = (volatile unsigned short *)port2adr(port);
246 while (count--) *((__u16 *) addr)++ = *p; 248 while (count--) *s++ = *p;
247} 249}
248 250
249void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) 251void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
@@ -252,8 +254,9 @@ void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
252 maybebadio(insl, port); 254 maybebadio(insl, port);
253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 255 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 256 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
257 __u32 *s = addr;
255 258
256 while (count--) *((__u32 *) addr)++ = *p; 259 while (count--) *s++ = *p;
257 } else 260 } else
258 maybebadio(insl, port); 261 maybebadio(insl, port);
259} 262}
@@ -262,24 +265,26 @@ void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count)
262{ 265{
263 volatile __u8 *bp; 266 volatile __u8 *bp;
264 volatile __u16 *p; 267 volatile __u16 *p;
268 const __u8 *s = addr;
265 269
266 if (CHECK_AX88796L_PORT(port)) { 270 if (CHECK_AX88796L_PORT(port)) {
267 p = (volatile unsigned short *)port88796l(port, 0); 271 p = (volatile unsigned short *)port88796l(port, 0);
268 while (count--) *p = *((unsigned char *) addr)++; 272 while (count--) *p = *s++;
269 } else if (PXSEG(port)) 273 } else if (PXSEG(port))
270 while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 274 while (count--) *(volatile unsigned char *)port = *s++;
271 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 275 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
272 bp = (__u8 *)PCI_IOMAP(port); 276 bp = (__u8 *)PCI_IOMAP(port);
273 while (count--) *bp = *((volatile unsigned char *) addr)++; 277 while (count--) *bp = *s++;
274 } else { 278 } else {
275 p = (volatile unsigned short *)port2adr(port); 279 p = (volatile unsigned short *)port2adr(port);
276 while (count--) *p = *((unsigned char *) addr)++; 280 while (count--) *p = *s++;
277 } 281 }
278} 282}
279 283
280void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) 284void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
281{ 285{
282 volatile __u16 *p; 286 volatile __u16 *p;
287 const __u16 *s = addr;
283 288
284 if (CHECK_AX88796L_PORT(port)) 289 if (CHECK_AX88796L_PORT(port))
285 p = (volatile unsigned short *)port88796l(port, 1); 290 p = (volatile unsigned short *)port88796l(port, 1);
@@ -289,7 +294,7 @@ void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
289 p = (volatile unsigned short *)PCI_IOMAP(port); 294 p = (volatile unsigned short *)PCI_IOMAP(port);
290 else 295 else
291 p = (volatile unsigned short *)port2adr(port); 296 p = (volatile unsigned short *)port2adr(port);
292 while (count--) *p = *((__u16 *) addr)++; 297 while (count--) *p = *s++;
293} 298}
294 299
295void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) 300void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
@@ -298,8 +303,9 @@ void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
298 maybebadio(outsl, port); 303 maybebadio(outsl, port);
299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 304 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 305 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
306 const __u32 *s = addr;
301 307
302 while (count--) *p = *((__u32 *) addr)++; 308 while (count--) *p = *s++;
303 } else 309 } else
304 maybebadio(outsl, port); 310 maybebadio(outsl, port);
305} 311}
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
index 472b450e61be..de29c45f23a7 100644
--- a/arch/sh64/kernel/sh_ksyms.c
+++ b/arch/sh64/kernel/sh_ksyms.c
@@ -31,14 +31,6 @@
31 31
32extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 32extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
33 33
34#if 0
35/* Not yet - there's no declaration of drive_info anywhere. */
36#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
37extern struct drive_info_struct drive_info;
38EXPORT_SYMBOL(drive_info);
39#endif
40#endif
41
42/* platform dependent support */ 34/* platform dependent support */
43EXPORT_SYMBOL(dump_fpu); 35EXPORT_SYMBOL(dump_fpu);
44EXPORT_SYMBOL(iounmap); 36EXPORT_SYMBOL(iounmap);
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 267ec8f6fb58..887f6a160c58 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -38,7 +38,7 @@
38 38
39#define curptr g6 39#define curptr g6
40 40
41#define NR_SYSCALLS 299 /* Each OS is different... */ 41#define NR_SYSCALLS 300 /* Each OS is different... */
42 42
43/* These are just handy. */ 43/* These are just handy. */
44#define _SV save %sp, -STACKFRAME_SZ, %sp 44#define _SV save %sp, -STACKFRAME_SZ, %sp
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index fbb05a452e51..118cac84a0f5 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -54,7 +54,7 @@ void (*pm_idle)(void);
54 * This is done via auxio, but could be used as a fallback 54 * This is done via auxio, but could be used as a fallback
55 * handler when auxio is not present-- unused for now... 55 * handler when auxio is not present-- unused for now...
56 */ 56 */
57void (*pm_power_off)(void); 57void (*pm_power_off)(void) = machine_power_off;
58 58
59/* 59/*
60 * sysctl - toggle power-off restriction for serial console 60 * sysctl - toggle power-off restriction for serial console
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 6877ae4cd1d9..c0314705d73a 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -78,7 +78,7 @@ sys_call_table:
78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat 79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat
80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
82 82
83#ifdef CONFIG_SUNOS_EMUL 83#ifdef CONFIG_SUNOS_EMUL
84 /* Now the SunOS syscall table. */ 84 /* Now the SunOS syscall table. */
@@ -190,5 +190,6 @@ sunos_sys_table:
190/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys 190/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys
191 .long sunos_nosys, sunos_nosys, sunos_nosys 191 .long sunos_nosys, sunos_nosys, sunos_nosys
192 .long sunos_nosys, sunos_nosys, sunos_nosys 192 .long sunos_nosys, sunos_nosys, sunos_nosys
193 .long sunos_nosys
193 194
194#endif 195#endif
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index bc56a7d88308..069d49777b2a 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc2 3# Linux kernel version: 2.6.16-rc2
4# Sat Feb 4 02:31:38 2006 4# Tue Feb 7 17:47:18 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -30,7 +30,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
30# General setup 30# General setup
31# 31#
32CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 33# CONFIG_LOCALVERSION_AUTO is not set
34CONFIG_SWAP=y 34CONFIG_SWAP=y
35CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
36CONFIG_POSIX_MQUEUE=y 36CONFIG_POSIX_MQUEUE=y
@@ -766,6 +766,7 @@ CONFIG_HWMON=y
766# CONFIG_SENSORS_ASB100 is not set 766# CONFIG_SENSORS_ASB100 is not set
767# CONFIG_SENSORS_ATXP1 is not set 767# CONFIG_SENSORS_ATXP1 is not set
768# CONFIG_SENSORS_DS1621 is not set 768# CONFIG_SENSORS_DS1621 is not set
769# CONFIG_SENSORS_F71805F is not set
769# CONFIG_SENSORS_FSCHER is not set 770# CONFIG_SENSORS_FSCHER is not set
770# CONFIG_SENSORS_FSCPOS is not set 771# CONFIG_SENSORS_FSCPOS is not set
771# CONFIG_SENSORS_GL518SM is not set 772# CONFIG_SENSORS_GL518SM is not set
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 12911e7463f2..a73553ae7e53 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -25,7 +25,7 @@
25 25
26#define curptr g6 26#define curptr g6
27 27
28#define NR_SYSCALLS 299 /* Each OS is different... */ 28#define NR_SYSCALLS 300 /* Each OS is different... */
29 29
30 .text 30 .text
31 .align 32 31 .align 32
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 2881faf36635..5928b3c33e27 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -79,7 +79,7 @@ sys_call_table32:
79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat 79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat 80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat
81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll 82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
83 83
84#endif /* CONFIG_COMPAT */ 84#endif /* CONFIG_COMPAT */
85 85
@@ -148,7 +148,7 @@ sys_call_table:
148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat
150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
152 152
153#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 153#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
154 defined(CONFIG_SOLARIS_EMUL_MODULE) 154 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -261,4 +261,5 @@ sunos_sys_table:
261/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys 261/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys
262 .word sunos_nosys, sunos_nosys, sunos_nosys 262 .word sunos_nosys, sunos_nosys, sunos_nosys
263 .word sunos_nosys, sunos_nosys, sunos_nosys 263 .word sunos_nosys, sunos_nosys, sunos_nosys
264 .word sunos_nosys
264#endif 265#endif
diff --git a/arch/sparc64/solaris/systbl.S b/arch/sparc64/solaris/systbl.S
index d25667eeae10..7043ca18caf9 100644
--- a/arch/sparc64/solaris/systbl.S
+++ b/arch/sparc64/solaris/systbl.S
@@ -283,32 +283,3 @@ solaris_sys_table:
283 .word solaris_unimplemented /* 253 */ 283 .word solaris_unimplemented /* 253 */
284 .word solaris_unimplemented /* 254 */ 284 .word solaris_unimplemented /* 254 */
285 .word solaris_unimplemented /* 255 */ 285 .word solaris_unimplemented /* 255 */
286 .word solaris_unimplemented /* 256 */
287 .word solaris_unimplemented /* 257 */
288 .word solaris_unimplemented /* 258 */
289 .word solaris_unimplemented /* 259 */
290 .word solaris_unimplemented /* 260 */
291 .word solaris_unimplemented /* 261 */
292 .word solaris_unimplemented /* 262 */
293 .word solaris_unimplemented /* 263 */
294 .word solaris_unimplemented /* 264 */
295 .word solaris_unimplemented /* 265 */
296 .word solaris_unimplemented /* 266 */
297 .word solaris_unimplemented /* 267 */
298 .word solaris_unimplemented /* 268 */
299 .word solaris_unimplemented /* 269 */
300 .word solaris_unimplemented /* 270 */
301 .word solaris_unimplemented /* 271 */
302 .word solaris_unimplemented /* 272 */
303 .word solaris_unimplemented /* 273 */
304 .word solaris_unimplemented /* 274 */
305 .word solaris_unimplemented /* 275 */
306 .word solaris_unimplemented /* 276 */
307 .word solaris_unimplemented /* 277 */
308 .word solaris_unimplemented /* 278 */
309 .word solaris_unimplemented /* 279 */
310 .word solaris_unimplemented /* 280 */
311 .word solaris_unimplemented /* 281 */
312 .word solaris_unimplemented /* 282 */
313 .word solaris_unimplemented /* 283 */
314
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 5d50d4a44abf..2f880cb167a5 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -9,6 +9,7 @@
9#include <termios.h> 9#include <termios.h>
10#include <string.h> 10#include <string.h>
11#include <signal.h> 11#include <signal.h>
12#include <sched.h>
12#include <sys/stat.h> 13#include <sys/stat.h>
13#include <sys/ioctl.h> 14#include <sys/ioctl.h>
14#include <sys/socket.h> 15#include <sys/socket.h>
@@ -73,7 +74,6 @@ static void winch_handler(int sig)
73struct winch_data { 74struct winch_data {
74 int pty_fd; 75 int pty_fd;
75 int pipe_fd; 76 int pipe_fd;
76 int close_me;
77}; 77};
78 78
79static int winch_thread(void *arg) 79static int winch_thread(void *arg)
@@ -84,7 +84,6 @@ static int winch_thread(void *arg)
84 int count, err; 84 int count, err;
85 char c = 1; 85 char c = 1;
86 86
87 os_close_file(data->close_me);
88 pty_fd = data->pty_fd; 87 pty_fd = data->pty_fd;
89 pipe_fd = data->pipe_fd; 88 pipe_fd = data->pipe_fd;
90 count = os_write_file(pipe_fd, &c, sizeof(c)); 89 count = os_write_file(pipe_fd, &c, sizeof(c));
@@ -153,15 +152,16 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
153 } 152 }
154 153
155 data = ((struct winch_data) { .pty_fd = fd, 154 data = ((struct winch_data) { .pty_fd = fd,
156 .pipe_fd = fds[1], 155 .pipe_fd = fds[1] } );
157 .close_me = fds[0] } ); 156 /* CLONE_FILES so this thread doesn't hold open files which are open
158 err = run_helper_thread(winch_thread, &data, 0, &stack, 0); 157 * now, but later closed. This is a problem with /dev/net/tun.
158 */
159 err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0);
159 if(err < 0){ 160 if(err < 0){
160 printk("fork of winch_thread failed - errno = %d\n", errno); 161 printk("fork of winch_thread failed - errno = %d\n", errno);
161 goto out_close; 162 goto out_close;
162 } 163 }
163 164
164 os_close_file(fds[1]);
165 *fd_out = fds[0]; 165 *fd_out = fds[0];
166 n = os_read_file(fds[0], &c, sizeof(c)); 166 n = os_read_file(fds[0], &c, sizeof(c));
167 if(n != sizeof(c)){ 167 if(n != sizeof(c)){
@@ -169,13 +169,12 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
169 printk("read failed, err = %d\n", -n); 169 printk("read failed, err = %d\n", -n);
170 printk("fd %d will not support SIGWINCH\n", fd); 170 printk("fd %d will not support SIGWINCH\n", fd);
171 err = -EINVAL; 171 err = -EINVAL;
172 goto out_close1; 172 goto out_close;
173 } 173 }
174 return err ; 174 return err ;
175 175
176 out_close: 176 out_close:
177 os_close_file(fds[1]); 177 os_close_file(fds[1]);
178 out_close1:
179 os_close_file(fds[0]); 178 os_close_file(fds[0]);
180 out: 179 out:
181 return err; 180 return err;
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 8ebb2241ad42..8c7279bb353b 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -131,9 +131,8 @@ static int uml_net_open(struct net_device *dev)
131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev); 131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev);
132 if(err != 0){ 132 if(err != 0){
133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); 133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
134 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
135 lp->fd = -1;
136 err = -ENETUNREACH; 134 err = -ENETUNREACH;
135 goto out_close;
137 } 136 }
138 137
139 lp->tl.data = (unsigned long) &lp->user; 138 lp->tl.data = (unsigned long) &lp->user;
@@ -145,9 +144,19 @@ static int uml_net_open(struct net_device *dev)
145 */ 144 */
146 while((err = uml_net_rx(dev)) > 0) ; 145 while((err = uml_net_rx(dev)) > 0) ;
147 146
148 out:
149 spin_unlock(&lp->lock); 147 spin_unlock(&lp->lock);
150 return(err); 148
149 spin_lock(&opened_lock);
150 list_add(&lp->list, &opened);
151 spin_unlock(&opened_lock);
152
153 return 0;
154out_close:
155 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
156 lp->fd = -1;
157out:
158 spin_unlock(&lp->lock);
159 return err;
151} 160}
152 161
153static int uml_net_close(struct net_device *dev) 162static int uml_net_close(struct net_device *dev)
@@ -161,9 +170,13 @@ static int uml_net_close(struct net_device *dev)
161 if(lp->close != NULL) 170 if(lp->close != NULL)
162 (*lp->close)(lp->fd, &lp->user); 171 (*lp->close)(lp->fd, &lp->user);
163 lp->fd = -1; 172 lp->fd = -1;
164 list_del(&lp->list);
165 173
166 spin_unlock(&lp->lock); 174 spin_unlock(&lp->lock);
175
176 spin_lock(&opened_lock);
177 list_del(&lp->list);
178 spin_unlock(&opened_lock);
179
167 return 0; 180 return 0;
168} 181}
169 182
@@ -410,11 +423,7 @@ static int eth_configure(int n, void *init, char *mac,
410 if (device->have_mac) 423 if (device->have_mac)
411 set_ether_mac(dev, device->mac); 424 set_ether_mac(dev, device->mac);
412 425
413 spin_lock(&opened_lock); 426 return 0;
414 list_add(&lp->list, &opened);
415 spin_unlock(&opened_lock);
416
417 return(0);
418} 427}
419 428
420static struct uml_net *find_device(int n) 429static struct uml_net *find_device(int n)
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 4892e5fcef07..83b688ca198f 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -14,7 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);
14extern void save_registers(int pid, union uml_pt_regs *regs); 14extern void save_registers(int pid, union uml_pt_regs *regs);
15extern void restore_registers(int pid, union uml_pt_regs *regs); 15extern void restore_registers(int pid, union uml_pt_regs *regs);
16extern void init_registers(int pid); 16extern void init_registers(int pid);
17extern void get_safe_registers(unsigned long * regs); 17extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs);
18extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); 18extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer);
19 19
20#endif 20#endif
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
deleted file mode 100644
index eea1c9c4bb0f..000000000000
--- a/arch/um/kernel/skas/process.c
+++ /dev/null
@@ -1,569 +0,0 @@
1/*
2 * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9#include <errno.h>
10#include <signal.h>
11#include <setjmp.h>
12#include <sched.h>
13#include <sys/wait.h>
14#include <sys/mman.h>
15#include <sys/user.h>
16#include <sys/time.h>
17#include <asm/unistd.h>
18#include <asm/types.h>
19#include "user.h"
20#include "ptrace_user.h"
21#include "sysdep/ptrace.h"
22#include "user_util.h"
23#include "kern_util.h"
24#include "skas.h"
25#include "stub-data.h"
26#include "mm_id.h"
27#include "sysdep/sigcontext.h"
28#include "sysdep/stub.h"
29#include "os.h"
30#include "proc_mm.h"
31#include "skas_ptrace.h"
32#include "chan_user.h"
33#include "registers.h"
34#include "mem.h"
35#include "uml-config.h"
36#include "process.h"
37
38int is_skas_winch(int pid, int fd, void *data)
39{
40 if(pid != os_getpgrp())
41 return(0);
42
43 register_winch_irq(-1, fd, -1, data);
44 return(1);
45}
46
47void wait_stub_done(int pid, int sig, char * fname)
48{
49 int n, status, err;
50
51 do {
52 if ( sig != -1 ) {
53 err = ptrace(PTRACE_CONT, pid, 0, sig);
54 if(err)
55 panic("%s : continue failed, errno = %d\n",
56 fname, errno);
57 }
58 sig = 0;
59
60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
61 } while((n >= 0) && WIFSTOPPED(status) &&
62 ((WSTOPSIG(status) == SIGVTALRM) ||
63 /* running UML inside a detached screen can cause
64 * SIGWINCHes
65 */
66 (WSTOPSIG(status) == SIGWINCH)));
67
68 if((n < 0) || !WIFSTOPPED(status) ||
69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
70 unsigned long regs[HOST_FRAME_SIZE];
71 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
72 printk("Failed to get registers from stub, "
73 "errno = %d\n", errno);
74 else {
75 int i;
76
77 printk("Stub registers -\n");
78 for(i = 0; i < HOST_FRAME_SIZE; i++)
79 printk("\t%d - %lx\n", i, regs[i]);
80 }
81 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
82 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
83 fname, pid, n, errno, status);
84 }
85}
86
87void get_skas_faultinfo(int pid, struct faultinfo * fi)
88{
89 int err;
90
91 if(ptrace_faultinfo){
92 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);
93 if(err)
94 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "
95 "errno = %d\n", errno);
96
97 /* Special handling for i386, which has different structs */
98 if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo))
99 memset((char *)fi + sizeof(struct ptrace_faultinfo), 0,
100 sizeof(struct faultinfo) -
101 sizeof(struct ptrace_faultinfo));
102 }
103 else {
104 wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo");
105
106 /* faultinfo is prepared by the stub-segv-handler at start of
107 * the stub stack page. We just have to copy it.
108 */
109 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
110 }
111}
112
113static void handle_segv(int pid, union uml_pt_regs * regs)
114{
115 get_skas_faultinfo(pid, &regs->skas.faultinfo);
116 segv(regs->skas.faultinfo, 0, 1, NULL);
117}
118
119/*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/
120static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu)
121{
122 int err, status;
123
124 /* Mark this as a syscall */
125 UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs);
126
127 if (!local_using_sysemu)
128 {
129 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);
130 if(err < 0)
131 panic("handle_trap - nullifying syscall failed errno = %d\n",
132 errno);
133
134 err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
135 if(err < 0)
136 panic("handle_trap - continuing to end of syscall failed, "
137 "errno = %d\n", errno);
138
139 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
140 if((err < 0) || !WIFSTOPPED(status) ||
141 (WSTOPSIG(status) != SIGTRAP + 0x80))
142 panic("handle_trap - failed to wait at end of syscall, "
143 "errno = %d, status = %d\n", errno, status);
144 }
145
146 handle_syscall(regs);
147}
148
149extern int __syscall_stub_start;
150int stub_code_fd = -1;
151__u64 stub_code_offset;
152
153static int userspace_tramp(void *stack)
154{
155 void *addr;
156
157 ptrace(PTRACE_TRACEME, 0, 0, 0);
158
159 init_new_thread_signals(1);
160 enable_timer();
161
162 if(!proc_mm){
163 /* This has a pte, but it can't be mapped in with the usual
164 * tlb_flush mechanism because this is part of that mechanism
165 */
166 addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(),
167 PROT_EXEC, MAP_FIXED | MAP_PRIVATE,
168 stub_code_fd, stub_code_offset);
169 if(addr == MAP_FAILED){
170 printk("mapping stub code failed, errno = %d\n",
171 errno);
172 exit(1);
173 }
174
175 if(stack != NULL){
176 int fd;
177 __u64 offset;
178
179 fd = phys_mapping(to_phys(stack), &offset);
180 addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(),
181 PROT_READ | PROT_WRITE,
182 MAP_FIXED | MAP_SHARED, fd, offset);
183 if(addr == MAP_FAILED){
184 printk("mapping stub stack failed, "
185 "errno = %d\n", errno);
186 exit(1);
187 }
188 }
189 }
190 if(!ptrace_faultinfo){
191 unsigned long v = UML_CONFIG_STUB_CODE +
192 (unsigned long) stub_segv_handler -
193 (unsigned long) &__syscall_stub_start;
194
195 set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size());
196 set_handler(SIGSEGV, (void *) v, SA_ONSTACK,
197 SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
198 SIGUSR1, -1);
199 }
200
201 os_stop_process(os_getpid());
202 return(0);
203}
204
205/* Each element set once, and only accessed by a single processor anyway */
206#undef NR_CPUS
207#define NR_CPUS 1
208int userspace_pid[NR_CPUS];
209
210int start_userspace(unsigned long stub_stack)
211{
212 void *stack;
213 unsigned long sp;
214 int pid, status, n, flags;
215
216 if ( stub_code_fd == -1 )
217 stub_code_fd = phys_mapping(to_phys(&__syscall_stub_start),
218 &stub_code_offset);
219
220 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
221 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
222 if(stack == MAP_FAILED)
223 panic("start_userspace : mmap failed, errno = %d", errno);
224 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
225
226 flags = CLONE_FILES | SIGCHLD;
227 if(proc_mm) flags |= CLONE_VM;
228 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
229 if(pid < 0)
230 panic("start_userspace : clone failed, errno = %d", errno);
231
232 do {
233 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
234 if(n < 0)
235 panic("start_userspace : wait failed, errno = %d",
236 errno);
237 } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM));
238
239 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
240 panic("start_userspace : expected SIGSTOP, got status = %d",
241 status);
242
243 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0)
244 panic("start_userspace : PTRACE_SETOPTIONS failed, errno=%d\n",
245 errno);
246
247 if(munmap(stack, PAGE_SIZE) < 0)
248 panic("start_userspace : munmap failed, errno = %d\n", errno);
249
250 return(pid);
251}
252
253void userspace(union uml_pt_regs *regs)
254{
255 int err, status, op, pid = userspace_pid[0];
256 int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/
257
258 while(1){
259 restore_registers(pid, regs);
260
261 /* Now we set local_using_sysemu to be used for one loop */
262 local_using_sysemu = get_using_sysemu();
263
264 op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));
265
266 err = ptrace(op, pid, 0, 0);
267 if(err)
268 panic("userspace - could not resume userspace process, "
269 "pid=%d, ptrace operation = %d, errno = %d\n",
270 op, errno);
271
272 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
273 if(err < 0)
274 panic("userspace - waitpid failed, errno = %d\n",
275 errno);
276
277 regs->skas.is_user = 1;
278 save_registers(pid, regs);
279 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
280
281 if(WIFSTOPPED(status)){
282 switch(WSTOPSIG(status)){
283 case SIGSEGV:
284 if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo)
285 user_signal(SIGSEGV, regs, pid);
286 else handle_segv(pid, regs);
287 break;
288 case SIGTRAP + 0x80:
289 handle_trap(pid, regs, local_using_sysemu);
290 break;
291 case SIGTRAP:
292 relay_signal(SIGTRAP, regs);
293 break;
294 case SIGIO:
295 case SIGVTALRM:
296 case SIGILL:
297 case SIGBUS:
298 case SIGFPE:
299 case SIGWINCH:
300 user_signal(WSTOPSIG(status), regs, pid);
301 break;
302 default:
303 printk("userspace - child stopped with signal "
304 "%d\n", WSTOPSIG(status));
305 }
306 pid = userspace_pid[0];
307 interrupt_end();
308
309 /* Avoid -ERESTARTSYS handling in host */
310 PT_SYSCALL_NR(regs->skas.regs) = -1;
311 }
312 }
313}
314#define INIT_JMP_NEW_THREAD 0
315#define INIT_JMP_REMOVE_SIGSTACK 1
316#define INIT_JMP_CALLBACK 2
317#define INIT_JMP_HALT 3
318#define INIT_JMP_REBOOT 4
319
320
321int copy_context_skas0(unsigned long new_stack, int pid)
322{
323 int err;
324 unsigned long regs[MAX_REG_NR];
325 unsigned long current_stack = current_stub_stack();
326 struct stub_data *data = (struct stub_data *) current_stack;
327 struct stub_data *child_data = (struct stub_data *) new_stack;
328 __u64 new_offset;
329 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
330
331 /* prepare offset and fd of child's stack as argument for parent's
332 * and child's mmap2 calls
333 */
334 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
335 .fd = new_fd,
336 .timer = ((struct itimerval)
337 { { 0, 1000000 / hz() },
338 { 0, 1000000 / hz() }})});
339 get_safe_registers(regs);
340
341 /* Set parent's instruction pointer to start of clone-stub */
342 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
343 (unsigned long) stub_clone_handler -
344 (unsigned long) &__syscall_stub_start;
345 regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -
346 sizeof(void *);
347 err = ptrace_setregs(pid, regs);
348 if(err < 0)
349 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
350 "pid = %d, errno = %d\n", pid, errno);
351
352 /* set a well known return code for detection of child write failure */
353 child_data->err = 12345678;
354
355 /* Wait, until parent has finished its work: read child's pid from
356 * parent's stack, and check, if bad result.
357 */
358 wait_stub_done(pid, 0, "copy_context_skas0");
359
360 pid = data->err;
361 if(pid < 0)
362 panic("copy_context_skas0 - stub-parent reports error %d\n",
363 pid);
364
365 /* Wait, until child has finished too: read child's result from
366 * child's stack and check it.
367 */
368 wait_stub_done(pid, -1, "copy_context_skas0");
369 if (child_data->err != UML_CONFIG_STUB_DATA)
370 panic("copy_context_skas0 - stub-child reports error %d\n",
371 child_data->err);
372
373 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
374 (void *)PTRACE_O_TRACESYSGOOD) < 0)
375 panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, "
376 "errno = %d\n", errno);
377
378 return pid;
379}
380
381/*
382 * This is used only, if stub pages are needed, while proc_mm is
383 * availabl. Opening /proc/mm creates a new mm_context, which lacks
384 * the stub-pages. Thus, we map them using /proc/mm-fd
385 */
386void map_stub_pages(int fd, unsigned long code,
387 unsigned long data, unsigned long stack)
388{
389 struct proc_mm_op mmop;
390 int n;
391
392 mmop = ((struct proc_mm_op) { .op = MM_MMAP,
393 .u =
394 { .mmap =
395 { .addr = code,
396 .len = PAGE_SIZE,
397 .prot = PROT_EXEC,
398 .flags = MAP_FIXED | MAP_PRIVATE,
399 .fd = stub_code_fd,
400 .offset = stub_code_offset
401 } } });
402 n = os_write_file(fd, &mmop, sizeof(mmop));
403 if(n != sizeof(mmop))
404 panic("map_stub_pages : /proc/mm map for code failed, "
405 "err = %d\n", -n);
406
407 if ( stack ) {
408 __u64 map_offset;
409 int map_fd = phys_mapping(to_phys((void *)stack), &map_offset);
410 mmop = ((struct proc_mm_op)
411 { .op = MM_MMAP,
412 .u =
413 { .mmap =
414 { .addr = data,
415 .len = PAGE_SIZE,
416 .prot = PROT_READ | PROT_WRITE,
417 .flags = MAP_FIXED | MAP_SHARED,
418 .fd = map_fd,
419 .offset = map_offset
420 } } });
421 n = os_write_file(fd, &mmop, sizeof(mmop));
422 if(n != sizeof(mmop))
423 panic("map_stub_pages : /proc/mm map for data failed, "
424 "err = %d\n", -n);
425 }
426}
427
428void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
429 void (*handler)(int))
430{
431 unsigned long flags;
432 sigjmp_buf switch_buf, fork_buf;
433
434 *switch_buf_ptr = &switch_buf;
435 *fork_buf_ptr = &fork_buf;
436
437 /* Somewhat subtle - siglongjmp restores the signal mask before doing
438 * the longjmp. This means that when jumping from one stack to another
439 * when the target stack has interrupts enabled, an interrupt may occur
440 * on the source stack. This is bad when starting up a process because
441 * it's not supposed to get timer ticks until it has been scheduled.
442 * So, we disable interrupts around the sigsetjmp to ensure that
443 * they can't happen until we get back here where they are safe.
444 */
445 flags = get_signals();
446 block_signals();
447 if(sigsetjmp(fork_buf, 1) == 0)
448 new_thread_proc(stack, handler);
449
450 remove_sigstack();
451
452 set_signals(flags);
453}
454
455void thread_wait(void *sw, void *fb)
456{
457 sigjmp_buf buf, **switch_buf = sw, *fork_buf;
458
459 *switch_buf = &buf;
460 fork_buf = fb;
461 if(sigsetjmp(buf, 1) == 0)
462 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
463}
464
465void switch_threads(void *me, void *next)
466{
467 sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;
468
469 *me_ptr = &my_buf;
470 if(sigsetjmp(my_buf, 1) == 0)
471 siglongjmp(*next_buf, 1);
472}
473
474static sigjmp_buf initial_jmpbuf;
475
476/* XXX Make these percpu */
477static void (*cb_proc)(void *arg);
478static void *cb_arg;
479static sigjmp_buf *cb_back;
480
481int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
482{
483 sigjmp_buf **switch_buf = switch_buf_ptr;
484 int n;
485
486 set_handler(SIGWINCH, (__sighandler_t) sig_handler,
487 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
488 SIGVTALRM, -1);
489
490 *fork_buf_ptr = &initial_jmpbuf;
491 n = sigsetjmp(initial_jmpbuf, 1);
492 switch(n){
493 case INIT_JMP_NEW_THREAD:
494 new_thread_proc((void *) stack, new_thread_handler);
495 break;
496 case INIT_JMP_REMOVE_SIGSTACK:
497 remove_sigstack();
498 break;
499 case INIT_JMP_CALLBACK:
500 (*cb_proc)(cb_arg);
501 siglongjmp(*cb_back, 1);
502 break;
503 case INIT_JMP_HALT:
504 kmalloc_ok = 0;
505 return(0);
506 case INIT_JMP_REBOOT:
507 kmalloc_ok = 0;
508 return(1);
509 default:
510 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
511 }
512 siglongjmp(**switch_buf, 1);
513}
514
515void initial_thread_cb_skas(void (*proc)(void *), void *arg)
516{
517 sigjmp_buf here;
518
519 cb_proc = proc;
520 cb_arg = arg;
521 cb_back = &here;
522
523 block_signals();
524 if(sigsetjmp(here, 1) == 0)
525 siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK);
526 unblock_signals();
527
528 cb_proc = NULL;
529 cb_arg = NULL;
530 cb_back = NULL;
531}
532
533void halt_skas(void)
534{
535 block_signals();
536 siglongjmp(initial_jmpbuf, INIT_JMP_HALT);
537}
538
539void reboot_skas(void)
540{
541 block_signals();
542 siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT);
543}
544
545void switch_mm_skas(struct mm_id *mm_idp)
546{
547 int err;
548
549#warning need cpu pid in switch_mm_skas
550 if(proc_mm){
551 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,
552 mm_idp->u.mm_fd);
553 if(err)
554 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, "
555 "errno = %d\n", errno);
556 }
557 else userspace_pid[0] = mm_idp->u.pid;
558}
559
560/*
561 * Overrides for Emacs so that we follow Linus's tabbing style.
562 * Emacs will notice this stuff at the end of the file and automatically
563 * adjust the settings for this buffer only. This must remain at the end
564 * of the file.
565 * ---------------------------------------------------------------------------
566 * Local variables:
567 * c-file-style: "linux"
568 * End:
569 */
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index e2d3ca445ef5..27cdf9164422 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -193,6 +193,24 @@ __uml_setup("root=", uml_root_setup,
193" root=/dev/ubd5\n\n" 193" root=/dev/ubd5\n\n"
194); 194);
195 195
196#ifndef CONFIG_MODE_TT
197
198static int __init no_skas_debug_setup(char *line, int *add)
199{
200 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
201 printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n");
202 printf("doesn't work as expected\n");
203
204 return 0;
205}
206
207__uml_setup("debug", no_skas_debug_setup,
208"debug\n"
209" this flag is not needed to run gdb on UML in skas mode\n\n"
210);
211
212#endif
213
196#ifdef CONFIG_SMP 214#ifdef CONFIG_SMP
197static int __init uml_ncpus_setup(char *line, int *add) 215static int __init uml_ncpus_setup(char *line, int *add)
198{ 216{
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 52945338b64d..87c3aa0252db 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
122 return(-EINVAL); 122 return(-EINVAL);
123 } 123 }
124 *fd_out = ((int *) CMSG_DATA(cmsg))[0]; 124 *fd_out = ((int *) CMSG_DATA(cmsg))[0];
125 os_set_exec_close(*fd_out, 1);
125 return(0); 126 return(0);
126} 127}
127 128
@@ -137,7 +138,8 @@ static int tuntap_open(void *data)
137 return(err); 138 return(err);
138 139
139 if(pri->fixed_config){ 140 if(pri->fixed_config){
140 pri->fd = os_open_file("/dev/net/tun", of_rdwr(OPENFLAGS()), 0); 141 pri->fd = os_open_file("/dev/net/tun",
142 of_cloexec(of_rdwr(OPENFLAGS())), 0);
141 if(pri->fd < 0){ 143 if(pri->fd < 0){
142 printk("Failed to open /dev/net/tun, err = %d\n", 144 printk("Failed to open /dev/net/tun, err = %d\n",
143 -pri->fd); 145 -pri->fd);
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 9890e9090f58..fbb080c2fc26 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -60,7 +60,7 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
60 60
61 multi_count++; 61 multi_count++;
62 62
63 get_safe_registers(regs); 63 get_safe_registers(regs, NULL);
64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
65 ((unsigned long) &batch_syscall_stub - 65 ((unsigned long) &batch_syscall_stub -
66 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 120a21c5883f..bbf34cb91ce1 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -310,16 +310,12 @@ void userspace(union uml_pt_regs *regs)
310 } 310 }
311 } 311 }
312} 312}
313#define INIT_JMP_NEW_THREAD 0
314#define INIT_JMP_REMOVE_SIGSTACK 1
315#define INIT_JMP_CALLBACK 2
316#define INIT_JMP_HALT 3
317#define INIT_JMP_REBOOT 4
318 313
319int copy_context_skas0(unsigned long new_stack, int pid) 314int copy_context_skas0(unsigned long new_stack, int pid)
320{ 315{
321 int err; 316 int err;
322 unsigned long regs[MAX_REG_NR]; 317 unsigned long regs[HOST_FRAME_SIZE];
318 unsigned long fp_regs[HOST_FP_SIZE];
323 unsigned long current_stack = current_stub_stack(); 319 unsigned long current_stack = current_stub_stack();
324 struct stub_data *data = (struct stub_data *) current_stack; 320 struct stub_data *data = (struct stub_data *) current_stack;
325 struct stub_data *child_data = (struct stub_data *) new_stack; 321 struct stub_data *child_data = (struct stub_data *) new_stack;
@@ -334,7 +330,7 @@ int copy_context_skas0(unsigned long new_stack, int pid)
334 .timer = ((struct itimerval) 330 .timer = ((struct itimerval)
335 { { 0, 1000000 / hz() }, 331 { { 0, 1000000 / hz() },
336 { 0, 1000000 / hz() }})}); 332 { 0, 1000000 / hz() }})});
337 get_safe_registers(regs); 333 get_safe_registers(regs, fp_regs);
338 334
339 /* Set parent's instruction pointer to start of clone-stub */ 335 /* Set parent's instruction pointer to start of clone-stub */
340 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 336 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
@@ -350,6 +346,11 @@ int copy_context_skas0(unsigned long new_stack, int pid)
350 panic("copy_context_skas0 : PTRACE_SETREGS failed, " 346 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
351 "pid = %d, errno = %d\n", pid, errno); 347 "pid = %d, errno = %d\n", pid, errno);
352 348
349 err = ptrace_setfpregs(pid, fp_regs);
350 if(err < 0)
351 panic("copy_context_skas0 : PTRACE_SETFPREGS failed, "
352 "pid = %d, errno = %d\n", pid, errno);
353
353 /* set a well known return code for detection of child write failure */ 354 /* set a well known return code for detection of child write failure */
354 child_data->err = 12345678; 355 child_data->err = 12345678;
355 356
@@ -457,6 +458,12 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
457 set_signals(flags); 458 set_signals(flags);
458} 459}
459 460
461#define INIT_JMP_NEW_THREAD 0
462#define INIT_JMP_REMOVE_SIGSTACK 1
463#define INIT_JMP_CALLBACK 2
464#define INIT_JMP_HALT 3
465#define INIT_JMP_REBOOT 4
466
460void thread_wait(void *sw, void *fb) 467void thread_wait(void *sw, void *fb)
461{ 468{
462 sigjmp_buf buf, **switch_buf = sw, *fork_buf; 469 sigjmp_buf buf, **switch_buf = sw, *fork_buf;
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 6c5b17ed59e1..829d6b0d8b02 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -49,6 +49,7 @@ static int ptrace_child(void *arg)
49 int pid = os_getpid(), ppid = getppid(); 49 int pid = os_getpid(), ppid = getppid();
50 int sc_result; 50 int sc_result;
51 51
52 change_sig(SIGWINCH, 0);
52 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ 53 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){
53 perror("ptrace"); 54 perror("ptrace");
54 os_kill_process(pid, 0); 55 os_kill_process(pid, 0);
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index aee4812333c6..7a6f6b99ceff 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -122,9 +122,12 @@ void init_registers(int pid)
122 err); 122 err);
123} 123}
124 124
125void get_safe_registers(unsigned long *regs) 125void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
126{ 126{
127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
128 if(fp_regs != NULL)
129 memcpy(fp_regs, exec_fp_regs,
130 HOST_FP_SIZE * sizeof(unsigned long));
128} 131}
129 132
130void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) 133void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 4b638dfb52b0..001941fa1a1e 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -70,9 +70,12 @@ void init_registers(int pid)
70 err); 70 err);
71} 71}
72 72
73void get_safe_registers(unsigned long *regs) 73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
74{ 74{
75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
76 if(fp_regs != NULL)
77 memcpy(fp_regs, exec_fp_regs,
78 HOST_FP_SIZE * sizeof(unsigned long));
76} 79}
77 80
78void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) 81void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
diff --git a/arch/um/sys-x86_64/ptrace_user.c b/arch/um/sys-x86_64/ptrace_user.c
index 12e404c6fa46..b5f9c33e311e 100644
--- a/arch/um/sys-x86_64/ptrace_user.c
+++ b/arch/um/sys-x86_64/ptrace_user.c
@@ -24,6 +24,13 @@ int ptrace_setregs(long pid, unsigned long *regs)
24 return(0); 24 return(0);
25} 25}
26 26
27int ptrace_setfpregs(long pid, unsigned long *regs)
28{
29 if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0)
30 return -errno;
31 return 0;
32}
33
27void ptrace_pokeuser(unsigned long addr, unsigned long data) 34void ptrace_pokeuser(unsigned long addr, unsigned long data)
28{ 35{
29 panic("ptrace_pokeuser"); 36 panic("ptrace_pokeuser");
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 5a585bfbb8c2..7bd54a921cf7 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -57,7 +57,7 @@ void foo(void)
57#endif 57#endif
58 58
59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); 59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE);
60 DEFINE(HOST_FP_SIZE, 0); 60 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
61 DEFINE(HOST_XFP_SIZE, 0); 61 DEFINE(HOST_XFP_SIZE, 0);
62 DEFINE_LONGS(HOST_RBX, RBX); 62 DEFINE_LONGS(HOST_RBX, RBX);
63 DEFINE_LONGS(HOST_RCX, RCX); 63 DEFINE_LONGS(HOST_RCX, RCX);
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 067c0f47bd0d..ada4535d0161 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -685,6 +685,9 @@ ia32_sys_call_table:
685 .quad sys_readlinkat /* 305 */ 685 .quad sys_readlinkat /* 305 */
686 .quad sys_fchmodat 686 .quad sys_fchmodat
687 .quad sys_faccessat 687 .quad sys_faccessat
688 .quad sys_ni_syscall /* pselect6 for now */
689 .quad sys_ni_syscall /* ppoll for now */
690 .quad sys_unshare /* 310 */
688ia32_syscall_end: 691ia32_syscall_end:
689 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 692 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
690 .quad ni_syscall 693 .quad ni_syscall
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 363db5a003df..9435ab7d6fb8 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -94,7 +94,6 @@ unsigned long saved_video_mode;
94/* 94/*
95 * Setup options 95 * Setup options
96 */ 96 */
97struct drive_info_struct { char dummy[32]; } drive_info;
98struct screen_info screen_info; 97struct screen_info screen_info;
99struct sys_desc_table_struct { 98struct sys_desc_table_struct {
100 unsigned short length; 99 unsigned short length;
@@ -572,7 +571,6 @@ void __init setup_arch(char **cmdline_p)
572 unsigned long kernel_end; 571 unsigned long kernel_end;
573 572
574 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 573 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
575 drive_info = DRIVE_INFO;
576 screen_info = SCREEN_INFO; 574 screen_info = SCREEN_INFO;
577 edid_info = EDID_INFO; 575 edid_info = EDID_INFO;
578 saved_video_mode = SAVED_VIDEO_MODE; 576 saved_video_mode = SAVED_VIDEO_MODE;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index a28756ef7cef..67e4e28f4df8 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -59,6 +59,7 @@
59#include <asm/nmi.h> 59#include <asm/nmi.h>
60#include <asm/irq.h> 60#include <asm/irq.h>
61#include <asm/hw_irq.h> 61#include <asm/hw_irq.h>
62#include <asm/numa.h>
62 63
63/* Number of siblings per CPU package */ 64/* Number of siblings per CPU package */
64int smp_num_siblings = 1; 65int smp_num_siblings = 1;
@@ -890,6 +891,7 @@ do_rest:
890 if (boot_error) { 891 if (boot_error) {
891 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */ 892 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */
892 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 893 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
894 clear_node_cpumask(cpu); /* was set by numa_add_cpu */
893 cpu_clear(cpu, cpu_present_map); 895 cpu_clear(cpu, cpu_present_map);
894 cpu_clear(cpu, cpu_possible_map); 896 cpu_clear(cpu, cpu_possible_map);
895 x86_cpu_to_apicid[cpu] = BAD_APICID; 897 x86_cpu_to_apicid[cpu] = BAD_APICID;
@@ -1187,6 +1189,7 @@ void remove_cpu_from_maps(void)
1187 cpu_clear(cpu, cpu_callout_map); 1189 cpu_clear(cpu, cpu_callout_map);
1188 cpu_clear(cpu, cpu_callin_map); 1190 cpu_clear(cpu, cpu_callin_map);
1189 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 1191 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
1192 clear_node_cpumask(cpu);
1190} 1193}
1191 1194
1192int __cpu_disable(void) 1195int __cpu_disable(void)
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index c0844bffbf84..dba7237be5c1 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -748,7 +748,7 @@ static __init int late_hpet_init(void)
748 * Timer0 and Timer1 is used by platform. 748 * Timer0 and Timer1 is used by platform.
749 */ 749 */
750 hd.hd_phys_address = vxtime.hpet_address; 750 hd.hd_phys_address = vxtime.hpet_address;
751 hd.hd_address = (void *)fix_to_virt(FIX_HPET_BASE); 751 hd.hd_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);
752 hd.hd_nirqs = ntimer; 752 hd.hd_nirqs = ntimer;
753 hd.hd_flags = HPET_DATA_PLATFORM; 753 hd.hd_flags = HPET_DATA_PLATFORM;
754 hpet_reserve_timer(&hd, 0); 754 hpet_reserve_timer(&hd, 0);
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index b614d54d2ae4..3496abc8d372 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -39,11 +39,6 @@ extern void __write_lock_failed(rwlock_t *rw);
39extern void __read_lock_failed(rwlock_t *rw); 39extern void __read_lock_failed(rwlock_t *rw);
40#endif 40#endif
41 41
42#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
43extern struct drive_info_struct drive_info;
44EXPORT_SYMBOL(drive_info);
45#endif
46
47/* platform dependent support */ 42/* platform dependent support */
48EXPORT_SYMBOL(boot_cpu_data); 43EXPORT_SYMBOL(boot_cpu_data);
49//EXPORT_SYMBOL(dump_fpu); 44//EXPORT_SYMBOL(dump_fpu);
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index b4a3fe4ec249..18f371fe37f8 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -49,7 +49,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
49 return pci_mmcfg_virt[0].virt; 49 return pci_mmcfg_virt[0].virt;
50 50
51 /* Fall back to type 0 */ 51 /* Fall back to type 0 */
52 return 0; 52 return NULL;
53} 53}
54 54
55static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 55static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
diff --git a/block/elevator.c b/block/elevator.c
index 2fc269f69726..24b702d649a9 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -293,7 +293,7 @@ void elv_requeue_request(request_queue_t *q, struct request *rq)
293 293
294 rq->flags &= ~REQ_STARTED; 294 rq->flags &= ~REQ_STARTED;
295 295
296 __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE, 0); 296 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);
297} 297}
298 298
299static void elv_drain_elevator(request_queue_t *q) 299static void elv_drain_elevator(request_queue_t *q)
@@ -310,41 +310,11 @@ static void elv_drain_elevator(request_queue_t *q)
310 } 310 }
311} 311}
312 312
313void __elv_add_request(request_queue_t *q, struct request *rq, int where, 313void elv_insert(request_queue_t *q, struct request *rq, int where)
314 int plug)
315{ 314{
316 struct list_head *pos; 315 struct list_head *pos;
317 unsigned ordseq; 316 unsigned ordseq;
318 317
319 if (q->ordcolor)
320 rq->flags |= REQ_ORDERED_COLOR;
321
322 if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
323 /*
324 * toggle ordered color
325 */
326 if (blk_barrier_rq(rq))
327 q->ordcolor ^= 1;
328
329 /*
330 * barriers implicitly indicate back insertion
331 */
332 if (where == ELEVATOR_INSERT_SORT)
333 where = ELEVATOR_INSERT_BACK;
334
335 /*
336 * this request is scheduling boundary, update end_sector
337 */
338 if (blk_fs_request(rq)) {
339 q->end_sector = rq_end_sector(rq);
340 q->boundary_rq = rq;
341 }
342 } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
343 where = ELEVATOR_INSERT_BACK;
344
345 if (plug)
346 blk_plug_device(q);
347
348 rq->q = q; 318 rq->q = q;
349 319
350 switch (where) { 320 switch (where) {
@@ -425,6 +395,42 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
425 } 395 }
426} 396}
427 397
398void __elv_add_request(request_queue_t *q, struct request *rq, int where,
399 int plug)
400{
401 if (q->ordcolor)
402 rq->flags |= REQ_ORDERED_COLOR;
403
404 if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
405 /*
406 * toggle ordered color
407 */
408 if (blk_barrier_rq(rq))
409 q->ordcolor ^= 1;
410
411 /*
412 * barriers implicitly indicate back insertion
413 */
414 if (where == ELEVATOR_INSERT_SORT)
415 where = ELEVATOR_INSERT_BACK;
416
417 /*
418 * this request is scheduling boundary, update
419 * end_sector
420 */
421 if (blk_fs_request(rq)) {
422 q->end_sector = rq_end_sector(rq);
423 q->boundary_rq = rq;
424 }
425 } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
426 where = ELEVATOR_INSERT_BACK;
427
428 if (plug)
429 blk_plug_device(q);
430
431 elv_insert(q, rq, where);
432}
433
428void elv_add_request(request_queue_t *q, struct request *rq, int where, 434void elv_add_request(request_queue_t *q, struct request *rq, int where,
429 int plug) 435 int plug)
430{ 436{
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index ee5ed98db4cd..03d9c82b0fe7 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -454,7 +454,7 @@ static void queue_flush(request_queue_t *q, unsigned which)
454 rq->end_io = end_io; 454 rq->end_io = end_io;
455 q->prepare_flush_fn(q, rq); 455 q->prepare_flush_fn(q, rq);
456 456
457 __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 457 elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
458} 458}
459 459
460static inline struct request *start_ordered(request_queue_t *q, 460static inline struct request *start_ordered(request_queue_t *q,
@@ -490,7 +490,7 @@ static inline struct request *start_ordered(request_queue_t *q,
490 else 490 else
491 q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH; 491 q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH;
492 492
493 __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 493 elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
494 494
495 if (q->ordered & QUEUE_ORDERED_PREFLUSH) { 495 if (q->ordered & QUEUE_ORDERED_PREFLUSH) {
496 queue_flush(q, QUEUE_ORDERED_PREFLUSH); 496 queue_flush(q, QUEUE_ORDERED_PREFLUSH);
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index cc72210687eb..24f7af9d0abc 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -310,6 +310,8 @@ static int sg_io(struct file *file, request_queue_t *q,
310 if (!rq->timeout) 310 if (!rq->timeout)
311 rq->timeout = BLK_DEFAULT_TIMEOUT; 311 rq->timeout = BLK_DEFAULT_TIMEOUT;
312 312
313 rq->retries = 0;
314
313 start_time = jiffies; 315 start_time = jiffies;
314 316
315 /* ignore return value. All information is passed back to caller 317 /* ignore return value. All information is passed back to caller
@@ -427,6 +429,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
427 rq->data = buffer; 429 rq->data = buffer;
428 rq->data_len = bytes; 430 rq->data_len = bytes;
429 rq->flags |= REQ_BLOCK_PC; 431 rq->flags |= REQ_BLOCK_PC;
432 rq->retries = 0;
430 433
431 blk_execute_rq(q, bd_disk, rq, 0); 434 blk_execute_rq(q, bd_disk, rq, 0);
432 err = rq->errors & 0xff; /* only 8 bit SCSI status */ 435 err = rq->errors & 0xff; /* only 8 bit SCSI status */
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 47ac90e615f4..2953e2cc56f0 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -17,7 +17,6 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/highmem.h> 19#include <linux/highmem.h>
20#include <asm/bug.h>
21#include <asm/scatterlist.h> 20#include <asm/scatterlist.h>
22#include "internal.h" 21#include "internal.h"
23#include "scatterwalk.h" 22#include "scatterwalk.h"
diff --git a/drivers/base/base.h b/drivers/base/base.h
index e3b548d46cff..5735b38582d0 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,6 +19,10 @@ extern void bus_remove_driver(struct device_driver *);
19extern void driver_detach(struct device_driver * drv); 19extern void driver_detach(struct device_driver * drv);
20extern int driver_probe_device(struct device_driver *, struct device *); 20extern int driver_probe_device(struct device_driver *, struct device *);
21 21
22extern void sysdev_shutdown(void);
23extern int sysdev_suspend(pm_message_t state);
24extern int sysdev_resume(void);
25
22static inline struct class_device *to_class_dev(struct kobject *obj) 26static inline struct class_device *to_class_dev(struct kobject *obj)
23{ 27{
24 return container_of(obj, struct class_device, kobj); 28 return container_of(obj, struct class_device, kobj);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 29f6af554e71..c3141565d59d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,6 +133,8 @@ static struct kobj_type ktype_bus = {
133decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
134 134
135 135
136#ifdef CONFIG_HOTPLUG
137
136/* Manually detach a device from its associated driver. */ 138/* Manually detach a device from its associated driver. */
137static int driver_helper(struct device *dev, void *data) 139static int driver_helper(struct device *dev, void *data)
138{ 140{
@@ -193,6 +195,7 @@ static ssize_t driver_bind(struct device_driver *drv,
193} 195}
194static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 196static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
195 197
198#endif
196 199
197static struct device * next_device(struct klist_iter * i) 200static struct device * next_device(struct klist_iter * i)
198{ 201{
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index d1a05224627e..105a0d61eb1f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -303,7 +303,7 @@ static int block_size_init(void)
303 */ 303 */
304#ifdef CONFIG_ARCH_MEMORY_PROBE 304#ifdef CONFIG_ARCH_MEMORY_PROBE
305static ssize_t 305static ssize_t
306memory_probe_store(struct class *class, const char __user *buf, size_t count) 306memory_probe_store(struct class *class, const char *buf, size_t count)
307{ 307{
308 u64 phys_addr; 308 u64 phys_addr;
309 int ret; 309 int ret;
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index 0a7aa07b9a2a..317edbf0feca 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_resume(void);
15
16 15
17/** 16/**
18 * resume_device - Restore state for one device. 17 * resume_device - Restore state for one device.
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index c2475f3134ea..8826a5b6673e 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -12,6 +12,7 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <asm/semaphore.h> 13#include <asm/semaphore.h>
14 14
15#include "../base.h"
15#include "power.h" 16#include "power.h"
16 17
17#define to_dev(node) container_of(node, struct device, kobj.entry) 18#define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@ extern struct subsystem devices_subsys;
28 * they only get one called once when interrupts are disabled. 29 * they only get one called once when interrupts are disabled.
29 */ 30 */
30 31
31extern int sysdev_shutdown(void);
32 32
33/** 33/**
34 * device_shutdown - call ->shutdown() on each device to shutdown. 34 * device_shutdown - call ->shutdown() on each device to shutdown.
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 50501764d050..8660779fb288 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_suspend(pm_message_t state);
15
16/* 15/*
17 * The entries in the dpm_active list are in a depth first order, simply 16 * The entries in the dpm_active list are in a depth first order, simply
18 * because children are guaranteed to be discovered after parents, and 17 * because children are guaranteed to be discovered after parents, and
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index f3a0c562bcb5..40d7242a07c1 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -27,22 +27,30 @@
27 27
28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) 28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
29{ 29{
30 return sprintf(buf, "%u\n", dev->power.power_state.event); 30 if (dev->power.power_state.event)
31 return sprintf(buf, "2\n");
32 else
33 return sprintf(buf, "0\n");
31} 34}
32 35
33static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) 36static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
34{ 37{
35 pm_message_t state; 38 pm_message_t state;
36 char * rest; 39 int error = -EINVAL;
37 int error = 0;
38 40
39 state.event = simple_strtoul(buf, &rest, 10); 41 state.event = PM_EVENT_SUSPEND;
40 if (*rest) 42 /* Older apps expected to write "3" here - confused with PCI D3 */
41 return -EINVAL; 43 if ((n == 1) && !strcmp(buf, "3"))
42 if (state.event)
43 error = dpm_runtime_suspend(dev, state); 44 error = dpm_runtime_suspend(dev, state);
44 else 45
46 if ((n == 1) && !strcmp(buf, "2"))
47 error = dpm_runtime_suspend(dev, state);
48
49 if ((n == 1) && !strcmp(buf, "0")) {
45 dpm_runtime_resume(dev); 50 dpm_runtime_resume(dev);
51 error = 0;
52 }
53
46 return error ? error : n; 54 return error ? error : n;
47} 55}
48 56
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 66ed8f2fece5..6fc23ab127bd 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -21,8 +21,11 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/device.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
25 26
27#include "base.h"
28
26extern struct subsystem devices_subsys; 29extern struct subsystem devices_subsys;
27 30
28#define to_sysdev(k) container_of(k, struct sys_device, kobj) 31#define to_sysdev(k) container_of(k, struct sys_device, kobj)
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 193446e6a08a..e27617259552 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -42,8 +42,6 @@
42#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44 44
45#include <asm/bug.h>
46
47#include <asm/vio.h> 45#include <asm/vio.h>
48#include <asm/scatterlist.h> 46#include <asm/scatterlist.h>
49#include <asm/iseries/hv_types.h> 47#include <asm/iseries/hv_types.h>
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 4c67727d75b1..05ba410682a3 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -222,7 +222,7 @@ config SYNCLINKMP
222 222
223config SYNCLINK_GT 223config SYNCLINK_GT
224 tristate "SyncLink GT/AC support" 224 tristate "SyncLink GT/AC support"
225 depends on SERIAL_NONSTANDARD 225 depends on SERIAL_NONSTANDARD && PCI
226 help 226 help
227 Support for SyncLink GT and SyncLink AC families of 227 Support for SyncLink GT and SyncLink AC families of
228 synchronous and asynchronous serial adapters 228 synchronous and asynchronous serial adapters
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 71b8b32b075f..107df9fdba4e 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -980,7 +980,7 @@ extern int drm_put_head(drm_head_t * head);
980extern unsigned int drm_debug; 980extern unsigned int drm_debug;
981extern unsigned int drm_cards_limit; 981extern unsigned int drm_cards_limit;
982extern drm_head_t **drm_heads; 982extern drm_head_t **drm_heads;
983extern struct drm_sysfs_class *drm_class; 983extern struct class *drm_class;
984extern struct proc_dir_entry *drm_proc_root; 984extern struct proc_dir_entry *drm_proc_root;
985 985
986 /* Proc support (drm_proc.h) */ 986 /* Proc support (drm_proc.h) */
@@ -1011,11 +1011,9 @@ extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
1011extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); 1011extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
1012 1012
1013 /* sysfs support (drm_sysfs.c) */ 1013 /* sysfs support (drm_sysfs.c) */
1014struct drm_sysfs_class; 1014extern struct class *drm_sysfs_create(struct module *owner, char *name);
1015extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, 1015extern void drm_sysfs_destroy(struct class *cs);
1016 char *name); 1016extern struct class_device *drm_sysfs_device_add(struct class *cs,
1017extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);
1018extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
1019 drm_head_t *head); 1017 drm_head_t *head);
1020extern void drm_sysfs_device_remove(struct class_device *class_dev); 1018extern void drm_sysfs_device_remove(struct class_device *class_dev);
1021 1019
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 7a9263ff3007..68073e14fdec 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -50,7 +50,7 @@ module_param_named(cards_limit, drm_cards_limit, int, 0444);
50module_param_named(debug, drm_debug, int, 0600); 50module_param_named(debug, drm_debug, int, 0600);
51 51
52drm_head_t **drm_heads; 52drm_head_t **drm_heads;
53struct drm_sysfs_class *drm_class; 53struct class *drm_class;
54struct proc_dir_entry *drm_proc_root; 54struct proc_dir_entry *drm_proc_root;
55 55
56static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, 56static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index 68e43ddc16ae..0b9f98a7eb10 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support 3 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support
3 * extra sysfs attribute from DRM. Normal drm_sysfs_class 4 * extra sysfs attribute from DRM. Normal drm_sysfs_class
@@ -19,36 +20,6 @@
19#include "drm_core.h" 20#include "drm_core.h"
20#include "drmP.h" 21#include "drmP.h"
21 22
22struct drm_sysfs_class {
23 struct class_device_attribute attr;
24 struct class class;
25};
26#define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class)
27
28struct simple_dev {
29 dev_t dev;
30 struct class_device class_dev;
31};
32#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
33
34static void release_simple_dev(struct class_device *class_dev)
35{
36 struct simple_dev *s_dev = to_simple_dev(class_dev);
37 kfree(s_dev);
38}
39
40static ssize_t show_dev(struct class_device *class_dev, char *buf)
41{
42 struct simple_dev *s_dev = to_simple_dev(class_dev);
43 return print_dev_t(buf, s_dev->dev);
44}
45
46static void drm_sysfs_class_release(struct class *class)
47{
48 struct drm_sysfs_class *cs = to_drm_sysfs_class(class);
49 kfree(cs);
50}
51
52/* Display the version of drm_core. This doesn't work right in current design */ 23/* Display the version of drm_core. This doesn't work right in current design */
53static ssize_t version_show(struct class *dev, char *buf) 24static ssize_t version_show(struct class *dev, char *buf)
54{ 25{
@@ -69,38 +40,16 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
69 * Note, the pointer created here is to be destroyed when finished by making a 40 * Note, the pointer created here is to be destroyed when finished by making a
70 * call to drm_sysfs_destroy(). 41 * call to drm_sysfs_destroy().
71 */ 42 */
72struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) 43struct class *drm_sysfs_create(struct module *owner, char *name)
73{ 44{
74 struct drm_sysfs_class *cs; 45 struct class *class;
75 int retval; 46
76 47 class = class_create(owner, name);
77 cs = kmalloc(sizeof(*cs), GFP_KERNEL); 48 if (!class)
78 if (!cs) { 49 return class;
79 retval = -ENOMEM; 50
80 goto error; 51 class_create_file(class, &class_attr_version);
81 } 52 return class;
82 memset(cs, 0x00, sizeof(*cs));
83
84 cs->class.name = name;
85 cs->class.class_release = drm_sysfs_class_release;
86 cs->class.release = release_simple_dev;
87
88 cs->attr.attr.name = "dev";
89 cs->attr.attr.mode = S_IRUGO;
90 cs->attr.attr.owner = owner;
91 cs->attr.show = show_dev;
92 cs->attr.store = NULL;
93
94 retval = class_register(&cs->class);
95 if (retval)
96 goto error;
97 class_create_file(&cs->class, &class_attr_version);
98
99 return cs;
100
101 error:
102 kfree(cs);
103 return ERR_PTR(retval);
104} 53}
105 54
106/** 55/**
@@ -110,12 +59,13 @@ struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name)
110 * Note, the pointer to be destroyed must have been created with a call to 59 * Note, the pointer to be destroyed must have been created with a call to
111 * drm_sysfs_create(). 60 * drm_sysfs_create().
112 */ 61 */
113void drm_sysfs_destroy(struct drm_sysfs_class *cs) 62void drm_sysfs_destroy(struct class *class)
114{ 63{
115 if ((cs == NULL) || (IS_ERR(cs))) 64 if ((class == NULL) || (IS_ERR(class)))
116 return; 65 return;
117 66
118 class_unregister(&cs->class); 67 class_remove_file(class, &class_attr_version);
68 class_destroy(class);
119} 69}
120 70
121static ssize_t show_dri(struct class_device *class_device, char *buf) 71static ssize_t show_dri(struct class_device *class_device, char *buf)
@@ -132,7 +82,7 @@ static struct class_device_attribute class_device_attrs[] = {
132 82
133/** 83/**
134 * drm_sysfs_device_add - adds a class device to sysfs for a character driver 84 * drm_sysfs_device_add - adds a class device to sysfs for a character driver
135 * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. 85 * @cs: pointer to the struct class that this device should be registered to.
136 * @dev: the dev_t for the device to be added. 86 * @dev: the dev_t for the device to be added.
137 * @device: a pointer to a struct device that is assiociated with this class device. 87 * @device: a pointer to a struct device that is assiociated with this class device.
138 * @fmt: string for the class device's name 88 * @fmt: string for the class device's name
@@ -141,46 +91,26 @@ static struct class_device_attribute class_device_attrs[] = {
141 * class. A "dev" file will be created, showing the dev_t for the device. The 91 * class. A "dev" file will be created, showing the dev_t for the device. The
142 * pointer to the struct class_device will be returned from the call. Any further 92 * pointer to the struct class_device will be returned from the call. Any further
143 * sysfs files that might be required can be created using this pointer. 93 * sysfs files that might be required can be created using this pointer.
144 * Note: the struct drm_sysfs_class passed to this function must have previously been 94 * Note: the struct class passed to this function must have previously been
145 * created with a call to drm_sysfs_create(). 95 * created with a call to drm_sysfs_create().
146 */ 96 */
147struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, 97struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)
148 drm_head_t *head)
149{ 98{
150 struct simple_dev *s_dev = NULL; 99 struct class_device *class_dev;
151 int i, retval; 100 int i;
152
153 if ((cs == NULL) || (IS_ERR(cs))) {
154 retval = -ENODEV;
155 goto error;
156 }
157
158 s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL);
159 if (!s_dev) {
160 retval = -ENOMEM;
161 goto error;
162 }
163 memset(s_dev, 0x00, sizeof(*s_dev));
164
165 s_dev->dev = MKDEV(DRM_MAJOR, head->minor);
166 s_dev->class_dev.dev = &(head->dev->pdev)->dev;
167 s_dev->class_dev.class = &cs->class;
168 101
169 snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); 102 class_dev = class_device_create(cs, NULL,
170 retval = class_device_register(&s_dev->class_dev); 103 MKDEV(DRM_MAJOR, head->minor),
171 if (retval) 104 &(head->dev->pdev)->dev,
172 goto error; 105 "card%d", head->minor);
106 if (!class_dev)
107 return NULL;
173 108
174 class_device_create_file(&s_dev->class_dev, &cs->attr); 109 class_set_devdata(class_dev, head);
175 class_set_devdata(&s_dev->class_dev, head);
176 110
177 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 111 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
178 class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); 112 class_device_create_file(class_dev, &class_device_attrs[i]);
179 return &s_dev->class_dev; 113 return class_dev;
180
181error:
182 kfree(s_dev);
183 return ERR_PTR(retval);
184} 114}
185 115
186/** 116/**
@@ -192,10 +122,9 @@ error:
192 */ 122 */
193void drm_sysfs_device_remove(struct class_device *class_dev) 123void drm_sysfs_device_remove(struct class_device *class_dev)
194{ 124{
195 struct simple_dev *s_dev = to_simple_dev(class_dev);
196 int i; 125 int i;
197 126
198 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 127 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
199 class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); 128 class_device_remove_file(class_dev, &class_device_attrs[i]);
200 class_device_unregister(&s_dev->class_dev); 129 class_device_unregister(class_dev);
201} 130}
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index 80a5b840e22f..fee68cc895f8 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -103,6 +103,7 @@
103 103
104#include <linux/serial.h> 104#include <linux/serial.h>
105#include <linux/generic_serial.h> 105#include <linux/generic_serial.h>
106#include <linux/tty_flip.h>
106 107
107#include "ser_a2232.h" 108#include "ser_a2232.h"
108#include "ser_a2232fw.h" 109#include "ser_a2232fw.h"
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c
index 7a4dfb95d087..837b1ec3ffe3 100644
--- a/drivers/char/watchdog/sbc_epx_c3.c
+++ b/drivers/char/watchdog/sbc_epx_c3.c
@@ -92,7 +92,7 @@ static int epx_c3_release(struct inode *inode, struct file *file)
92 return 0; 92 return 0;
93} 93}
94 94
95static ssize_t epx_c3_write(struct file *file, const char *data, 95static ssize_t epx_c3_write(struct file *file, const char __user *data,
96 size_t len, loff_t *ppos) 96 size_t len, loff_t *ppos)
97{ 97{
98 /* Refresh the timer. */ 98 /* Refresh the timer. */
@@ -105,6 +105,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
105 unsigned int cmd, unsigned long arg) 105 unsigned int cmd, unsigned long arg)
106{ 106{
107 int options, retval = -EINVAL; 107 int options, retval = -EINVAL;
108 int __user *argp = (void __user *)arg;
108 static struct watchdog_info ident = { 109 static struct watchdog_info ident = {
109 .options = WDIOF_KEEPALIVEPING | 110 .options = WDIOF_KEEPALIVEPING |
110 WDIOF_MAGICCLOSE, 111 WDIOF_MAGICCLOSE,
@@ -114,20 +115,19 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
114 115
115 switch (cmd) { 116 switch (cmd) {
116 case WDIOC_GETSUPPORT: 117 case WDIOC_GETSUPPORT:
117 if (copy_to_user((struct watchdog_info *)arg, 118 if (copy_to_user(argp, &ident, sizeof(ident)))
118 &ident, sizeof(ident)))
119 return -EFAULT; 119 return -EFAULT;
120 return 0; 120 return 0;
121 case WDIOC_GETSTATUS: 121 case WDIOC_GETSTATUS:
122 case WDIOC_GETBOOTSTATUS: 122 case WDIOC_GETBOOTSTATUS:
123 return put_user(0,(int *)arg); 123 return put_user(0, argp);
124 case WDIOC_KEEPALIVE: 124 case WDIOC_KEEPALIVE:
125 epx_c3_pet(); 125 epx_c3_pet();
126 return 0; 126 return 0;
127 case WDIOC_GETTIMEOUT: 127 case WDIOC_GETTIMEOUT:
128 return put_user(WATCHDOG_TIMEOUT,(int *)arg); 128 return put_user(WATCHDOG_TIMEOUT, argp);
129 case WDIOC_SETOPTIONS: { 129 case WDIOC_SETOPTIONS:
130 if (get_user(options, (int *)arg)) 130 if (get_user(options, argp))
131 return -EFAULT; 131 return -EFAULT;
132 132
133 if (options & WDIOS_DISABLECARD) { 133 if (options & WDIOS_DISABLECARD) {
@@ -141,7 +141,6 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
141 } 141 }
142 142
143 return retval; 143 return retval;
144 }
145 default: 144 default:
146 return -ENOIOCTLCMD; 145 return -ENOIOCTLCMD;
147 } 146 }
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 009c08fe5d69..1991f94af753 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -159,7 +159,7 @@ enum i82875p_chips {
159 159
160struct i82875p_pvt { 160struct i82875p_pvt {
161 struct pci_dev *ovrfl_pdev; 161 struct pci_dev *ovrfl_pdev;
162 void *ovrfl_window; 162 void __iomem *ovrfl_window;
163}; 163};
164 164
165 165
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index c58295914365..7230d4e08196 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -113,6 +113,16 @@ config SENSORS_DS1621
113 This driver can also be built as a module. If so, the module 113 This driver can also be built as a module. If so, the module
114 will be called ds1621. 114 will be called ds1621.
115 115
116config SENSORS_F71805F
117 tristate "Fintek F71805F/FG"
118 depends on HWMON && EXPERIMENTAL
119 help
120 If you say yes here you get support for hardware monitoring
121 features of the Fintek F71805F/FG chips.
122
123 This driver can also be built as a module. If so, the module
124 will be called f71805f.
125
116config SENSORS_FSCHER 126config SENSORS_FSCHER
117 tristate "FSC Hermes" 127 tristate "FSC Hermes"
118 depends on HWMON && I2C && EXPERIMENTAL 128 depends on HWMON && I2C && EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 06d4a1d14105..fbdb8d911a72 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
18obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o 18obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o
19obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 19obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
20obj-$(CONFIG_SENSORS_DS1621) += ds1621.o 20obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
21obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
21obj-$(CONFIG_SENSORS_FSCHER) += fscher.o 22obj-$(CONFIG_SENSORS_FSCHER) += fscher.o
22obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o 23obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o
23obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o 24obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c
new file mode 100644
index 000000000000..e029e0a94ecc
--- /dev/null
+++ b/drivers/hwmon/f71805f.c
@@ -0,0 +1,908 @@
1/*
2 * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated
3 * hardware monitoring features
4 * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
5 *
6 * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates
7 * complete hardware monitoring features: voltage, fan and temperature
8 * sensors, and manual and automatic fan speed control.
9 *
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
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/slab.h>
28#include <linux/jiffies.h>
29#include <linux/platform_device.h>
30#include <linux/hwmon.h>
31#include <linux/hwmon-sysfs.h>
32#include <linux/err.h>
33#include <asm/io.h>
34
35static struct platform_device *pdev;
36
37#define DRVNAME "f71805f"
38
39/*
40 * Super-I/O constants and functions
41 */
42
43#define F71805F_LD_HWM 0x04
44
45#define SIO_REG_LDSEL 0x07 /* Logical device select */
46#define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */
47#define SIO_REG_DEVREV 0x22 /* Device revision */
48#define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */
49#define SIO_REG_ENABLE 0x30 /* Logical device enable */
50#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
51
52#define SIO_FINTEK_ID 0x1934
53#define SIO_F71805F_ID 0x0406
54
55static inline int
56superio_inb(int base, int reg)
57{
58 outb(reg, base);
59 return inb(base + 1);
60}
61
62static int
63superio_inw(int base, int reg)
64{
65 int val;
66 outb(reg++, base);
67 val = inb(base + 1) << 8;
68 outb(reg, base);
69 val |= inb(base + 1);
70 return val;
71}
72
73static inline void
74superio_select(int base, int ld)
75{
76 outb(SIO_REG_LDSEL, base);
77 outb(ld, base + 1);
78}
79
80static inline void
81superio_enter(int base)
82{
83 outb(0x87, base);
84 outb(0x87, base);
85}
86
87static inline void
88superio_exit(int base)
89{
90 outb(0xaa, base);
91}
92
93/*
94 * ISA constants
95 */
96
97#define REGION_LENGTH 2
98#define ADDR_REG_OFFSET 0
99#define DATA_REG_OFFSET 1
100
101static struct resource f71805f_resource __initdata = {
102 .flags = IORESOURCE_IO,
103};
104
105/*
106 * Registers
107 */
108
109/* in nr from 0 to 8 (8-bit values) */
110#define F71805F_REG_IN(nr) (0x10 + (nr))
111#define F71805F_REG_IN_HIGH(nr) (0x40 + 2 * (nr))
112#define F71805F_REG_IN_LOW(nr) (0x41 + 2 * (nr))
113/* fan nr from 0 to 2 (12-bit values, two registers) */
114#define F71805F_REG_FAN(nr) (0x20 + 2 * (nr))
115#define F71805F_REG_FAN_LOW(nr) (0x28 + 2 * (nr))
116#define F71805F_REG_FAN_CTRL(nr) (0x60 + 16 * (nr))
117/* temp nr from 0 to 2 (8-bit values) */
118#define F71805F_REG_TEMP(nr) (0x1B + (nr))
119#define F71805F_REG_TEMP_HIGH(nr) (0x54 + 2 * (nr))
120#define F71805F_REG_TEMP_HYST(nr) (0x55 + 2 * (nr))
121#define F71805F_REG_TEMP_MODE 0x01
122
123#define F71805F_REG_START 0x00
124/* status nr from 0 to 2 */
125#define F71805F_REG_STATUS(nr) (0x36 + (nr))
126
127/*
128 * Data structures and manipulation thereof
129 */
130
131struct f71805f_data {
132 unsigned short addr;
133 const char *name;
134 struct semaphore lock;
135 struct class_device *class_dev;
136
137 struct semaphore update_lock;
138 char valid; /* !=0 if following fields are valid */
139 unsigned long last_updated; /* In jiffies */
140 unsigned long last_limits; /* In jiffies */
141
142 /* Register values */
143 u8 in[9];
144 u8 in_high[9];
145 u8 in_low[9];
146 u16 fan[3];
147 u16 fan_low[3];
148 u8 fan_enabled; /* Read once at init time */
149 u8 temp[3];
150 u8 temp_high[3];
151 u8 temp_hyst[3];
152 u8 temp_mode;
153 u8 alarms[3];
154};
155
156static inline long in_from_reg(u8 reg)
157{
158 return (reg * 8);
159}
160
161/* The 2 least significant bits are not used */
162static inline u8 in_to_reg(long val)
163{
164 if (val <= 0)
165 return 0;
166 if (val >= 2016)
167 return 0xfc;
168 return (((val + 16) / 32) << 2);
169}
170
171/* in0 is downscaled by a factor 2 internally */
172static inline long in0_from_reg(u8 reg)
173{
174 return (reg * 16);
175}
176
177static inline u8 in0_to_reg(long val)
178{
179 if (val <= 0)
180 return 0;
181 if (val >= 4032)
182 return 0xfc;
183 return (((val + 32) / 64) << 2);
184}
185
186/* The 4 most significant bits are not used */
187static inline long fan_from_reg(u16 reg)
188{
189 reg &= 0xfff;
190 if (!reg || reg == 0xfff)
191 return 0;
192 return (1500000 / reg);
193}
194
195static inline u16 fan_to_reg(long rpm)
196{
197 /* If the low limit is set below what the chip can measure,
198 store the largest possible 12-bit value in the registers,
199 so that no alarm will ever trigger. */
200 if (rpm < 367)
201 return 0xfff;
202 return (1500000 / rpm);
203}
204
205static inline long temp_from_reg(u8 reg)
206{
207 return (reg * 1000);
208}
209
210static inline u8 temp_to_reg(long val)
211{
212 if (val < 0)
213 val = 0;
214 else if (val > 1000 * 0xff)
215 val = 0xff;
216 return ((val + 500) / 1000);
217}
218
219/*
220 * Device I/O access
221 */
222
223static u8 f71805f_read8(struct f71805f_data *data, u8 reg)
224{
225 u8 val;
226
227 down(&data->lock);
228 outb(reg, data->addr + ADDR_REG_OFFSET);
229 val = inb(data->addr + DATA_REG_OFFSET);
230 up(&data->lock);
231
232 return val;
233}
234
235static void f71805f_write8(struct f71805f_data *data, u8 reg, u8 val)
236{
237 down(&data->lock);
238 outb(reg, data->addr + ADDR_REG_OFFSET);
239 outb(val, data->addr + DATA_REG_OFFSET);
240 up(&data->lock);
241}
242
243/* It is important to read the MSB first, because doing so latches the
244 value of the LSB, so we are sure both bytes belong to the same value. */
245static u16 f71805f_read16(struct f71805f_data *data, u8 reg)
246{
247 u16 val;
248
249 down(&data->lock);
250 outb(reg, data->addr + ADDR_REG_OFFSET);
251 val = inb(data->addr + DATA_REG_OFFSET) << 8;
252 outb(++reg, data->addr + ADDR_REG_OFFSET);
253 val |= inb(data->addr + DATA_REG_OFFSET);
254 up(&data->lock);
255
256 return val;
257}
258
259static void f71805f_write16(struct f71805f_data *data, u8 reg, u16 val)
260{
261 down(&data->lock);
262 outb(reg, data->addr + ADDR_REG_OFFSET);
263 outb(val >> 8, data->addr + DATA_REG_OFFSET);
264 outb(++reg, data->addr + ADDR_REG_OFFSET);
265 outb(val & 0xff, data->addr + DATA_REG_OFFSET);
266 up(&data->lock);
267}
268
269static struct f71805f_data *f71805f_update_device(struct device *dev)
270{
271 struct f71805f_data *data = dev_get_drvdata(dev);
272 int nr;
273
274 down(&data->update_lock);
275
276 /* Limit registers cache is refreshed after 60 seconds */
277 if (time_after(jiffies, data->last_updated + 60 * HZ)
278 || !data->valid) {
279 for (nr = 0; nr < 9; nr++) {
280 data->in_high[nr] = f71805f_read8(data,
281 F71805F_REG_IN_HIGH(nr));
282 data->in_low[nr] = f71805f_read8(data,
283 F71805F_REG_IN_LOW(nr));
284 }
285 for (nr = 0; nr < 3; nr++) {
286 if (data->fan_enabled & (1 << nr))
287 data->fan_low[nr] = f71805f_read16(data,
288 F71805F_REG_FAN_LOW(nr));
289 }
290 for (nr = 0; nr < 3; nr++) {
291 data->temp_high[nr] = f71805f_read8(data,
292 F71805F_REG_TEMP_HIGH(nr));
293 data->temp_hyst[nr] = f71805f_read8(data,
294 F71805F_REG_TEMP_HYST(nr));
295 }
296 data->temp_mode = f71805f_read8(data, F71805F_REG_TEMP_MODE);
297
298 data->last_limits = jiffies;
299 }
300
301 /* Measurement registers cache is refreshed after 1 second */
302 if (time_after(jiffies, data->last_updated + HZ)
303 || !data->valid) {
304 for (nr = 0; nr < 9; nr++) {
305 data->in[nr] = f71805f_read8(data,
306 F71805F_REG_IN(nr));
307 }
308 for (nr = 0; nr < 3; nr++) {
309 if (data->fan_enabled & (1 << nr))
310 data->fan[nr] = f71805f_read16(data,
311 F71805F_REG_FAN(nr));
312 }
313 for (nr = 0; nr < 3; nr++) {
314 data->temp[nr] = f71805f_read8(data,
315 F71805F_REG_TEMP(nr));
316 }
317 for (nr = 0; nr < 3; nr++) {
318 data->alarms[nr] = f71805f_read8(data,
319 F71805F_REG_STATUS(nr));
320 }
321
322 data->last_updated = jiffies;
323 data->valid = 1;
324 }
325
326 up(&data->update_lock);
327
328 return data;
329}
330
331/*
332 * Sysfs interface
333 */
334
335static ssize_t show_in0(struct device *dev, struct device_attribute *devattr,
336 char *buf)
337{
338 struct f71805f_data *data = f71805f_update_device(dev);
339
340 return sprintf(buf, "%ld\n", in0_from_reg(data->in[0]));
341}
342
343static ssize_t show_in0_max(struct device *dev, struct device_attribute
344 *devattr, char *buf)
345{
346 struct f71805f_data *data = f71805f_update_device(dev);
347
348 return sprintf(buf, "%ld\n", in0_from_reg(data->in_high[0]));
349}
350
351static ssize_t show_in0_min(struct device *dev, struct device_attribute
352 *devattr, char *buf)
353{
354 struct f71805f_data *data = f71805f_update_device(dev);
355
356 return sprintf(buf, "%ld\n", in0_from_reg(data->in_low[0]));
357}
358
359static ssize_t set_in0_max(struct device *dev, struct device_attribute
360 *devattr, const char *buf, size_t count)
361{
362 struct f71805f_data *data = dev_get_drvdata(dev);
363 long val = simple_strtol(buf, NULL, 10);
364
365 down(&data->update_lock);
366 data->in_high[0] = in0_to_reg(val);
367 f71805f_write8(data, F71805F_REG_IN_HIGH(0), data->in_high[0]);
368 up(&data->update_lock);
369
370 return count;
371}
372
373static ssize_t set_in0_min(struct device *dev, struct device_attribute
374 *devattr, const char *buf, size_t count)
375{
376 struct f71805f_data *data = dev_get_drvdata(dev);
377 long val = simple_strtol(buf, NULL, 10);
378
379 down(&data->update_lock);
380 data->in_low[0] = in0_to_reg(val);
381 f71805f_write8(data, F71805F_REG_IN_LOW(0), data->in_low[0]);
382 up(&data->update_lock);
383
384 return count;
385}
386
387static DEVICE_ATTR(in0_input, S_IRUGO, show_in0, NULL);
388static DEVICE_ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max);
389static DEVICE_ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min);
390
391static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
392 char *buf)
393{
394 struct f71805f_data *data = f71805f_update_device(dev);
395 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
396 int nr = attr->index;
397
398 return sprintf(buf, "%ld\n", in_from_reg(data->in[nr]));
399}
400
401static ssize_t show_in_max(struct device *dev, struct device_attribute
402 *devattr, char *buf)
403{
404 struct f71805f_data *data = f71805f_update_device(dev);
405 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
406 int nr = attr->index;
407
408 return sprintf(buf, "%ld\n", in_from_reg(data->in_high[nr]));
409}
410
411static ssize_t show_in_min(struct device *dev, struct device_attribute
412 *devattr, char *buf)
413{
414 struct f71805f_data *data = f71805f_update_device(dev);
415 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
416 int nr = attr->index;
417
418 return sprintf(buf, "%ld\n", in_from_reg(data->in_low[nr]));
419}
420
421static ssize_t set_in_max(struct device *dev, struct device_attribute
422 *devattr, const char *buf, size_t count)
423{
424 struct f71805f_data *data = dev_get_drvdata(dev);
425 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
426 int nr = attr->index;
427 long val = simple_strtol(buf, NULL, 10);
428
429 down(&data->update_lock);
430 data->in_high[nr] = in_to_reg(val);
431 f71805f_write8(data, F71805F_REG_IN_HIGH(nr), data->in_high[nr]);
432 up(&data->update_lock);
433
434 return count;
435}
436
437static ssize_t set_in_min(struct device *dev, struct device_attribute
438 *devattr, const char *buf, size_t count)
439{
440 struct f71805f_data *data = dev_get_drvdata(dev);
441 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
442 int nr = attr->index;
443 long val = simple_strtol(buf, NULL, 10);
444
445 down(&data->update_lock);
446 data->in_low[nr] = in_to_reg(val);
447 f71805f_write8(data, F71805F_REG_IN_LOW(nr), data->in_low[nr]);
448 up(&data->update_lock);
449
450 return count;
451}
452
453#define sysfs_in(offset) \
454static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
455 show_in, NULL, offset); \
456static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
457 show_in_max, set_in_max, offset); \
458static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
459 show_in_min, set_in_min, offset)
460
461sysfs_in(1);
462sysfs_in(2);
463sysfs_in(3);
464sysfs_in(4);
465sysfs_in(5);
466sysfs_in(6);
467sysfs_in(7);
468sysfs_in(8);
469
470static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
471 char *buf)
472{
473 struct f71805f_data *data = f71805f_update_device(dev);
474 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
475 int nr = attr->index;
476
477 return sprintf(buf, "%ld\n", fan_from_reg(data->fan[nr]));
478}
479
480static ssize_t show_fan_min(struct device *dev, struct device_attribute
481 *devattr, char *buf)
482{
483 struct f71805f_data *data = f71805f_update_device(dev);
484 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
485 int nr = attr->index;
486
487 return sprintf(buf, "%ld\n", fan_from_reg(data->fan_low[nr]));
488}
489
490static ssize_t set_fan_min(struct device *dev, struct device_attribute
491 *devattr, const char *buf, size_t count)
492{
493 struct f71805f_data *data = dev_get_drvdata(dev);
494 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
495 int nr = attr->index;
496 long val = simple_strtol(buf, NULL, 10);
497
498 down(&data->update_lock);
499 data->fan_low[nr] = fan_to_reg(val);
500 f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);
501 up(&data->update_lock);
502
503 return count;
504}
505
506#define sysfs_fan(offset) \
507static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
508 show_fan, NULL, offset - 1); \
509static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
510 show_fan_min, set_fan_min, offset - 1)
511
512sysfs_fan(1);
513sysfs_fan(2);
514sysfs_fan(3);
515
516static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
517 char *buf)
518{
519 struct f71805f_data *data = f71805f_update_device(dev);
520 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
521 int nr = attr->index;
522
523 return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr]));
524}
525
526static ssize_t show_temp_max(struct device *dev, struct device_attribute
527 *devattr, char *buf)
528{
529 struct f71805f_data *data = f71805f_update_device(dev);
530 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
531 int nr = attr->index;
532
533 return sprintf(buf, "%ld\n", temp_from_reg(data->temp_high[nr]));
534}
535
536static ssize_t show_temp_hyst(struct device *dev, struct device_attribute
537 *devattr, char *buf)
538{
539 struct f71805f_data *data = f71805f_update_device(dev);
540 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
541 int nr = attr->index;
542
543 return sprintf(buf, "%ld\n", temp_from_reg(data->temp_hyst[nr]));
544}
545
546static ssize_t show_temp_type(struct device *dev, struct device_attribute
547 *devattr, char *buf)
548{
549 struct f71805f_data *data = f71805f_update_device(dev);
550 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
551 int nr = attr->index;
552
553 /* 3 is diode, 4 is thermistor */
554 return sprintf(buf, "%u\n", (data->temp_mode & (1 << nr)) ? 3 : 4);
555}
556
557static ssize_t set_temp_max(struct device *dev, struct device_attribute
558 *devattr, const char *buf, size_t count)
559{
560 struct f71805f_data *data = dev_get_drvdata(dev);
561 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
562 int nr = attr->index;
563 long val = simple_strtol(buf, NULL, 10);
564
565 down(&data->update_lock);
566 data->temp_high[nr] = temp_to_reg(val);
567 f71805f_write8(data, F71805F_REG_TEMP_HIGH(nr), data->temp_high[nr]);
568 up(&data->update_lock);
569
570 return count;
571}
572
573static ssize_t set_temp_hyst(struct device *dev, struct device_attribute
574 *devattr, const char *buf, size_t count)
575{
576 struct f71805f_data *data = dev_get_drvdata(dev);
577 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
578 int nr = attr->index;
579 long val = simple_strtol(buf, NULL, 10);
580
581 down(&data->update_lock);
582 data->temp_hyst[nr] = temp_to_reg(val);
583 f71805f_write8(data, F71805F_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
584 up(&data->update_lock);
585
586 return count;
587}
588
589#define sysfs_temp(offset) \
590static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
591 show_temp, NULL, offset - 1); \
592static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
593 show_temp_max, set_temp_max, offset - 1); \
594static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \
595 show_temp_hyst, set_temp_hyst, offset - 1); \
596static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO, \
597 show_temp_type, NULL, offset - 1)
598
599sysfs_temp(1);
600sysfs_temp(2);
601sysfs_temp(3);
602
603static ssize_t show_alarms_in(struct device *dev, struct device_attribute
604 *devattr, char *buf)
605{
606 struct f71805f_data *data = f71805f_update_device(dev);
607
608 return sprintf(buf, "%d\n", data->alarms[0] |
609 ((data->alarms[1] & 0x01) << 8));
610}
611
612static ssize_t show_alarms_fan(struct device *dev, struct device_attribute
613 *devattr, char *buf)
614{
615 struct f71805f_data *data = f71805f_update_device(dev);
616
617 return sprintf(buf, "%d\n", data->alarms[2] & 0x07);
618}
619
620static ssize_t show_alarms_temp(struct device *dev, struct device_attribute
621 *devattr, char *buf)
622{
623 struct f71805f_data *data = f71805f_update_device(dev);
624
625 return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07);
626}
627
628static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL);
629static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL);
630static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL);
631
632static ssize_t show_name(struct device *dev, struct device_attribute
633 *devattr, char *buf)
634{
635 struct f71805f_data *data = dev_get_drvdata(dev);
636
637 return sprintf(buf, "%s\n", data->name);
638}
639
640static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
641
642/*
643 * Device registration and initialization
644 */
645
646static void __devinit f71805f_init_device(struct f71805f_data *data)
647{
648 u8 reg;
649 int i;
650
651 reg = f71805f_read8(data, F71805F_REG_START);
652 if ((reg & 0x41) != 0x01) {
653 printk(KERN_DEBUG DRVNAME ": Starting monitoring "
654 "operations\n");
655 f71805f_write8(data, F71805F_REG_START, (reg | 0x01) & ~0x40);
656 }
657
658 /* Fan monitoring can be disabled. If it is, we won't be polling
659 the register values, and won't create the related sysfs files. */
660 for (i = 0; i < 3; i++) {
661 reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i));
662 if (!(reg & 0x80))
663 data->fan_enabled |= (1 << i);
664 }
665}
666
667static int __devinit f71805f_probe(struct platform_device *pdev)
668{
669 struct f71805f_data *data;
670 struct resource *res;
671 int err;
672
673 if (!(data = kzalloc(sizeof(struct f71805f_data), GFP_KERNEL))) {
674 err = -ENOMEM;
675 printk(KERN_ERR DRVNAME ": Out of memory\n");
676 goto exit;
677 }
678
679 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
680 data->addr = res->start;
681 init_MUTEX(&data->lock);
682 data->name = "f71805f";
683 init_MUTEX(&data->update_lock);
684
685 platform_set_drvdata(pdev, data);
686
687 data->class_dev = hwmon_device_register(&pdev->dev);
688 if (IS_ERR(data->class_dev)) {
689 err = PTR_ERR(data->class_dev);
690 dev_err(&pdev->dev, "Class registration failed (%d)\n", err);
691 goto exit_free;
692 }
693
694 /* Initialize the F71805F chip */
695 f71805f_init_device(data);
696
697 /* Register sysfs interface files */
698 device_create_file(&pdev->dev, &dev_attr_in0_input);
699 device_create_file(&pdev->dev, &dev_attr_in0_max);
700 device_create_file(&pdev->dev, &dev_attr_in0_min);
701 device_create_file(&pdev->dev, &sensor_dev_attr_in1_input.dev_attr);
702 device_create_file(&pdev->dev, &sensor_dev_attr_in2_input.dev_attr);
703 device_create_file(&pdev->dev, &sensor_dev_attr_in3_input.dev_attr);
704 device_create_file(&pdev->dev, &sensor_dev_attr_in4_input.dev_attr);
705 device_create_file(&pdev->dev, &sensor_dev_attr_in5_input.dev_attr);
706 device_create_file(&pdev->dev, &sensor_dev_attr_in6_input.dev_attr);
707 device_create_file(&pdev->dev, &sensor_dev_attr_in7_input.dev_attr);
708 device_create_file(&pdev->dev, &sensor_dev_attr_in8_input.dev_attr);
709 device_create_file(&pdev->dev, &sensor_dev_attr_in1_max.dev_attr);
710 device_create_file(&pdev->dev, &sensor_dev_attr_in2_max.dev_attr);
711 device_create_file(&pdev->dev, &sensor_dev_attr_in3_max.dev_attr);
712 device_create_file(&pdev->dev, &sensor_dev_attr_in4_max.dev_attr);
713 device_create_file(&pdev->dev, &sensor_dev_attr_in5_max.dev_attr);
714 device_create_file(&pdev->dev, &sensor_dev_attr_in6_max.dev_attr);
715 device_create_file(&pdev->dev, &sensor_dev_attr_in7_max.dev_attr);
716 device_create_file(&pdev->dev, &sensor_dev_attr_in8_max.dev_attr);
717 device_create_file(&pdev->dev, &sensor_dev_attr_in1_min.dev_attr);
718 device_create_file(&pdev->dev, &sensor_dev_attr_in2_min.dev_attr);
719 device_create_file(&pdev->dev, &sensor_dev_attr_in3_min.dev_attr);
720 device_create_file(&pdev->dev, &sensor_dev_attr_in4_min.dev_attr);
721 device_create_file(&pdev->dev, &sensor_dev_attr_in5_min.dev_attr);
722 device_create_file(&pdev->dev, &sensor_dev_attr_in6_min.dev_attr);
723 device_create_file(&pdev->dev, &sensor_dev_attr_in7_min.dev_attr);
724 device_create_file(&pdev->dev, &sensor_dev_attr_in8_min.dev_attr);
725 if (data->fan_enabled & (1 << 0)) {
726 device_create_file(&pdev->dev,
727 &sensor_dev_attr_fan1_input.dev_attr);
728 device_create_file(&pdev->dev,
729 &sensor_dev_attr_fan1_min.dev_attr);
730 }
731 if (data->fan_enabled & (1 << 1)) {
732 device_create_file(&pdev->dev,
733 &sensor_dev_attr_fan2_input.dev_attr);
734 device_create_file(&pdev->dev,
735 &sensor_dev_attr_fan2_min.dev_attr);
736 }
737 if (data->fan_enabled & (1 << 2)) {
738 device_create_file(&pdev->dev,
739 &sensor_dev_attr_fan3_input.dev_attr);
740 device_create_file(&pdev->dev,
741 &sensor_dev_attr_fan3_min.dev_attr);
742 }
743 device_create_file(&pdev->dev,
744 &sensor_dev_attr_temp1_input.dev_attr);
745 device_create_file(&pdev->dev,
746 &sensor_dev_attr_temp2_input.dev_attr);
747 device_create_file(&pdev->dev,
748 &sensor_dev_attr_temp3_input.dev_attr);
749 device_create_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
750 device_create_file(&pdev->dev, &sensor_dev_attr_temp2_max.dev_attr);
751 device_create_file(&pdev->dev, &sensor_dev_attr_temp3_max.dev_attr);
752 device_create_file(&pdev->dev,
753 &sensor_dev_attr_temp1_max_hyst.dev_attr);
754 device_create_file(&pdev->dev,
755 &sensor_dev_attr_temp2_max_hyst.dev_attr);
756 device_create_file(&pdev->dev,
757 &sensor_dev_attr_temp3_max_hyst.dev_attr);
758 device_create_file(&pdev->dev, &sensor_dev_attr_temp1_type.dev_attr);
759 device_create_file(&pdev->dev, &sensor_dev_attr_temp2_type.dev_attr);
760 device_create_file(&pdev->dev, &sensor_dev_attr_temp3_type.dev_attr);
761 device_create_file(&pdev->dev, &dev_attr_alarms_in);
762 device_create_file(&pdev->dev, &dev_attr_alarms_fan);
763 device_create_file(&pdev->dev, &dev_attr_alarms_temp);
764 device_create_file(&pdev->dev, &dev_attr_name);
765
766 return 0;
767
768exit_free:
769 kfree(data);
770exit:
771 return err;
772}
773
774static int __devexit f71805f_remove(struct platform_device *pdev)
775{
776 struct f71805f_data *data = platform_get_drvdata(pdev);
777
778 platform_set_drvdata(pdev, NULL);
779 hwmon_device_unregister(data->class_dev);
780 kfree(data);
781
782 return 0;
783}
784
785static struct platform_driver f71805f_driver = {
786 .driver = {
787 .owner = THIS_MODULE,
788 .name = DRVNAME,
789 },
790 .probe = f71805f_probe,
791 .remove = __devexit_p(f71805f_remove),
792};
793
794static int __init f71805f_device_add(unsigned short address)
795{
796 int err;
797
798 pdev = platform_device_alloc(DRVNAME, address);
799 if (!pdev) {
800 err = -ENOMEM;
801 printk(KERN_ERR DRVNAME ": Device allocation failed\n");
802 goto exit;
803 }
804
805 f71805f_resource.start = address;
806 f71805f_resource.end = address + REGION_LENGTH - 1;
807 f71805f_resource.name = pdev->name;
808 err = platform_device_add_resources(pdev, &f71805f_resource, 1);
809 if (err) {
810 printk(KERN_ERR DRVNAME ": Device resource addition failed "
811 "(%d)\n", err);
812 goto exit_device_put;
813 }
814
815 err = platform_device_add(pdev);
816 if (err) {
817 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
818 err);
819 goto exit_device_put;
820 }
821
822 return 0;
823
824exit_device_put:
825 platform_device_put(pdev);
826exit:
827 return err;
828}
829
830static int __init f71805f_find(int sioaddr, unsigned short *address)
831{
832 int err = -ENODEV;
833 u16 devid;
834
835 superio_enter(sioaddr);
836
837 devid = superio_inw(sioaddr, SIO_REG_MANID);
838 if (devid != SIO_FINTEK_ID)
839 goto exit;
840
841 devid = superio_inw(sioaddr, SIO_REG_DEVID);
842 if (devid != SIO_F71805F_ID) {
843 printk(KERN_INFO DRVNAME ": Unsupported Fintek device, "
844 "skipping\n");
845 goto exit;
846 }
847
848 superio_select(sioaddr, F71805F_LD_HWM);
849 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
850 printk(KERN_WARNING DRVNAME ": Device not activated, "
851 "skipping\n");
852 goto exit;
853 }
854
855 *address = superio_inw(sioaddr, SIO_REG_ADDR);
856 if (*address == 0) {
857 printk(KERN_WARNING DRVNAME ": Base address not set, "
858 "skipping\n");
859 goto exit;
860 }
861
862 err = 0;
863 printk(KERN_INFO DRVNAME ": Found F71805F chip at %#x, revision %u\n",
864 *address, superio_inb(sioaddr, SIO_REG_DEVREV));
865
866exit:
867 superio_exit(sioaddr);
868 return err;
869}
870
871static int __init f71805f_init(void)
872{
873 int err;
874 unsigned short address;
875
876 if (f71805f_find(0x2e, &address)
877 && f71805f_find(0x4e, &address))
878 return -ENODEV;
879
880 err = platform_driver_register(&f71805f_driver);
881 if (err)
882 goto exit;
883
884 /* Sets global pdev as a side effect */
885 err = f71805f_device_add(address);
886 if (err)
887 goto exit_driver;
888
889 return 0;
890
891exit_driver:
892 platform_driver_unregister(&f71805f_driver);
893exit:
894 return err;
895}
896
897static void __exit f71805f_exit(void)
898{
899 platform_device_unregister(pdev);
900 platform_driver_unregister(&f71805f_driver);
901}
902
903MODULE_AUTHOR("Jean Delvare <khali@linux-fr>");
904MODULE_LICENSE("GPL");
905MODULE_DESCRIPTION("F71805F hardware monitoring driver");
906
907module_init(f71805f_init);
908module_exit(f71805f_exit);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0da7c9c508c3..e87d52c59940 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -45,8 +45,7 @@
45 45
46 46
47/* Addresses to scan */ 47/* Addresses to scan */
48static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 48static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
49 0x2e, 0x2f, I2C_CLIENT_END };
50static unsigned short isa_address; 49static unsigned short isa_address;
51 50
52/* Insmod parameters */ 51/* Insmod parameters */
@@ -830,6 +829,11 @@ static int it87_detect(struct i2c_adapter *adapter, int address, int kind)
830 if ((err = i2c_attach_client(new_client))) 829 if ((err = i2c_attach_client(new_client)))
831 goto ERROR2; 830 goto ERROR2;
832 831
832 if (!is_isa)
833 dev_info(&new_client->dev, "The I2C interface to IT87xxF "
834 "hardware monitoring chips is deprecated. Please "
835 "report if you still rely on it.\n");
836
833 /* Check PWM configuration */ 837 /* Check PWM configuration */
834 enable_pwm_interface = it87_check_pwm(new_client); 838 enable_pwm_interface = it87_check_pwm(new_client);
835 839
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
index a2f420d01fb7..df9e02aaa70a 100644
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -87,15 +87,15 @@ static struct i2c_driver lm77_driver = {
87 87
88/* In the temperature registers, the low 3 bits are not part of the 88/* In the temperature registers, the low 3 bits are not part of the
89 temperature values; they are the status bits. */ 89 temperature values; they are the status bits. */
90static inline u16 LM77_TEMP_TO_REG(int temp) 90static inline s16 LM77_TEMP_TO_REG(int temp)
91{ 91{
92 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX); 92 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX);
93 return (u16)((ntemp / 500) * 8); 93 return (ntemp / 500) * 8;
94} 94}
95 95
96static inline int LM77_TEMP_FROM_REG(u16 reg) 96static inline int LM77_TEMP_FROM_REG(s16 reg)
97{ 97{
98 return ((int)reg / 8) * 500; 98 return (reg / 8) * 500;
99} 99}
100 100
101/* sysfs stuff */ 101/* sysfs stuff */
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index b176bf0c4c7b..a2f6bb676235 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -303,10 +303,6 @@ struct w83792d_data {
303static int w83792d_attach_adapter(struct i2c_adapter *adapter); 303static int w83792d_attach_adapter(struct i2c_adapter *adapter);
304static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind); 304static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind);
305static int w83792d_detach_client(struct i2c_client *client); 305static int w83792d_detach_client(struct i2c_client *client);
306
307static int w83792d_read_value(struct i2c_client *client, u8 register);
308static int w83792d_write_value(struct i2c_client *client, u8 register,
309 u8 value);
310static struct w83792d_data *w83792d_update_device(struct device *dev); 306static struct w83792d_data *w83792d_update_device(struct device *dev);
311 307
312#ifdef DEBUG 308#ifdef DEBUG
@@ -329,6 +325,20 @@ static inline long in_count_from_reg(int nr, struct w83792d_data *data)
329 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03)); 325 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03));
330} 326}
331 327
328/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
329 but the driver only accesses registers in bank 0, so we don't have
330 to switch banks and lock access between switches. */
331static inline int w83792d_read_value(struct i2c_client *client, u8 reg)
332{
333 return i2c_smbus_read_byte_data(client, reg);
334}
335
336static inline int
337w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
338{
339 return i2c_smbus_write_byte_data(client, reg, value);
340}
341
332/* following are the sysfs callback functions */ 342/* following are the sysfs callback functions */
333static ssize_t show_in(struct device *dev, struct device_attribute *attr, 343static ssize_t show_in(struct device *dev, struct device_attribute *attr,
334 char *buf) 344 char *buf)
@@ -1386,19 +1396,6 @@ w83792d_detach_client(struct i2c_client *client)
1386 return 0; 1396 return 0;
1387} 1397}
1388 1398
1389/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
1390 but the driver only accesses registers in bank 0, so we don't have
1391 to switch banks and lock access between switches. */
1392static int w83792d_read_value(struct i2c_client *client, u8 reg)
1393{
1394 return i2c_smbus_read_byte_data(client, reg);
1395}
1396
1397static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
1398{
1399 return i2c_smbus_write_byte_data(client, reg, value);
1400}
1401
1402static void 1399static void
1403w83792d_init_client(struct i2c_client *client) 1400w83792d_init_client(struct i2c_client *client)
1404{ 1401{
diff --git a/drivers/i2c/algos/i2c-algo-sibyte.c b/drivers/i2c/algos/i2c-algo-sibyte.c
index 938848ae162d..3df3f09995c2 100644
--- a/drivers/i2c/algos/i2c-algo-sibyte.c
+++ b/drivers/i2c/algos/i2c-algo-sibyte.c
@@ -202,7 +202,7 @@ EXPORT_SYMBOL(i2c_sibyte_del_bus);
202#ifdef MODULE 202#ifdef MODULE
203MODULE_AUTHOR("Kip Walker, Broadcom Corp."); 203MODULE_AUTHOR("Kip Walker, Broadcom Corp.");
204MODULE_DESCRIPTION("SiByte I2C-Bus algorithm"); 204MODULE_DESCRIPTION("SiByte I2C-Bus algorithm");
205MODULE_PARM(bit_scan, "i"); 205module_param(bit_scan, int, 0);
206MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus"); 206MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");
207MODULE_LICENSE("GPL"); 207MODULE_LICENSE("GPL");
208 208
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 08d5b8fed2dc..ff92735c7c85 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -124,6 +124,7 @@ config I2C_I801
124 ICH6 124 ICH6
125 ICH7 125 ICH7
126 ESB2 126 ESB2
127 ICH8
127 128
128 This driver can also be built as a module. If so, the module 129 This driver can also be built as a module. If so, the module
129 will be called i2c-i801. 130 will be called i2c-i801.
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 1c752ddc10e2..8e0f3158215f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -32,6 +32,7 @@
32 ICH6 266A 32 ICH6 266A
33 ICH7 27DA 33 ICH7 27DA
34 ESB2 269B 34 ESB2 269B
35 ICH8 283E
35 This driver supports several versions of Intel's I/O Controller Hubs (ICH). 36 This driver supports several versions of Intel's I/O Controller Hubs (ICH).
36 For SMBus support, they are similar to the PIIX4 and are part 37 For SMBus support, they are similar to the PIIX4 and are part
37 of Intel's '810' and other chipsets. 38 of Intel's '810' and other chipsets.
@@ -527,6 +528,7 @@ static struct pci_device_id i801_ids[] = {
527 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) }, 528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) },
528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, 529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) },
529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, 530 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) },
531 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },
530 { 0, } 532 { 0, }
531}; 533};
532 534
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 3e5eba9fcacb..c63025a4c861 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -121,14 +121,11 @@ static struct i2c_adapter parport_adapter = {
121 121
122static int __init i2c_parport_init(void) 122static int __init i2c_parport_init(void)
123{ 123{
124 int type_count; 124 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
125
126 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
127 if (type < 0 || type >= type_count) {
128 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
129 type = 0; 126 type = 0;
130 } 127 }
131 128
132 if (base == 0) { 129 if (base == 0) {
133 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE); 130 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
134 base = DEFAULT_BASE; 131 base = DEFAULT_BASE;
@@ -152,7 +149,7 @@ static int __init i2c_parport_init(void)
152 release_region(base, 3); 149 release_region(base, 3);
153 return -ENODEV; 150 return -ENODEV;
154 } 151 }
155 152
156 return 0; 153 return 0;
157} 154}
158 155
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 2854d858fc9b..7e2e8cd1c14a 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -241,14 +241,11 @@ static struct parport_driver i2c_parport_driver = {
241 241
242static int __init i2c_parport_init(void) 242static int __init i2c_parport_init(void)
243{ 243{
244 int type_count; 244 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
245
246 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
247 if (type < 0 || type >= type_count) {
248 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
249 type = 0; 246 type = 0;
250 } 247 }
251 248
252 return parport_register_driver(&i2c_parport_driver); 249 return parport_register_driver(&i2c_parport_driver);
253} 250}
254 251
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 86e2234faf80..7579f4b256a8 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -861,7 +861,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id, struct pt_regs *r
861 decode_ISR(isr); 861 decode_ISR(isr);
862 } 862 }
863 863
864 if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32)) 864 if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))
865 i2c->isrlog[i2c->irqlogidx++] = isr; 865 i2c->isrlog[i2c->irqlogidx++] = isr;
866 866
867 show_state(i2c); 867 show_state(i2c);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 0ce58b506046..1a2c9ab5d9e3 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -946,6 +946,20 @@ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *val
946 } 946 }
947} 947}
948 948
949s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
950 u8 length, u8 *values)
951{
952 union i2c_smbus_data data;
953
954 if (length > I2C_SMBUS_BLOCK_MAX)
955 length = I2C_SMBUS_BLOCK_MAX;
956 data.block[0] = length;
957 memcpy(data.block + 1, values, length);
958 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
959 I2C_SMBUS_WRITE, command,
960 I2C_SMBUS_I2C_BLOCK_DATA, &data);
961}
962
949/* Simulate a SMBus command using the i2c protocol 963/* Simulate a SMBus command using the i2c protocol
950 No checking of parameters is done! */ 964 No checking of parameters is done! */
951static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, 965static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
@@ -1150,6 +1164,7 @@ EXPORT_SYMBOL(i2c_smbus_read_word_data);
1150EXPORT_SYMBOL(i2c_smbus_write_word_data); 1164EXPORT_SYMBOL(i2c_smbus_write_word_data);
1151EXPORT_SYMBOL(i2c_smbus_write_block_data); 1165EXPORT_SYMBOL(i2c_smbus_write_block_data);
1152EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); 1166EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
1167EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);
1153 1168
1154MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 1169MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
1155MODULE_DESCRIPTION("I2C-Bus main module"); 1170MODULE_DESCRIPTION("I2C-Bus main module");
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 6c60a9d2afd8..09086b8b6486 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -190,7 +190,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
190 if (lba48) { 190 if (lba48) {
191 task_ioreg_t tasklets[10]; 191 task_ioreg_t tasklets[10];
192 192
193 pr_debug("%s: LBA=0x%012llx\n", drive->name, block); 193 pr_debug("%s: LBA=0x%012llx\n", drive->name,
194 (unsigned long long)block);
194 195
195 tasklets[0] = 0; 196 tasklets[0] = 0;
196 tasklets[1] = 0; 197 tasklets[1] = 0;
@@ -317,7 +318,8 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s
317 318
318 pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", 319 pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
319 drive->name, rq_data_dir(rq) == READ ? "read" : "writ", 320 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
320 block, rq->nr_sectors, (unsigned long)rq->buffer); 321 (unsigned long long)block, rq->nr_sectors,
322 (unsigned long)rq->buffer);
321 323
322 if (hwif->rw_disk) 324 if (hwif->rw_disk)
323 hwif->rw_disk(drive, rq); 325 hwif->rw_disk(drive, rq);
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index e95c4293a496..f6a05965a4e8 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1319,15 +1319,6 @@ static struct class ucm_class = {
1319 .release = ib_ucm_release_class_dev 1319 .release = ib_ucm_release_class_dev
1320}; 1320};
1321 1321
1322static ssize_t show_dev(struct class_device *class_dev, char *buf)
1323{
1324 struct ib_ucm_device *dev;
1325
1326 dev = container_of(class_dev, struct ib_ucm_device, class_dev);
1327 return print_dev_t(buf, dev->dev.dev);
1328}
1329static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
1330
1331static ssize_t show_ibdev(struct class_device *class_dev, char *buf) 1322static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
1332{ 1323{
1333 struct ib_ucm_device *dev; 1324 struct ib_ucm_device *dev;
@@ -1364,15 +1355,13 @@ static void ib_ucm_add_one(struct ib_device *device)
1364 1355
1365 ucm_dev->class_dev.class = &ucm_class; 1356 ucm_dev->class_dev.class = &ucm_class;
1366 ucm_dev->class_dev.dev = device->dma_device; 1357 ucm_dev->class_dev.dev = device->dma_device;
1358 ucm_dev->class_dev.devt = ucm_dev->dev.dev;
1367 snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d", 1359 snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d",
1368 ucm_dev->devnum); 1360 ucm_dev->devnum);
1369 if (class_device_register(&ucm_dev->class_dev)) 1361 if (class_device_register(&ucm_dev->class_dev))
1370 goto err_cdev; 1362 goto err_cdev;
1371 1363
1372 if (class_device_create_file(&ucm_dev->class_dev, 1364 if (class_device_create_file(&ucm_dev->class_dev,
1373 &class_device_attr_dev))
1374 goto err_class;
1375 if (class_device_create_file(&ucm_dev->class_dev,
1376 &class_device_attr_ibdev)) 1365 &class_device_attr_ibdev))
1377 goto err_class; 1366 goto err_class;
1378 1367
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 0ef560144be3..6dfc94122dd9 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -351,7 +351,7 @@ config HISAX_ENTERNOW_PCI
351 351
352config HISAX_AMD7930 352config HISAX_AMD7930
353 bool "Am7930 (EXPERIMENTAL)" 353 bool "Am7930 (EXPERIMENTAL)"
354 depends on EXPERIMENTAL && SPARC 354 depends on EXPERIMENTAL && SPARC && BROKEN
355 help 355 help
356 This enables HiSax support for the AMD7930 chips on some SPARCs. 356 This enables HiSax support for the AMD7930 chips on some SPARCs.
357 This code is not finished yet. 357 This code is not finished yet.
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 7d4a0ac28c06..12ad462737ba 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -187,6 +187,14 @@ config WINDFARM_PM91
187 This driver provides thermal control for the PowerMac9,1 187 This driver provides thermal control for the PowerMac9,1
188 which is the recent (SMU based) single CPU desktop G5 188 which is the recent (SMU based) single CPU desktop G5
189 189
190config WINDFARM_PM112
191 tristate "Support for thermal management on PowerMac11,2"
192 depends on WINDFARM && I2C && PMAC_SMU
193 select I2C_POWERMAC
194 help
195 This driver provides thermal control for the PowerMac11,2
196 which are the recent dual and quad G5 machines using the
197 970MP dual-core processor.
190 198
191config ANSLCD 199config ANSLCD
192 tristate "Support for ANS LCD display" 200 tristate "Support for ANS LCD display"
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index f4657aa81fb0..6081acdea404 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -35,3 +35,8 @@ obj-$(CONFIG_WINDFARM_PM91) += windfarm_smu_controls.o \
35 windfarm_smu_sensors.o \ 35 windfarm_smu_sensors.o \
36 windfarm_lm75_sensor.o windfarm_pid.o \ 36 windfarm_lm75_sensor.o windfarm_pid.o \
37 windfarm_cpufreq_clamp.o windfarm_pm91.o 37 windfarm_cpufreq_clamp.o windfarm_pm91.o
38obj-$(CONFIG_WINDFARM_PM112) += windfarm_pm112.o windfarm_smu_sat.o \
39 windfarm_smu_controls.o \
40 windfarm_smu_sensors.o \
41 windfarm_max6690_sensor.o \
42 windfarm_lm75_sensor.o windfarm_pid.o
diff --git a/drivers/macintosh/windfarm.h b/drivers/macintosh/windfarm.h
index 3f0cb0312ea3..7a2482cc26a7 100644
--- a/drivers/macintosh/windfarm.h
+++ b/drivers/macintosh/windfarm.h
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/device.h>
17 18
18/* Display a 16.16 fixed point value */ 19/* Display a 16.16 fixed point value */
19#define FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16) 20#define FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16)
@@ -39,6 +40,7 @@ struct wf_control {
39 char *name; 40 char *name;
40 int type; 41 int type;
41 struct kref ref; 42 struct kref ref;
43 struct device_attribute attr;
42}; 44};
43 45
44#define WF_CONTROL_TYPE_GENERIC 0 46#define WF_CONTROL_TYPE_GENERIC 0
@@ -87,6 +89,7 @@ struct wf_sensor {
87 struct wf_sensor_ops *ops; 89 struct wf_sensor_ops *ops;
88 char *name; 90 char *name;
89 struct kref ref; 91 struct kref ref;
92 struct device_attribute attr;
90}; 93};
91 94
92/* Same lifetime rules as controls */ 95/* Same lifetime rules as controls */
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 6c2a471ea6c0..bb8d5efe19bf 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -33,6 +33,7 @@
33#include <linux/reboot.h> 33#include <linux/reboot.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/mutex.h>
36 37
37#include "windfarm.h" 38#include "windfarm.h"
38 39
@@ -48,13 +49,17 @@
48 49
49static LIST_HEAD(wf_controls); 50static LIST_HEAD(wf_controls);
50static LIST_HEAD(wf_sensors); 51static LIST_HEAD(wf_sensors);
51static DECLARE_MUTEX(wf_lock); 52static DEFINE_MUTEX(wf_lock);
52static struct notifier_block *wf_client_list; 53static struct notifier_block *wf_client_list;
53static int wf_client_count; 54static int wf_client_count;
54static unsigned int wf_overtemp; 55static unsigned int wf_overtemp;
55static unsigned int wf_overtemp_counter; 56static unsigned int wf_overtemp_counter;
56struct task_struct *wf_thread; 57struct task_struct *wf_thread;
57 58
59static struct platform_device wf_platform_device = {
60 .name = "windfarm",
61};
62
58/* 63/*
59 * Utilities & tick thread 64 * Utilities & tick thread
60 */ 65 */
@@ -156,26 +161,67 @@ static void wf_control_release(struct kref *kref)
156 kfree(ct); 161 kfree(ct);
157} 162}
158 163
164static ssize_t wf_show_control(struct device *dev,
165 struct device_attribute *attr, char *buf)
166{
167 struct wf_control *ctrl = container_of(attr, struct wf_control, attr);
168 s32 val = 0;
169 int err;
170
171 err = ctrl->ops->get_value(ctrl, &val);
172 if (err < 0)
173 return err;
174 return sprintf(buf, "%d\n", val);
175}
176
177/* This is really only for debugging... */
178static ssize_t wf_store_control(struct device *dev,
179 struct device_attribute *attr,
180 const char *buf, size_t count)
181{
182 struct wf_control *ctrl = container_of(attr, struct wf_control, attr);
183 int val;
184 int err;
185 char *endp;
186
187 val = simple_strtoul(buf, &endp, 0);
188 while (endp < buf + count && (*endp == ' ' || *endp == '\n'))
189 ++endp;
190 if (endp - buf < count)
191 return -EINVAL;
192 err = ctrl->ops->set_value(ctrl, val);
193 if (err < 0)
194 return err;
195 return count;
196}
197
159int wf_register_control(struct wf_control *new_ct) 198int wf_register_control(struct wf_control *new_ct)
160{ 199{
161 struct wf_control *ct; 200 struct wf_control *ct;
162 201
163 down(&wf_lock); 202 mutex_lock(&wf_lock);
164 list_for_each_entry(ct, &wf_controls, link) { 203 list_for_each_entry(ct, &wf_controls, link) {
165 if (!strcmp(ct->name, new_ct->name)) { 204 if (!strcmp(ct->name, new_ct->name)) {
166 printk(KERN_WARNING "windfarm: trying to register" 205 printk(KERN_WARNING "windfarm: trying to register"
167 " duplicate control %s\n", ct->name); 206 " duplicate control %s\n", ct->name);
168 up(&wf_lock); 207 mutex_unlock(&wf_lock);
169 return -EEXIST; 208 return -EEXIST;
170 } 209 }
171 } 210 }
172 kref_init(&new_ct->ref); 211 kref_init(&new_ct->ref);
173 list_add(&new_ct->link, &wf_controls); 212 list_add(&new_ct->link, &wf_controls);
174 213
214 new_ct->attr.attr.name = new_ct->name;
215 new_ct->attr.attr.owner = THIS_MODULE;
216 new_ct->attr.attr.mode = 0644;
217 new_ct->attr.show = wf_show_control;
218 new_ct->attr.store = wf_store_control;
219 device_create_file(&wf_platform_device.dev, &new_ct->attr);
220
175 DBG("wf: Registered control %s\n", new_ct->name); 221 DBG("wf: Registered control %s\n", new_ct->name);
176 222
177 wf_notify(WF_EVENT_NEW_CONTROL, new_ct); 223 wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
178 up(&wf_lock); 224 mutex_unlock(&wf_lock);
179 225
180 return 0; 226 return 0;
181} 227}
@@ -183,9 +229,9 @@ EXPORT_SYMBOL_GPL(wf_register_control);
183 229
184void wf_unregister_control(struct wf_control *ct) 230void wf_unregister_control(struct wf_control *ct)
185{ 231{
186 down(&wf_lock); 232 mutex_lock(&wf_lock);
187 list_del(&ct->link); 233 list_del(&ct->link);
188 up(&wf_lock); 234 mutex_unlock(&wf_lock);
189 235
190 DBG("wf: Unregistered control %s\n", ct->name); 236 DBG("wf: Unregistered control %s\n", ct->name);
191 237
@@ -197,16 +243,16 @@ struct wf_control * wf_find_control(const char *name)
197{ 243{
198 struct wf_control *ct; 244 struct wf_control *ct;
199 245
200 down(&wf_lock); 246 mutex_lock(&wf_lock);
201 list_for_each_entry(ct, &wf_controls, link) { 247 list_for_each_entry(ct, &wf_controls, link) {
202 if (!strcmp(ct->name, name)) { 248 if (!strcmp(ct->name, name)) {
203 if (wf_get_control(ct)) 249 if (wf_get_control(ct))
204 ct = NULL; 250 ct = NULL;
205 up(&wf_lock); 251 mutex_unlock(&wf_lock);
206 return ct; 252 return ct;
207 } 253 }
208 } 254 }
209 up(&wf_lock); 255 mutex_unlock(&wf_lock);
210 return NULL; 256 return NULL;
211} 257}
212EXPORT_SYMBOL_GPL(wf_find_control); 258EXPORT_SYMBOL_GPL(wf_find_control);
@@ -246,26 +292,46 @@ static void wf_sensor_release(struct kref *kref)
246 kfree(sr); 292 kfree(sr);
247} 293}
248 294
295static ssize_t wf_show_sensor(struct device *dev,
296 struct device_attribute *attr, char *buf)
297{
298 struct wf_sensor *sens = container_of(attr, struct wf_sensor, attr);
299 s32 val = 0;
300 int err;
301
302 err = sens->ops->get_value(sens, &val);
303 if (err < 0)
304 return err;
305 return sprintf(buf, "%d.%03d\n", FIX32TOPRINT(val));
306}
307
249int wf_register_sensor(struct wf_sensor *new_sr) 308int wf_register_sensor(struct wf_sensor *new_sr)
250{ 309{
251 struct wf_sensor *sr; 310 struct wf_sensor *sr;
252 311
253 down(&wf_lock); 312 mutex_lock(&wf_lock);
254 list_for_each_entry(sr, &wf_sensors, link) { 313 list_for_each_entry(sr, &wf_sensors, link) {
255 if (!strcmp(sr->name, new_sr->name)) { 314 if (!strcmp(sr->name, new_sr->name)) {
256 printk(KERN_WARNING "windfarm: trying to register" 315 printk(KERN_WARNING "windfarm: trying to register"
257 " duplicate sensor %s\n", sr->name); 316 " duplicate sensor %s\n", sr->name);
258 up(&wf_lock); 317 mutex_unlock(&wf_lock);
259 return -EEXIST; 318 return -EEXIST;
260 } 319 }
261 } 320 }
262 kref_init(&new_sr->ref); 321 kref_init(&new_sr->ref);
263 list_add(&new_sr->link, &wf_sensors); 322 list_add(&new_sr->link, &wf_sensors);
264 323
324 new_sr->attr.attr.name = new_sr->name;
325 new_sr->attr.attr.owner = THIS_MODULE;
326 new_sr->attr.attr.mode = 0444;
327 new_sr->attr.show = wf_show_sensor;
328 new_sr->attr.store = NULL;
329 device_create_file(&wf_platform_device.dev, &new_sr->attr);
330
265 DBG("wf: Registered sensor %s\n", new_sr->name); 331 DBG("wf: Registered sensor %s\n", new_sr->name);
266 332
267 wf_notify(WF_EVENT_NEW_SENSOR, new_sr); 333 wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
268 up(&wf_lock); 334 mutex_unlock(&wf_lock);
269 335
270 return 0; 336 return 0;
271} 337}
@@ -273,9 +339,9 @@ EXPORT_SYMBOL_GPL(wf_register_sensor);
273 339
274void wf_unregister_sensor(struct wf_sensor *sr) 340void wf_unregister_sensor(struct wf_sensor *sr)
275{ 341{
276 down(&wf_lock); 342 mutex_lock(&wf_lock);
277 list_del(&sr->link); 343 list_del(&sr->link);
278 up(&wf_lock); 344 mutex_unlock(&wf_lock);
279 345
280 DBG("wf: Unregistered sensor %s\n", sr->name); 346 DBG("wf: Unregistered sensor %s\n", sr->name);
281 347
@@ -287,16 +353,16 @@ struct wf_sensor * wf_find_sensor(const char *name)
287{ 353{
288 struct wf_sensor *sr; 354 struct wf_sensor *sr;
289 355
290 down(&wf_lock); 356 mutex_lock(&wf_lock);
291 list_for_each_entry(sr, &wf_sensors, link) { 357 list_for_each_entry(sr, &wf_sensors, link) {
292 if (!strcmp(sr->name, name)) { 358 if (!strcmp(sr->name, name)) {
293 if (wf_get_sensor(sr)) 359 if (wf_get_sensor(sr))
294 sr = NULL; 360 sr = NULL;
295 up(&wf_lock); 361 mutex_unlock(&wf_lock);
296 return sr; 362 return sr;
297 } 363 }
298 } 364 }
299 up(&wf_lock); 365 mutex_unlock(&wf_lock);
300 return NULL; 366 return NULL;
301} 367}
302EXPORT_SYMBOL_GPL(wf_find_sensor); 368EXPORT_SYMBOL_GPL(wf_find_sensor);
@@ -329,7 +395,7 @@ int wf_register_client(struct notifier_block *nb)
329 struct wf_control *ct; 395 struct wf_control *ct;
330 struct wf_sensor *sr; 396 struct wf_sensor *sr;
331 397
332 down(&wf_lock); 398 mutex_lock(&wf_lock);
333 rc = notifier_chain_register(&wf_client_list, nb); 399 rc = notifier_chain_register(&wf_client_list, nb);
334 if (rc != 0) 400 if (rc != 0)
335 goto bail; 401 goto bail;
@@ -341,19 +407,19 @@ int wf_register_client(struct notifier_block *nb)
341 if (wf_client_count == 1) 407 if (wf_client_count == 1)
342 wf_start_thread(); 408 wf_start_thread();
343 bail: 409 bail:
344 up(&wf_lock); 410 mutex_unlock(&wf_lock);
345 return rc; 411 return rc;
346} 412}
347EXPORT_SYMBOL_GPL(wf_register_client); 413EXPORT_SYMBOL_GPL(wf_register_client);
348 414
349int wf_unregister_client(struct notifier_block *nb) 415int wf_unregister_client(struct notifier_block *nb)
350{ 416{
351 down(&wf_lock); 417 mutex_lock(&wf_lock);
352 notifier_chain_unregister(&wf_client_list, nb); 418 notifier_chain_unregister(&wf_client_list, nb);
353 wf_client_count++; 419 wf_client_count++;
354 if (wf_client_count == 0) 420 if (wf_client_count == 0)
355 wf_stop_thread(); 421 wf_stop_thread();
356 up(&wf_lock); 422 mutex_unlock(&wf_lock);
357 423
358 return 0; 424 return 0;
359} 425}
@@ -361,23 +427,23 @@ EXPORT_SYMBOL_GPL(wf_unregister_client);
361 427
362void wf_set_overtemp(void) 428void wf_set_overtemp(void)
363{ 429{
364 down(&wf_lock); 430 mutex_lock(&wf_lock);
365 wf_overtemp++; 431 wf_overtemp++;
366 if (wf_overtemp == 1) { 432 if (wf_overtemp == 1) {
367 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n"); 433 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n");
368 wf_overtemp_counter = 0; 434 wf_overtemp_counter = 0;
369 wf_notify(WF_EVENT_OVERTEMP, NULL); 435 wf_notify(WF_EVENT_OVERTEMP, NULL);
370 } 436 }
371 up(&wf_lock); 437 mutex_unlock(&wf_lock);
372} 438}
373EXPORT_SYMBOL_GPL(wf_set_overtemp); 439EXPORT_SYMBOL_GPL(wf_set_overtemp);
374 440
375void wf_clear_overtemp(void) 441void wf_clear_overtemp(void)
376{ 442{
377 down(&wf_lock); 443 mutex_lock(&wf_lock);
378 WARN_ON(wf_overtemp == 0); 444 WARN_ON(wf_overtemp == 0);
379 if (wf_overtemp == 0) { 445 if (wf_overtemp == 0) {
380 up(&wf_lock); 446 mutex_unlock(&wf_lock);
381 return; 447 return;
382 } 448 }
383 wf_overtemp--; 449 wf_overtemp--;
@@ -385,7 +451,7 @@ void wf_clear_overtemp(void)
385 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n"); 451 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n");
386 wf_notify(WF_EVENT_NORMALTEMP, NULL); 452 wf_notify(WF_EVENT_NORMALTEMP, NULL);
387 } 453 }
388 up(&wf_lock); 454 mutex_unlock(&wf_lock);
389} 455}
390EXPORT_SYMBOL_GPL(wf_clear_overtemp); 456EXPORT_SYMBOL_GPL(wf_clear_overtemp);
391 457
@@ -395,10 +461,6 @@ int wf_is_overtemp(void)
395} 461}
396EXPORT_SYMBOL_GPL(wf_is_overtemp); 462EXPORT_SYMBOL_GPL(wf_is_overtemp);
397 463
398static struct platform_device wf_platform_device = {
399 .name = "windfarm",
400};
401
402static int __init windfarm_core_init(void) 464static int __init windfarm_core_init(void)
403{ 465{
404 DBG("wf: core loaded\n"); 466 DBG("wf: core loaded\n");
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
new file mode 100644
index 000000000000..5b9ad6ca7cba
--- /dev/null
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -0,0 +1,169 @@
1/*
2 * Windfarm PowerMac thermal control. MAX6690 sensor.
3 *
4 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
5 *
6 * Use and redistribute under the terms of the GNU GPL v2.
7 */
8#include <linux/types.h>
9#include <linux/errno.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/slab.h>
13#include <linux/i2c.h>
14#include <linux/i2c-dev.h>
15#include <asm/prom.h>
16#include <asm/pmac_low_i2c.h>
17
18#include "windfarm.h"
19
20#define VERSION "0.1"
21
22/* This currently only exports the external temperature sensor,
23 since that's all the control loops need. */
24
25/* Some MAX6690 register numbers */
26#define MAX6690_INTERNAL_TEMP 0
27#define MAX6690_EXTERNAL_TEMP 1
28
29struct wf_6690_sensor {
30 struct i2c_client i2c;
31 struct wf_sensor sens;
32};
33
34#define wf_to_6690(x) container_of((x), struct wf_6690_sensor, sens)
35#define i2c_to_6690(x) container_of((x), struct wf_6690_sensor, i2c)
36
37static int wf_max6690_attach(struct i2c_adapter *adapter);
38static int wf_max6690_detach(struct i2c_client *client);
39
40static struct i2c_driver wf_max6690_driver = {
41 .driver = {
42 .name = "wf_max6690",
43 },
44 .attach_adapter = wf_max6690_attach,
45 .detach_client = wf_max6690_detach,
46};
47
48static int wf_max6690_get(struct wf_sensor *sr, s32 *value)
49{
50 struct wf_6690_sensor *max = wf_to_6690(sr);
51 s32 data;
52
53 if (max->i2c.adapter == NULL)
54 return -ENODEV;
55
56 /* chip gets initialized by firmware */
57 data = i2c_smbus_read_byte_data(&max->i2c, MAX6690_EXTERNAL_TEMP);
58 if (data < 0)
59 return data;
60 *value = data << 16;
61 return 0;
62}
63
64static void wf_max6690_release(struct wf_sensor *sr)
65{
66 struct wf_6690_sensor *max = wf_to_6690(sr);
67
68 if (max->i2c.adapter) {
69 i2c_detach_client(&max->i2c);
70 max->i2c.adapter = NULL;
71 }
72 kfree(max);
73}
74
75static struct wf_sensor_ops wf_max6690_ops = {
76 .get_value = wf_max6690_get,
77 .release = wf_max6690_release,
78 .owner = THIS_MODULE,
79};
80
81static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
82{
83 struct wf_6690_sensor *max;
84 char *name = "u4-temp";
85
86 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
87 if (max == NULL) {
88 printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: "
89 "no memory\n", name);
90 return;
91 }
92
93 max->sens.ops = &wf_max6690_ops;
94 max->sens.name = name;
95 max->i2c.addr = addr >> 1;
96 max->i2c.adapter = adapter;
97 max->i2c.driver = &wf_max6690_driver;
98 strncpy(max->i2c.name, name, I2C_NAME_SIZE-1);
99
100 if (i2c_attach_client(&max->i2c)) {
101 printk(KERN_ERR "windfarm: failed to attach MAX6690 sensor\n");
102 goto fail;
103 }
104
105 if (wf_register_sensor(&max->sens)) {
106 i2c_detach_client(&max->i2c);
107 goto fail;
108 }
109
110 return;
111
112 fail:
113 kfree(max);
114}
115
116static int wf_max6690_attach(struct i2c_adapter *adapter)
117{
118 struct device_node *busnode, *dev = NULL;
119 struct pmac_i2c_bus *bus;
120 const char *loc;
121 u32 *reg;
122
123 bus = pmac_i2c_adapter_to_bus(adapter);
124 if (bus == NULL)
125 return -ENODEV;
126 busnode = pmac_i2c_get_bus_node(bus);
127
128 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
129 if (!device_is_compatible(dev, "max6690"))
130 continue;
131 loc = get_property(dev, "hwsensor-location", NULL);
132 reg = (u32 *) get_property(dev, "reg", NULL);
133 if (!loc || !reg)
134 continue;
135 printk("found max6690, loc=%s reg=%x\n", loc, *reg);
136 if (strcmp(loc, "BACKSIDE"))
137 continue;
138 wf_max6690_create(adapter, *reg);
139 }
140
141 return 0;
142}
143
144static int wf_max6690_detach(struct i2c_client *client)
145{
146 struct wf_6690_sensor *max = i2c_to_6690(client);
147
148 max->i2c.adapter = NULL;
149 wf_unregister_sensor(&max->sens);
150
151 return 0;
152}
153
154static int __init wf_max6690_sensor_init(void)
155{
156 return i2c_add_driver(&wf_max6690_driver);
157}
158
159static void __exit wf_max6690_sensor_exit(void)
160{
161 i2c_del_driver(&wf_max6690_driver);
162}
163
164module_init(wf_max6690_sensor_init);
165module_exit(wf_max6690_sensor_exit);
166
167MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
168MODULE_DESCRIPTION("MAX6690 sensor objects for PowerMac thermal control");
169MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_pid.c b/drivers/macintosh/windfarm_pid.c
index 2e803b368757..0842432e27ad 100644
--- a/drivers/macintosh/windfarm_pid.c
+++ b/drivers/macintosh/windfarm_pid.c
@@ -88,8 +88,8 @@ EXPORT_SYMBOL_GPL(wf_cpu_pid_init);
88 88
89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp) 89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
90{ 90{
91 s64 error, integ, deriv, prop; 91 s64 integ, deriv, prop;
92 s32 target, sval, adj; 92 s32 error, target, sval, adj;
93 int i, hlen = st->param.history_len; 93 int i, hlen = st->param.history_len;
94 94
95 /* Calculate error term */ 95 /* Calculate error term */
@@ -117,7 +117,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
117 integ += st->errors[(st->index + hlen - i) % hlen]; 117 integ += st->errors[(st->index + hlen - i) % hlen];
118 integ *= st->param.interval; 118 integ *= st->param.interval;
119 integ *= st->param.gr; 119 integ *= st->param.gr;
120 sval = st->param.tmax - ((integ >> 20) & 0xffffffff); 120 sval = st->param.tmax - (s32)(integ >> 20);
121 adj = min(st->param.ttarget, sval); 121 adj = min(st->param.ttarget, sval);
122 122
123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj); 123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj);
@@ -129,7 +129,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
129 deriv *= st->param.gd; 129 deriv *= st->param.gd;
130 130
131 /* Calculate proportional term */ 131 /* Calculate proportional term */
132 prop = (new_temp - adj); 132 prop = st->last_delta = (new_temp - adj);
133 prop *= st->param.gp; 133 prop *= st->param.gp;
134 134
135 DBG("deriv: %lx, prop: %lx\n", deriv, prop); 135 DBG("deriv: %lx, prop: %lx\n", deriv, prop);
diff --git a/drivers/macintosh/windfarm_pid.h b/drivers/macintosh/windfarm_pid.h
index a364c2a2499c..bbccc22d42b8 100644
--- a/drivers/macintosh/windfarm_pid.h
+++ b/drivers/macintosh/windfarm_pid.h
@@ -72,6 +72,7 @@ struct wf_cpu_pid_state {
72 int index; /* index of current power */ 72 int index; /* index of current power */
73 int tindex; /* index of current temp */ 73 int tindex; /* index of current temp */
74 s32 target; /* current target value */ 74 s32 target; /* current target value */
75 s32 last_delta; /* last Tactual - Ttarget */
75 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */ 76 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */
76 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */ 77 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */
77 s32 temps[2]; /* temp. history buffer */ 78 s32 temps[2]; /* temp. history buffer */
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
new file mode 100644
index 000000000000..c2a4e689c784
--- /dev/null
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -0,0 +1,698 @@
1/*
2 * Windfarm PowerMac thermal control.
3 * Control loops for machines with SMU and PPC970MP processors.
4 *
5 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
6 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
7 *
8 * Use and redistribute under the terms of the GNU GPL v2.
9 */
10#include <linux/types.h>
11#include <linux/errno.h>
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/platform_device.h>
15#include <linux/reboot.h>
16#include <asm/prom.h>
17#include <asm/smu.h>
18
19#include "windfarm.h"
20#include "windfarm_pid.h"
21
22#define VERSION "0.2"
23
24#define DEBUG
25#undef LOTSA_DEBUG
26
27#ifdef DEBUG
28#define DBG(args...) printk(args)
29#else
30#define DBG(args...) do { } while(0)
31#endif
32
33#ifdef LOTSA_DEBUG
34#define DBG_LOTS(args...) printk(args)
35#else
36#define DBG_LOTS(args...) do { } while(0)
37#endif
38
39/* define this to force CPU overtemp to 60 degree, useful for testing
40 * the overtemp code
41 */
42#undef HACKED_OVERTEMP
43
44/* We currently only handle 2 chips, 4 cores... */
45#define NR_CHIPS 2
46#define NR_CORES 4
47#define NR_CPU_FANS 3 * NR_CHIPS
48
49/* Controls and sensors */
50static struct wf_sensor *sens_cpu_temp[NR_CORES];
51static struct wf_sensor *sens_cpu_power[NR_CORES];
52static struct wf_sensor *hd_temp;
53static struct wf_sensor *slots_power;
54static struct wf_sensor *u4_temp;
55
56static struct wf_control *cpu_fans[NR_CPU_FANS];
57static char *cpu_fan_names[NR_CPU_FANS] = {
58 "cpu-rear-fan-0",
59 "cpu-rear-fan-1",
60 "cpu-front-fan-0",
61 "cpu-front-fan-1",
62 "cpu-pump-0",
63 "cpu-pump-1",
64};
65static struct wf_control *cpufreq_clamp;
66
67/* Second pump isn't required (and isn't actually present) */
68#define CPU_FANS_REQD (NR_CPU_FANS - 2)
69#define FIRST_PUMP 4
70#define LAST_PUMP 5
71
72/* We keep a temperature history for average calculation of 180s */
73#define CPU_TEMP_HIST_SIZE 180
74
75/* Scale factor for fan speed, *100 */
76static int cpu_fan_scale[NR_CPU_FANS] = {
77 100,
78 100,
79 97, /* inlet fans run at 97% of exhaust fan */
80 97,
81 100, /* updated later */
82 100, /* updated later */
83};
84
85static struct wf_control *backside_fan;
86static struct wf_control *slots_fan;
87static struct wf_control *drive_bay_fan;
88
89/* PID loop state */
90static struct wf_cpu_pid_state cpu_pid[NR_CORES];
91static u32 cpu_thist[CPU_TEMP_HIST_SIZE];
92static int cpu_thist_pt;
93static s64 cpu_thist_total;
94static s32 cpu_all_tmax = 100 << 16;
95static int cpu_last_target;
96static struct wf_pid_state backside_pid;
97static int backside_tick;
98static struct wf_pid_state slots_pid;
99static int slots_started;
100static struct wf_pid_state drive_bay_pid;
101static int drive_bay_tick;
102
103static int nr_cores;
104static int have_all_controls;
105static int have_all_sensors;
106static int started;
107
108static int failure_state;
109#define FAILURE_SENSOR 1
110#define FAILURE_FAN 2
111#define FAILURE_PERM 4
112#define FAILURE_LOW_OVERTEMP 8
113#define FAILURE_HIGH_OVERTEMP 16
114
115/* Overtemp values */
116#define LOW_OVER_AVERAGE 0
117#define LOW_OVER_IMMEDIATE (10 << 16)
118#define LOW_OVER_CLEAR ((-10) << 16)
119#define HIGH_OVER_IMMEDIATE (14 << 16)
120#define HIGH_OVER_AVERAGE (10 << 16)
121#define HIGH_OVER_IMMEDIATE (14 << 16)
122
123
124/* Implementation... */
125static int create_cpu_loop(int cpu)
126{
127 int chip = cpu / 2;
128 int core = cpu & 1;
129 struct smu_sdbp_header *hdr;
130 struct smu_sdbp_cpupiddata *piddata;
131 struct wf_cpu_pid_param pid;
132 struct wf_control *main_fan = cpu_fans[0];
133 s32 tmax;
134 int fmin;
135
136 /* Get PID params from the appropriate SAT */
137 hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL);
138 if (hdr == NULL) {
139 printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n");
140 return -EINVAL;
141 }
142 piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];
143
144 /* Get FVT params to get Tmax; if not found, assume default */
145 hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
146 if (hdr) {
147 struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1];
148 tmax = fvt->maxtemp << 16;
149 } else
150 tmax = 95 << 16; /* default to 95 degrees C */
151
152 /* We keep a global tmax for overtemp calculations */
153 if (tmax < cpu_all_tmax)
154 cpu_all_tmax = tmax;
155
156 /*
157 * Darwin has a minimum fan speed of 1000 rpm for the 4-way and
158 * 515 for the 2-way. That appears to be overkill, so for now,
159 * impose a minimum of 750 or 515.
160 */
161 fmin = (nr_cores > 2) ? 750 : 515;
162
163 /* Initialize PID loop */
164 pid.interval = 1; /* seconds */
165 pid.history_len = piddata->history_len;
166 pid.gd = piddata->gd;
167 pid.gp = piddata->gp;
168 pid.gr = piddata->gr / piddata->history_len;
169 pid.pmaxadj = (piddata->max_power << 16) - (piddata->power_adj << 8);
170 pid.ttarget = tmax - (piddata->target_temp_delta << 16);
171 pid.tmax = tmax;
172 pid.min = main_fan->ops->get_min(main_fan);
173 pid.max = main_fan->ops->get_max(main_fan);
174 if (pid.min < fmin)
175 pid.min = fmin;
176
177 wf_cpu_pid_init(&cpu_pid[cpu], &pid);
178 return 0;
179}
180
181static void cpu_max_all_fans(void)
182{
183 int i;
184
185 /* We max all CPU fans in case of a sensor error. We also do the
186 * cpufreq clamping now, even if it's supposedly done later by the
187 * generic code anyway, we do it earlier here to react faster
188 */
189 if (cpufreq_clamp)
190 wf_control_set_max(cpufreq_clamp);
191 for (i = 0; i < NR_CPU_FANS; ++i)
192 if (cpu_fans[i])
193 wf_control_set_max(cpu_fans[i]);
194}
195
196static int cpu_check_overtemp(s32 temp)
197{
198 int new_state = 0;
199 s32 t_avg, t_old;
200
201 /* First check for immediate overtemps */
202 if (temp >= (cpu_all_tmax + LOW_OVER_IMMEDIATE)) {
203 new_state |= FAILURE_LOW_OVERTEMP;
204 if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)
205 printk(KERN_ERR "windfarm: Overtemp due to immediate CPU"
206 " temperature !\n");
207 }
208 if (temp >= (cpu_all_tmax + HIGH_OVER_IMMEDIATE)) {
209 new_state |= FAILURE_HIGH_OVERTEMP;
210 if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)
211 printk(KERN_ERR "windfarm: Critical overtemp due to"
212 " immediate CPU temperature !\n");
213 }
214
215 /* We calculate a history of max temperatures and use that for the
216 * overtemp management
217 */
218 t_old = cpu_thist[cpu_thist_pt];
219 cpu_thist[cpu_thist_pt] = temp;
220 cpu_thist_pt = (cpu_thist_pt + 1) % CPU_TEMP_HIST_SIZE;
221 cpu_thist_total -= t_old;
222 cpu_thist_total += temp;
223 t_avg = cpu_thist_total / CPU_TEMP_HIST_SIZE;
224
225 DBG_LOTS("t_avg = %d.%03d (out: %d.%03d, in: %d.%03d)\n",
226 FIX32TOPRINT(t_avg), FIX32TOPRINT(t_old), FIX32TOPRINT(temp));
227
228 /* Now check for average overtemps */
229 if (t_avg >= (cpu_all_tmax + LOW_OVER_AVERAGE)) {
230 new_state |= FAILURE_LOW_OVERTEMP;
231 if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)
232 printk(KERN_ERR "windfarm: Overtemp due to average CPU"
233 " temperature !\n");
234 }
235 if (t_avg >= (cpu_all_tmax + HIGH_OVER_AVERAGE)) {
236 new_state |= FAILURE_HIGH_OVERTEMP;
237 if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)
238 printk(KERN_ERR "windfarm: Critical overtemp due to"
239 " average CPU temperature !\n");
240 }
241
242 /* Now handle overtemp conditions. We don't currently use the windfarm
243 * overtemp handling core as it's not fully suited to the needs of those
244 * new machine. This will be fixed later.
245 */
246 if (new_state) {
247 /* High overtemp -> immediate shutdown */
248 if (new_state & FAILURE_HIGH_OVERTEMP)
249 machine_power_off();
250 if ((failure_state & new_state) != new_state)
251 cpu_max_all_fans();
252 failure_state |= new_state;
253 } else if ((failure_state & FAILURE_LOW_OVERTEMP) &&
254 (temp < (cpu_all_tmax + LOW_OVER_CLEAR))) {
255 printk(KERN_ERR "windfarm: Overtemp condition cleared !\n");
256 failure_state &= ~FAILURE_LOW_OVERTEMP;
257 }
258
259 return failure_state & (FAILURE_LOW_OVERTEMP | FAILURE_HIGH_OVERTEMP);
260}
261
262static void cpu_fans_tick(void)
263{
264 int err, cpu;
265 s32 greatest_delta = 0;
266 s32 temp, power, t_max = 0;
267 int i, t, target = 0;
268 struct wf_sensor *sr;
269 struct wf_control *ct;
270 struct wf_cpu_pid_state *sp;
271
272 DBG_LOTS(KERN_DEBUG);
273 for (cpu = 0; cpu < nr_cores; ++cpu) {
274 /* Get CPU core temperature */
275 sr = sens_cpu_temp[cpu];
276 err = sr->ops->get_value(sr, &temp);
277 if (err) {
278 DBG("\n");
279 printk(KERN_WARNING "windfarm: CPU %d temperature "
280 "sensor error %d\n", cpu, err);
281 failure_state |= FAILURE_SENSOR;
282 cpu_max_all_fans();
283 return;
284 }
285
286 /* Keep track of highest temp */
287 t_max = max(t_max, temp);
288
289 /* Get CPU power */
290 sr = sens_cpu_power[cpu];
291 err = sr->ops->get_value(sr, &power);
292 if (err) {
293 DBG("\n");
294 printk(KERN_WARNING "windfarm: CPU %d power "
295 "sensor error %d\n", cpu, err);
296 failure_state |= FAILURE_SENSOR;
297 cpu_max_all_fans();
298 return;
299 }
300
301 /* Run PID */
302 sp = &cpu_pid[cpu];
303 t = wf_cpu_pid_run(sp, power, temp);
304
305 if (cpu == 0 || sp->last_delta > greatest_delta) {
306 greatest_delta = sp->last_delta;
307 target = t;
308 }
309 DBG_LOTS("[%d] P=%d.%.3d T=%d.%.3d ",
310 cpu, FIX32TOPRINT(power), FIX32TOPRINT(temp));
311 }
312 DBG_LOTS("fans = %d, t_max = %d.%03d\n", target, FIX32TOPRINT(t_max));
313
314 /* Darwin limits decrease to 20 per iteration */
315 if (target < (cpu_last_target - 20))
316 target = cpu_last_target - 20;
317 cpu_last_target = target;
318 for (cpu = 0; cpu < nr_cores; ++cpu)
319 cpu_pid[cpu].target = target;
320
321 /* Handle possible overtemps */
322 if (cpu_check_overtemp(t_max))
323 return;
324
325 /* Set fans */
326 for (i = 0; i < NR_CPU_FANS; ++i) {
327 ct = cpu_fans[i];
328 if (ct == NULL)
329 continue;
330 err = ct->ops->set_value(ct, target * cpu_fan_scale[i] / 100);
331 if (err) {
332 printk(KERN_WARNING "windfarm: fan %s reports "
333 "error %d\n", ct->name, err);
334 failure_state |= FAILURE_FAN;
335 break;
336 }
337 }
338}
339
340/* Backside/U4 fan */
341static struct wf_pid_param backside_param = {
342 .interval = 5,
343 .history_len = 2,
344 .gd = 48 << 20,
345 .gp = 5 << 20,
346 .gr = 0,
347 .itarget = 64 << 16,
348 .additive = 1,
349};
350
351static void backside_fan_tick(void)
352{
353 s32 temp;
354 int speed;
355 int err;
356
357 if (!backside_fan || !u4_temp)
358 return;
359 if (!backside_tick) {
360 /* first time; initialize things */
361 backside_param.min = backside_fan->ops->get_min(backside_fan);
362 backside_param.max = backside_fan->ops->get_max(backside_fan);
363 wf_pid_init(&backside_pid, &backside_param);
364 backside_tick = 1;
365 }
366 if (--backside_tick > 0)
367 return;
368 backside_tick = backside_pid.param.interval;
369
370 err = u4_temp->ops->get_value(u4_temp, &temp);
371 if (err) {
372 printk(KERN_WARNING "windfarm: U4 temp sensor error %d\n",
373 err);
374 failure_state |= FAILURE_SENSOR;
375 wf_control_set_max(backside_fan);
376 return;
377 }
378 speed = wf_pid_run(&backside_pid, temp);
379 DBG_LOTS("backside PID temp=%d.%.3d speed=%d\n",
380 FIX32TOPRINT(temp), speed);
381
382 err = backside_fan->ops->set_value(backside_fan, speed);
383 if (err) {
384 printk(KERN_WARNING "windfarm: backside fan error %d\n", err);
385 failure_state |= FAILURE_FAN;
386 }
387}
388
389/* Drive bay fan */
390static struct wf_pid_param drive_bay_prm = {
391 .interval = 5,
392 .history_len = 2,
393 .gd = 30 << 20,
394 .gp = 5 << 20,
395 .gr = 0,
396 .itarget = 40 << 16,
397 .additive = 1,
398};
399
400static void drive_bay_fan_tick(void)
401{
402 s32 temp;
403 int speed;
404 int err;
405
406 if (!drive_bay_fan || !hd_temp)
407 return;
408 if (!drive_bay_tick) {
409 /* first time; initialize things */
410 drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan);
411 drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan);
412 wf_pid_init(&drive_bay_pid, &drive_bay_prm);
413 drive_bay_tick = 1;
414 }
415 if (--drive_bay_tick > 0)
416 return;
417 drive_bay_tick = drive_bay_pid.param.interval;
418
419 err = hd_temp->ops->get_value(hd_temp, &temp);
420 if (err) {
421 printk(KERN_WARNING "windfarm: drive bay temp sensor "
422 "error %d\n", err);
423 failure_state |= FAILURE_SENSOR;
424 wf_control_set_max(drive_bay_fan);
425 return;
426 }
427 speed = wf_pid_run(&drive_bay_pid, temp);
428 DBG_LOTS("drive_bay PID temp=%d.%.3d speed=%d\n",
429 FIX32TOPRINT(temp), speed);
430
431 err = drive_bay_fan->ops->set_value(drive_bay_fan, speed);
432 if (err) {
433 printk(KERN_WARNING "windfarm: drive bay fan error %d\n", err);
434 failure_state |= FAILURE_FAN;
435 }
436}
437
438/* PCI slots area fan */
439/* This makes the fan speed proportional to the power consumed */
440static struct wf_pid_param slots_param = {
441 .interval = 1,
442 .history_len = 2,
443 .gd = 0,
444 .gp = 0,
445 .gr = 0x1277952,
446 .itarget = 0,
447 .min = 1560,
448 .max = 3510,
449};
450
451static void slots_fan_tick(void)
452{
453 s32 power;
454 int speed;
455 int err;
456
457 if (!slots_fan || !slots_power)
458 return;
459 if (!slots_started) {
460 /* first time; initialize things */
461 wf_pid_init(&slots_pid, &slots_param);
462 slots_started = 1;
463 }
464
465 err = slots_power->ops->get_value(slots_power, &power);
466 if (err) {
467 printk(KERN_WARNING "windfarm: slots power sensor error %d\n",
468 err);
469 failure_state |= FAILURE_SENSOR;
470 wf_control_set_max(slots_fan);
471 return;
472 }
473 speed = wf_pid_run(&slots_pid, power);
474 DBG_LOTS("slots PID power=%d.%.3d speed=%d\n",
475 FIX32TOPRINT(power), speed);
476
477 err = slots_fan->ops->set_value(slots_fan, speed);
478 if (err) {
479 printk(KERN_WARNING "windfarm: slots fan error %d\n", err);
480 failure_state |= FAILURE_FAN;
481 }
482}
483
484static void set_fail_state(void)
485{
486 int i;
487
488 if (cpufreq_clamp)
489 wf_control_set_max(cpufreq_clamp);
490 for (i = 0; i < NR_CPU_FANS; ++i)
491 if (cpu_fans[i])
492 wf_control_set_max(cpu_fans[i]);
493 if (backside_fan)
494 wf_control_set_max(backside_fan);
495 if (slots_fan)
496 wf_control_set_max(slots_fan);
497 if (drive_bay_fan)
498 wf_control_set_max(drive_bay_fan);
499}
500
501static void pm112_tick(void)
502{
503 int i, last_failure;
504
505 if (!started) {
506 started = 1;
507 for (i = 0; i < nr_cores; ++i) {
508 if (create_cpu_loop(i) < 0) {
509 failure_state = FAILURE_PERM;
510 set_fail_state();
511 break;
512 }
513 }
514 DBG_LOTS("cpu_all_tmax=%d.%03d\n", FIX32TOPRINT(cpu_all_tmax));
515
516#ifdef HACKED_OVERTEMP
517 cpu_all_tmax = 60 << 16;
518#endif
519 }
520
521 /* Permanent failure, bail out */
522 if (failure_state & FAILURE_PERM)
523 return;
524 /* Clear all failure bits except low overtemp which will be eventually
525 * cleared by the control loop itself
526 */
527 last_failure = failure_state;
528 failure_state &= FAILURE_LOW_OVERTEMP;
529 cpu_fans_tick();
530 backside_fan_tick();
531 slots_fan_tick();
532 drive_bay_fan_tick();
533
534 DBG_LOTS("last_failure: 0x%x, failure_state: %x\n",
535 last_failure, failure_state);
536
537 /* Check for failures. Any failure causes cpufreq clamping */
538 if (failure_state && last_failure == 0 && cpufreq_clamp)
539 wf_control_set_max(cpufreq_clamp);
540 if (failure_state == 0 && last_failure && cpufreq_clamp)
541 wf_control_set_min(cpufreq_clamp);
542
543 /* That's it for now, we might want to deal with other failures
544 * differently in the future though
545 */
546}
547
548static void pm112_new_control(struct wf_control *ct)
549{
550 int i, max_exhaust;
551
552 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
553 if (wf_get_control(ct) == 0)
554 cpufreq_clamp = ct;
555 }
556
557 for (i = 0; i < NR_CPU_FANS; ++i) {
558 if (!strcmp(ct->name, cpu_fan_names[i])) {
559 if (cpu_fans[i] == NULL && wf_get_control(ct) == 0)
560 cpu_fans[i] = ct;
561 break;
562 }
563 }
564 if (i >= NR_CPU_FANS) {
565 /* not a CPU fan, try the others */
566 if (!strcmp(ct->name, "backside-fan")) {
567 if (backside_fan == NULL && wf_get_control(ct) == 0)
568 backside_fan = ct;
569 } else if (!strcmp(ct->name, "slots-fan")) {
570 if (slots_fan == NULL && wf_get_control(ct) == 0)
571 slots_fan = ct;
572 } else if (!strcmp(ct->name, "drive-bay-fan")) {
573 if (drive_bay_fan == NULL && wf_get_control(ct) == 0)
574 drive_bay_fan = ct;
575 }
576 return;
577 }
578
579 for (i = 0; i < CPU_FANS_REQD; ++i)
580 if (cpu_fans[i] == NULL)
581 return;
582
583 /* work out pump scaling factors */
584 max_exhaust = cpu_fans[0]->ops->get_max(cpu_fans[0]);
585 for (i = FIRST_PUMP; i <= LAST_PUMP; ++i)
586 if ((ct = cpu_fans[i]) != NULL)
587 cpu_fan_scale[i] =
588 ct->ops->get_max(ct) * 100 / max_exhaust;
589
590 have_all_controls = 1;
591}
592
593static void pm112_new_sensor(struct wf_sensor *sr)
594{
595 unsigned int i;
596
597 if (have_all_sensors)
598 return;
599 if (!strncmp(sr->name, "cpu-temp-", 9)) {
600 i = sr->name[9] - '0';
601 if (sr->name[10] == 0 && i < NR_CORES &&
602 sens_cpu_temp[i] == NULL && wf_get_sensor(sr) == 0)
603 sens_cpu_temp[i] = sr;
604
605 } else if (!strncmp(sr->name, "cpu-power-", 10)) {
606 i = sr->name[10] - '0';
607 if (sr->name[11] == 0 && i < NR_CORES &&
608 sens_cpu_power[i] == NULL && wf_get_sensor(sr) == 0)
609 sens_cpu_power[i] = sr;
610 } else if (!strcmp(sr->name, "hd-temp")) {
611 if (hd_temp == NULL && wf_get_sensor(sr) == 0)
612 hd_temp = sr;
613 } else if (!strcmp(sr->name, "slots-power")) {
614 if (slots_power == NULL && wf_get_sensor(sr) == 0)
615 slots_power = sr;
616 } else if (!strcmp(sr->name, "u4-temp")) {
617 if (u4_temp == NULL && wf_get_sensor(sr) == 0)
618 u4_temp = sr;
619 } else
620 return;
621
622 /* check if we have all the sensors we need */
623 for (i = 0; i < nr_cores; ++i)
624 if (sens_cpu_temp[i] == NULL || sens_cpu_power[i] == NULL)
625 return;
626
627 have_all_sensors = 1;
628}
629
630static int pm112_wf_notify(struct notifier_block *self,
631 unsigned long event, void *data)
632{
633 switch (event) {
634 case WF_EVENT_NEW_SENSOR:
635 pm112_new_sensor(data);
636 break;
637 case WF_EVENT_NEW_CONTROL:
638 pm112_new_control(data);
639 break;
640 case WF_EVENT_TICK:
641 if (have_all_controls && have_all_sensors)
642 pm112_tick();
643 }
644 return 0;
645}
646
647static struct notifier_block pm112_events = {
648 .notifier_call = pm112_wf_notify,
649};
650
651static int wf_pm112_probe(struct device *dev)
652{
653 wf_register_client(&pm112_events);
654 return 0;
655}
656
657static int wf_pm112_remove(struct device *dev)
658{
659 wf_unregister_client(&pm112_events);
660 /* should release all sensors and controls */
661 return 0;
662}
663
664static struct device_driver wf_pm112_driver = {
665 .name = "windfarm",
666 .bus = &platform_bus_type,
667 .probe = wf_pm112_probe,
668 .remove = wf_pm112_remove,
669};
670
671static int __init wf_pm112_init(void)
672{
673 struct device_node *cpu;
674
675 if (!machine_is_compatible("PowerMac11,2"))
676 return -ENODEV;
677
678 /* Count the number of CPU cores */
679 nr_cores = 0;
680 for (cpu = NULL; (cpu = of_find_node_by_type(cpu, "cpu")) != NULL; )
681 ++nr_cores;
682
683 printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n");
684 driver_register(&wf_pm112_driver);
685 return 0;
686}
687
688static void __exit wf_pm112_exit(void)
689{
690 driver_unregister(&wf_pm112_driver);
691}
692
693module_init(wf_pm112_init);
694module_exit(wf_pm112_exit);
695
696MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
697MODULE_DESCRIPTION("Thermal control for PowerMac11,2");
698MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c
index eb69a601e765..f1df6efcbe68 100644
--- a/drivers/macintosh/windfarm_pm81.c
+++ b/drivers/macintosh/windfarm_pm81.c
@@ -538,45 +538,6 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
538 } 538 }
539} 539}
540 540
541
542/*
543 * ****** Attributes ******
544 *
545 */
546
547#define BUILD_SHOW_FUNC_FIX(name, data) \
548static ssize_t show_##name(struct device *dev, \
549 struct device_attribute *attr, \
550 char *buf) \
551{ \
552 ssize_t r; \
553 s32 val = 0; \
554 data->ops->get_value(data, &val); \
555 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \
556 return r; \
557} \
558static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
559
560
561#define BUILD_SHOW_FUNC_INT(name, data) \
562static ssize_t show_##name(struct device *dev, \
563 struct device_attribute *attr, \
564 char *buf) \
565{ \
566 s32 val = 0; \
567 data->ops->get_value(data, &val); \
568 return sprintf(buf, "%d", val); \
569} \
570static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
571
572BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);
573BUILD_SHOW_FUNC_INT(sys_fan, fan_system);
574BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);
575
576BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);
577BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);
578BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);
579
580/* 541/*
581 * ****** Setup / Init / Misc ... ****** 542 * ****** Setup / Init / Misc ... ******
582 * 543 *
@@ -654,17 +615,13 @@ static void wf_smu_new_control(struct wf_control *ct)
654 return; 615 return;
655 616
656 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) { 617 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) {
657 if (wf_get_control(ct) == 0) { 618 if (wf_get_control(ct) == 0)
658 fan_cpu_main = ct; 619 fan_cpu_main = ct;
659 device_create_file(wf_smu_dev, &dev_attr_cpu_fan);
660 }
661 } 620 }
662 621
663 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) { 622 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) {
664 if (wf_get_control(ct) == 0) { 623 if (wf_get_control(ct) == 0)
665 fan_system = ct; 624 fan_system = ct;
666 device_create_file(wf_smu_dev, &dev_attr_sys_fan);
667 }
668 } 625 }
669 626
670 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { 627 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
@@ -683,10 +640,8 @@ static void wf_smu_new_control(struct wf_control *ct)
683 } 640 }
684 641
685 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 642 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {
686 if (wf_get_control(ct) == 0) { 643 if (wf_get_control(ct) == 0)
687 fan_hd = ct; 644 fan_hd = ct;
688 device_create_file(wf_smu_dev, &dev_attr_hd_fan);
689 }
690 } 645 }
691 646
692 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp) 647 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp)
@@ -699,24 +654,18 @@ static void wf_smu_new_sensor(struct wf_sensor *sr)
699 return; 654 return;
700 655
701 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 656 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {
702 if (wf_get_sensor(sr) == 0) { 657 if (wf_get_sensor(sr) == 0)
703 sensor_cpu_power = sr; 658 sensor_cpu_power = sr;
704 device_create_file(wf_smu_dev, &dev_attr_cpu_power);
705 }
706 } 659 }
707 660
708 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 661 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {
709 if (wf_get_sensor(sr) == 0) { 662 if (wf_get_sensor(sr) == 0)
710 sensor_cpu_temp = sr; 663 sensor_cpu_temp = sr;
711 device_create_file(wf_smu_dev, &dev_attr_cpu_temp);
712 }
713 } 664 }
714 665
715 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 666 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {
716 if (wf_get_sensor(sr) == 0) { 667 if (wf_get_sensor(sr) == 0)
717 sensor_hd_temp = sr; 668 sensor_hd_temp = sr;
718 device_create_file(wf_smu_dev, &dev_attr_hd_temp);
719 }
720 } 669 }
721 670
722 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp) 671 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp)
@@ -794,32 +743,20 @@ static int wf_smu_remove(struct device *ddev)
794 * with that except by adding locks all over... I'll do that 743 * with that except by adding locks all over... I'll do that
795 * eventually but heh, who ever rmmod this module anyway ? 744 * eventually but heh, who ever rmmod this module anyway ?
796 */ 745 */
797 if (sensor_cpu_power) { 746 if (sensor_cpu_power)
798 device_remove_file(wf_smu_dev, &dev_attr_cpu_power);
799 wf_put_sensor(sensor_cpu_power); 747 wf_put_sensor(sensor_cpu_power);
800 } 748 if (sensor_cpu_temp)
801 if (sensor_cpu_temp) {
802 device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);
803 wf_put_sensor(sensor_cpu_temp); 749 wf_put_sensor(sensor_cpu_temp);
804 } 750 if (sensor_hd_temp)
805 if (sensor_hd_temp) {
806 device_remove_file(wf_smu_dev, &dev_attr_hd_temp);
807 wf_put_sensor(sensor_hd_temp); 751 wf_put_sensor(sensor_hd_temp);
808 }
809 752
810 /* Release all controls */ 753 /* Release all controls */
811 if (fan_cpu_main) { 754 if (fan_cpu_main)
812 device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);
813 wf_put_control(fan_cpu_main); 755 wf_put_control(fan_cpu_main);
814 } 756 if (fan_hd)
815 if (fan_hd) {
816 device_remove_file(wf_smu_dev, &dev_attr_hd_fan);
817 wf_put_control(fan_hd); 757 wf_put_control(fan_hd);
818 } 758 if (fan_system)
819 if (fan_system) {
820 device_remove_file(wf_smu_dev, &dev_attr_sys_fan);
821 wf_put_control(fan_system); 759 wf_put_control(fan_system);
822 }
823 if (cpufreq_clamp) 760 if (cpufreq_clamp)
824 wf_put_control(cpufreq_clamp); 761 wf_put_control(cpufreq_clamp);
825 762
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index 43243cf7410b..0d6372e96d32 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -458,45 +458,6 @@ static void wf_smu_slots_fans_tick(struct wf_smu_slots_fans_state *st)
458 458
459 459
460/* 460/*
461 * ****** Attributes ******
462 *
463 */
464
465#define BUILD_SHOW_FUNC_FIX(name, data) \
466static ssize_t show_##name(struct device *dev, \
467 struct device_attribute *attr, \
468 char *buf) \
469{ \
470 ssize_t r; \
471 s32 val = 0; \
472 data->ops->get_value(data, &val); \
473 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \
474 return r; \
475} \
476static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
477
478
479#define BUILD_SHOW_FUNC_INT(name, data) \
480static ssize_t show_##name(struct device *dev, \
481 struct device_attribute *attr, \
482 char *buf) \
483{ \
484 s32 val = 0; \
485 data->ops->get_value(data, &val); \
486 return sprintf(buf, "%d", val); \
487} \
488static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
489
490BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);
491BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);
492BUILD_SHOW_FUNC_INT(slots_fan, fan_slots);
493
494BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);
495BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);
496BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);
497BUILD_SHOW_FUNC_FIX(slots_power, sensor_slots_power);
498
499/*
500 * ****** Setup / Init / Misc ... ****** 461 * ****** Setup / Init / Misc ... ******
501 * 462 *
502 */ 463 */
@@ -581,10 +542,8 @@ static void wf_smu_new_control(struct wf_control *ct)
581 return; 542 return;
582 543
583 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) { 544 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) {
584 if (wf_get_control(ct) == 0) { 545 if (wf_get_control(ct) == 0)
585 fan_cpu_main = ct; 546 fan_cpu_main = ct;
586 device_create_file(wf_smu_dev, &dev_attr_cpu_fan);
587 }
588 } 547 }
589 548
590 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) { 549 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) {
@@ -603,17 +562,13 @@ static void wf_smu_new_control(struct wf_control *ct)
603 } 562 }
604 563
605 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 564 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {
606 if (wf_get_control(ct) == 0) { 565 if (wf_get_control(ct) == 0)
607 fan_hd = ct; 566 fan_hd = ct;
608 device_create_file(wf_smu_dev, &dev_attr_hd_fan);
609 }
610 } 567 }
611 568
612 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) { 569 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) {
613 if (wf_get_control(ct) == 0) { 570 if (wf_get_control(ct) == 0)
614 fan_slots = ct; 571 fan_slots = ct;
615 device_create_file(wf_smu_dev, &dev_attr_slots_fan);
616 }
617 } 572 }
618 573
619 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd && 574 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd &&
@@ -627,31 +582,23 @@ static void wf_smu_new_sensor(struct wf_sensor *sr)
627 return; 582 return;
628 583
629 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 584 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {
630 if (wf_get_sensor(sr) == 0) { 585 if (wf_get_sensor(sr) == 0)
631 sensor_cpu_power = sr; 586 sensor_cpu_power = sr;
632 device_create_file(wf_smu_dev, &dev_attr_cpu_power);
633 }
634 } 587 }
635 588
636 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 589 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {
637 if (wf_get_sensor(sr) == 0) { 590 if (wf_get_sensor(sr) == 0)
638 sensor_cpu_temp = sr; 591 sensor_cpu_temp = sr;
639 device_create_file(wf_smu_dev, &dev_attr_cpu_temp);
640 }
641 } 592 }
642 593
643 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 594 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {
644 if (wf_get_sensor(sr) == 0) { 595 if (wf_get_sensor(sr) == 0)
645 sensor_hd_temp = sr; 596 sensor_hd_temp = sr;
646 device_create_file(wf_smu_dev, &dev_attr_hd_temp);
647 }
648 } 597 }
649 598
650 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) { 599 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) {
651 if (wf_get_sensor(sr) == 0) { 600 if (wf_get_sensor(sr) == 0)
652 sensor_slots_power = sr; 601 sensor_slots_power = sr;
653 device_create_file(wf_smu_dev, &dev_attr_slots_power);
654 }
655 } 602 }
656 603
657 if (sensor_cpu_power && sensor_cpu_temp && 604 if (sensor_cpu_power && sensor_cpu_temp &&
@@ -720,40 +667,26 @@ static int wf_smu_remove(struct device *ddev)
720 * with that except by adding locks all over... I'll do that 667 * with that except by adding locks all over... I'll do that
721 * eventually but heh, who ever rmmod this module anyway ? 668 * eventually but heh, who ever rmmod this module anyway ?
722 */ 669 */
723 if (sensor_cpu_power) { 670 if (sensor_cpu_power)
724 device_remove_file(wf_smu_dev, &dev_attr_cpu_power);
725 wf_put_sensor(sensor_cpu_power); 671 wf_put_sensor(sensor_cpu_power);
726 } 672 if (sensor_cpu_temp)
727 if (sensor_cpu_temp) {
728 device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);
729 wf_put_sensor(sensor_cpu_temp); 673 wf_put_sensor(sensor_cpu_temp);
730 } 674 if (sensor_hd_temp)
731 if (sensor_hd_temp) {
732 device_remove_file(wf_smu_dev, &dev_attr_hd_temp);
733 wf_put_sensor(sensor_hd_temp); 675 wf_put_sensor(sensor_hd_temp);
734 } 676 if (sensor_slots_power)
735 if (sensor_slots_power) {
736 device_remove_file(wf_smu_dev, &dev_attr_slots_power);
737 wf_put_sensor(sensor_slots_power); 677 wf_put_sensor(sensor_slots_power);
738 }
739 678
740 /* Release all controls */ 679 /* Release all controls */
741 if (fan_cpu_main) { 680 if (fan_cpu_main)
742 device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);
743 wf_put_control(fan_cpu_main); 681 wf_put_control(fan_cpu_main);
744 }
745 if (fan_cpu_second) 682 if (fan_cpu_second)
746 wf_put_control(fan_cpu_second); 683 wf_put_control(fan_cpu_second);
747 if (fan_cpu_third) 684 if (fan_cpu_third)
748 wf_put_control(fan_cpu_third); 685 wf_put_control(fan_cpu_third);
749 if (fan_hd) { 686 if (fan_hd)
750 device_remove_file(wf_smu_dev, &dev_attr_hd_fan);
751 wf_put_control(fan_hd); 687 wf_put_control(fan_hd);
752 } 688 if (fan_slots)
753 if (fan_slots) {
754 device_remove_file(wf_smu_dev, &dev_attr_slots_fan);
755 wf_put_control(fan_slots); 689 wf_put_control(fan_slots);
756 }
757 if (cpufreq_clamp) 690 if (cpufreq_clamp)
758 wf_put_control(cpufreq_clamp); 691 wf_put_control(cpufreq_clamp);
759 692
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 4d811600bdab..a9e88edc0c72 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -24,7 +24,7 @@
24 24
25#include "windfarm.h" 25#include "windfarm.h"
26 26
27#define VERSION "0.3" 27#define VERSION "0.4"
28 28
29#undef DEBUG 29#undef DEBUG
30 30
@@ -34,6 +34,8 @@
34#define DBG(args...) do { } while(0) 34#define DBG(args...) do { } while(0)
35#endif 35#endif
36 36
37static int smu_supports_new_fans_ops = 1;
38
37/* 39/*
38 * SMU fans control object 40 * SMU fans control object
39 */ 41 */
@@ -59,23 +61,49 @@ static int smu_set_fan(int pwm, u8 id, u16 value)
59 61
60 /* Fill SMU command structure */ 62 /* Fill SMU command structure */
61 cmd.cmd = SMU_CMD_FAN_COMMAND; 63 cmd.cmd = SMU_CMD_FAN_COMMAND;
62 cmd.data_len = 14; 64
65 /* The SMU has an "old" and a "new" way of setting the fan speed
66 * Unfortunately, I found no reliable way to know which one works
67 * on a given machine model. After some investigations it appears
68 * that MacOS X just tries the new one, and if it fails fallbacks
69 * to the old ones ... Ugh.
70 */
71 retry:
72 if (smu_supports_new_fans_ops) {
73 buffer[0] = 0x30;
74 buffer[1] = id;
75 *((u16 *)(&buffer[2])) = value;
76 cmd.data_len = 4;
77 } else {
78 if (id > 7)
79 return -EINVAL;
80 /* Fill argument buffer */
81 memset(buffer, 0, 16);
82 buffer[0] = pwm ? 0x10 : 0x00;
83 buffer[1] = 0x01 << id;
84 *((u16 *)&buffer[2 + id * 2]) = value;
85 cmd.data_len = 14;
86 }
87
63 cmd.reply_len = 16; 88 cmd.reply_len = 16;
64 cmd.data_buf = cmd.reply_buf = buffer; 89 cmd.data_buf = cmd.reply_buf = buffer;
65 cmd.status = 0; 90 cmd.status = 0;
66 cmd.done = smu_done_complete; 91 cmd.done = smu_done_complete;
67 cmd.misc = &comp; 92 cmd.misc = &comp;
68 93
69 /* Fill argument buffer */
70 memset(buffer, 0, 16);
71 buffer[0] = pwm ? 0x10 : 0x00;
72 buffer[1] = 0x01 << id;
73 *((u16 *)&buffer[2 + id * 2]) = value;
74
75 rc = smu_queue_cmd(&cmd); 94 rc = smu_queue_cmd(&cmd);
76 if (rc) 95 if (rc)
77 return rc; 96 return rc;
78 wait_for_completion(&comp); 97 wait_for_completion(&comp);
98
99 /* Handle fallback (see coment above) */
100 if (cmd.status != 0 && smu_supports_new_fans_ops) {
101 printk(KERN_WARNING "windfarm: SMU failed new fan command "
102 "falling back to old method\n");
103 smu_supports_new_fans_ops = 0;
104 goto retry;
105 }
106
79 return cmd.status; 107 return cmd.status;
80} 108}
81 109
@@ -158,19 +186,29 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
158 186
159 /* Names used on desktop models */ 187 /* Names used on desktop models */
160 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") || 188 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") ||
161 !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan")) 189 !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan") ||
190 !strcmp(l, "CPU A EXHAUST"))
162 fct->ctrl.name = "cpu-rear-fan-0"; 191 fct->ctrl.name = "cpu-rear-fan-0";
163 else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1")) 192 else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1") ||
193 !strcmp(l, "CPU B EXHAUST"))
164 fct->ctrl.name = "cpu-rear-fan-1"; 194 fct->ctrl.name = "cpu-rear-fan-1";
165 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") || 195 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") ||
166 !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan")) 196 !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan") ||
197 !strcmp(l, "CPU A INTAKE"))
167 fct->ctrl.name = "cpu-front-fan-0"; 198 fct->ctrl.name = "cpu-front-fan-0";
168 else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1")) 199 else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1") ||
200 !strcmp(l, "CPU B INTAKE"))
169 fct->ctrl.name = "cpu-front-fan-1"; 201 fct->ctrl.name = "cpu-front-fan-1";
170 else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan")) 202 else if (!strcmp(l, "CPU A PUMP"))
203 fct->ctrl.name = "cpu-pump-0";
204 else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||
205 !strcmp(l, "EXPANSION SLOTS INTAKE"))
171 fct->ctrl.name = "slots-fan"; 206 fct->ctrl.name = "slots-fan";
172 else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay")) 207 else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay") ||
208 !strcmp(l, "DRIVE BAY A INTAKE"))
173 fct->ctrl.name = "drive-bay-fan"; 209 fct->ctrl.name = "drive-bay-fan";
210 else if (!strcmp(l, "BACKSIDE"))
211 fct->ctrl.name = "backside-fan";
174 212
175 /* Names used on iMac models */ 213 /* Names used on iMac models */
176 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan")) 214 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan"))
@@ -223,7 +261,8 @@ static int __init smu_controls_init(void)
223 261
224 /* Look for RPM fans */ 262 /* Look for RPM fans */
225 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;) 263 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;)
226 if (!strcmp(fans->name, "rpm-fans")) 264 if (!strcmp(fans->name, "rpm-fans") ||
265 device_is_compatible(fans, "smu-rpm-fans"))
227 break; 266 break;
228 for (fan = NULL; 267 for (fan = NULL;
229 fans && (fan = of_get_next_child(fans, fan)) != NULL;) { 268 fans && (fan = of_get_next_child(fans, fan)) != NULL;) {
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
new file mode 100644
index 000000000000..3a32c59494f2
--- /dev/null
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -0,0 +1,418 @@
1/*
2 * Windfarm PowerMac thermal control. SMU "satellite" controller sensors.
3 *
4 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
5 *
6 * Released under the terms of the GNU GPL v2.
7 */
8
9#include <linux/types.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/init.h>
14#include <linux/wait.h>
15#include <linux/i2c.h>
16#include <linux/i2c-dev.h>
17#include <asm/semaphore.h>
18#include <asm/prom.h>
19#include <asm/smu.h>
20#include <asm/pmac_low_i2c.h>
21
22#include "windfarm.h"
23
24#define VERSION "0.2"
25
26#define DEBUG
27
28#ifdef DEBUG
29#define DBG(args...) printk(args)
30#else
31#define DBG(args...) do { } while(0)
32#endif
33
34/* If the cache is older than 800ms we'll refetch it */
35#define MAX_AGE msecs_to_jiffies(800)
36
37struct wf_sat {
38 int nr;
39 atomic_t refcnt;
40 struct semaphore mutex;
41 unsigned long last_read; /* jiffies when cache last updated */
42 u8 cache[16];
43 struct i2c_client i2c;
44 struct device_node *node;
45};
46
47static struct wf_sat *sats[2];
48
49struct wf_sat_sensor {
50 int index;
51 int index2; /* used for power sensors */
52 int shift;
53 struct wf_sat *sat;
54 struct wf_sensor sens;
55};
56
57#define wf_to_sat(c) container_of(c, struct wf_sat_sensor, sens)
58#define i2c_to_sat(c) container_of(c, struct wf_sat, i2c)
59
60static int wf_sat_attach(struct i2c_adapter *adapter);
61static int wf_sat_detach(struct i2c_client *client);
62
63static struct i2c_driver wf_sat_driver = {
64 .driver = {
65 .name = "wf_smu_sat",
66 },
67 .attach_adapter = wf_sat_attach,
68 .detach_client = wf_sat_detach,
69};
70
71/*
72 * XXX i2c_smbus_read_i2c_block_data doesn't pass the requested
73 * length down to the low-level driver, so we use this, which
74 * works well enough with the SMU i2c driver code...
75 */
76static int sat_read_block(struct i2c_client *client, u8 command,
77 u8 *values, int len)
78{
79 union i2c_smbus_data data;
80 int err;
81
82 data.block[0] = len;
83 err = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
84 I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA,
85 &data);
86 if (!err)
87 memcpy(values, data.block, len);
88 return err;
89}
90
91struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
92 unsigned int *size)
93{
94 struct wf_sat *sat;
95 int err;
96 unsigned int i, len;
97 u8 *buf;
98 u8 data[4];
99
100 /* TODO: Add the resulting partition to the device-tree */
101
102 if (sat_id > 1 || (sat = sats[sat_id]) == NULL)
103 return NULL;
104
105 err = i2c_smbus_write_word_data(&sat->i2c, 8, id << 8);
106 if (err) {
107 printk(KERN_ERR "smu_sat_get_sdb_part wr error %d\n", err);
108 return NULL;
109 }
110
111 len = i2c_smbus_read_word_data(&sat->i2c, 9);
112 if (len < 0) {
113 printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n");
114 return NULL;
115 }
116 if (len == 0) {
117 printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id);
118 return NULL;
119 }
120
121 len = le16_to_cpu(len);
122 len = (len + 3) & ~3;
123 buf = kmalloc(len, GFP_KERNEL);
124 if (buf == NULL)
125 return NULL;
126
127 for (i = 0; i < len; i += 4) {
128 err = sat_read_block(&sat->i2c, 0xa, data, 4);
129 if (err) {
130 printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n",
131 err);
132 goto fail;
133 }
134 buf[i] = data[1];
135 buf[i+1] = data[0];
136 buf[i+2] = data[3];
137 buf[i+3] = data[2];
138 }
139#ifdef DEBUG
140 DBG(KERN_DEBUG "sat %d partition %x:", sat_id, id);
141 for (i = 0; i < len; ++i)
142 DBG(" %x", buf[i]);
143 DBG("\n");
144#endif
145
146 if (size)
147 *size = len;
148 return (struct smu_sdbp_header *) buf;
149
150 fail:
151 kfree(buf);
152 return NULL;
153}
154
155/* refresh the cache */
156static int wf_sat_read_cache(struct wf_sat *sat)
157{
158 int err;
159
160 err = sat_read_block(&sat->i2c, 0x3f, sat->cache, 16);
161 if (err)
162 return err;
163 sat->last_read = jiffies;
164#ifdef LOTSA_DEBUG
165 {
166 int i;
167 DBG(KERN_DEBUG "wf_sat_get: data is");
168 for (i = 0; i < 16; ++i)
169 DBG(" %.2x", sat->cache[i]);
170 DBG("\n");
171 }
172#endif
173 return 0;
174}
175
176static int wf_sat_get(struct wf_sensor *sr, s32 *value)
177{
178 struct wf_sat_sensor *sens = wf_to_sat(sr);
179 struct wf_sat *sat = sens->sat;
180 int i, err;
181 s32 val;
182
183 if (sat->i2c.adapter == NULL)
184 return -ENODEV;
185
186 down(&sat->mutex);
187 if (time_after(jiffies, (sat->last_read + MAX_AGE))) {
188 err = wf_sat_read_cache(sat);
189 if (err)
190 goto fail;
191 }
192
193 i = sens->index * 2;
194 val = ((sat->cache[i] << 8) + sat->cache[i+1]) << sens->shift;
195 if (sens->index2 >= 0) {
196 i = sens->index2 * 2;
197 /* 4.12 * 8.8 -> 12.20; shift right 4 to get 16.16 */
198 val = (val * ((sat->cache[i] << 8) + sat->cache[i+1])) >> 4;
199 }
200
201 *value = val;
202 err = 0;
203
204 fail:
205 up(&sat->mutex);
206 return err;
207}
208
209static void wf_sat_release(struct wf_sensor *sr)
210{
211 struct wf_sat_sensor *sens = wf_to_sat(sr);
212 struct wf_sat *sat = sens->sat;
213
214 if (atomic_dec_and_test(&sat->refcnt)) {
215 if (sat->i2c.adapter) {
216 i2c_detach_client(&sat->i2c);
217 sat->i2c.adapter = NULL;
218 }
219 if (sat->nr >= 0)
220 sats[sat->nr] = NULL;
221 kfree(sat);
222 }
223 kfree(sens);
224}
225
226static struct wf_sensor_ops wf_sat_ops = {
227 .get_value = wf_sat_get,
228 .release = wf_sat_release,
229 .owner = THIS_MODULE,
230};
231
232static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
233{
234 struct wf_sat *sat;
235 struct wf_sat_sensor *sens;
236 u32 *reg;
237 char *loc, *type;
238 u8 addr, chip, core;
239 struct device_node *child;
240 int shift, cpu, index;
241 char *name;
242 int vsens[2], isens[2];
243
244 reg = (u32 *) get_property(dev, "reg", NULL);
245 if (reg == NULL)
246 return;
247 addr = *reg;
248 DBG(KERN_DEBUG "wf_sat: creating sat at address %x\n", addr);
249
250 sat = kzalloc(sizeof(struct wf_sat), GFP_KERNEL);
251 if (sat == NULL)
252 return;
253 sat->nr = -1;
254 sat->node = of_node_get(dev);
255 atomic_set(&sat->refcnt, 0);
256 init_MUTEX(&sat->mutex);
257 sat->i2c.addr = (addr >> 1) & 0x7f;
258 sat->i2c.adapter = adapter;
259 sat->i2c.driver = &wf_sat_driver;
260 strncpy(sat->i2c.name, "smu-sat", I2C_NAME_SIZE-1);
261
262 if (i2c_attach_client(&sat->i2c)) {
263 printk(KERN_ERR "windfarm: failed to attach smu-sat to i2c\n");
264 goto fail;
265 }
266
267 vsens[0] = vsens[1] = -1;
268 isens[0] = isens[1] = -1;
269 child = NULL;
270 while ((child = of_get_next_child(dev, child)) != NULL) {
271 reg = (u32 *) get_property(child, "reg", NULL);
272 type = get_property(child, "device_type", NULL);
273 loc = get_property(child, "location", NULL);
274 if (reg == NULL || loc == NULL)
275 continue;
276
277 /* the cooked sensors are between 0x30 and 0x37 */
278 if (*reg < 0x30 || *reg > 0x37)
279 continue;
280 index = *reg - 0x30;
281
282 /* expect location to be CPU [AB][01] ... */
283 if (strncmp(loc, "CPU ", 4) != 0)
284 continue;
285 chip = loc[4] - 'A';
286 core = loc[5] - '0';
287 if (chip > 1 || core > 1) {
288 printk(KERN_ERR "wf_sat_create: don't understand "
289 "location %s for %s\n", loc, child->full_name);
290 continue;
291 }
292 cpu = 2 * chip + core;
293 if (sat->nr < 0)
294 sat->nr = chip;
295 else if (sat->nr != chip) {
296 printk(KERN_ERR "wf_sat_create: can't cope with "
297 "multiple CPU chips on one SAT (%s)\n", loc);
298 continue;
299 }
300
301 if (strcmp(type, "voltage-sensor") == 0) {
302 name = "cpu-voltage";
303 shift = 4;
304 vsens[core] = index;
305 } else if (strcmp(type, "current-sensor") == 0) {
306 name = "cpu-current";
307 shift = 8;
308 isens[core] = index;
309 } else if (strcmp(type, "temp-sensor") == 0) {
310 name = "cpu-temp";
311 shift = 10;
312 } else
313 continue; /* hmmm shouldn't happen */
314
315 /* the +16 is enough for "cpu-voltage-n" */
316 sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);
317 if (sens == NULL) {
318 printk(KERN_ERR "wf_sat_create: couldn't create "
319 "%s sensor %d (no memory)\n", name, cpu);
320 continue;
321 }
322 sens->index = index;
323 sens->index2 = -1;
324 sens->shift = shift;
325 sens->sat = sat;
326 atomic_inc(&sat->refcnt);
327 sens->sens.ops = &wf_sat_ops;
328 sens->sens.name = (char *) (sens + 1);
329 snprintf(sens->sens.name, 16, "%s-%d", name, cpu);
330
331 if (wf_register_sensor(&sens->sens)) {
332 atomic_dec(&sat->refcnt);
333 kfree(sens);
334 }
335 }
336
337 /* make the power sensors */
338 for (core = 0; core < 2; ++core) {
339 if (vsens[core] < 0 || isens[core] < 0)
340 continue;
341 cpu = 2 * sat->nr + core;
342 sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);
343 if (sens == NULL) {
344 printk(KERN_ERR "wf_sat_create: couldn't create power "
345 "sensor %d (no memory)\n", cpu);
346 continue;
347 }
348 sens->index = vsens[core];
349 sens->index2 = isens[core];
350 sens->shift = 0;
351 sens->sat = sat;
352 atomic_inc(&sat->refcnt);
353 sens->sens.ops = &wf_sat_ops;
354 sens->sens.name = (char *) (sens + 1);
355 snprintf(sens->sens.name, 16, "cpu-power-%d", cpu);
356
357 if (wf_register_sensor(&sens->sens)) {
358 atomic_dec(&sat->refcnt);
359 kfree(sens);
360 }
361 }
362
363 if (sat->nr >= 0)
364 sats[sat->nr] = sat;
365
366 return;
367
368 fail:
369 kfree(sat);
370}
371
372static int wf_sat_attach(struct i2c_adapter *adapter)
373{
374 struct device_node *busnode, *dev = NULL;
375 struct pmac_i2c_bus *bus;
376
377 bus = pmac_i2c_adapter_to_bus(adapter);
378 if (bus == NULL)
379 return -ENODEV;
380 busnode = pmac_i2c_get_bus_node(bus);
381
382 while ((dev = of_get_next_child(busnode, dev)) != NULL)
383 if (device_is_compatible(dev, "smu-sat"))
384 wf_sat_create(adapter, dev);
385 return 0;
386}
387
388static int wf_sat_detach(struct i2c_client *client)
389{
390 struct wf_sat *sat = i2c_to_sat(client);
391
392 /* XXX TODO */
393
394 sat->i2c.adapter = NULL;
395 return 0;
396}
397
398static int __init sat_sensors_init(void)
399{
400 int err;
401
402 err = i2c_add_driver(&wf_sat_driver);
403 if (err < 0)
404 return err;
405 return 0;
406}
407
408static void __exit sat_sensors_exit(void)
409{
410 i2c_del_driver(&wf_sat_driver);
411}
412
413module_init(sat_sensors_init);
414/*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */
415
416MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
417MODULE_DESCRIPTION("SMU satellite sensors for PowerMac thermal control");
418MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c
index 1a00d9c75a23..bed25dcf8a1e 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -220,14 +220,29 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
220 !strcmp(l, "CPU T-Diode")) { 220 !strcmp(l, "CPU T-Diode")) {
221 ads->sens.ops = &smu_cputemp_ops; 221 ads->sens.ops = &smu_cputemp_ops;
222 ads->sens.name = "cpu-temp"; 222 ads->sens.name = "cpu-temp";
223 if (cpudiode == NULL) {
224 DBG("wf: cpudiode partition (%02x) not found\n",
225 SMU_SDB_CPUDIODE_ID);
226 goto fail;
227 }
223 } else if (!strcmp(c, "current-sensor") && 228 } else if (!strcmp(c, "current-sensor") &&
224 !strcmp(l, "CPU Current")) { 229 !strcmp(l, "CPU Current")) {
225 ads->sens.ops = &smu_cpuamp_ops; 230 ads->sens.ops = &smu_cpuamp_ops;
226 ads->sens.name = "cpu-current"; 231 ads->sens.name = "cpu-current";
232 if (cpuvcp == NULL) {
233 DBG("wf: cpuvcp partition (%02x) not found\n",
234 SMU_SDB_CPUVCP_ID);
235 goto fail;
236 }
227 } else if (!strcmp(c, "voltage-sensor") && 237 } else if (!strcmp(c, "voltage-sensor") &&
228 !strcmp(l, "CPU Voltage")) { 238 !strcmp(l, "CPU Voltage")) {
229 ads->sens.ops = &smu_cpuvolt_ops; 239 ads->sens.ops = &smu_cpuvolt_ops;
230 ads->sens.name = "cpu-voltage"; 240 ads->sens.name = "cpu-voltage";
241 if (cpuvcp == NULL) {
242 DBG("wf: cpuvcp partition (%02x) not found\n",
243 SMU_SDB_CPUVCP_ID);
244 goto fail;
245 }
231 } else if (!strcmp(c, "power-sensor") && 246 } else if (!strcmp(c, "power-sensor") &&
232 !strcmp(l, "Slots Power")) { 247 !strcmp(l, "Slots Power")) {
233 ads->sens.ops = &smu_slotspow_ops; 248 ads->sens.ops = &smu_slotspow_ops;
@@ -365,29 +380,22 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps)
365 return NULL; 380 return NULL;
366} 381}
367 382
368static int smu_fetch_param_partitions(void) 383static void smu_fetch_param_partitions(void)
369{ 384{
370 struct smu_sdbp_header *hdr; 385 struct smu_sdbp_header *hdr;
371 386
372 /* Get CPU voltage/current/power calibration data */ 387 /* Get CPU voltage/current/power calibration data */
373 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); 388 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL);
374 if (hdr == NULL) { 389 if (hdr != NULL) {
375 DBG("wf: cpuvcp partition (%02x) not found\n", 390 cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];
376 SMU_SDB_CPUVCP_ID); 391 /* Keep version around */
377 return -ENODEV; 392 cpuvcp_version = hdr->version;
378 } 393 }
379 cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];
380 /* Keep version around */
381 cpuvcp_version = hdr->version;
382 394
383 /* Get CPU diode calibration data */ 395 /* Get CPU diode calibration data */
384 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL); 396 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL);
385 if (hdr == NULL) { 397 if (hdr != NULL)
386 DBG("wf: cpudiode partition (%02x) not found\n", 398 cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];
387 SMU_SDB_CPUDIODE_ID);
388 return -ENODEV;
389 }
390 cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];
391 399
392 /* Get slots power calibration data if any */ 400 /* Get slots power calibration data if any */
393 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL); 401 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL);
@@ -398,23 +406,18 @@ static int smu_fetch_param_partitions(void)
398 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL); 406 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL);
399 if (hdr != NULL) 407 if (hdr != NULL)
400 debugswitches = (u8 *)&hdr[1]; 408 debugswitches = (u8 *)&hdr[1];
401
402 return 0;
403} 409}
404 410
405static int __init smu_sensors_init(void) 411static int __init smu_sensors_init(void)
406{ 412{
407 struct device_node *smu, *sensors, *s; 413 struct device_node *smu, *sensors, *s;
408 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL; 414 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL;
409 int rc;
410 415
411 if (!smu_present()) 416 if (!smu_present())
412 return -ENODEV; 417 return -ENODEV;
413 418
414 /* Get parameters partitions */ 419 /* Get parameters partitions */
415 rc = smu_fetch_param_partitions(); 420 smu_fetch_param_partitions();
416 if (rc)
417 return rc;
418 421
419 smu = of_find_node_by_type(NULL, "smu"); 422 smu = of_find_node_by_type(NULL, "smu");
420 if (smu == NULL) 423 if (smu == NULL)
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 130ea7f21f5e..12ebaf8bddca 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -151,7 +151,7 @@ static struct dvb_usb_properties dtt200u_properties = {
151 .cold_ids = { &dtt200u_usb_table[0], NULL }, 151 .cold_ids = { &dtt200u_usb_table[0], NULL },
152 .warm_ids = { &dtt200u_usb_table[1], NULL }, 152 .warm_ids = { &dtt200u_usb_table[1], NULL },
153 }, 153 },
154 { 0 }, 154 { NULL },
155 } 155 }
156}; 156};
157 157
@@ -192,7 +192,7 @@ static struct dvb_usb_properties wt220u_properties = {
192 .cold_ids = { &dtt200u_usb_table[2], NULL }, 192 .cold_ids = { &dtt200u_usb_table[2], NULL },
193 .warm_ids = { &dtt200u_usb_table[3], NULL }, 193 .warm_ids = { &dtt200u_usb_table[3], NULL },
194 }, 194 },
195 { 0 }, 195 { NULL },
196 } 196 }
197}; 197};
198 198
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 028204956bb0..3835235b68df 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -247,7 +247,7 @@ static struct dvb_usb_properties vp7045_properties = {
247 .cold_ids = { &vp7045_usb_table[2], NULL }, 247 .cold_ids = { &vp7045_usb_table[2], NULL },
248 .warm_ids = { &vp7045_usb_table[3], NULL }, 248 .warm_ids = { &vp7045_usb_table[3], NULL },
249 }, 249 },
250 { 0 }, 250 { NULL },
251 } 251 }
252}; 252};
253 253
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 297c32ab51e3..840fe0177121 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -167,29 +167,32 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
167 if (kp->clipcount > 2048) 167 if (kp->clipcount > 2048)
168 return -EINVAL; 168 return -EINVAL;
169 if (kp->clipcount) { 169 if (kp->clipcount) {
170 struct v4l2_clip32 *uclips = compat_ptr(up->clips); 170 struct v4l2_clip32 __user *uclips;
171 struct v4l2_clip *kclips; 171 struct v4l2_clip __user *kclips;
172 int n = kp->clipcount; 172 int n = kp->clipcount;
173 compat_caddr_t p;
173 174
175 if (get_user(p, &up->clips))
176 return -EFAULT;
177 uclips = compat_ptr(p);
174 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); 178 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
175 kp->clips = kclips; 179 kp->clips = kclips;
176 while (--n >= 0) { 180 while (--n >= 0) {
177 if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) || 181 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
178 copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 182 return -EFAULT;
183 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
179 return -EFAULT; 184 return -EFAULT;
180 kclips->next = n ? kclips + 1 : 0;
181 uclips += 1; 185 uclips += 1;
182 kclips += 1; 186 kclips += 1;
183 } 187 }
184 } else 188 } else
185 kp->clips = 0; 189 kp->clips = NULL;
186 return 0; 190 return 0;
187} 191}
188 192
189static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 193static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
190{ 194{
191 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) || 195 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
192 copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
193 put_user(kp->field, &up->field) || 196 put_user(kp->field, &up->field) ||
194 put_user(kp->chromakey, &up->chromakey) || 197 put_user(kp->chromakey, &up->chromakey) ||
195 put_user(kp->clipcount, &up->clipcount)) 198 put_user(kp->clipcount, &up->clipcount))
@@ -199,33 +202,29 @@ static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
199 202
200static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 203static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
201{ 204{
202 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) || 205 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
203 copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 206 return -EFAULT;
204 return -EFAULT;
205 return 0; 207 return 0;
206} 208}
207 209
208static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 210static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
209{ 211{
210 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) || 212 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
211 copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 213 return -EFAULT;
212 return -EFAULT;
213 return 0; 214 return 0;
214} 215}
215 216
216static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 217static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
217{ 218{
218 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) || 219 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
219 copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 220 return -EFAULT;
220 return -EFAULT;
221 return 0; 221 return 0;
222} 222}
223 223
224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
225{ 225{
226 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) || 226 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
227 copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 227 return -EFAULT;
228 return -EFAULT;
229 return 0; 228 return 0;
230} 229}
231 230
@@ -279,18 +278,16 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
279 278
280static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 279static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
281{ 280{
282 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) || 281 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
283 copy_from_user(kp, up, sizeof(struct v4l2_standard))) 282 return -EFAULT;
284 return -EFAULT;
285 return 0; 283 return 0;
286 284
287} 285}
288 286
289static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 287static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
290{ 288{
291 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) || 289 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
292 copy_to_user(up, kp, sizeof(struct v4l2_standard))) 290 return -EFAULT;
293 return -EFAULT;
294 return 0; 291 return 0;
295} 292}
296 293
@@ -328,18 +325,16 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
328 325
329static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 326static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
330{ 327{
331 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) || 328 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
332 copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 329 return -EFAULT;
333 return -EFAULT;
334 return 0; 330 return 0;
335 331
336} 332}
337 333
338static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 334static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
339{ 335{
340 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) || 336 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
341 copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 337 return -EFAULT;
342 return -EFAULT;
343 return 0; 338 return 0;
344} 339}
345 340
@@ -380,11 +375,13 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
380 break; 375 break;
381 case V4L2_MEMORY_USERPTR: 376 case V4L2_MEMORY_USERPTR:
382 { 377 {
383 unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr); 378 compat_long_t tmp;
384 379
385 if(get_user(kp->length, &up->length) || 380 if (get_user(kp->length, &up->length) ||
386 get_user(kp->m.userptr, &tmp)) 381 get_user(tmp, &up->m.userptr))
387 return -EFAULT; 382 return -EFAULT;
383
384 kp->m.userptr = (unsigned long)compat_ptr(tmp);
388 } 385 }
389 break; 386 break;
390 case V4L2_MEMORY_OVERLAY: 387 case V4L2_MEMORY_OVERLAY:
@@ -468,33 +465,29 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
468 465
469static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 466static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
470{ 467{
471 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) || 468 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
472 copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 469 return -EFAULT;
473 return -EFAULT;
474 return 0; 470 return 0;
475} 471}
476 472
477static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 473static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
478{ 474{
479 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) || 475 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
480 copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 476 return -EFAULT;
481 return -EFAULT;
482 return 0; 477 return 0;
483} 478}
484 479
485static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 480static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
486{ 481{
487 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) || 482 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
488 copy_from_user(kp, up, sizeof(struct v4l2_input))) 483 return -EFAULT;
489 return -EFAULT;
490 return 0; 484 return 0;
491} 485}
492 486
493static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 487static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
494{ 488{
495 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) || 489 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
496 copy_to_user(up, kp, sizeof(struct v4l2_input))) 490 return -EFAULT;
497 return -EFAULT;
498 return 0; 491 return 0;
499} 492}
500 493
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index c483a863b116..5d397b7a5497 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -65,7 +65,7 @@ config MMC_AU1X
65 depends on SOC_AU1X00 && MMC 65 depends on SOC_AU1X00 && MMC
66 help 66 help
67 This selects the AMD Alchemy(R) Multimedia card interface. 67 This selects the AMD Alchemy(R) Multimedia card interface.
68 iIf you have a Alchemy platform with a MMC slot, say Y or M here. 68 If you have a Alchemy platform with a MMC slot, say Y or M here.
69 69
70 If unsure, say N. 70 If unsure, say N.
71 71
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index effa0d7a73ac..205bb7083335 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -301,7 +301,7 @@ config MTD_JEDEC
301 301
302config MTD_XIP 302config MTD_XIP
303 bool "XIP aware MTD support" 303 bool "XIP aware MTD support"
304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM 304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP
305 default y if XIP_KERNEL 305 default y if XIP_KERNEL
306 help 306 help
307 This allows MTD support to work with flash memory which is also 307 This allows MTD support to work with flash memory which is also
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 18b027e73f28..86633c5f1a4b 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -29,7 +29,7 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/skbuff.h> 31#include <linux/skbuff.h>
32#include <linux/irq.h> 32#include <asm/irq.h>
33/* Used for the temporal inet entries and routing */ 33/* Used for the temporal inet entries and routing */
34#include <linux/socket.h> 34#include <linux/socket.h>
35#include <linux/bitops.h> 35#include <linux/bitops.h>
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 13b745b39667..da0c878dcba8 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -614,7 +614,7 @@ static void rebuild_rx_bufs(struct net_device *dev)
614static int init_i596_mem(struct net_device *dev) 614static int init_i596_mem(struct net_device *dev)
615{ 615{
616 struct i596_private *lp = dev->priv; 616 struct i596_private *lp = dev->priv;
617#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) 617#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) || defined(ENABLE_APRICOT)
618 short ioaddr = dev->base_addr; 618 short ioaddr = dev->base_addr;
619#endif 619#endif
620 unsigned long flags; 620 unsigned long flags;
diff --git a/drivers/net/appletalk/cops.h b/drivers/net/appletalk/cops.h
index c68ba9c2ef46..aca47f3a7b98 100644
--- a/drivers/net/appletalk/cops.h
+++ b/drivers/net/appletalk/cops.h
@@ -51,7 +51,7 @@
51struct ltfirmware 51struct ltfirmware
52{ 52{
53 unsigned int length; 53 unsigned int length;
54 unsigned char * data; 54 const unsigned char * data;
55}; 55};
56 56
57#define DAYNA 1 57#define DAYNA 1
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index 38c3f033f739..8c8d6c453c45 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -97,25 +97,44 @@ static int __init arcrimi_probe(struct net_device *dev)
97 "must specify the shmem and irq!\n"); 97 "must specify the shmem and irq!\n");
98 return -ENODEV; 98 return -ENODEV;
99 } 99 }
100 if (dev->dev_addr[0] == 0) {
101 BUGMSG(D_NORMAL, "You need to specify your card's station "
102 "ID!\n");
103 return -ENODEV;
104 }
100 /* 105 /*
101 * Grab the memory region at mem_start for BUFFER_SIZE bytes. 106 * Grab the memory region at mem_start for MIRROR_SIZE bytes.
102 * Later in arcrimi_found() the real size will be determined 107 * Later in arcrimi_found() the real size will be determined
103 * and this reserve will be released and the correct size 108 * and this reserve will be released and the correct size
104 * will be taken. 109 * will be taken.
105 */ 110 */
106 if (!request_mem_region(dev->mem_start, BUFFER_SIZE, "arcnet (90xx)")) { 111 if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) {
107 BUGMSG(D_NORMAL, "Card memory already allocated\n"); 112 BUGMSG(D_NORMAL, "Card memory already allocated\n");
108 return -ENODEV; 113 return -ENODEV;
109 } 114 }
110 if (dev->dev_addr[0] == 0) {
111 release_mem_region(dev->mem_start, BUFFER_SIZE);
112 BUGMSG(D_NORMAL, "You need to specify your card's station "
113 "ID!\n");
114 return -ENODEV;
115 }
116 return arcrimi_found(dev); 115 return arcrimi_found(dev);
117} 116}
118 117
118static int check_mirror(unsigned long addr, size_t size)
119{
120 void __iomem *p;
121 int res = -1;
122
123 if (!request_mem_region(addr, size, "arcnet (90xx)"))
124 return -1;
125
126 p = ioremap(addr, size);
127 if (p) {
128 if (readb(p) == TESTvalue)
129 res = 1;
130 else
131 res = 0;
132 iounmap(p);
133 }
134
135 release_mem_region(addr, size);
136 return res;
137}
119 138
120/* 139/*
121 * Set up the struct net_device associated with this card. Called after 140 * Set up the struct net_device associated with this card. Called after
@@ -125,19 +144,28 @@ static int __init arcrimi_found(struct net_device *dev)
125{ 144{
126 struct arcnet_local *lp; 145 struct arcnet_local *lp;
127 unsigned long first_mirror, last_mirror, shmem; 146 unsigned long first_mirror, last_mirror, shmem;
147 void __iomem *p;
128 int mirror_size; 148 int mirror_size;
129 int err; 149 int err;
130 150
151 p = ioremap(dev->mem_start, MIRROR_SIZE);
152 if (!p) {
153 release_mem_region(dev->mem_start, MIRROR_SIZE);
154 BUGMSG(D_NORMAL, "Can't ioremap\n");
155 return -ENODEV;
156 }
157
131 /* reserve the irq */ 158 /* reserve the irq */
132 if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) { 159 if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) {
133 release_mem_region(dev->mem_start, BUFFER_SIZE); 160 iounmap(p);
161 release_mem_region(dev->mem_start, MIRROR_SIZE);
134 BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq); 162 BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
135 return -ENODEV; 163 return -ENODEV;
136 } 164 }
137 165
138 shmem = dev->mem_start; 166 shmem = dev->mem_start;
139 isa_writeb(TESTvalue, shmem); 167 writeb(TESTvalue, p);
140 isa_writeb(dev->dev_addr[0], shmem + 1); /* actually the node ID */ 168 writeb(dev->dev_addr[0], p + 1); /* actually the node ID */
141 169
142 /* find the real shared memory start/end points, including mirrors */ 170 /* find the real shared memory start/end points, including mirrors */
143 171
@@ -146,17 +174,18 @@ static int __init arcrimi_found(struct net_device *dev)
146 * 2k (or there are no mirrors at all) but on some, it's 4k. 174 * 2k (or there are no mirrors at all) but on some, it's 4k.
147 */ 175 */
148 mirror_size = MIRROR_SIZE; 176 mirror_size = MIRROR_SIZE;
149 if (isa_readb(shmem) == TESTvalue 177 if (readb(p) == TESTvalue
150 && isa_readb(shmem - mirror_size) != TESTvalue 178 && check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0
151 && isa_readb(shmem - 2 * mirror_size) == TESTvalue) 179 && check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1)
152 mirror_size *= 2; 180 mirror_size = 2 * MIRROR_SIZE;
153 181
154 first_mirror = last_mirror = shmem; 182 first_mirror = shmem - mirror_size;
155 while (isa_readb(first_mirror) == TESTvalue) 183 while (check_mirror(first_mirror, mirror_size) == 1)
156 first_mirror -= mirror_size; 184 first_mirror -= mirror_size;
157 first_mirror += mirror_size; 185 first_mirror += mirror_size;
158 186
159 while (isa_readb(last_mirror) == TESTvalue) 187 last_mirror = shmem + mirror_size;
188 while (check_mirror(last_mirror, mirror_size) == 1)
160 last_mirror += mirror_size; 189 last_mirror += mirror_size;
161 last_mirror -= mirror_size; 190 last_mirror -= mirror_size;
162 191
@@ -181,7 +210,8 @@ static int __init arcrimi_found(struct net_device *dev)
181 * with the correct size. There is a VERY slim chance this could 210 * with the correct size. There is a VERY slim chance this could
182 * fail. 211 * fail.
183 */ 212 */
184 release_mem_region(shmem, BUFFER_SIZE); 213 iounmap(p);
214 release_mem_region(shmem, MIRROR_SIZE);
185 if (!request_mem_region(dev->mem_start, 215 if (!request_mem_region(dev->mem_start,
186 dev->mem_end - dev->mem_start + 1, 216 dev->mem_end - dev->mem_start + 1,
187 "arcnet (90xx)")) { 217 "arcnet (90xx)")) {
diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c
index 6c2c9b9ac6db..43150b2bd13f 100644
--- a/drivers/net/arcnet/com90xx.c
+++ b/drivers/net/arcnet/com90xx.c
@@ -53,7 +53,7 @@
53 53
54 54
55/* Internal function declarations */ 55/* Internal function declarations */
56static int com90xx_found(int ioaddr, int airq, u_long shmem); 56static int com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *);
57static void com90xx_command(struct net_device *dev, int command); 57static void com90xx_command(struct net_device *dev, int command);
58static int com90xx_status(struct net_device *dev); 58static int com90xx_status(struct net_device *dev);
59static void com90xx_setmask(struct net_device *dev, int mask); 59static void com90xx_setmask(struct net_device *dev, int mask);
@@ -116,14 +116,26 @@ static void __init com90xx_probe(void)
116 unsigned long airqmask; 116 unsigned long airqmask;
117 int ports[(0x3f0 - 0x200) / 16 + 1] = 117 int ports[(0x3f0 - 0x200) / 16 + 1] =
118 {0}; 118 {0};
119 u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] = 119 unsigned long *shmems;
120 {0}; 120 void __iomem **iomem;
121 int numports, numshmems, *port; 121 int numports, numshmems, *port;
122 u_long *p; 122 u_long *p;
123 int index;
123 124
124 if (!io && !irq && !shmem && !*device && com90xx_skip_probe) 125 if (!io && !irq && !shmem && !*device && com90xx_skip_probe)
125 return; 126 return;
126 127
128 shmems = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(unsigned long),
129 GFP_KERNEL);
130 if (!shmems)
131 return;
132 iomem = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(void __iomem *),
133 GFP_KERNEL);
134 if (!iomem) {
135 kfree(shmems);
136 return;
137 }
138
127 BUGLVL(D_NORMAL) printk(VERSION); 139 BUGLVL(D_NORMAL) printk(VERSION);
128 140
129 /* set up the arrays where we'll store the possible probe addresses */ 141 /* set up the arrays where we'll store the possible probe addresses */
@@ -179,6 +191,8 @@ static void __init com90xx_probe(void)
179 191
180 if (!numports) { 192 if (!numports) {
181 BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n"); 193 BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n");
194 kfree(shmems);
195 kfree(iomem);
182 return; 196 return;
183 } 197 }
184 /* Stage 2: we have now reset any possible ARCnet cards, so we can't 198 /* Stage 2: we have now reset any possible ARCnet cards, so we can't
@@ -202,8 +216,8 @@ static void __init com90xx_probe(void)
202 * 0xD1 byte in the right place, or are read-only. 216 * 0xD1 byte in the right place, or are read-only.
203 */ 217 */
204 numprint = -1; 218 numprint = -1;
205 for (p = &shmems[0]; p < shmems + numshmems; p++) { 219 for (index = 0, p = &shmems[0]; index < numshmems; p++, index++) {
206 u_long ptr = *p; 220 void __iomem *base;
207 221
208 numprint++; 222 numprint++;
209 numprint %= 8; 223 numprint %= 8;
@@ -213,38 +227,49 @@ static void __init com90xx_probe(void)
213 } 227 }
214 BUGMSG2(D_INIT, "%lXh ", *p); 228 BUGMSG2(D_INIT, "%lXh ", *p);
215 229
216 if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) { 230 if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) {
217 BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n"); 231 BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n");
218 BUGMSG2(D_INIT_REASONS, "Stage 3: "); 232 BUGMSG2(D_INIT_REASONS, "Stage 3: ");
219 BUGLVL(D_INIT_REASONS) numprint = 0; 233 BUGLVL(D_INIT_REASONS) numprint = 0;
220 *p-- = shmems[--numshmems]; 234 goto out;
221 continue; 235 }
236 base = ioremap(*p, MIRROR_SIZE);
237 if (!base) {
238 BUGMSG2(D_INIT_REASONS, "(ioremap)\n");
239 BUGMSG2(D_INIT_REASONS, "Stage 3: ");
240 BUGLVL(D_INIT_REASONS) numprint = 0;
241 goto out1;
222 } 242 }
223 if (isa_readb(ptr) != TESTvalue) { 243 if (readb(base) != TESTvalue) {
224 BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n", 244 BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n",
225 isa_readb(ptr), TESTvalue); 245 readb(base), TESTvalue);
226 BUGMSG2(D_INIT_REASONS, "S3: "); 246 BUGMSG2(D_INIT_REASONS, "S3: ");
227 BUGLVL(D_INIT_REASONS) numprint = 0; 247 BUGLVL(D_INIT_REASONS) numprint = 0;
228 release_mem_region(*p, BUFFER_SIZE); 248 goto out2;
229 *p-- = shmems[--numshmems];
230 continue;
231 } 249 }
232 /* By writing 0x42 to the TESTvalue location, we also make 250 /* By writing 0x42 to the TESTvalue location, we also make
233 * sure no "mirror" shmem areas show up - if they occur 251 * sure no "mirror" shmem areas show up - if they occur
234 * in another pass through this loop, they will be discarded 252 * in another pass through this loop, they will be discarded
235 * because *cptr != TESTvalue. 253 * because *cptr != TESTvalue.
236 */ 254 */
237 isa_writeb(0x42, ptr); 255 writeb(0x42, base);
238 if (isa_readb(ptr) != 0x42) { 256 if (readb(base) != 0x42) {
239 BUGMSG2(D_INIT_REASONS, "(read only)\n"); 257 BUGMSG2(D_INIT_REASONS, "(read only)\n");
240 BUGMSG2(D_INIT_REASONS, "S3: "); 258 BUGMSG2(D_INIT_REASONS, "S3: ");
241 release_mem_region(*p, BUFFER_SIZE); 259 goto out2;
242 *p-- = shmems[--numshmems];
243 continue;
244 } 260 }
245 BUGMSG2(D_INIT_REASONS, "\n"); 261 BUGMSG2(D_INIT_REASONS, "\n");
246 BUGMSG2(D_INIT_REASONS, "S3: "); 262 BUGMSG2(D_INIT_REASONS, "S3: ");
247 BUGLVL(D_INIT_REASONS) numprint = 0; 263 BUGLVL(D_INIT_REASONS) numprint = 0;
264 iomem[index] = base;
265 continue;
266 out2:
267 iounmap(base);
268 out1:
269 release_mem_region(*p, MIRROR_SIZE);
270 out:
271 *p-- = shmems[--numshmems];
272 index--;
248 } 273 }
249 BUGMSG2(D_INIT, "\n"); 274 BUGMSG2(D_INIT, "\n");
250 275
@@ -252,6 +277,8 @@ static void __init com90xx_probe(void)
252 BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n"); 277 BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n");
253 for (port = &ports[0]; port < ports + numports; port++) 278 for (port = &ports[0]; port < ports + numports; port++)
254 release_region(*port, ARCNET_TOTAL_SIZE); 279 release_region(*port, ARCNET_TOTAL_SIZE);
280 kfree(shmems);
281 kfree(iomem);
255 return; 282 return;
256 } 283 }
257 /* Stage 4: something of a dummy, to report the shmems that are 284 /* Stage 4: something of a dummy, to report the shmems that are
@@ -351,30 +378,32 @@ static void __init com90xx_probe(void)
351 mdelay(RESETtime); 378 mdelay(RESETtime);
352 } else { 379 } else {
353 /* just one shmem and port, assume they match */ 380 /* just one shmem and port, assume they match */
354 isa_writeb(TESTvalue, shmems[0]); 381 writeb(TESTvalue, iomem[0]);
355 } 382 }
356#else 383#else
357 inb(_RESET); 384 inb(_RESET);
358 mdelay(RESETtime); 385 mdelay(RESETtime);
359#endif 386#endif
360 387
361 for (p = &shmems[0]; p < shmems + numshmems; p++) { 388 for (index = 0; index < numshmems; index++) {
362 u_long ptr = *p; 389 u_long ptr = shmems[index];
390 void __iomem *base = iomem[index];
363 391
364 if (isa_readb(ptr) == TESTvalue) { /* found one */ 392 if (readb(base) == TESTvalue) { /* found one */
365 BUGMSG2(D_INIT, "%lXh)\n", *p); 393 BUGMSG2(D_INIT, "%lXh)\n", *p);
366 openparen = 0; 394 openparen = 0;
367 395
368 /* register the card */ 396 /* register the card */
369 if (com90xx_found(*port, airq, *p) == 0) 397 if (com90xx_found(*port, airq, ptr, base) == 0)
370 found = 1; 398 found = 1;
371 numprint = -1; 399 numprint = -1;
372 400
373 /* remove shmem from the list */ 401 /* remove shmem from the list */
374 *p = shmems[--numshmems]; 402 shmems[index] = shmems[--numshmems];
403 iomem[index] = iomem[numshmems];
375 break; /* go to the next I/O port */ 404 break; /* go to the next I/O port */
376 } else { 405 } else {
377 BUGMSG2(D_INIT_REASONS, "%Xh-", isa_readb(ptr)); 406 BUGMSG2(D_INIT_REASONS, "%Xh-", readb(base));
378 } 407 }
379 } 408 }
380 409
@@ -391,17 +420,40 @@ static void __init com90xx_probe(void)
391 BUGLVL(D_INIT_REASONS) printk("\n"); 420 BUGLVL(D_INIT_REASONS) printk("\n");
392 421
393 /* Now put back TESTvalue on all leftover shmems. */ 422 /* Now put back TESTvalue on all leftover shmems. */
394 for (p = &shmems[0]; p < shmems + numshmems; p++) { 423 for (index = 0; index < numshmems; index++) {
395 isa_writeb(TESTvalue, *p); 424 writeb(TESTvalue, iomem[index]);
396 release_mem_region(*p, BUFFER_SIZE); 425 iounmap(iomem[index]);
426 release_mem_region(shmems[index], MIRROR_SIZE);
397 } 427 }
428 kfree(shmems);
429 kfree(iomem);
398} 430}
399 431
432static int check_mirror(unsigned long addr, size_t size)
433{
434 void __iomem *p;
435 int res = -1;
436
437 if (!request_mem_region(addr, size, "arcnet (90xx)"))
438 return -1;
439
440 p = ioremap(addr, size);
441 if (p) {
442 if (readb(p) == TESTvalue)
443 res = 1;
444 else
445 res = 0;
446 iounmap(p);
447 }
448
449 release_mem_region(addr, size);
450 return res;
451}
400 452
401/* Set up the struct net_device associated with this card. Called after 453/* Set up the struct net_device associated with this card. Called after
402 * probing succeeds. 454 * probing succeeds.
403 */ 455 */
404static int __init com90xx_found(int ioaddr, int airq, u_long shmem) 456static int __init com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *p)
405{ 457{
406 struct net_device *dev = NULL; 458 struct net_device *dev = NULL;
407 struct arcnet_local *lp; 459 struct arcnet_local *lp;
@@ -412,7 +464,8 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem)
412 dev = alloc_arcdev(device); 464 dev = alloc_arcdev(device);
413 if (!dev) { 465 if (!dev) {
414 BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n"); 466 BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n");
415 release_mem_region(shmem, BUFFER_SIZE); 467 iounmap(p);
468 release_mem_region(shmem, MIRROR_SIZE);
416 return -ENOMEM; 469 return -ENOMEM;
417 } 470 }
418 lp = dev->priv; 471 lp = dev->priv;
@@ -423,24 +476,27 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem)
423 * 2k (or there are no mirrors at all) but on some, it's 4k. 476 * 2k (or there are no mirrors at all) but on some, it's 4k.
424 */ 477 */
425 mirror_size = MIRROR_SIZE; 478 mirror_size = MIRROR_SIZE;
426 if (isa_readb(shmem) == TESTvalue 479 if (readb(p) == TESTvalue &&
427 && isa_readb(shmem - mirror_size) != TESTvalue 480 check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 &&
428 && isa_readb(shmem - 2 * mirror_size) == TESTvalue) 481 check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1)
429 mirror_size *= 2; 482 mirror_size = 2 * MIRROR_SIZE;
430 483
431 first_mirror = last_mirror = shmem; 484 first_mirror = shmem - mirror_size;
432 while (isa_readb(first_mirror) == TESTvalue) 485 while (check_mirror(first_mirror, mirror_size) == 1)
433 first_mirror -= mirror_size; 486 first_mirror -= mirror_size;
434 first_mirror += mirror_size; 487 first_mirror += mirror_size;
435 488
436 while (isa_readb(last_mirror) == TESTvalue) 489 last_mirror = shmem + mirror_size;
490 while (check_mirror(last_mirror, mirror_size) == 1)
437 last_mirror += mirror_size; 491 last_mirror += mirror_size;
438 last_mirror -= mirror_size; 492 last_mirror -= mirror_size;
439 493
440 dev->mem_start = first_mirror; 494 dev->mem_start = first_mirror;
441 dev->mem_end = last_mirror + MIRROR_SIZE - 1; 495 dev->mem_end = last_mirror + MIRROR_SIZE - 1;
442 496
443 release_mem_region(shmem, BUFFER_SIZE); 497 iounmap(p);
498 release_mem_region(shmem, MIRROR_SIZE);
499
444 if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)")) 500 if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)"))
445 goto err_free_dev; 501 goto err_free_dev;
446 502
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index 3b1bef1ee215..77411a00d1ee 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -86,7 +86,6 @@
86#include <linux/bitops.h> 86#include <linux/bitops.h>
87#include <linux/jiffies.h> 87#include <linux/jiffies.h>
88 88
89#include <asm/bug.h>
90#include <asm/system.h> 89#include <asm/system.h>
91#include <asm/uaccess.h> 90#include <asm/uaccess.h>
92 91
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index a37b82ebca37..247c8ca86033 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1719,17 +1719,10 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1719 hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */ 1719 hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */
1720 1720
1721 if (lp->mode == 2) { /* memory mapped */ 1721 if (lp->mode == 2) { /* memory mapped */
1722 if (lp->mem_ptr_virt) { /* high pci memory was remapped */ 1722 /* Note: The J2585B needs alignment to 32bits here! */
1723 /* Note: The J2585B needs alignment to 32bits here! */ 1723 memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3);
1724 memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3); 1724 if (!ok_flag)
1725 if (!ok_flag) 1725 memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len);
1726 memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len);
1727 } else {
1728 /* Note: The J2585B needs alignment to 32bits here! */
1729 isa_memcpy_toio(lp->mem_ptr_phys, skb->data, (skb->len + 3) & ~3);
1730 if (!ok_flag)
1731 isa_memset_io(lp->mem_ptr_phys, 0, HP100_MIN_PACKET_SIZE - skb->len);
1732 }
1733 } else { /* programmed i/o */ 1726 } else { /* programmed i/o */
1734 outsl(ioaddr + HP100_REG_DATA32, skb->data, 1727 outsl(ioaddr + HP100_REG_DATA32, skb->data,
1735 (skb->len + 3) >> 2); 1728 (skb->len + 3) >> 2);
@@ -1799,10 +1792,7 @@ static void hp100_rx(struct net_device *dev)
1799 /* First we get the header, which contains information about the */ 1792 /* First we get the header, which contains information about the */
1800 /* actual length of the received packet. */ 1793 /* actual length of the received packet. */
1801 if (lp->mode == 2) { /* memory mapped mode */ 1794 if (lp->mode == 2) { /* memory mapped mode */
1802 if (lp->mem_ptr_virt) /* if memory was remapped */ 1795 header = readl(lp->mem_ptr_virt);
1803 header = readl(lp->mem_ptr_virt);
1804 else
1805 header = isa_readl(lp->mem_ptr_phys);
1806 } else /* programmed i/o */ 1796 } else /* programmed i/o */
1807 header = hp100_inl(DATA32); 1797 header = hp100_inl(DATA32);
1808 1798
@@ -1834,13 +1824,9 @@ static void hp100_rx(struct net_device *dev)
1834 ptr = skb->data; 1824 ptr = skb->data;
1835 1825
1836 /* Now transfer the data from the card into that area */ 1826 /* Now transfer the data from the card into that area */
1837 if (lp->mode == 2) { 1827 if (lp->mode == 2)
1838 if (lp->mem_ptr_virt) 1828 memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len);
1839 memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len); 1829 else /* io mapped */
1840 /* Note alignment to 32bit transfers */
1841 else
1842 isa_memcpy_fromio(ptr, lp->mem_ptr_phys, pkt_len);
1843 } else /* io mapped */
1844 insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2); 1830 insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2);
1845 1831
1846 skb->protocol = eth_type_trans(skb, dev); 1832 skb->protocol = eth_type_trans(skb, dev);
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 591c5864ffb1..7e49522b8b3c 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -204,7 +204,7 @@ static inline int emac_phy_gpcs(int phy_mode)
204 204
205static inline void emac_tx_enable(struct ocp_enet_private *dev) 205static inline void emac_tx_enable(struct ocp_enet_private *dev)
206{ 206{
207 struct emac_regs *p = dev->emacp; 207 struct emac_regs __iomem *p = dev->emacp;
208 unsigned long flags; 208 unsigned long flags;
209 u32 r; 209 u32 r;
210 210
@@ -220,7 +220,7 @@ static inline void emac_tx_enable(struct ocp_enet_private *dev)
220 220
221static void emac_tx_disable(struct ocp_enet_private *dev) 221static void emac_tx_disable(struct ocp_enet_private *dev)
222{ 222{
223 struct emac_regs *p = dev->emacp; 223 struct emac_regs __iomem *p = dev->emacp;
224 unsigned long flags; 224 unsigned long flags;
225 u32 r; 225 u32 r;
226 226
@@ -244,7 +244,7 @@ static void emac_tx_disable(struct ocp_enet_private *dev)
244 244
245static void emac_rx_enable(struct ocp_enet_private *dev) 245static void emac_rx_enable(struct ocp_enet_private *dev)
246{ 246{
247 struct emac_regs *p = dev->emacp; 247 struct emac_regs __iomem *p = dev->emacp;
248 unsigned long flags; 248 unsigned long flags;
249 u32 r; 249 u32 r;
250 250
@@ -275,7 +275,7 @@ static void emac_rx_enable(struct ocp_enet_private *dev)
275 275
276static void emac_rx_disable(struct ocp_enet_private *dev) 276static void emac_rx_disable(struct ocp_enet_private *dev)
277{ 277{
278 struct emac_regs *p = dev->emacp; 278 struct emac_regs __iomem *p = dev->emacp;
279 unsigned long flags; 279 unsigned long flags;
280 u32 r; 280 u32 r;
281 281
@@ -299,7 +299,7 @@ static void emac_rx_disable(struct ocp_enet_private *dev)
299 299
300static inline void emac_rx_disable_async(struct ocp_enet_private *dev) 300static inline void emac_rx_disable_async(struct ocp_enet_private *dev)
301{ 301{
302 struct emac_regs *p = dev->emacp; 302 struct emac_regs __iomem *p = dev->emacp;
303 unsigned long flags; 303 unsigned long flags;
304 u32 r; 304 u32 r;
305 305
@@ -315,7 +315,7 @@ static inline void emac_rx_disable_async(struct ocp_enet_private *dev)
315 315
316static int emac_reset(struct ocp_enet_private *dev) 316static int emac_reset(struct ocp_enet_private *dev)
317{ 317{
318 struct emac_regs *p = dev->emacp; 318 struct emac_regs __iomem *p = dev->emacp;
319 unsigned long flags; 319 unsigned long flags;
320 int n = 20; 320 int n = 20;
321 321
@@ -348,7 +348,7 @@ static int emac_reset(struct ocp_enet_private *dev)
348 348
349static void emac_hash_mc(struct ocp_enet_private *dev) 349static void emac_hash_mc(struct ocp_enet_private *dev)
350{ 350{
351 struct emac_regs *p = dev->emacp; 351 struct emac_regs __iomem *p = dev->emacp;
352 u16 gaht[4] = { 0 }; 352 u16 gaht[4] = { 0 };
353 struct dev_mc_list *dmi; 353 struct dev_mc_list *dmi;
354 354
@@ -393,7 +393,7 @@ static inline int emac_opb_mhz(void)
393/* BHs disabled */ 393/* BHs disabled */
394static int emac_configure(struct ocp_enet_private *dev) 394static int emac_configure(struct ocp_enet_private *dev)
395{ 395{
396 struct emac_regs *p = dev->emacp; 396 struct emac_regs __iomem *p = dev->emacp;
397 struct net_device *ndev = dev->ndev; 397 struct net_device *ndev = dev->ndev;
398 int gige; 398 int gige;
399 u32 r; 399 u32 r;
@@ -555,7 +555,7 @@ static void emac_full_tx_reset(struct net_device *ndev)
555 555
556static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) 556static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg)
557{ 557{
558 struct emac_regs *p = dev->emacp; 558 struct emac_regs __iomem *p = dev->emacp;
559 u32 r; 559 u32 r;
560 int n; 560 int n;
561 561
@@ -604,7 +604,7 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg)
604static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, 604static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg,
605 u16 val) 605 u16 val)
606{ 606{
607 struct emac_regs *p = dev->emacp; 607 struct emac_regs __iomem *p = dev->emacp;
608 int n; 608 int n;
609 609
610 DBG2("%d: mdio_write(%02x,%02x,%04x)" NL, dev->def->index, id, reg, 610 DBG2("%d: mdio_write(%02x,%02x,%04x)" NL, dev->def->index, id, reg,
@@ -666,7 +666,7 @@ static void emac_mdio_write(struct net_device *ndev, int id, int reg, int val)
666static void emac_set_multicast_list(struct net_device *ndev) 666static void emac_set_multicast_list(struct net_device *ndev)
667{ 667{
668 struct ocp_enet_private *dev = ndev->priv; 668 struct ocp_enet_private *dev = ndev->priv;
669 struct emac_regs *p = dev->emacp; 669 struct emac_regs __iomem *p = dev->emacp;
670 u32 rmr = emac_iff2rmr(ndev); 670 u32 rmr = emac_iff2rmr(ndev);
671 671
672 DBG("%d: multicast %08x" NL, dev->def->index, rmr); 672 DBG("%d: multicast %08x" NL, dev->def->index, rmr);
@@ -825,7 +825,7 @@ static void emac_clean_rx_ring(struct ocp_enet_private *dev)
825} 825}
826 826
827static inline int emac_alloc_rx_skb(struct ocp_enet_private *dev, int slot, 827static inline int emac_alloc_rx_skb(struct ocp_enet_private *dev, int slot,
828 int flags) 828 gfp_t flags)
829{ 829{
830 struct sk_buff *skb = alloc_skb(dev->rx_skb_size, flags); 830 struct sk_buff *skb = alloc_skb(dev->rx_skb_size, flags);
831 if (unlikely(!skb)) 831 if (unlikely(!skb))
@@ -1047,7 +1047,7 @@ static inline u16 emac_tx_csum(struct ocp_enet_private *dev,
1047 1047
1048static inline int emac_xmit_finish(struct ocp_enet_private *dev, int len) 1048static inline int emac_xmit_finish(struct ocp_enet_private *dev, int len)
1049{ 1049{
1050 struct emac_regs *p = dev->emacp; 1050 struct emac_regs __iomem *p = dev->emacp;
1051 struct net_device *ndev = dev->ndev; 1051 struct net_device *ndev = dev->ndev;
1052 1052
1053 /* Send the packet out */ 1053 /* Send the packet out */
@@ -1519,7 +1519,7 @@ static void emac_rxde(void *param)
1519static irqreturn_t emac_irq(int irq, void *dev_instance, struct pt_regs *regs) 1519static irqreturn_t emac_irq(int irq, void *dev_instance, struct pt_regs *regs)
1520{ 1520{
1521 struct ocp_enet_private *dev = dev_instance; 1521 struct ocp_enet_private *dev = dev_instance;
1522 struct emac_regs *p = dev->emacp; 1522 struct emac_regs __iomem *p = dev->emacp;
1523 struct ibm_emac_error_stats *st = &dev->estats; 1523 struct ibm_emac_error_stats *st = &dev->estats;
1524 1524
1525 u32 isr = in_be32(&p->isr); 1525 u32 isr = in_be32(&p->isr);
@@ -1619,17 +1619,17 @@ static void emac_remove(struct ocp_device *ocpdev)
1619 1619
1620 DBG("%d: remove" NL, dev->def->index); 1620 DBG("%d: remove" NL, dev->def->index);
1621 1621
1622 ocp_set_drvdata(ocpdev, 0); 1622 ocp_set_drvdata(ocpdev, NULL);
1623 unregister_netdev(dev->ndev); 1623 unregister_netdev(dev->ndev);
1624 1624
1625 tah_fini(dev->tah_dev); 1625 tah_fini(dev->tah_dev);
1626 rgmii_fini(dev->rgmii_dev, dev->rgmii_input); 1626 rgmii_fini(dev->rgmii_dev, dev->rgmii_input);
1627 zmii_fini(dev->zmii_dev, dev->zmii_input); 1627 zmii_fini(dev->zmii_dev, dev->zmii_input);
1628 1628
1629 emac_dbg_register(dev->def->index, 0); 1629 emac_dbg_register(dev->def->index, NULL);
1630 1630
1631 mal_unregister_commac(dev->mal, &dev->commac); 1631 mal_unregister_commac(dev->mal, &dev->commac);
1632 iounmap((void *)dev->emacp); 1632 iounmap(dev->emacp);
1633 kfree(dev->ndev); 1633 kfree(dev->ndev);
1634} 1634}
1635 1635
@@ -2048,9 +2048,7 @@ static int __init emac_probe(struct ocp_device *ocpdev)
2048 goto out4; 2048 goto out4;
2049 2049
2050 /* Map EMAC regs */ 2050 /* Map EMAC regs */
2051 dev->emacp = 2051 dev->emacp = ioremap(dev->def->paddr, sizeof(struct emac_regs));
2052 (struct emac_regs *)ioremap(dev->def->paddr,
2053 sizeof(struct emac_regs));
2054 if (!dev->emacp) { 2052 if (!dev->emacp) {
2055 printk(KERN_ERR "emac%d: could not ioremap device registers!\n", 2053 printk(KERN_ERR "emac%d: could not ioremap device registers!\n",
2056 dev->def->index); 2054 dev->def->index);
@@ -2210,7 +2208,7 @@ static int __init emac_probe(struct ocp_device *ocpdev)
2210 2208
2211 return 0; 2209 return 0;
2212 out6: 2210 out6:
2213 iounmap((void *)dev->emacp); 2211 iounmap(dev->emacp);
2214 out5: 2212 out5:
2215 tah_fini(dev->tah_dev); 2213 tah_fini(dev->tah_dev);
2216 out4: 2214 out4:
diff --git a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h
index 911abbaf471b..f61273b2e94f 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.h
+++ b/drivers/net/ibm_emac/ibm_emac_core.h
@@ -155,7 +155,7 @@ struct ibm_emac_error_stats {
155 155
156struct ocp_enet_private { 156struct ocp_enet_private {
157 struct net_device *ndev; /* 0 */ 157 struct net_device *ndev; /* 0 */
158 struct emac_regs *emacp; 158 struct emac_regs __iomem *emacp;
159 159
160 struct mal_descriptor *tx_desc; 160 struct mal_descriptor *tx_desc;
161 int tx_cnt; 161 int tx_cnt;
diff --git a/drivers/net/ibm_emac/ibm_emac_debug.c b/drivers/net/ibm_emac/ibm_emac_debug.c
index 75d3b8639041..c7e1ecfa08fe 100644
--- a/drivers/net/ibm_emac/ibm_emac_debug.c
+++ b/drivers/net/ibm_emac/ibm_emac_debug.c
@@ -58,7 +58,7 @@ static void emac_desc_dump(int idx, struct ocp_enet_private *p)
58 58
59static void emac_mac_dump(int idx, struct ocp_enet_private *dev) 59static void emac_mac_dump(int idx, struct ocp_enet_private *dev)
60{ 60{
61 struct emac_regs *p = dev->emacp; 61 struct emac_regs __iomem *p = dev->emacp;
62 62
63 printk("** EMAC%d registers **\n" 63 printk("** EMAC%d registers **\n"
64 "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" 64 "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n"
diff --git a/drivers/net/ibm_emac/ibm_emac_rgmii.h b/drivers/net/ibm_emac/ibm_emac_rgmii.h
index a1ffb8a44fff..7f03d536c9a3 100644
--- a/drivers/net/ibm_emac/ibm_emac_rgmii.h
+++ b/drivers/net/ibm_emac/ibm_emac_rgmii.h
@@ -31,7 +31,7 @@ struct rgmii_regs {
31 31
32/* RGMII device */ 32/* RGMII device */
33struct ibm_ocp_rgmii { 33struct ibm_ocp_rgmii {
34 struct rgmii_regs *base; 34 struct rgmii_regs __iomem *base;
35 int users; /* number of EMACs using this RGMII bridge */ 35 int users; /* number of EMACs using this RGMII bridge */
36}; 36};
37 37
diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.c b/drivers/net/ibm_emac/ibm_emac_zmii.c
index 35c1185079ed..e129e0aaa045 100644
--- a/drivers/net/ibm_emac/ibm_emac_zmii.c
+++ b/drivers/net/ibm_emac/ibm_emac_zmii.c
@@ -80,7 +80,7 @@ static inline u32 zmii_mode_mask(int mode, int input)
80static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode) 80static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode)
81{ 81{
82 struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev); 82 struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev);
83 struct zmii_regs *p; 83 struct zmii_regs __iomem *p;
84 84
85 ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode); 85 ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode);
86 86
@@ -94,8 +94,7 @@ static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode)
94 } 94 }
95 dev->mode = PHY_MODE_NA; 95 dev->mode = PHY_MODE_NA;
96 96
97 p = (struct zmii_regs *)ioremap(ocpdev->def->paddr, 97 p = ioremap(ocpdev->def->paddr, sizeof(struct zmii_regs));
98 sizeof(struct zmii_regs));
99 if (!p) { 98 if (!p) {
100 printk(KERN_ERR 99 printk(KERN_ERR
101 "zmii%d: could not ioremap device registers!\n", 100 "zmii%d: could not ioremap device registers!\n",
@@ -231,7 +230,7 @@ void __exit __zmii_fini(struct ocp_device *ocpdev, int input)
231 if (!--dev->users) { 230 if (!--dev->users) {
232 /* Free everything if this is the last user */ 231 /* Free everything if this is the last user */
233 ocp_set_drvdata(ocpdev, NULL); 232 ocp_set_drvdata(ocpdev, NULL);
234 iounmap((void *)dev->base); 233 iounmap(dev->base);
235 kfree(dev); 234 kfree(dev);
236 } 235 }
237} 236}
diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.h b/drivers/net/ibm_emac/ibm_emac_zmii.h
index 0bb26062c0ad..92c854410753 100644
--- a/drivers/net/ibm_emac/ibm_emac_zmii.h
+++ b/drivers/net/ibm_emac/ibm_emac_zmii.h
@@ -32,7 +32,7 @@ struct zmii_regs {
32 32
33/* ZMII device */ 33/* ZMII device */
34struct ibm_ocp_zmii { 34struct ibm_ocp_zmii {
35 struct zmii_regs *base; 35 struct zmii_regs __iomem *base;
36 int mode; /* subset of PHY_MODE_XXXX */ 36 int mode; /* subset of PHY_MODE_XXXX */
37 int users; /* number of EMACs using this ZMII bridge */ 37 int users; /* number of EMACs using this ZMII bridge */
38 u32 fer_save; /* FER value left by firmware */ 38 u32 fer_save; /* FER value left by firmware */
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 02d5c6822733..f6f3dafe83ee 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -622,7 +622,7 @@ static int __init mac_sonic_init_module(void)
622 return 0; 622 return 0;
623 623
624out_unregister: 624out_unregister:
625 driver_unregister(&mac_sonic_driver); 625 platform_driver_unregister(&mac_sonic_driver);
626 626
627 return -ENOMEM; 627 return -ENOMEM;
628} 628}
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index df572018595e..6b4fff80ae5f 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -32,6 +32,8 @@
32 */ 32 */
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/in.h>
36#include <linux/ip.h>
35#include <linux/tcp.h> 37#include <linux/tcp.h>
36#include <linux/udp.h> 38#include <linux/udp.h>
37#include <linux/etherdevice.h> 39#include <linux/etherdevice.h>
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index c5c738a51ee3..56344103ac23 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -32,6 +32,9 @@
32 32
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#ifdef CONFIG_NET_POLL_CONTROLLER
36#include <asm/irq.h>
37#endif
35 38
36#ifdef DEBUG 39#ifdef DEBUG
37#define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) 40#define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 7db1d1d0bb34..cf5c805452a3 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -29,6 +29,7 @@
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <net/arp.h> 30#include <net/arp.h>
31 31
32#include <asm/irq.h>
32#include <asm/io.h> 33#include <asm/io.h>
33#include <asm/dma.h> 34#include <asm/dma.h>
34#include <asm/byteorder.h> 35#include <asm/byteorder.h>
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index 8dea07b47999..eba8e5cfacc2 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -29,7 +29,7 @@
29#include <linux/netdevice.h> 29#include <linux/netdevice.h>
30#include <linux/hdlc.h> 30#include <linux/hdlc.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <asm/delay.h> 32#include <linux/delay.h>
33#include <asm/io.h> 33#include <asm/io.h>
34 34
35#include "hd64572.h" 35#include "hd64572.h"
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 5380ddfcd7d5..050e854e7774 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <net/arp.h> 24#include <net/arp.h>
25 25
26#include <asm/irq.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/dma.h> 28#include <asm/dma.h>
28#include <asm/byteorder.h> 29#include <asm/byteorder.h>
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 9c1e10602f2b..9d3b51c3ef54 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -27,8 +27,8 @@
27#include <linux/hdlc.h> 27#include <linux/hdlc.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/delay.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/delay.h>
32 32
33#include "wanxl.h" 33#include "wanxl.h"
34 34
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index c5cd61c7f927..e5bb9f5ae429 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
748 if (essid->length) { 748 if (essid->length) {
749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ 749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
750 /* if it is to big, trunk it */ 750 /* if it is to big, trunk it */
751 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length); 751 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length);
752 } else { 752 } else {
753 dwrq->flags = 0; 753 dwrq->flags = 0;
754 dwrq->length = 0; 754 dwrq->length = 0;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 38d6d00fb0fc..014cc8d54a9f 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -38,10 +38,10 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/completion.h> 39#include <linux/completion.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <linux/delay.h>
41#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
42#include <scsi/scsi_device.h> 43#include <scsi/scsi_device.h>
43#include <asm/semaphore.h> 44#include <asm/semaphore.h>
44#include <asm/delay.h>
45 45
46#include "aacraid.h" 46#include "aacraid.h"
47 47
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 311a4122bd70..93edaa8696cf 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -537,9 +537,9 @@ static int mac53c94_remove(struct macio_dev *mdev)
537 free_irq(fp->intr, fp); 537 free_irq(fp->intr, fp);
538 538
539 if (fp->regs) 539 if (fp->regs)
540 iounmap((void *) fp->regs); 540 iounmap(fp->regs);
541 if (fp->dma) 541 if (fp->dma)
542 iounmap((void *) fp->dma); 542 iounmap(fp->dma);
543 kfree(fp->dma_cmd_space); 543 kfree(fp->dma_cmd_space);
544 544
545 scsi_host_put(host); 545 scsi_host_put(host);
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 59a1c9d9d3bd..723f7acbeb12 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -463,7 +463,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
463} 463}
464 464
465static void* 465static void*
466mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 466mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
467{ 467{
468 struct mempool_zone *zone = pool_data; 468 struct mempool_zone *zone = pool_data;
469 469
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 7d0700091f3d..2a547538d444 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1679,7 +1679,7 @@ static int
1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) 1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1680{ 1680{
1681 int sg_bufflen = tablesize * sizeof(struct scatterlist); 1681 int sg_bufflen = tablesize * sizeof(struct scatterlist);
1682 unsigned int gfp_flags = GFP_ATOMIC | __GFP_NOWARN; 1682 gfp_t gfp_flags = GFP_ATOMIC | __GFP_NOWARN;
1683 1683
1684 /* 1684 /*
1685 * TODO: test without low_dma, we should not need it since 1685 * TODO: test without low_dma, we should not need it since
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 7aef7518b0d1..8c5c276c5577 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -362,7 +362,7 @@ static struct uart_ops serial21285_ops = {
362 362
363static struct uart_port serial21285_port = { 363static struct uart_port serial21285_port = {
364 .mapbase = 0x42000160, 364 .mapbase = 0x42000160,
365 .iotype = SERIAL_IO_MEM, 365 .iotype = UPIO_MEM,
366 .irq = NO_IRQ, 366 .irq = NO_IRQ,
367 .fifosize = 16, 367 .fifosize = 16,
368 .ops = &serial21285_ops, 368 .ops = &serial21285_ops,
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 8cbf0fc5a225..7f0f35a05dca 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -332,7 +332,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg
332 * Make sure that we do not overflow the buffer 332 * Make sure that we do not overflow the buffer
333 */ 333 */
334 if (tty_request_buffer_room(tty, 1) == 0) { 334 if (tty_request_buffer_room(tty, 1) == 0) {
335 schedule_work(&tty->flip.work); 335 tty_schedule_flip(tty);
336 return; 336 return;
337 } 337 }
338 338
@@ -353,7 +353,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg
353 } while((rx = uart->urx.w) & URX_DATA_READY); 353 } while((rx = uart->urx.w) & URX_DATA_READY);
354#endif 354#endif
355 355
356 schedule_work(&tty->flip.work); 356 tty_schedule_flip(tty);
357 357
358clear_and_exit: 358clear_and_exit:
359 return; 359 return;
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index 60f5a5dc17f1..9843ae3d420e 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -509,7 +509,7 @@ static _INLINE_ void receive_chars(ser_info_t *info)
509 509
510 info->rx_cur = (QUICC_BD *)bdp; 510 info->rx_cur = (QUICC_BD *)bdp;
511 511
512 schedule_work(&tty->flip.work); 512 tty_schedule_flip(tty);
513} 513}
514 514
515static _INLINE_ void receive_break(ser_info_t *info) 515static _INLINE_ void receive_break(ser_info_t *info)
@@ -521,7 +521,7 @@ static _INLINE_ void receive_break(ser_info_t *info)
521 * the break. If not, we exit now, losing the break. FIXME 521 * the break. If not, we exit now, losing the break. FIXME
522 */ 522 */
523 tty_insert_flip_char(tty, 0, TTY_BREAK); 523 tty_insert_flip_char(tty, 0, TTY_BREAK);
524 schedule_work(&tty->flip.work); 524 tty_schedule_flip(tty);
525} 525}
526 526
527static _INLINE_ void transmit_chars(ser_info_t *info) 527static _INLINE_ void transmit_chars(ser_info_t *info)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 179c1f065e60..b1fc97d5f643 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2229,6 +2229,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2229 * and restore the IER 2229 * and restore the IER
2230 */ 2230 */
2231 wait_for_xmitr(up, BOTH_EMPTY); 2231 wait_for_xmitr(up, BOTH_EMPTY);
2232 up->ier |= UART_IER_THRI;
2232 serial_out(up, UART_IER, ier | UART_IER_THRI); 2233 serial_out(up, UART_IER, ier | UART_IER_THRI);
2233} 2234}
2234 2235
diff --git a/drivers/serial/8250_au1x00.c b/drivers/serial/8250_au1x00.c
index 06ae8fbcc947..8d8d7a70d03e 100644
--- a/drivers/serial/8250_au1x00.c
+++ b/drivers/serial/8250_au1x00.c
@@ -56,7 +56,6 @@ static struct plat_serial8250_port au1x00_data[] = {
56#elif defined(CONFIG_SOC_AU1550) 56#elif defined(CONFIG_SOC_AU1550)
57 PORT(UART0_ADDR, AU1550_UART0_INT), 57 PORT(UART0_ADDR, AU1550_UART0_INT),
58 PORT(UART1_ADDR, AU1550_UART1_INT), 58 PORT(UART1_ADDR, AU1550_UART1_INT),
59 PORT(UART2_ADDR, AU1550_UART2_INT),
60 PORT(UART3_ADDR, AU1550_UART3_INT), 59 PORT(UART3_ADDR, AU1550_UART3_INT),
61#elif defined(CONFIG_SOC_AU1200) 60#elif defined(CONFIG_SOC_AU1200)
62 PORT(UART0_ADDR, AU1200_UART0_INT), 61 PORT(UART0_ADDR, AU1200_UART0_INT),
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index bb9ec28ccc2b..94886c000d2a 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1882,6 +1882,10 @@ static struct pci_device_id serial_pci_tbl[] = {
1882 PCI_SUBVENDOR_ID_CONNECT_TECH, 1882 PCI_SUBVENDOR_ID_CONNECT_TECH,
1883 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0, 1883 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
1884 pbn_b0_4_1843200 }, 1884 pbn_b0_4_1843200 },
1885 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1886 PCI_VENDOR_ID_AFAVLAB,
1887 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
1888 pbn_b0_4_1152000 },
1885 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152, 1889 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1886 PCI_SUBVENDOR_ID_CONNECT_TECH, 1890 PCI_SUBVENDOR_ID_CONNECT_TECH,
1887 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0, 1891 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 429de2723a1c..321a3b3a5728 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -561,7 +561,7 @@ static struct uart_amba_port amba_ports[UART_NR] = {
561 .port = { 561 .port = {
562 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART0_BASE), 562 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART0_BASE),
563 .mapbase = INTEGRATOR_UART0_BASE, 563 .mapbase = INTEGRATOR_UART0_BASE,
564 .iotype = SERIAL_IO_MEM, 564 .iotype = UPIO_MEM,
565 .irq = IRQ_UARTINT0, 565 .irq = IRQ_UARTINT0,
566 .uartclk = 14745600, 566 .uartclk = 14745600,
567 .fifosize = 16, 567 .fifosize = 16,
@@ -576,7 +576,7 @@ static struct uart_amba_port amba_ports[UART_NR] = {
576 .port = { 576 .port = {
577 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART1_BASE), 577 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART1_BASE),
578 .mapbase = INTEGRATOR_UART1_BASE, 578 .mapbase = INTEGRATOR_UART1_BASE,
579 .iotype = SERIAL_IO_MEM, 579 .iotype = UPIO_MEM,
580 .irq = IRQ_UARTINT1, 580 .irq = IRQ_UARTINT1,
581 .uartclk = 14745600, 581 .uartclk = 14745600,
582 .fifosize = 16, 582 .fifosize = 16,
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c
index ceb5d7f37bbd..344022fe53ef 100644
--- a/drivers/serial/au1x00_uart.c
+++ b/drivers/serial/au1x00_uart.c
@@ -892,7 +892,7 @@ serial8250_request_std_resource(struct uart_8250_port *up, struct resource **res
892 int ret = 0; 892 int ret = 0;
893 893
894 switch (up->port.iotype) { 894 switch (up->port.iotype) {
895 case SERIAL_IO_MEM: 895 case UPIO_MEM:
896 if (up->port.mapbase) { 896 if (up->port.mapbase) {
897 *res = request_mem_region(up->port.mapbase, size, "serial"); 897 *res = request_mem_region(up->port.mapbase, size, "serial");
898 if (!*res) 898 if (!*res)
@@ -900,8 +900,8 @@ serial8250_request_std_resource(struct uart_8250_port *up, struct resource **res
900 } 900 }
901 break; 901 break;
902 902
903 case SERIAL_IO_HUB6: 903 case UPIO_HUB6:
904 case SERIAL_IO_PORT: 904 case UPIO_PORT:
905 *res = request_region(up->port.iobase, size, "serial"); 905 *res = request_region(up->port.iobase, size, "serial");
906 if (!*res) 906 if (!*res)
907 ret = -EBUSY; 907 ret = -EBUSY;
@@ -919,7 +919,7 @@ static void serial8250_release_port(struct uart_port *port)
919 size <<= up->port.regshift; 919 size <<= up->port.regshift;
920 920
921 switch (up->port.iotype) { 921 switch (up->port.iotype) {
922 case SERIAL_IO_MEM: 922 case UPIO_MEM:
923 if (up->port.mapbase) { 923 if (up->port.mapbase) {
924 /* 924 /*
925 * Unmap the area. 925 * Unmap the area.
@@ -935,8 +935,8 @@ static void serial8250_release_port(struct uart_port *port)
935 } 935 }
936 break; 936 break;
937 937
938 case SERIAL_IO_HUB6: 938 case UPIO_HUB6:
939 case SERIAL_IO_PORT: 939 case UPIO_PORT:
940 start = up->port.iobase; 940 start = up->port.iobase;
941 941
942 if (size) 942 if (size)
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 16af5626c243..b7bf4c698a47 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -252,12 +252,9 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs)
252 /* If we have not enough room in tty flip buffer, then we try 252 /* If we have not enough room in tty flip buffer, then we try
253 * later, which will be the next rx-interrupt or a timeout 253 * later, which will be the next rx-interrupt or a timeout
254 */ 254 */
255 if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 255 if(tty_buffer_request_room(tty, i) < i) {
256 tty->flip.work.func((void *)tty); 256 printk(KERN_WARNING "No room in flip buffer\n");
257 if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 257 return;
258 printk(KERN_WARNING "TTY_DONT_FLIP set\n");
259 return;
260 }
261 } 258 }
262 259
263 /* get pointer */ 260 /* get pointer */
@@ -276,9 +273,7 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs)
276 continue; 273 continue;
277 274
278 error_return: 275 error_return:
279 *tty->flip.char_buf_ptr++ = ch; 276 tty_insert_flip_char(tty, ch, flg);
280 *tty->flip.flag_buf_ptr++ = flg;
281 tty->flip.count++;
282 277
283 } /* End while (i--) */ 278 } /* End while (i--) */
284 279
@@ -908,7 +903,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
908 .port = { 903 .port = {
909 .irq = SMC1_IRQ, 904 .irq = SMC1_IRQ,
910 .ops = &cpm_uart_pops, 905 .ops = &cpm_uart_pops,
911 .iotype = SERIAL_IO_MEM, 906 .iotype = UPIO_MEM,
912 .lock = SPIN_LOCK_UNLOCKED, 907 .lock = SPIN_LOCK_UNLOCKED,
913 }, 908 },
914 .flags = FLAG_SMC, 909 .flags = FLAG_SMC,
@@ -922,7 +917,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
922 .port = { 917 .port = {
923 .irq = SMC2_IRQ, 918 .irq = SMC2_IRQ,
924 .ops = &cpm_uart_pops, 919 .ops = &cpm_uart_pops,
925 .iotype = SERIAL_IO_MEM, 920 .iotype = UPIO_MEM,
926 .lock = SPIN_LOCK_UNLOCKED, 921 .lock = SPIN_LOCK_UNLOCKED,
927 }, 922 },
928 .flags = FLAG_SMC, 923 .flags = FLAG_SMC,
@@ -939,7 +934,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
939 .port = { 934 .port = {
940 .irq = SCC1_IRQ, 935 .irq = SCC1_IRQ,
941 .ops = &cpm_uart_pops, 936 .ops = &cpm_uart_pops,
942 .iotype = SERIAL_IO_MEM, 937 .iotype = UPIO_MEM,
943 .lock = SPIN_LOCK_UNLOCKED, 938 .lock = SPIN_LOCK_UNLOCKED,
944 }, 939 },
945 .tx_nrfifos = TX_NUM_FIFO, 940 .tx_nrfifos = TX_NUM_FIFO,
@@ -953,7 +948,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
953 .port = { 948 .port = {
954 .irq = SCC2_IRQ, 949 .irq = SCC2_IRQ,
955 .ops = &cpm_uart_pops, 950 .ops = &cpm_uart_pops,
956 .iotype = SERIAL_IO_MEM, 951 .iotype = UPIO_MEM,
957 .lock = SPIN_LOCK_UNLOCKED, 952 .lock = SPIN_LOCK_UNLOCKED,
958 }, 953 },
959 .tx_nrfifos = TX_NUM_FIFO, 954 .tx_nrfifos = TX_NUM_FIFO,
@@ -967,7 +962,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
967 .port = { 962 .port = {
968 .irq = SCC3_IRQ, 963 .irq = SCC3_IRQ,
969 .ops = &cpm_uart_pops, 964 .ops = &cpm_uart_pops,
970 .iotype = SERIAL_IO_MEM, 965 .iotype = UPIO_MEM,
971 .lock = SPIN_LOCK_UNLOCKED, 966 .lock = SPIN_LOCK_UNLOCKED,
972 }, 967 },
973 .tx_nrfifos = TX_NUM_FIFO, 968 .tx_nrfifos = TX_NUM_FIFO,
@@ -981,7 +976,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
981 .port = { 976 .port = {
982 .irq = SCC4_IRQ, 977 .irq = SCC4_IRQ,
983 .ops = &cpm_uart_pops, 978 .ops = &cpm_uart_pops,
984 .iotype = SERIAL_IO_MEM, 979 .iotype = UPIO_MEM,
985 .lock = SPIN_LOCK_UNLOCKED, 980 .lock = SPIN_LOCK_UNLOCKED,
986 }, 981 },
987 .tx_nrfifos = TX_NUM_FIFO, 982 .tx_nrfifos = TX_NUM_FIFO,
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index a64ba26a94e8..ba5541de673b 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -262,6 +262,7 @@ static inline void dz_receive_chars(struct dz_port *dport)
262 } 262 }
263 tty_insert_flip_char(tty, ch, flag); 263 tty_insert_flip_char(tty, ch, flag);
264 ignore_char: 264 ignore_char:
265 ;
265 } while (status & DZ_DVAL); 266 } while (status & DZ_DVAL);
266 267
267 if (tty) 268 if (tty)
@@ -650,7 +651,7 @@ static void __init dz_init_ports(void)
650 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { 651 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) {
651 spin_lock_init(&dport->port.lock); 652 spin_lock_init(&dport->port.lock);
652 dport->port.membase = (char *) base; 653 dport->port.membase = (char *) base;
653 dport->port.iotype = SERIAL_IO_PORT; 654 dport->port.iotype = UPIO_PORT;
654 dport->port.irq = dec_interrupt[DEC_IRQ_DZ11]; 655 dport->port.irq = dec_interrupt[DEC_IRQ_DZ11];
655 dport->port.line = i; 656 dport->port.line = i;
656 dport->port.fifosize = 1; 657 dport->port.fifosize = 1;
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 858048efe1ed..4d53fb5ca87b 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -668,7 +668,7 @@ static struct imx_port imx_ports[] = {
668 .rtsirq = UART1_MINT_RTS, 668 .rtsirq = UART1_MINT_RTS,
669 .port = { 669 .port = {
670 .type = PORT_IMX, 670 .type = PORT_IMX,
671 .iotype = SERIAL_IO_MEM, 671 .iotype = UPIO_MEM,
672 .membase = (void *)IMX_UART1_BASE, 672 .membase = (void *)IMX_UART1_BASE,
673 .mapbase = IMX_UART1_BASE, /* FIXME */ 673 .mapbase = IMX_UART1_BASE, /* FIXME */
674 .irq = UART1_MINT_RX, 674 .irq = UART1_MINT_RX,
@@ -684,7 +684,7 @@ static struct imx_port imx_ports[] = {
684 .rtsirq = UART2_MINT_RTS, 684 .rtsirq = UART2_MINT_RTS,
685 .port = { 685 .port = {
686 .type = PORT_IMX, 686 .type = PORT_IMX,
687 .iotype = SERIAL_IO_MEM, 687 .iotype = UPIO_MEM,
688 .membase = (void *)IMX_UART2_BASE, 688 .membase = (void *)IMX_UART2_BASE,
689 .mapbase = IMX_UART2_BASE, /* FIXME */ 689 .mapbase = IMX_UART2_BASE, /* FIXME */
690 .irq = UART2_MINT_RX, 690 .irq = UART2_MINT_RX,
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 66f117d15065..419dd3cd7862 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -215,7 +215,7 @@ static void __load_zsregs(struct zilog_channel *channel, unsigned char *regs)
215 /* Lower and upper byte of baud rate generator divisor. */ 215 /* Lower and upper byte of baud rate generator divisor. */
216 write_zsreg(channel, R12, regs[R12]); 216 write_zsreg(channel, R12, regs[R12]);
217 write_zsreg(channel, R13, regs[R13]); 217 write_zsreg(channel, R13, regs[R13]);
218 218
219 /* Now rewrite R14, with BRENAB (if set). */ 219 /* Now rewrite R14, with BRENAB (if set). */
220 write_zsreg(channel, R14, regs[R14]); 220 write_zsreg(channel, R14, regs[R14]);
221 221
@@ -571,7 +571,7 @@ static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
571 else 571 else
572 clear_bits |= DTR; 572 clear_bits |= DTR;
573 573
574 /* NOTE: Not subject to 'transmitter active' rule. */ 574 /* NOTE: Not subject to 'transmitter active' rule. */
575 up->curregs[R5] |= set_bits; 575 up->curregs[R5] |= set_bits;
576 up->curregs[R5] &= ~clear_bits; 576 up->curregs[R5] &= ~clear_bits;
577 write_zsreg(channel, R5, up->curregs[R5]); 577 write_zsreg(channel, R5, up->curregs[R5]);
@@ -654,7 +654,7 @@ static void ip22zilog_enable_ms(struct uart_port *port)
654 if (new_reg != up->curregs[R15]) { 654 if (new_reg != up->curregs[R15]) {
655 up->curregs[R15] = new_reg; 655 up->curregs[R15] = new_reg;
656 656
657 /* NOTE: Not subject to 'transmitter active' rule. */ 657 /* NOTE: Not subject to 'transmitter active' rule. */
658 write_zsreg(channel, R15, up->curregs[R15]); 658 write_zsreg(channel, R15, up->curregs[R15]);
659 } 659 }
660} 660}
@@ -680,7 +680,7 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
680 if (new_reg != up->curregs[R5]) { 680 if (new_reg != up->curregs[R5]) {
681 up->curregs[R5] = new_reg; 681 up->curregs[R5] = new_reg;
682 682
683 /* NOTE: Not subject to 'transmitter active' rule. */ 683 /* NOTE: Not subject to 'transmitter active' rule. */
684 write_zsreg(channel, R5, up->curregs[R5]); 684 write_zsreg(channel, R5, up->curregs[R5]);
685 } 685 }
686 686
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index b48066a64a7d..242a04104393 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -80,7 +80,7 @@
80#include <asm/serial.h> 80#include <asm/serial.h>
81 81
82/* Standard COM flags */ 82/* Standard COM flags */
83#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 83#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
84 84
85/* 85/*
86 * SERIAL_PORT_DFNS tells us about built-in ports that have no 86 * SERIAL_PORT_DFNS tells us about built-in ports that have no
diff --git a/drivers/serial/m32r_sio.h b/drivers/serial/m32r_sio.h
index 07d0dd80aa3d..7c3ec24f7e50 100644
--- a/drivers/serial/m32r_sio.h
+++ b/drivers/serial/m32r_sio.h
@@ -37,7 +37,7 @@ struct old_serial_port {
37 unsigned int irq; 37 unsigned int irq;
38 unsigned int flags; 38 unsigned int flags;
39 unsigned char io_type; 39 unsigned char io_type;
40 unsigned char *iomem_base; 40 unsigned char __iomem *iomem_base;
41 unsigned short iomem_reg_shift; 41 unsigned short iomem_reg_shift;
42}; 42};
43 43
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 0ef648fa4b2d..8cbbb954df2c 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -57,20 +57,16 @@ struct timer_list mcfrs_timer_struct;
57 * keep going. Perhaps one day the cflag settings for the 57 * keep going. Perhaps one day the cflag settings for the
58 * console can be used instead. 58 * console can be used instead.
59 */ 59 */
60#if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \
61 defined(CONFIG_senTec) || defined(CONFIG_SNEHA)
62#define CONSOLE_BAUD_RATE 19200
63#define DEFAULT_CBAUD B19200
64#endif
65
66#if defined(CONFIG_HW_FEITH) 60#if defined(CONFIG_HW_FEITH)
67#define CONSOLE_BAUD_RATE 38400 61#define CONSOLE_BAUD_RATE 38400
68#define DEFAULT_CBAUD B38400 62#define DEFAULT_CBAUD B38400
69#endif 63#elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)
70
71#if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)
72#define CONSOLE_BAUD_RATE 115200 64#define CONSOLE_BAUD_RATE 115200
73#define DEFAULT_CBAUD B115200 65#define DEFAULT_CBAUD B115200
66#elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \
67 defined(CONFIG_senTec) || defined(CONFIG_SNEHA)
68#define CONSOLE_BAUD_RATE 19200
69#define DEFAULT_CBAUD B19200
74#endif 70#endif
75 71
76#ifndef CONSOLE_BAUD_RATE 72#ifndef CONSOLE_BAUD_RATE
@@ -350,7 +346,7 @@ static inline void receive_chars(struct mcf_serial *info)
350 } 346 }
351 tty_insert_flip_char(tty, ch, flag); 347 tty_insert_flip_char(tty, ch, flag);
352 } 348 }
353 tty_flip_buffer_push(tty); 349 tty_schedule_flip(tty);
354 return; 350 return;
355} 351}
356 352
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 4e49168c3176..868eaf4a1a68 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -462,7 +462,7 @@ static int __init mux_probe(struct parisc_device *dev)
462 port->mapbase = dev->hpa.start + MUX_OFFSET + 462 port->mapbase = dev->hpa.start + MUX_OFFSET +
463 (i * MUX_LINE_OFFSET); 463 (i * MUX_LINE_OFFSET);
464 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); 464 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET);
465 port->iotype = SERIAL_IO_MEM; 465 port->iotype = UPIO_MEM;
466 port->type = PORT_MUX; 466 port->type = PORT_MUX;
467 port->irq = NO_IRQ; 467 port->irq = NO_IRQ;
468 port->uartclk = 0; 468 port->uartclk = 0;
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 4e03a87f3fb4..9b7ed58cb53b 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1492,7 +1492,7 @@ no_dma:
1492 /* 1492 /*
1493 * Init remaining bits of "port" structure 1493 * Init remaining bits of "port" structure
1494 */ 1494 */
1495 uap->port.iotype = SERIAL_IO_MEM; 1495 uap->port.iotype = UPIO_MEM;
1496 uap->port.irq = np->intrs[0].line; 1496 uap->port.irq = np->intrs[0].line;
1497 uap->port.uartclk = ZS_CLOCK; 1497 uap->port.uartclk = ZS_CLOCK;
1498 uap->port.fifosize = 1; 1498 uap->port.fifosize = 1;
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 0a2dd6c5b95f..7410e093a6b9 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -161,7 +161,11 @@ s3c24xx_serial_dbg(const char *fmt, ...)
161 161
162/* we can support 3 uarts, but not always use them */ 162/* we can support 3 uarts, but not always use them */
163 163
164#ifdef CONFIG_CPU_S3C2400
165#define NR_PORTS (2)
166#else
164#define NR_PORTS (3) 167#define NR_PORTS (3)
168#endif
165 169
166/* port irq numbers */ 170/* port irq numbers */
167 171
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index ff7b60b4de37..2c00b8625852 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -628,7 +628,7 @@ static void __init sa1100_init_ports(void)
628 sa1100_ports[i].port.ops = &sa1100_pops; 628 sa1100_ports[i].port.ops = &sa1100_pops;
629 sa1100_ports[i].port.fifosize = 8; 629 sa1100_ports[i].port.fifosize = 8;
630 sa1100_ports[i].port.line = i; 630 sa1100_ports[i].port.line = i;
631 sa1100_ports[i].port.iotype = SERIAL_IO_MEM; 631 sa1100_ports[i].port.iotype = UPIO_MEM;
632 init_timer(&sa1100_ports[i].timer); 632 init_timer(&sa1100_ports[i].timer);
633 sa1100_ports[i].timer.function = sa1100_timeout; 633 sa1100_ports[i].timer.function = sa1100_timeout;
634 sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i]; 634 sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i];
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index d0490f67f597..04186eaae227 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -501,7 +501,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
501 .port = { 501 .port = {
502 .membase = (void*) io_p2v (UART1_PHYS), 502 .membase = (void*) io_p2v (UART1_PHYS),
503 .mapbase = UART1_PHYS, 503 .mapbase = UART1_PHYS,
504 .iotype = SERIAL_IO_MEM, 504 .iotype = UPIO_MEM,
505 .irq = IRQ_UART1INTR, 505 .irq = IRQ_UART1INTR,
506 .uartclk = 14745600/2, 506 .uartclk = 14745600/2,
507 .fifosize = 16, 507 .fifosize = 16,
@@ -514,7 +514,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
514 .port = { 514 .port = {
515 .membase = (void*) io_p2v (UART2_PHYS), 515 .membase = (void*) io_p2v (UART2_PHYS),
516 .mapbase = UART2_PHYS, 516 .mapbase = UART2_PHYS,
517 .iotype = SERIAL_IO_MEM, 517 .iotype = UPIO_MEM,
518 .irq = IRQ_UART2INTR, 518 .irq = IRQ_UART2INTR,
519 .uartclk = 14745600/2, 519 .uartclk = 14745600/2,
520 .fifosize = 16, 520 .fifosize = 16,
@@ -527,7 +527,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
527 .port = { 527 .port = {
528 .membase = (void*) io_p2v (UART3_PHYS), 528 .membase = (void*) io_p2v (UART3_PHYS),
529 .mapbase = UART3_PHYS, 529 .mapbase = UART3_PHYS,
530 .iotype = SERIAL_IO_MEM, 530 .iotype = UPIO_MEM,
531 .irq = IRQ_UART3INTR, 531 .irq = IRQ_UART3INTR,
532 .uartclk = 14745600/2, 532 .uartclk = 14745600/2,
533 .fifosize = 16, 533 .fifosize = 16,
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 80737c131ce7..44f6bf79bbe1 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1468,10 +1468,10 @@ static struct sci_port sci_ports[] = {
1468 .port = { 1468 .port = {
1469 .membase = (void *)0xff923000, 1469 .membase = (void *)0xff923000,
1470 .mapbase = 0xff923000, 1470 .mapbase = 0xff923000,
1471 .iotype = SERIAL_IO_MEM, 1471 .iotype = UPIO_MEM,
1472 .irq = 61, 1472 .irq = 61,
1473 .ops = &sci_uart_ops, 1473 .ops = &sci_uart_ops,
1474 .flags = ASYNC_BOOT_AUTOCONF, 1474 .flags = UPF_BOOT_AUTOCONF,
1475 .line = 0, 1475 .line = 0,
1476 }, 1476 },
1477 .type = PORT_SCIF, 1477 .type = PORT_SCIF,
@@ -1482,10 +1482,10 @@ static struct sci_port sci_ports[] = {
1482 .port = { 1482 .port = {
1483 .membase = (void *)0xff924000, 1483 .membase = (void *)0xff924000,
1484 .mapbase = 0xff924000, 1484 .mapbase = 0xff924000,
1485 .iotype = SERIAL_IO_MEM, 1485 .iotype = UPIO_MEM,
1486 .irq = 62, 1486 .irq = 62,
1487 .ops = &sci_uart_ops, 1487 .ops = &sci_uart_ops,
1488 .flags = ASYNC_BOOT_AUTOCONF, 1488 .flags = UPF_BOOT_AUTOCONF,
1489 .line = 1, 1489 .line = 1,
1490 }, 1490 },
1491 .type = PORT_SCIF, 1491 .type = PORT_SCIF,
@@ -1496,10 +1496,10 @@ static struct sci_port sci_ports[] = {
1496 .port = { 1496 .port = {
1497 .membase = (void *)0xff925000, 1497 .membase = (void *)0xff925000,
1498 .mapbase = 0xff925000, 1498 .mapbase = 0xff925000,
1499 .iotype = SERIAL_IO_MEM, 1499 .iotype = UPIO_MEM,
1500 .irq = 63, 1500 .irq = 63,
1501 .ops = &sci_uart_ops, 1501 .ops = &sci_uart_ops,
1502 .flags = ASYNC_BOOT_AUTOCONF, 1502 .flags = UPF_BOOT_AUTOCONF,
1503 .line = 2, 1503 .line = 2,
1504 }, 1504 },
1505 .type = PORT_SCIF, 1505 .type = PORT_SCIF,
@@ -1511,10 +1511,10 @@ static struct sci_port sci_ports[] = {
1511 .port = { 1511 .port = {
1512 .membase = (void *)0xffe00000, 1512 .membase = (void *)0xffe00000,
1513 .mapbase = 0xffe00000, 1513 .mapbase = 0xffe00000,
1514 .iotype = SERIAL_IO_MEM, 1514 .iotype = UPIO_MEM,
1515 .irq = 43, 1515 .irq = 43,
1516 .ops = &sci_uart_ops, 1516 .ops = &sci_uart_ops,
1517 .flags = ASYNC_BOOT_AUTOCONF, 1517 .flags = UPF_BOOT_AUTOCONF,
1518 .line = 0, 1518 .line = 0,
1519 }, 1519 },
1520 .type = PORT_SCIF, 1520 .type = PORT_SCIF,
@@ -1525,10 +1525,10 @@ static struct sci_port sci_ports[] = {
1525 .port = { 1525 .port = {
1526 .membase = (void *)0xffe10000, 1526 .membase = (void *)0xffe10000,
1527 .mapbase = 0xffe10000, 1527 .mapbase = 0xffe10000,
1528 .iotype = SERIAL_IO_MEM, 1528 .iotype = UPIO_MEM,
1529 .irq = 79, 1529 .irq = 79,
1530 .ops = &sci_uart_ops, 1530 .ops = &sci_uart_ops,
1531 .flags = ASYNC_BOOT_AUTOCONF, 1531 .flags = UPF_BOOT_AUTOCONF,
1532 .line = 1, 1532 .line = 1,
1533 }, 1533 },
1534 .type = PORT_SCIF, 1534 .type = PORT_SCIF,
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 8bcaebcc0ad7..85664228a0b6 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -1036,7 +1036,7 @@ static void __init sab_attach_callback(struct linux_ebus_device *edev, void *arg
1036 up->port.irq = edev->irqs[0]; 1036 up->port.irq = edev->irqs[0];
1037 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; 1037 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE;
1038 up->port.mapbase = (unsigned long)up->regs; 1038 up->port.mapbase = (unsigned long)up->regs;
1039 up->port.iotype = SERIAL_IO_MEM; 1039 up->port.iotype = UPIO_MEM;
1040 1040
1041 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); 1041 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc);
1042 1042
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index bc67442c6b4c..308704566948 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -109,11 +109,11 @@ static _INLINE_ unsigned int serial_in(struct uart_sunsu_port *up, int offset)
109 offset <<= up->port.regshift; 109 offset <<= up->port.regshift;
110 110
111 switch (up->port.iotype) { 111 switch (up->port.iotype) {
112 case SERIAL_IO_HUB6: 112 case UPIO_HUB6:
113 outb(up->port.hub6 - 1 + offset, up->port.iobase); 113 outb(up->port.hub6 - 1 + offset, up->port.iobase);
114 return inb(up->port.iobase + 1); 114 return inb(up->port.iobase + 1);
115 115
116 case SERIAL_IO_MEM: 116 case UPIO_MEM:
117 return readb(up->port.membase + offset); 117 return readb(up->port.membase + offset);
118 118
119 default: 119 default:
@@ -139,12 +139,12 @@ serial_out(struct uart_sunsu_port *up, int offset, int value)
139 offset <<= up->port.regshift; 139 offset <<= up->port.regshift;
140 140
141 switch (up->port.iotype) { 141 switch (up->port.iotype) {
142 case SERIAL_IO_HUB6: 142 case UPIO_HUB6:
143 outb(up->port.hub6 - 1 + offset, up->port.iobase); 143 outb(up->port.hub6 - 1 + offset, up->port.iobase);
144 outb(value, up->port.iobase + 1); 144 outb(value, up->port.iobase + 1);
145 break; 145 break;
146 146
147 case SERIAL_IO_MEM: 147 case UPIO_MEM:
148 writeb(value, up->port.membase + offset); 148 writeb(value, up->port.membase + offset);
149 break; 149 break;
150 150
@@ -1052,7 +1052,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
1052 return; 1052 return;
1053 1053
1054 up->type_probed = PORT_UNKNOWN; 1054 up->type_probed = PORT_UNKNOWN;
1055 up->port.iotype = SERIAL_IO_MEM; 1055 up->port.iotype = UPIO_MEM;
1056 1056
1057 /* 1057 /*
1058 * First we look for Ebus-bases su's 1058 * First we look for Ebus-bases su's
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 3c72484adea7..5cc4d4c2935c 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1487,7 +1487,7 @@ static void __init sunzilog_prepare(void)
1487 up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB; 1487 up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB;
1488 1488
1489 /* Channel A */ 1489 /* Channel A */
1490 up[(chip * 2) + 0].port.iotype = SERIAL_IO_MEM; 1490 up[(chip * 2) + 0].port.iotype = UPIO_MEM;
1491 up[(chip * 2) + 0].port.irq = zilog_irq; 1491 up[(chip * 2) + 0].port.irq = zilog_irq;
1492 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; 1492 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
1493 up[(chip * 2) + 0].port.fifosize = 1; 1493 up[(chip * 2) + 0].port.fifosize = 1;
@@ -1498,7 +1498,7 @@ static void __init sunzilog_prepare(void)
1498 up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; 1498 up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A;
1499 1499
1500 /* Channel B */ 1500 /* Channel B */
1501 up[(chip * 2) + 1].port.iotype = SERIAL_IO_MEM; 1501 up[(chip * 2) + 1].port.iotype = UPIO_MEM;
1502 up[(chip * 2) + 1].port.irq = zilog_irq; 1502 up[(chip * 2) + 1].port.irq = zilog_irq;
1503 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; 1503 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
1504 up[(chip * 2) + 1].port.fifosize = 1; 1504 up[(chip * 2) + 1].port.fifosize = 1;
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
index 9378895a8d56..df705fda4243 100644
--- a/drivers/serial/v850e_uart.c
+++ b/drivers/serial/v850e_uart.c
@@ -496,7 +496,7 @@ static int __init v850e_uart_init (void)
496 496
497 port->ops = &v850e_uart_ops; 497 port->ops = &v850e_uart_ops;
498 port->line = chan; 498 port->line = chan;
499 port->iotype = SERIAL_IO_MEM; 499 port->iotype = UPIO_MEM;
500 port->flags = UPF_BOOT_AUTOCONF; 500 port->flags = UPF_BOOT_AUTOCONF;
501 501
502 /* We actually use multiple IRQs, but the serial 502 /* We actually use multiple IRQs, but the serial
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index c70ae81b5d98..12357e1fa558 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -38,10 +38,10 @@ static inline unsigned mcr_pack(unsigned pulse, unsigned sample)
38 38
39static int nic_wait(struct ioc3_driver_data *idd) 39static int nic_wait(struct ioc3_driver_data *idd)
40{ 40{
41 volatile unsigned mcr; 41 unsigned mcr;
42 42
43 do { 43 do {
44 mcr = (volatile unsigned)idd->vma->mcr; 44 mcr = readl(&idd->vma->mcr);
45 } while (!(mcr & 2)); 45 } while (!(mcr & 2));
46 46
47 return mcr & 1; 47 return mcr & 1;
@@ -53,7 +53,7 @@ static int nic_reset(struct ioc3_driver_data *idd)
53 unsigned long flags; 53 unsigned long flags;
54 54
55 local_irq_save(flags); 55 local_irq_save(flags);
56 idd->vma->mcr = mcr_pack(500, 65); 56 writel(mcr_pack(500, 65), &idd->vma->mcr);
57 presence = nic_wait(idd); 57 presence = nic_wait(idd);
58 local_irq_restore(flags); 58 local_irq_restore(flags);
59 59
@@ -68,7 +68,7 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
68 unsigned long flags; 68 unsigned long flags;
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 idd->vma->mcr = mcr_pack(6, 13); 71 writel(mcr_pack(6, 13), &idd->vma->mcr);
72 result = nic_wait(idd); 72 result = nic_wait(idd);
73 local_irq_restore(flags); 73 local_irq_restore(flags);
74 74
@@ -80,9 +80,9 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) 80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit)
81{ 81{
82 if (bit) 82 if (bit)
83 idd->vma->mcr = mcr_pack(6, 110); 83 writel(mcr_pack(6, 110), &idd->vma->mcr);
84 else 84 else
85 idd->vma->mcr = mcr_pack(80, 30); 85 writel(mcr_pack(80, 30), &idd->vma->mcr);
86 86
87 nic_wait(idd); 87 nic_wait(idd);
88} 88}
@@ -337,7 +337,7 @@ static void probe_nic(struct ioc3_driver_data *idd)
337 int save = 0, loops = 3; 337 int save = 0, loops = 3;
338 unsigned long first, addr; 338 unsigned long first, addr;
339 339
340 idd->vma->gpcr_s = GPCR_MLAN_EN; 340 writel(GPCR_MLAN_EN, &idd->vma->gpcr_s);
341 341
342 while(loops>0) { 342 while(loops>0) {
343 idd->nic_part[0] = 0; 343 idd->nic_part[0] = 0;
@@ -408,7 +408,7 @@ static irqreturn_t ioc3_intr_io(int irq, void *arg, struct pt_regs *regs)
408 408
409 read_lock_irqsave(&ioc3_submodules_lock, flags); 409 read_lock_irqsave(&ioc3_submodules_lock, flags);
410 410
411 if(idd->dual_irq && idd->vma->eisr) { 411 if(idd->dual_irq && readb(&idd->vma->eisr)) {
412 /* send Ethernet IRQ to the driver */ 412 /* send Ethernet IRQ to the driver */
413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && 413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] &&
414 ioc3_ethernet->intr) { 414 ioc3_ethernet->intr) {
@@ -682,7 +682,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
682 idd->id = ioc3_counter++; 682 idd->id = ioc3_counter++;
683 up_write(&ioc3_devices_rwsem); 683 up_write(&ioc3_devices_rwsem);
684 684
685 idd->gpdr_shadow = idd->vma->gpdr; 685 idd->gpdr_shadow = readl(&idd->vma->gpdr);
686 686
687 /* Read IOC3 NIC contents */ 687 /* Read IOC3 NIC contents */
688 probe_nic(idd); 688 probe_nic(idd);
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b77dbd63e596..7a75faeb0526 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -75,16 +75,6 @@ config SPI_BUTTERFLY
75 inexpensive battery powered microcontroller evaluation board. 75 inexpensive battery powered microcontroller evaluation board.
76 This same cable can be used to flash new firmware. 76 This same cable can be used to flash new firmware.
77 77
78config SPI_BUTTERFLY
79 tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)"
80 depends on SPI_MASTER && PARPORT && EXPERIMENTAL
81 select SPI_BITBANG
82 help
83 This uses a custom parallel port cable to connect to an AVR
84 Butterfly <http://www.atmel.com/products/avr/butterfly>, an
85 inexpensive battery powered microcontroller evaluation board.
86 This same cable can be used to flash new firmware.
87
88# 78#
89# Add new SPI master controllers in alphabetical order above this line 79# Add new SPI master controllers in alphabetical order above this line
90# 80#
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 79a3c59615ab..ff9e5faa4dc9 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -163,21 +163,20 @@ static void butterfly_chipselect(struct spi_device *spi, int value)
163 struct butterfly *pp = spidev_to_pp(spi); 163 struct butterfly *pp = spidev_to_pp(spi);
164 164
165 /* set default clock polarity */ 165 /* set default clock polarity */
166 if (value) 166 if (value != BITBANG_CS_INACTIVE)
167 setsck(spi, spi->mode & SPI_CPOL); 167 setsck(spi, spi->mode & SPI_CPOL);
168 168
169 /* no chipselect on this USI link config */ 169 /* no chipselect on this USI link config */
170 if (is_usidev(spi)) 170 if (is_usidev(spi))
171 return; 171 return;
172 172
173 /* here, value == "activate or not" */ 173 /* here, value == "activate or not";
174 174 * most PARPORT_CONTROL_* bits are negated, so we must
175 /* most PARPORT_CONTROL_* bits are negated */ 175 * morph it to value == "bit value to write in control register"
176 */
176 if (spi_cs_bit == PARPORT_CONTROL_INIT) 177 if (spi_cs_bit == PARPORT_CONTROL_INIT)
177 value = !value; 178 value = !value;
178 179
179 /* here, value == "bit value to write in control register" */
180
181 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0); 180 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);
182} 181}
183 182
@@ -202,7 +201,9 @@ butterfly_txrx_word_mode0(struct spi_device *spi,
202 201
203/* override default partitioning with cmdlinepart */ 202/* override default partitioning with cmdlinepart */
204static struct mtd_partition partitions[] = { { 203static struct mtd_partition partitions[] = { {
205 /* JFFS2 wants partitions of 4*N blocks for this device ... */ 204 /* JFFS2 wants partitions of 4*N blocks for this device,
205 * so sectors 0 and 1 can't be partitions by themselves.
206 */
206 207
207 /* sector 0 = 8 pages * 264 bytes/page (1 block) 208 /* sector 0 = 8 pages * 264 bytes/page (1 block)
208 * sector 1 = 248 pages * 264 bytes/page 209 * sector 1 = 248 pages * 264 bytes/page
@@ -316,8 +317,9 @@ static void butterfly_attach(struct parport *p)
316 if (status < 0) 317 if (status < 0)
317 goto clean2; 318 goto clean2;
318 319
319 /* Bus 1 lets us talk to at45db041b (firmware disables AVR) 320 /* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR
320 * or AVR (firmware resets at45, acts as spi slave) 321 * (firmware resets at45, acts as spi slave) or neither (we ignore
322 * both, AVR uses AT45). Here we expect firmware for the first option.
321 */ 323 */
322 pp->info[0].max_speed_hz = 15 * 1000 * 1000; 324 pp->info[0].max_speed_hz = 15 * 1000 * 1000;
323 strcpy(pp->info[0].modalias, "mtd_dataflash"); 325 strcpy(pp->info[0].modalias, "mtd_dataflash");
@@ -330,7 +332,9 @@ static void butterfly_attach(struct parport *p)
330 pp->dataflash->dev.bus_id); 332 pp->dataflash->dev.bus_id);
331 333
332#ifdef HAVE_USI 334#ifdef HAVE_USI
333 /* even more custom AVR firmware */ 335 /* Bus 2 is only for talking to the AVR, and it can work no
336 * matter who masters bus 1; needs appropriate AVR firmware.
337 */
334 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000; 338 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000;
335 strcpy(pp->info[1].modalias, "butterfly"); 339 strcpy(pp->info[1].modalias, "butterfly");
336 // pp->info[1].platform_data = ... TBD ... ; 340 // pp->info[1].platform_data = ... TBD ... ;
@@ -378,13 +382,8 @@ static void butterfly_detach(struct parport *p)
378 pp = butterfly; 382 pp = butterfly;
379 butterfly = NULL; 383 butterfly = NULL;
380 384
381#ifdef HAVE_USI 385 /* stop() unregisters child devices too */
382 spi_unregister_device(pp->butterfly); 386 pdev = to_platform_device(pp->bitbang.master->cdev.dev);
383 pp->butterfly = NULL;
384#endif
385 spi_unregister_device(pp->dataflash);
386 pp->dataflash = NULL;
387
388 status = spi_bitbang_stop(&pp->bitbang); 387 status = spi_bitbang_stop(&pp->bitbang);
389 388
390 /* turn off VCC */ 389 /* turn off VCC */
@@ -394,8 +393,6 @@ static void butterfly_detach(struct parport *p)
394 parport_release(pp->pd); 393 parport_release(pp->pd);
395 parport_unregister_device(pp->pd); 394 parport_unregister_device(pp->pd);
396 395
397 pdev = to_platform_device(pp->bitbang.master->cdev.dev);
398
399 (void) spi_master_put(pp->bitbang.master); 396 (void) spi_master_put(pp->bitbang.master);
400 397
401 platform_device_unregister(pdev); 398 platform_device_unregister(pdev);
@@ -420,4 +417,5 @@ static void __exit butterfly_exit(void)
420} 417}
421module_exit(butterfly_exit); 418module_exit(butterfly_exit);
422 419
420MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly");
423MODULE_LICENSE("GPL"); 421MODULE_LICENSE("GPL");
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c
index a0e5af638e0e..4a51e56f85b6 100644
--- a/drivers/tc/tc.c
+++ b/drivers/tc/tc.c
@@ -17,7 +17,6 @@
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19#include <asm/addrspace.h> 19#include <asm/addrspace.h>
20#include <asm/bug.h>
21#include <asm/errno.h> 20#include <asm/errno.h>
22#include <asm/io.h> 21#include <asm/io.h>
23#include <asm/paccess.h> 22#include <asm/paccess.h>
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 9d5015e99372..bd39bbd88d41 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -13,7 +13,6 @@
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <asm/bug.h>
17 16
18static ssize_t backlight_show_power(struct class_device *cdev, char *buf) 17static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
19{ 18{
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 68c690605aa7..9e32485ee7bb 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -13,7 +13,6 @@
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <asm/bug.h>
17 16
18static ssize_t lcd_show_power(struct class_device *cdev, char *buf) 17static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
19{ 18{
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c
index f3927b6cda9d..f5361cd8ccce 100644
--- a/drivers/video/pmag-ba-fb.c
+++ b/drivers/video/pmag-ba-fb.c
@@ -30,7 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/types.h> 31#include <linux/types.h>
32 32
33#include <asm/bug.h>
34#include <asm/io.h> 33#include <asm/io.h>
35#include <asm/system.h> 34#include <asm/system.h>
36 35
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c
index 25148de5fe67..eeeac924b500 100644
--- a/drivers/video/pmagb-b-fb.c
+++ b/drivers/video/pmagb-b-fb.c
@@ -27,7 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30#include <asm/bug.h>
31#include <asm/io.h> 30#include <asm/io.h>
32#include <asm/system.h> 31#include <asm/system.h>
33 32
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5dd0207ffd46..057e60217fc5 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -931,8 +931,8 @@ struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
932{ 932{
933 int err, i; 933 int err, i;
934 sg_req_info_t *r; 934 sg_req_info_t __user *r;
935 struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; 935 struct compat_sg_req_info __user *o = (void __user *)arg;
936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); 936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
937 err = sys_ioctl(fd,cmd,(unsigned long)r); 937 err = sys_ioctl(fd,cmd,(unsigned long)r);
938 if (err < 0) 938 if (err < 0)
@@ -2739,8 +2739,8 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
2739static int 2739static int
2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
2741{ 2741{
2742 struct compat_timeval *tc = (struct compat_timeval *)arg; 2742 struct compat_timeval __user *tc = (struct compat_timeval __user *)arg;
2743 struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2743 struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval));
2744 struct timeval ts; 2744 struct timeval ts;
2745 if (get_user(ts.tv_sec, &tc->tv_sec) || 2745 if (get_user(ts.tv_sec, &tc->tv_sec) ||
2746 get_user(ts.tv_usec, &tc->tv_usec) || 2746 get_user(ts.tv_usec, &tc->tv_usec) ||
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index efc97d9b7860..d575452cd9f7 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -56,7 +56,7 @@ static u64 debugfs_u8_get(void *data)
56DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); 56DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");
57 57
58/** 58/**
59 * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 59 * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value.
60 * 60 *
61 * @name: a pointer to a string containing the name of the file to create. 61 * @name: a pointer to a string containing the name of the file to create.
62 * @mode: the permission that the file should have 62 * @mode: the permission that the file should have
@@ -98,7 +98,7 @@ static u64 debugfs_u16_get(void *data)
98DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); 98DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");
99 99
100/** 100/**
101 * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 101 * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value.
102 * 102 *
103 * @name: a pointer to a string containing the name of the file to create. 103 * @name: a pointer to a string containing the name of the file to create.
104 * @mode: the permission that the file should have 104 * @mode: the permission that the file should have
@@ -140,7 +140,7 @@ static u64 debugfs_u32_get(void *data)
140DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); 140DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");
141 141
142/** 142/**
143 * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 143 * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value.
144 * 144 *
145 * @name: a pointer to a string containing the name of the file to create. 145 * @name: a pointer to a string containing the name of the file to create.
146 * @mode: the permission that the file should have 146 * @mode: the permission that the file should have
diff --git a/fs/inotify.c b/fs/inotify.c
index 878ccca61213..3041503bde02 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -967,7 +967,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
967 mask_add = 1; 967 mask_add = 1;
968 968
969 /* don't let user-space set invalid bits: we don't want flags set */ 969 /* don't let user-space set invalid bits: we don't want flags set */
970 mask &= IN_ALL_EVENTS; 970 mask &= IN_ALL_EVENTS | IN_ONESHOT;
971 if (unlikely(!mask)) { 971 if (unlikely(!mask)) {
972 ret = -EINVAL; 972 ret = -EINVAL;
973 goto out; 973 goto out;
diff --git a/fs/namei.c b/fs/namei.c
index faf61c35308c..e28de846c591 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name,
1119 current->total_link_count = 0; 1119 current->total_link_count = 0;
1120 retval = link_path_walk(name, nd); 1120 retval = link_path_walk(name, nd);
1121out: 1121out:
1122 if (unlikely(current->audit_context 1122 if (likely(retval == 0)) {
1123 && nd && nd->dentry && nd->dentry->d_inode)) 1123 if (unlikely(current->audit_context && nd && nd->dentry &&
1124 nd->dentry->d_inode))
1124 audit_inode(name, nd->dentry->d_inode, flags); 1125 audit_inode(name, nd->dentry->d_inode, flags);
1126 }
1125 return retval; 1127 return retval;
1126 1128
1127fput_unlock_fail: 1129fput_unlock_fail:
diff --git a/fs/namespace.c b/fs/namespace.c
index ce97becff461..058a44865beb 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -494,7 +494,7 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
494 p->mnt_namespace = NULL; 494 p->mnt_namespace = NULL;
495 list_del_init(&p->mnt_child); 495 list_del_init(&p->mnt_child);
496 if (p->mnt_parent != p) 496 if (p->mnt_parent != p)
497 mnt->mnt_mountpoint->d_mounted--; 497 p->mnt_mountpoint->d_mounted--;
498 change_mnt_propagation(p, MS_PRIVATE); 498 change_mnt_propagation(p, MS_PRIVATE);
499 } 499 }
500} 500}
@@ -1325,27 +1325,17 @@ dput_out:
1325 return retval; 1325 return retval;
1326} 1326}
1327 1327
1328int copy_namespace(int flags, struct task_struct *tsk) 1328/*
1329 * Allocate a new namespace structure and populate it with contents
1330 * copied from the namespace of the passed in task structure.
1331 */
1332struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1329{ 1333{
1330 struct namespace *namespace = tsk->namespace; 1334 struct namespace *namespace = tsk->namespace;
1331 struct namespace *new_ns; 1335 struct namespace *new_ns;
1332 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; 1336 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
1333 struct fs_struct *fs = tsk->fs;
1334 struct vfsmount *p, *q; 1337 struct vfsmount *p, *q;
1335 1338
1336 if (!namespace)
1337 return 0;
1338
1339 get_namespace(namespace);
1340
1341 if (!(flags & CLONE_NEWNS))
1342 return 0;
1343
1344 if (!capable(CAP_SYS_ADMIN)) {
1345 put_namespace(namespace);
1346 return -EPERM;
1347 }
1348
1349 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); 1339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);
1350 if (!new_ns) 1340 if (!new_ns)
1351 goto out; 1341 goto out;
@@ -1396,8 +1386,6 @@ int copy_namespace(int flags, struct task_struct *tsk)
1396 } 1386 }
1397 up_write(&namespace_sem); 1387 up_write(&namespace_sem);
1398 1388
1399 tsk->namespace = new_ns;
1400
1401 if (rootmnt) 1389 if (rootmnt)
1402 mntput(rootmnt); 1390 mntput(rootmnt);
1403 if (pwdmnt) 1391 if (pwdmnt)
@@ -1405,12 +1393,40 @@ int copy_namespace(int flags, struct task_struct *tsk)
1405 if (altrootmnt) 1393 if (altrootmnt)
1406 mntput(altrootmnt); 1394 mntput(altrootmnt);
1407 1395
1408 put_namespace(namespace); 1396out:
1409 return 0; 1397 return new_ns;
1398}
1399
1400int copy_namespace(int flags, struct task_struct *tsk)
1401{
1402 struct namespace *namespace = tsk->namespace;
1403 struct namespace *new_ns;
1404 int err = 0;
1405
1406 if (!namespace)
1407 return 0;
1408
1409 get_namespace(namespace);
1410
1411 if (!(flags & CLONE_NEWNS))
1412 return 0;
1413
1414 if (!capable(CAP_SYS_ADMIN)) {
1415 err = -EPERM;
1416 goto out;
1417 }
1418
1419 new_ns = dup_namespace(tsk, tsk->fs);
1420 if (!new_ns) {
1421 err = -ENOMEM;
1422 goto out;
1423 }
1424
1425 tsk->namespace = new_ns;
1410 1426
1411out: 1427out:
1412 put_namespace(namespace); 1428 put_namespace(namespace);
1413 return -ENOMEM; 1429 return err;
1414} 1430}
1415 1431
1416asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, 1432asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name,
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index e897e00c2c9d..c0a754ecdee6 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -465,10 +465,11 @@ static int __init root_nfs_ports(void)
465 "number from server, using default\n"); 465 "number from server, using default\n");
466 port = nfsd_port; 466 port = nfsd_port;
467 } 467 }
468 nfs_port = htons(port); 468 nfs_port = port;
469 dprintk("Root-NFS: Portmapper on server returned %d " 469 dprintk("Root-NFS: Portmapper on server returned %d "
470 "as nfsd port\n", port); 470 "as nfsd port\n", port);
471 } 471 }
472 nfs_port = htons(nfs_port);
472 473
473 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { 474 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {
474 printk(KERN_ERR "Root-NFS: Unable to get mountd port " 475 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a00fe8686293..6d63f1d9e5f5 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -195,10 +195,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
195 195
196 /* Openowner is now set, so sequence id will get bumped. Now we need 196 /* Openowner is now set, so sequence id will get bumped. Now we need
197 * these checks before we do any creates: */ 197 * these checks before we do any creates: */
198 status = nfserr_grace;
198 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) 199 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
199 return nfserr_grace; 200 goto out;
201 status = nfserr_no_grace;
200 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) 202 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
201 return nfserr_no_grace; 203 goto out;
202 204
203 switch (open->op_claim_type) { 205 switch (open->op_claim_type) {
204 case NFS4_OPEN_CLAIM_DELEGATE_CUR: 206 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
diff --git a/fs/reiserfs/hashes.c b/fs/reiserfs/hashes.c
index a3ec238fd9e0..e664ac16fad9 100644
--- a/fs/reiserfs/hashes.c
+++ b/fs/reiserfs/hashes.c
@@ -21,7 +21,6 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/reiserfs_fs.h> 22#include <linux/reiserfs_fs.h>
23#include <asm/types.h> 23#include <asm/types.h>
24#include <asm/bug.h>
25 24
26#define DELTA 0x9E3779B9 25#define DELTA 0x9E3779B9
27#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */ 26#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
diff --git a/fs/select.c b/fs/select.c
index c0f02d36c60e..bc60a3e14ef3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -510,9 +510,9 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
510 510
511 if (sig) { 511 if (sig) {
512 if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t)) 512 if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t))
513 || __get_user(up, (sigset_t * __user *)sig) 513 || __get_user(up, (sigset_t __user * __user *)sig)
514 || __get_user(sigsetsize, 514 || __get_user(sigsetsize,
515 (size_t * __user)(sig+sizeof(void *)))) 515 (size_t __user *)(sig+sizeof(void *))))
516 return -EFAULT; 516 return -EFAULT;
517 } 517 }
518 518
diff --git a/fs/super.c b/fs/super.c
index c177b92419c5..30294218fa63 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -247,8 +247,9 @@ void generic_shutdown_super(struct super_block *sb)
247 247
248 /* Forget any remaining inodes */ 248 /* Forget any remaining inodes */
249 if (invalidate_inodes(sb)) { 249 if (invalidate_inodes(sb)) {
250 printk("VFS: Busy inodes after unmount. " 250 printk("VFS: Busy inodes after unmount of %s. "
251 "Self-destruct in 5 seconds. Have a nice day...\n"); 251 "Self-destruct in 5 seconds. Have a nice day...\n",
252 sb->s_id);
252 } 253 }
253 254
254 unlock_kernel(); 255 unlock_kernel();
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 9892268e3005..8f2beec526cf 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -747,10 +747,11 @@ xfs_convert_page(
747 struct backing_dev_info *bdi; 747 struct backing_dev_info *bdi;
748 748
749 bdi = inode->i_mapping->backing_dev_info; 749 bdi = inode->i_mapping->backing_dev_info;
750 wbc->nr_to_write--;
750 if (bdi_write_congested(bdi)) { 751 if (bdi_write_congested(bdi)) {
751 wbc->encountered_congestion = 1; 752 wbc->encountered_congestion = 1;
752 done = 1; 753 done = 1;
753 } else if (--wbc->nr_to_write <= 0) { 754 } else if (wbc->nr_to_write <= 0) {
754 done = 1; 755 done = 1;
755 } 756 }
756 } 757 }
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index eda7919b70a1..d7f6f2d8ac8e 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -673,6 +673,8 @@ linvfs_setattr(
673 if (ia_valid & ATTR_ATIME) { 673 if (ia_valid & ATTR_ATIME) {
674 vattr.va_mask |= XFS_AT_ATIME; 674 vattr.va_mask |= XFS_AT_ATIME;
675 vattr.va_atime = attr->ia_atime; 675 vattr.va_atime = attr->ia_atime;
676 if (ia_valid & ATTR_ATIME_SET)
677 inode->i_atime = attr->ia_atime;
676 } 678 }
677 if (ia_valid & ATTR_MTIME) { 679 if (ia_valid & ATTR_MTIME) {
678 vattr.va_mask |= XFS_AT_MTIME; 680 vattr.va_mask |= XFS_AT_MTIME;
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index cc9c7e8cced5..f3b7b1a59c56 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -572,7 +572,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
572 if something tries to do an invalid cmpxchg(). */ 572 if something tries to do an invalid cmpxchg(). */
573extern void __cmpxchg_called_with_bad_pointer(void); 573extern void __cmpxchg_called_with_bad_pointer(void);
574 574
575static inline unsigned long 575static __always_inline unsigned long
576__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 576__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
577{ 577{
578 switch (size) { 578 switch (size) {
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index f5bcc9a1aed6..b726acfcab14 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -116,7 +116,11 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
116 ->offset[((vaddr)&4095)>>2] 116 ->offset[((vaddr)&4095)>>2]
117#define __REG32(paddr) __REGV32(io_p2v(paddr)) 117#define __REG32(paddr) __REGV32(io_p2v(paddr))
118 118
119extern void omap_map_common_io(void); 119extern void omap1_map_common_io(void);
120extern void omap1_init_common_hw(void);
121
122extern void omap2_map_common_io(void);
123extern void omap2_init_common_hw(void);
120 124
121#else 125#else
122 126
diff --git a/include/asm-arm/mutex.h b/include/asm-arm/mutex.h
index 6caa59f1f595..cb29d84e690d 100644
--- a/include/asm-arm/mutex.h
+++ b/include/asm-arm/mutex.h
@@ -23,72 +23,71 @@
23 * simply bail out immediately through the slow path where the lock will be 23 * simply bail out immediately through the slow path where the lock will be
24 * reattempted until it succeeds. 24 * reattempted until it succeeds.
25 */ 25 */
26#define __mutex_fastpath_lock(count, fail_fn) \ 26static inline void
27do { \ 27__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
28 int __ex_flag, __res; \ 28{
29 \ 29 int __ex_flag, __res;
30 typecheck(atomic_t *, count); \ 30
31 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 31 __asm__ (
32 \ 32
33 __asm__ ( \ 33 "ldrex %0, [%2] \n\t"
34 "ldrex %0, [%2] \n" \ 34 "sub %0, %0, #1 \n\t"
35 "sub %0, %0, #1 \n" \ 35 "strex %1, %0, [%2] "
36 "strex %1, %0, [%2] \n" \ 36
37 \ 37 : "=&r" (__res), "=&r" (__ex_flag)
38 : "=&r" (__res), "=&r" (__ex_flag) \ 38 : "r" (&(count)->counter)
39 : "r" (&(count)->counter) \ 39 : "cc","memory" );
40 : "cc","memory" ); \ 40
41 \ 41 __res |= __ex_flag;
42 if (unlikely(__res || __ex_flag)) \ 42 if (unlikely(__res != 0))
43 fail_fn(count); \ 43 fail_fn(count);
44} while (0) 44}
45 45
46#define __mutex_fastpath_lock_retval(count, fail_fn) \ 46static inline int
47({ \ 47__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
48 int __ex_flag, __res; \ 48{
49 \ 49 int __ex_flag, __res;
50 typecheck(atomic_t *, count); \ 50
51 typecheck_fn(fastcall int (*)(atomic_t *), fail_fn); \ 51 __asm__ (
52 \ 52
53 __asm__ ( \ 53 "ldrex %0, [%2] \n\t"
54 "ldrex %0, [%2] \n" \ 54 "sub %0, %0, #1 \n\t"
55 "sub %0, %0, #1 \n" \ 55 "strex %1, %0, [%2] "
56 "strex %1, %0, [%2] \n" \ 56
57 \ 57 : "=&r" (__res), "=&r" (__ex_flag)
58 : "=&r" (__res), "=&r" (__ex_flag) \ 58 : "r" (&(count)->counter)
59 : "r" (&(count)->counter) \ 59 : "cc","memory" );
60 : "cc","memory" ); \ 60
61 \ 61 __res |= __ex_flag;
62 __res |= __ex_flag; \ 62 if (unlikely(__res != 0))
63 if (unlikely(__res != 0)) \ 63 __res = fail_fn(count);
64 __res = fail_fn(count); \ 64 return __res;
65 __res; \ 65}
66})
67 66
68/* 67/*
69 * Same trick is used for the unlock fast path. However the original value, 68 * Same trick is used for the unlock fast path. However the original value,
70 * rather than the result, is used to test for success in order to have 69 * rather than the result, is used to test for success in order to have
71 * better generated assembly. 70 * better generated assembly.
72 */ 71 */
73#define __mutex_fastpath_unlock(count, fail_fn) \ 72static inline void
74do { \ 73__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
75 int __ex_flag, __res, __orig; \ 74{
76 \ 75 int __ex_flag, __res, __orig;
77 typecheck(atomic_t *, count); \ 76
78 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 77 __asm__ (
79 \ 78
80 __asm__ ( \ 79 "ldrex %0, [%3] \n\t"
81 "ldrex %0, [%3] \n" \ 80 "add %1, %0, #1 \n\t"
82 "add %1, %0, #1 \n" \ 81 "strex %2, %1, [%3] "
83 "strex %2, %1, [%3] \n" \ 82
84 \ 83 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
85 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) \ 84 : "r" (&(count)->counter)
86 : "r" (&(count)->counter) \ 85 : "cc","memory" );
87 : "cc","memory" ); \ 86
88 \ 87 __orig |= __ex_flag;
89 if (unlikely(__orig || __ex_flag)) \ 88 if (unlikely(__orig != 0))
90 fail_fn(count); \ 89 fail_fn(count);
91} while (0) 90}
92 91
93/* 92/*
94 * If the unlock was done on a contended lock, or if the unlock simply fails 93 * If the unlock was done on a contended lock, or if the unlock simply fails
@@ -110,12 +109,12 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
110 109
111 __asm__ ( 110 __asm__ (
112 111
113 "1: ldrex %0, [%3] \n" 112 "1: ldrex %0, [%3] \n\t"
114 "subs %1, %0, #1 \n" 113 "subs %1, %0, #1 \n\t"
115 "strexeq %2, %1, [%3] \n" 114 "strexeq %2, %1, [%3] \n\t"
116 "movlt %0, #0 \n" 115 "movlt %0, #0 \n\t"
117 "cmpeq %2, #0 \n" 116 "cmpeq %2, #0 \n\t"
118 "bgt 1b \n" 117 "bgt 1b "
119 118
120 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) 119 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
121 : "r" (&count->counter) 120 : "r" (&count->counter)
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 597496ed2aee..cf6f2cd9c514 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -315,8 +315,9 @@
315#define __NR_faccessat 307 315#define __NR_faccessat 307
316#define __NR_pselect6 308 316#define __NR_pselect6 308
317#define __NR_ppoll 309 317#define __NR_ppoll 309
318#define __NR_unshare 310
318 319
319#define NR_syscalls 310 320#define NR_syscalls 311
320 321
321/* 322/*
322 * user-visible error numbers are in the range -1 - -128: see 323 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-m68knommu/hardirq.h b/include/asm-m68knommu/hardirq.h
index e8659e739a64..476180f4cba2 100644
--- a/include/asm-m68knommu/hardirq.h
+++ b/include/asm-m68knommu/hardirq.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/cache.h> 5#include <linux/cache.h>
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <asm/irq.h>
7 8
8typedef struct { 9typedef struct {
9 unsigned int __softirq_pending; 10 unsigned int __softirq_pending;
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
index 2e7e651c3e3f..1ce0518ace2e 100644
--- a/include/asm-mips/abi.h
+++ b/include/asm-mips/abi.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005 by Ralf Baechle 6 * Copyright (C) 2005, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2005 MIPS Technologies, Inc. 7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */ 8 */
9#ifndef _ASM_ABI_H 9#ifndef _ASM_ABI_H
@@ -13,7 +13,7 @@
13#include <asm/siginfo.h> 13#include <asm/siginfo.h>
14 14
15struct mips_abi { 15struct mips_abi {
16 int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs); 16 void (* const do_signal)(struct pt_regs *regs);
17 int (* const setup_frame)(struct k_sigaction * ka, 17 int (* const setup_frame)(struct k_sigaction * ka,
18 struct pt_regs *regs, int signr, 18 struct pt_regs *regs, int signr,
19 sigset_t *set); 19 sigset_t *set);
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d42685747e7d..5a4c8a54b8f4 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20#include <asm/addrspace.h> 20#include <asm/addrspace.h>
21#include <asm/bug.h>
22#include <asm/byteorder.h> 21#include <asm/byteorder.h>
23#include <asm/cpu.h> 22#include <asm/cpu.h>
24#include <asm/cpu-features.h> 23#include <asm/cpu-features.h>
@@ -57,38 +56,38 @@
57 * variations of functions: non-prefixed ones that preserve the value 56 * variations of functions: non-prefixed ones that preserve the value
58 * and prefixed ones that preserve byte addresses. The latters are 57 * and prefixed ones that preserve byte addresses. The latters are
59 * typically used for moving raw data between a peripheral and memory (cf. 58 * typically used for moving raw data between a peripheral and memory (cf.
60 * string I/O functions), hence the "mem_" prefix. 59 * string I/O functions), hence the "__mem_" prefix.
61 */ 60 */
62#if defined(CONFIG_SWAP_IO_SPACE) 61#if defined(CONFIG_SWAP_IO_SPACE)
63 62
64# define ioswabb(x) (x) 63# define ioswabb(x) (x)
65# define mem_ioswabb(x) (x) 64# define __mem_ioswabb(x) (x)
66# ifdef CONFIG_SGI_IP22 65# ifdef CONFIG_SGI_IP22
67/* 66/*
68 * IP22 seems braindead enough to swap 16bits values in hardware, but 67 * IP22 seems braindead enough to swap 16bits values in hardware, but
69 * not 32bits. Go figure... Can't tell without documentation. 68 * not 32bits. Go figure... Can't tell without documentation.
70 */ 69 */
71# define ioswabw(x) (x) 70# define ioswabw(x) (x)
72# define mem_ioswabw(x) le16_to_cpu(x) 71# define __mem_ioswabw(x) le16_to_cpu(x)
73# else 72# else
74# define ioswabw(x) le16_to_cpu(x) 73# define ioswabw(x) le16_to_cpu(x)
75# define mem_ioswabw(x) (x) 74# define __mem_ioswabw(x) (x)
76# endif 75# endif
77# define ioswabl(x) le32_to_cpu(x) 76# define ioswabl(x) le32_to_cpu(x)
78# define mem_ioswabl(x) (x) 77# define __mem_ioswabl(x) (x)
79# define ioswabq(x) le64_to_cpu(x) 78# define ioswabq(x) le64_to_cpu(x)
80# define mem_ioswabq(x) (x) 79# define __mem_ioswabq(x) (x)
81 80
82#else 81#else
83 82
84# define ioswabb(x) (x) 83# define ioswabb(x) (x)
85# define mem_ioswabb(x) (x) 84# define __mem_ioswabb(x) (x)
86# define ioswabw(x) (x) 85# define ioswabw(x) (x)
87# define mem_ioswabw(x) cpu_to_le16(x) 86# define __mem_ioswabw(x) cpu_to_le16(x)
88# define ioswabl(x) (x) 87# define ioswabl(x) (x)
89# define mem_ioswabl(x) cpu_to_le32(x) 88# define __mem_ioswabl(x) cpu_to_le32(x)
90# define ioswabq(x) (x) 89# define ioswabq(x) (x)
91# define mem_ioswabq(x) cpu_to_le32(x) 90# define __mem_ioswabq(x) cpu_to_le32(x)
92 91
93#endif 92#endif
94 93
@@ -343,7 +342,7 @@ static inline void pfx##write##bwlq(type val, \
343 BUG(); \ 342 BUG(); \
344} \ 343} \
345 \ 344 \
346static inline type pfx##read##bwlq(volatile void __iomem *mem) \ 345static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
347{ \ 346{ \
348 volatile type *__mem; \ 347 volatile type *__mem; \
349 type __val; \ 348 type __val; \
@@ -418,7 +417,7 @@ __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
418 \ 417 \
419__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 418__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
420__BUILD_MEMORY_PFX(, bwlq, type) \ 419__BUILD_MEMORY_PFX(, bwlq, type) \
421__BUILD_MEMORY_PFX(mem_, bwlq, type) \ 420__BUILD_MEMORY_PFX(__mem_, bwlq, type) \
422 421
423BUILDIO_MEM(b, u8) 422BUILDIO_MEM(b, u8)
424BUILDIO_MEM(w, u16) 423BUILDIO_MEM(w, u16)
@@ -431,7 +430,7 @@ BUILDIO_MEM(q, u64)
431 430
432#define BUILDIO_IOPORT(bwlq, type) \ 431#define BUILDIO_IOPORT(bwlq, type) \
433 __BUILD_IOPORT_PFX(, bwlq, type) \ 432 __BUILD_IOPORT_PFX(, bwlq, type) \
434 __BUILD_IOPORT_PFX(mem_, bwlq, type) 433 __BUILD_IOPORT_PFX(__mem_, bwlq, type)
435 434
436BUILDIO_IOPORT(b, u8) 435BUILDIO_IOPORT(b, u8)
437BUILDIO_IOPORT(w, u16) 436BUILDIO_IOPORT(w, u16)
@@ -465,7 +464,7 @@ static inline void writes##bwlq(volatile void __iomem *mem, \
465 const volatile type *__addr = addr; \ 464 const volatile type *__addr = addr; \
466 \ 465 \
467 while (count--) { \ 466 while (count--) { \
468 mem_write##bwlq(*__addr, mem); \ 467 __mem_write##bwlq(*__addr, mem); \
469 __addr++; \ 468 __addr++; \
470 } \ 469 } \
471} \ 470} \
@@ -476,7 +475,7 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
476 volatile type *__addr = addr; \ 475 volatile type *__addr = addr; \
477 \ 476 \
478 while (count--) { \ 477 while (count--) { \
479 *__addr = mem_read##bwlq(mem); \ 478 *__addr = __mem_read##bwlq(mem); \
480 __addr++; \ 479 __addr++; \
481 } \ 480 } \
482} 481}
@@ -489,7 +488,7 @@ static inline void outs##bwlq(unsigned long port, const void *addr, \
489 const volatile type *__addr = addr; \ 488 const volatile type *__addr = addr; \
490 \ 489 \
491 while (count--) { \ 490 while (count--) { \
492 mem_out##bwlq(*__addr, port); \ 491 __mem_out##bwlq(*__addr, port); \
493 __addr++; \ 492 __addr++; \
494 } \ 493 } \
495} \ 494} \
@@ -500,7 +499,7 @@ static inline void ins##bwlq(unsigned long port, void *addr, \
500 volatile type *__addr = addr; \ 499 volatile type *__addr = addr; \
501 \ 500 \
502 while (count--) { \ 501 while (count--) { \
503 *__addr = mem_in##bwlq(port); \ 502 *__addr = __mem_in##bwlq(port); \
504 __addr++; \ 503 __addr++; \
505 } \ 504 } \
506} 505}
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 1612b3fe1080..fa193f861e71 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -114,6 +114,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
116#define TIF_SECCOMP 5 /* secure computing */ 116#define TIF_SECCOMP 5 /* secure computing */
117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
119#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
@@ -125,6 +126,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 126#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 127#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
127#define _TIF_SECCOMP (1<<TIF_SECCOMP) 128#define _TIF_SECCOMP (1<<TIF_SECCOMP)
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
128#define _TIF_USEDFPU (1<<TIF_USEDFPU) 130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
129#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
130 132
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 89ea8b60e945..e7ff9b187783 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -307,17 +307,33 @@
307#define __NR_inotify_init (__NR_Linux + 284) 307#define __NR_inotify_init (__NR_Linux + 284)
308#define __NR_inotify_add_watch (__NR_Linux + 285) 308#define __NR_inotify_add_watch (__NR_Linux + 285)
309#define __NR_inotify_rm_watch (__NR_Linux + 286) 309#define __NR_inotify_rm_watch (__NR_Linux + 286)
310 310#define __NR_migrate_pages (__NR_Linux + 287)
311#define __NR_openat (__NR_Linux + 288)
312#define __NR_mkdirat (__NR_Linux + 289)
313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_newfstatat (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296)
320#define __NR_symlinkat (__NR_Linux + 297)
321#define __NR_readlinkat (__NR_Linux + 298)
322#define __NR_fchmodat (__NR_Linux + 299)
323#define __NR_faccessat (__NR_Linux + 300)
324#define __NR_pselect6 (__NR_Linux + 301)
325#define __NR_ppoll (__NR_Linux + 302)
326#define __NR_unshare (__NR_Linux + 303)
311 327
312/* 328/*
313 * Offset of the last Linux o32 flavoured syscall 329 * Offset of the last Linux o32 flavoured syscall
314 */ 330 */
315#define __NR_Linux_syscalls 286 331#define __NR_Linux_syscalls 303
316 332
317#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 333#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
318 334
319#define __NR_O32_Linux 4000 335#define __NR_O32_Linux 4000
320#define __NR_O32_Linux_syscalls 283 336#define __NR_O32_Linux_syscalls 303
321 337
322#if _MIPS_SIM == _MIPS_SIM_ABI64 338#if _MIPS_SIM == _MIPS_SIM_ABI64
323 339
@@ -571,16 +587,33 @@
571#define __NR_inotify_init (__NR_Linux + 243) 587#define __NR_inotify_init (__NR_Linux + 243)
572#define __NR_inotify_add_watch (__NR_Linux + 244) 588#define __NR_inotify_add_watch (__NR_Linux + 244)
573#define __NR_inotify_rm_watch (__NR_Linux + 245) 589#define __NR_inotify_rm_watch (__NR_Linux + 245)
590#define __NR_migrate_pages (__NR_Linux + 246)
591#define __NR_openat (__NR_Linux + 247)
592#define __NR_mkdirat (__NR_Linux + 248)
593#define __NR_mknodat (__NR_Linux + 249)
594#define __NR_fchownat (__NR_Linux + 250)
595#define __NR_futimesat (__NR_Linux + 251)
596#define __NR_newfstatat (__NR_Linux + 252)
597#define __NR_unlinkat (__NR_Linux + 253)
598#define __NR_renameat (__NR_Linux + 254)
599#define __NR_linkat (__NR_Linux + 255)
600#define __NR_symlinkat (__NR_Linux + 256)
601#define __NR_readlinkat (__NR_Linux + 257)
602#define __NR_fchmodat (__NR_Linux + 258)
603#define __NR_faccessat (__NR_Linux + 259)
604#define __NR_pselect6 (__NR_Linux + 260)
605#define __NR_ppoll (__NR_Linux + 261)
606#define __NR_unshare (__NR_Linux + 262)
574 607
575/* 608/*
576 * Offset of the last Linux 64-bit flavoured syscall 609 * Offset of the last Linux 64-bit flavoured syscall
577 */ 610 */
578#define __NR_Linux_syscalls 245 611#define __NR_Linux_syscalls 262
579 612
580#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 613#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
581 614
582#define __NR_64_Linux 5000 615#define __NR_64_Linux 5000
583#define __NR_64_Linux_syscalls 242 616#define __NR_64_Linux_syscalls 262
584 617
585#if _MIPS_SIM == _MIPS_SIM_NABI32 618#if _MIPS_SIM == _MIPS_SIM_NABI32
586 619
@@ -838,16 +871,33 @@
838#define __NR_inotify_init (__NR_Linux + 247) 871#define __NR_inotify_init (__NR_Linux + 247)
839#define __NR_inotify_add_watch (__NR_Linux + 248) 872#define __NR_inotify_add_watch (__NR_Linux + 248)
840#define __NR_inotify_rm_watch (__NR_Linux + 249) 873#define __NR_inotify_rm_watch (__NR_Linux + 249)
874#define __NR_migrate_pages (__NR_Linux + 250)
875#define __NR_openat (__NR_Linux + 251)
876#define __NR_mkdirat (__NR_Linux + 252)
877#define __NR_mknodat (__NR_Linux + 253)
878#define __NR_fchownat (__NR_Linux + 254)
879#define __NR_futimesat (__NR_Linux + 255)
880#define __NR_newfstatat (__NR_Linux + 256)
881#define __NR_unlinkat (__NR_Linux + 257)
882#define __NR_renameat (__NR_Linux + 258)
883#define __NR_linkat (__NR_Linux + 259)
884#define __NR_symlinkat (__NR_Linux + 260)
885#define __NR_readlinkat (__NR_Linux + 261)
886#define __NR_fchmodat (__NR_Linux + 262)
887#define __NR_faccessat (__NR_Linux + 263)
888#define __NR_pselect6 (__NR_Linux + 264)
889#define __NR_ppoll (__NR_Linux + 265)
890#define __NR_unshare (__NR_Linux + 266)
841 891
842/* 892/*
843 * Offset of the last N32 flavoured syscall 893 * Offset of the last N32 flavoured syscall
844 */ 894 */
845#define __NR_Linux_syscalls 249 895#define __NR_Linux_syscalls 266
846 896
847#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 897#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
848 898
849#define __NR_N32_Linux 6000 899#define __NR_N32_Linux 6000
850#define __NR_N32_Linux_syscalls 246 900#define __NR_N32_Linux_syscalls 266
851 901
852#ifndef __ASSEMBLY__ 902#ifndef __ASSEMBLY__
853 903
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index accb80c9a339..aacaabd28ac1 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -126,6 +126,11 @@ static inline void __user *compat_ptr(compat_uptr_t uptr)
126 return (void __user *)(unsigned long)uptr; 126 return (void __user *)(unsigned long)uptr;
127} 127}
128 128
129static inline compat_uptr_t ptr_to_compat(void __user *uptr)
130{
131 return (u32)(unsigned long)uptr;
132}
133
129static inline void __user *compat_alloc_user_space(long len) 134static inline void __user *compat_alloc_user_space(long len)
130{ 135{
131 struct pt_regs *regs = current->thread.regs; 136 struct pt_regs *regs = current->thread.regs;
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 837756ab7dc7..2ac63f569592 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -15,7 +15,6 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/bug.h>
19 18
20#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 19#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
21 20
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 5b2bd4eefb01..cbd297f44cce 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -222,5 +222,7 @@ extern int of_address_to_resource(struct device_node *dev, int index,
222extern int of_pci_address_to_resource(struct device_node *dev, int bar, 222extern int of_pci_address_to_resource(struct device_node *dev, int bar,
223 struct resource *r); 223 struct resource *r);
224 224
225extern void kdump_move_device_tree(void);
226
225#endif /* __KERNEL__ */ 227#endif /* __KERNEL__ */
226#endif /* _POWERPC_PROM_H */ 228#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 82ce47607774..2dc93632f210 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -521,6 +521,11 @@ struct smu_sdbp_cpupiddata {
521extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 521extern struct smu_sdbp_header *smu_get_sdb_partition(int id,
522 unsigned int *size); 522 unsigned int *size);
523 523
524/* Get "sdb" partition data from an SMU satellite */
525extern struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id,
526 int id, unsigned int *size);
527
528
524#endif /* __KERNEL__ */ 529#endif /* __KERNEL__ */
525 530
526 531
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 67cdaf3ae9fc..c044ec16a879 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -37,7 +37,7 @@ struct thread_info {
37 int preempt_count; /* 0 => preemptable, 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */ 38 <0 => BUG */
39 struct restart_block restart_block; 39 struct restart_block restart_block;
40 void *nvgprs_frame; 40 void __user *nvgprs_frame;
41 /* low level flags - has atomic operations done on it */ 41 /* low level flags - has atomic operations done on it */
42 unsigned long flags ____cacheline_aligned_in_smp; 42 unsigned long flags ____cacheline_aligned_in_smp;
43}; 43};
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index be104f21c70a..0b7c0ca4c3d7 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -61,7 +61,7 @@
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
63 63
64static inline int __access_ok(const void *addr, unsigned long size) 64static inline int __access_ok(const void __user *addr, unsigned long size)
65{ 65{
66 return 1; 66 return 1;
67} 67}
@@ -208,25 +208,25 @@ extern int __put_user_bad(void) __attribute__((noreturn));
208 case 1: { \ 208 case 1: { \
209 unsigned char __x; \ 209 unsigned char __x; \
210 __get_user_asm(__x, ptr, __gu_err); \ 210 __get_user_asm(__x, ptr, __gu_err); \
211 (x) = *(__typeof__(*(ptr)) *) &__x; \ 211 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
212 break; \ 212 break; \
213 }; \ 213 }; \
214 case 2: { \ 214 case 2: { \
215 unsigned short __x; \ 215 unsigned short __x; \
216 __get_user_asm(__x, ptr, __gu_err); \ 216 __get_user_asm(__x, ptr, __gu_err); \
217 (x) = *(__typeof__(*(ptr)) *) &__x; \ 217 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
218 break; \ 218 break; \
219 }; \ 219 }; \
220 case 4: { \ 220 case 4: { \
221 unsigned int __x; \ 221 unsigned int __x; \
222 __get_user_asm(__x, ptr, __gu_err); \ 222 __get_user_asm(__x, ptr, __gu_err); \
223 (x) = *(__typeof__(*(ptr)) *) &__x; \ 223 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
224 break; \ 224 break; \
225 }; \ 225 }; \
226 case 8: { \ 226 case 8: { \
227 unsigned long long __x; \ 227 unsigned long long __x; \
228 __get_user_asm(__x, ptr, __gu_err); \ 228 __get_user_asm(__x, ptr, __gu_err); \
229 (x) = *(__typeof__(*(ptr)) *) &__x; \ 229 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
230 break; \ 230 break; \
231 }; \ 231 }; \
232 default: \ 232 default: \
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 2ac64e65e336..0615d601a7c6 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -315,11 +315,12 @@
315#define __NR_faccessat 296 315#define __NR_faccessat 296
316#define __NR_pselect6 297 316#define __NR_pselect6 297
317#define __NR_ppoll 298 317#define __NR_ppoll 298
318#define __NR_unshare 299
318 319
319/* WARNING: You MAY NOT add syscall numbers larger than 298, since 320/* WARNING: You MAY NOT add syscall numbers larger than 299, since
320 * all of the syscall tables in the Sparc kernel are 321 * all of the syscall tables in the Sparc kernel are
321 * sized to have 298 entries (starting at zero). Therefore 322 * sized to have 299 entries (starting at zero). Therefore
322 * find a free slot in the 0-298 range. 323 * find a free slot in the 0-299 range.
323 */ 324 */
324 325
325#define _syscall0(type,name) \ 326#define _syscall0(type,name) \
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 84ac2bdb0902..c58ba8a096cf 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -317,11 +317,12 @@
317#define __NR_faccessat 296 317#define __NR_faccessat 296
318#define __NR_pselect6 297 318#define __NR_pselect6 297
319#define __NR_ppoll 298 319#define __NR_ppoll 298
320#define __NR_unshare 299
320 321
321/* WARNING: You MAY NOT add syscall numbers larger than 298, since 322/* WARNING: You MAY NOT add syscall numbers larger than 299, since
322 * all of the syscall tables in the Sparc kernel are 323 * all of the syscall tables in the Sparc kernel are
323 * sized to have 298 entries (starting at zero). Therefore 324 * sized to have 299 entries (starting at zero). Therefore
324 * find a free slot in the 0-298 range. 325 * find a free slot in the 0-299 range.
325 */ 326 */
326 327
327#define _syscall0(type,name) \ 328#define _syscall0(type,name) \
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index 9afc0c7d3661..20468983d453 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -313,7 +313,10 @@
313#define __NR_ia32_readlinkat 305 313#define __NR_ia32_readlinkat 305
314#define __NR_ia32_fchmodat 306 314#define __NR_ia32_fchmodat 306
315#define __NR_ia32_faccessat 307 315#define __NR_ia32_faccessat 307
316#define __NR_ia32_pselect6 308
317#define __NR_ia32_ppoll 309
318#define __NR_ia32_unshare 310
316 319
317#define IA32_NR_syscalls 308 /* must be > than biggest syscall! */ 320#define IA32_NR_syscalls 315 /* must be > than biggest syscall! */
318 321
319#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 322#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index 34e434ce3268..dffe276ca2df 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -22,8 +22,15 @@ extern void numa_set_node(int cpu, int node);
22extern unsigned char apicid_to_node[256]; 22extern unsigned char apicid_to_node[256];
23#ifdef CONFIG_NUMA 23#ifdef CONFIG_NUMA
24extern void __init init_cpu_to_node(void); 24extern void __init init_cpu_to_node(void);
25
26static inline void clear_node_cpumask(int cpu)
27{
28 clear_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
29}
30
25#else 31#else
26#define init_cpu_to_node() do {} while (0) 32#define init_cpu_to_node() do {} while (0)
33#define clear_node_cpumask(cpu) do {} while (0)
27#endif 34#endif
28 35
29#define NUMA_NO_NODE 0xff 36#define NUMA_NO_NODE 0xff
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 436d099b5b6b..da0341c57949 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -599,8 +599,14 @@ __SYSCALL(__NR_readlinkat, sys_readlinkat)
599__SYSCALL(__NR_fchmodat, sys_fchmodat) 599__SYSCALL(__NR_fchmodat, sys_fchmodat)
600#define __NR_faccessat 269 600#define __NR_faccessat 269
601__SYSCALL(__NR_faccessat, sys_faccessat) 601__SYSCALL(__NR_faccessat, sys_faccessat)
602 602#define __NR_pselect6 270
603#define __NR_syscall_max __NR_faccessat 603__SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */
604#define __NR_ppoll 271
605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */
606#define __NR_unshare 272
607__SYSCALL(__NR_unshare, sys_unshare)
608
609#define __NR_syscall_max __NR_unshare
604 610
605#ifndef __NO_STUBS 611#ifndef __NO_STUBS
606 612
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 13e9f4a3ab26..20b446f26ecd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -84,7 +84,6 @@
84#include <linux/kernel.h> 84#include <linux/kernel.h>
85#include <linux/threads.h> 85#include <linux/threads.h>
86#include <linux/bitmap.h> 86#include <linux/bitmap.h>
87#include <asm/bug.h>
88 87
89typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 88typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
90extern cpumask_t _unused_cpumask_arg_; 89extern cpumask_t _unused_cpumask_arg_;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index a3f09947940e..4361f3789975 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -8,7 +8,6 @@
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/cache.h> 9#include <linux/cache.h>
10#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
11#include <asm/bug.h>
12 11
13struct nameidata; 12struct nameidata;
14struct vfsmount; 13struct vfsmount;
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index b1999bfeaa56..b81e58b2ebf8 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -135,7 +135,7 @@ typedef struct video_spu {
135 135
136typedef struct video_spu_palette { /* SPU Palette information */ 136typedef struct video_spu_palette { /* SPU Palette information */
137 int length; 137 int length;
138 uint8_t *palette; 138 uint8_t __user *palette;
139} video_spu_palette_t; 139} video_spu_palette_t;
140 140
141 141
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 23fe746a1d51..18cf1f3e1184 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -82,6 +82,7 @@ struct elevator_queue
82extern void elv_dispatch_sort(request_queue_t *, struct request *); 82extern void elv_dispatch_sort(request_queue_t *, struct request *);
83extern void elv_add_request(request_queue_t *, struct request *, int, int); 83extern void elv_add_request(request_queue_t *, struct request *, int, int);
84extern void __elv_add_request(request_queue_t *, struct request *, int, int); 84extern void __elv_add_request(request_queue_t *, struct request *, int, int);
85extern void elv_insert(request_queue_t *, struct request *, int);
85extern int elv_merge(request_queue_t *, struct request **, struct bio *); 86extern int elv_merge(request_queue_t *, struct request **, struct bio *);
86extern void elv_merge_requests(request_queue_t *, struct request *, 87extern void elv_merge_requests(request_queue_t *, struct request *,
87 struct request *); 88 struct request *);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 7863a59bd598..63f1d63cc1d8 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -100,6 +100,9 @@ extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
100/* Returns the number of read bytes */ 100/* Returns the number of read bytes */
101extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 101extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
102 u8 command, u8 *values); 102 u8 command, u8 *values);
103extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
104 u8 command, u8 length,
105 u8 *values);
103 106
104/* 107/*
105 * A driver is capable of handling one or more physical devices present on 108 * A driver is capable of handling one or more physical devices present on
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h
index e7906a72a4f1..da7c09e4ede6 100644
--- a/include/linux/ioc3.h
+++ b/include/linux/ioc3.h
@@ -27,7 +27,7 @@ struct ioc3_driver_data {
27 int id; /* IOC3 sequence number */ 27 int id; /* IOC3 sequence number */
28 /* PCI mapping */ 28 /* PCI mapping */
29 unsigned long pma; /* physical address */ 29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */ 30 struct ioc3 __iomem *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */ 31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */ 32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */ 33 int dual_irq; /* set if separate IRQs are used */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 751bb3849467..0fe4aa891ddc 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -239,7 +239,6 @@ typedef struct journal_superblock_s
239 239
240#include <linux/fs.h> 240#include <linux/fs.h>
241#include <linux/sched.h> 241#include <linux/sched.h>
242#include <asm/bug.h>
243 242
244#define JBD_ASSERTIONS 243#define JBD_ASSERTIONS
245#ifdef JBD_ASSERTIONS 244#ifdef JBD_ASSERTIONS
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 85854b867463..75e9f0724997 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -303,7 +303,7 @@ struct page {
303 */ 303 */
304#define put_page_testzero(p) \ 304#define put_page_testzero(p) \
305 ({ \ 305 ({ \
306 BUG_ON(page_count(p) == 0); \ 306 BUG_ON(atomic_read(&(p)->_count) == -1);\
307 atomic_add_negative(-1, &(p)->_count); \ 307 atomic_add_negative(-1, &(p)->_count); \
308 }) 308 })
309 309
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index fedfbc8a287f..7dfd6e1fcde7 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -15,7 +15,6 @@
15#include <asm/unaligned.h> 15#include <asm/unaligned.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/bug.h>
19 18
20#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 19#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1
21#define map_bankwidth(map) 1 20#define map_bankwidth(map) 1
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 6731977c4c13..3abc8e3b4879 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -15,6 +15,7 @@ struct namespace {
15 15
16extern int copy_namespace(int, struct task_struct *); 16extern int copy_namespace(int, struct task_struct *);
17extern void __put_namespace(struct namespace *namespace); 17extern void __put_namespace(struct namespace *namespace);
18extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
18 19
19static inline void put_namespace(struct namespace *namespace) 20static inline void put_namespace(struct namespace *namespace)
20{ 21{
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 4726ef7ba8e8..b959a4525cbd 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -84,7 +84,6 @@
84#include <linux/threads.h> 84#include <linux/threads.h>
85#include <linux/bitmap.h> 85#include <linux/bitmap.h>
86#include <linux/numa.h> 86#include <linux/numa.h>
87#include <asm/bug.h>
88 87
89typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 88typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
90extern nodemask_t _unused_nodemask_arg_; 89extern nodemask_t _unused_nodemask_arg_;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 92a619ba163f..7a61ccdcbc4b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1832,6 +1832,7 @@
1832#define PCI_VENDOR_ID_AFAVLAB 0x14db 1832#define PCI_VENDOR_ID_AFAVLAB 0x14db
1833#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 1833#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180
1834#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 1834#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
1835#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150
1835 1836
1836#define PCI_VENDOR_ID_BROADCOM 0x14e4 1837#define PCI_VENDOR_ID_BROADCOM 0x14e4
1837#define PCI_DEVICE_ID_TIGON3_5752 0x1600 1838#define PCI_DEVICE_ID_TIGON3_5752 0x1600
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9dfa3ee769ae..44153fdf73fc 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -17,7 +17,6 @@ extern void cpu_idle(void);
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/thread_info.h> 18#include <linux/thread_info.h>
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/bug.h>
21 20
22/* 21/*
23 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. 22 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 43bcd13eb1ec..37c1c76fd547 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -42,13 +42,21 @@ extern void mark_free_pages(struct zone *zone);
42#ifdef CONFIG_PM 42#ifdef CONFIG_PM
43/* kernel/power/swsusp.c */ 43/* kernel/power/swsusp.c */
44extern int software_suspend(void); 44extern int software_suspend(void);
45
46#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
47extern int pm_prepare_console(void);
48extern void pm_restore_console(void);
49#else
50static inline int pm_prepare_console(void) { return 0; }
51static inline void pm_restore_console(void) {}
52#endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */
45#else 53#else
46static inline int software_suspend(void) 54static inline int software_suspend(void)
47{ 55{
48 printk("Warning: fake suspend called\n"); 56 printk("Warning: fake suspend called\n");
49 return -EPERM; 57 return -EPERM;
50} 58}
51#endif 59#endif /* CONFIG_PM */
52 60
53#ifdef CONFIG_SUSPEND_SMP 61#ifdef CONFIG_SUSPEND_SMP
54extern void disable_nonboot_cpus(void); 62extern void disable_nonboot_cpus(void);
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b23be44cbea8..5208b12d5550 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -549,7 +549,7 @@ struct v4l2_framebuffer
549struct v4l2_clip 549struct v4l2_clip
550{ 550{
551 struct v4l2_rect c; 551 struct v4l2_rect c;
552 struct v4l2_clip *next; 552 struct v4l2_clip __user *next;
553}; 553};
554 554
555struct v4l2_window 555struct v4l2_window
diff --git a/init/Kconfig b/init/Kconfig
index 8b7abae87bf9..38416a199def 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -169,7 +169,6 @@ config SYSCTL
169config AUDIT 169config AUDIT
170 bool "Auditing support" 170 bool "Auditing support"
171 depends on NET 171 depends on NET
172 default y if SECURITY_SELINUX
173 help 172 help
174 Enable auditing infrastructure that can be used with another 173 Enable auditing infrastructure that can be used with another
175 kernel subsystem, such as SELinux (which requires this for 174 kernel subsystem, such as SELinux (which requires this for
diff --git a/kernel/compat.c b/kernel/compat.c
index 1867290c37e3..8c9cd88b6785 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -23,7 +23,6 @@
23#include <linux/security.h> 23#include <linux/security.h>
24 24
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/bug.h>
27 26
28int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) 27int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
29{ 28{
diff --git a/kernel/fork.c b/kernel/fork.c
index 7f0ab5ee948c..8e88b374cee9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -446,6 +446,55 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
446 } 446 }
447} 447}
448 448
449/*
450 * Allocate a new mm structure and copy contents from the
451 * mm structure of the passed in task structure.
452 */
453static struct mm_struct *dup_mm(struct task_struct *tsk)
454{
455 struct mm_struct *mm, *oldmm = current->mm;
456 int err;
457
458 if (!oldmm)
459 return NULL;
460
461 mm = allocate_mm();
462 if (!mm)
463 goto fail_nomem;
464
465 memcpy(mm, oldmm, sizeof(*mm));
466
467 if (!mm_init(mm))
468 goto fail_nomem;
469
470 if (init_new_context(tsk, mm))
471 goto fail_nocontext;
472
473 err = dup_mmap(mm, oldmm);
474 if (err)
475 goto free_pt;
476
477 mm->hiwater_rss = get_mm_rss(mm);
478 mm->hiwater_vm = mm->total_vm;
479
480 return mm;
481
482free_pt:
483 mmput(mm);
484
485fail_nomem:
486 return NULL;
487
488fail_nocontext:
489 /*
490 * If init_new_context() failed, we cannot use mmput() to free the mm
491 * because it calls destroy_context()
492 */
493 mm_free_pgd(mm);
494 free_mm(mm);
495 return NULL;
496}
497
449static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) 498static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
450{ 499{
451 struct mm_struct * mm, *oldmm; 500 struct mm_struct * mm, *oldmm;
@@ -473,43 +522,17 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
473 } 522 }
474 523
475 retval = -ENOMEM; 524 retval = -ENOMEM;
476 mm = allocate_mm(); 525 mm = dup_mm(tsk);
477 if (!mm) 526 if (!mm)
478 goto fail_nomem; 527 goto fail_nomem;
479 528
480 /* Copy the current MM stuff.. */
481 memcpy(mm, oldmm, sizeof(*mm));
482 if (!mm_init(mm))
483 goto fail_nomem;
484
485 if (init_new_context(tsk,mm))
486 goto fail_nocontext;
487
488 retval = dup_mmap(mm, oldmm);
489 if (retval)
490 goto free_pt;
491
492 mm->hiwater_rss = get_mm_rss(mm);
493 mm->hiwater_vm = mm->total_vm;
494
495good_mm: 529good_mm:
496 tsk->mm = mm; 530 tsk->mm = mm;
497 tsk->active_mm = mm; 531 tsk->active_mm = mm;
498 return 0; 532 return 0;
499 533
500free_pt:
501 mmput(mm);
502fail_nomem: 534fail_nomem:
503 return retval; 535 return retval;
504
505fail_nocontext:
506 /*
507 * If init_new_context() failed, we cannot use mmput() to free the mm
508 * because it calls destroy_context()
509 */
510 mm_free_pgd(mm);
511 free_mm(mm);
512 return retval;
513} 536}
514 537
515static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) 538static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old)
@@ -597,32 +620,17 @@ out:
597 return newf; 620 return newf;
598} 621}
599 622
600static int copy_files(unsigned long clone_flags, struct task_struct * tsk) 623/*
624 * Allocate a new files structure and copy contents from the
625 * passed in files structure.
626 */
627static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
601{ 628{
602 struct files_struct *oldf, *newf; 629 struct files_struct *newf;
603 struct file **old_fds, **new_fds; 630 struct file **old_fds, **new_fds;
604 int open_files, size, i, error = 0, expand; 631 int open_files, size, i, expand;
605 struct fdtable *old_fdt, *new_fdt; 632 struct fdtable *old_fdt, *new_fdt;
606 633
607 /*
608 * A background process may not have any files ...
609 */
610 oldf = current->files;
611 if (!oldf)
612 goto out;
613
614 if (clone_flags & CLONE_FILES) {
615 atomic_inc(&oldf->count);
616 goto out;
617 }
618
619 /*
620 * Note: we may be using current for both targets (See exec.c)
621 * This works because we cache current->files (old) as oldf. Don't
622 * break this.
623 */
624 tsk->files = NULL;
625 error = -ENOMEM;
626 newf = alloc_files(); 634 newf = alloc_files();
627 if (!newf) 635 if (!newf)
628 goto out; 636 goto out;
@@ -651,9 +659,9 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
651 if (expand) { 659 if (expand) {
652 spin_unlock(&oldf->file_lock); 660 spin_unlock(&oldf->file_lock);
653 spin_lock(&newf->file_lock); 661 spin_lock(&newf->file_lock);
654 error = expand_files(newf, open_files-1); 662 *errorp = expand_files(newf, open_files-1);
655 spin_unlock(&newf->file_lock); 663 spin_unlock(&newf->file_lock);
656 if (error < 0) 664 if (*errorp < 0)
657 goto out_release; 665 goto out_release;
658 new_fdt = files_fdtable(newf); 666 new_fdt = files_fdtable(newf);
659 /* 667 /*
@@ -702,10 +710,8 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
702 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); 710 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
703 } 711 }
704 712
705 tsk->files = newf;
706 error = 0;
707out: 713out:
708 return error; 714 return newf;
709 715
710out_release: 716out_release:
711 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset); 717 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset);
@@ -715,6 +721,40 @@ out_release:
715 goto out; 721 goto out;
716} 722}
717 723
724static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
725{
726 struct files_struct *oldf, *newf;
727 int error = 0;
728
729 /*
730 * A background process may not have any files ...
731 */
732 oldf = current->files;
733 if (!oldf)
734 goto out;
735
736 if (clone_flags & CLONE_FILES) {
737 atomic_inc(&oldf->count);
738 goto out;
739 }
740
741 /*
742 * Note: we may be using current for both targets (See exec.c)
743 * This works because we cache current->files (old) as oldf. Don't
744 * break this.
745 */
746 tsk->files = NULL;
747 error = -ENOMEM;
748 newf = dup_fd(oldf, &error);
749 if (!newf)
750 goto out;
751
752 tsk->files = newf;
753 error = 0;
754out:
755 return error;
756}
757
718/* 758/*
719 * Helper to unshare the files of the current task. 759 * Helper to unshare the files of the current task.
720 * We don't want to expose copy_files internals to 760 * We don't want to expose copy_files internals to
@@ -1323,3 +1363,249 @@ void __init proc_caches_init(void)
1323 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, 1363 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
1324 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 1364 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
1325} 1365}
1366
1367
1368/*
1369 * Check constraints on flags passed to the unshare system call and
1370 * force unsharing of additional process context as appropriate.
1371 */
1372static inline void check_unshare_flags(unsigned long *flags_ptr)
1373{
1374 /*
1375 * If unsharing a thread from a thread group, must also
1376 * unshare vm.
1377 */
1378 if (*flags_ptr & CLONE_THREAD)
1379 *flags_ptr |= CLONE_VM;
1380
1381 /*
1382 * If unsharing vm, must also unshare signal handlers.
1383 */
1384 if (*flags_ptr & CLONE_VM)
1385 *flags_ptr |= CLONE_SIGHAND;
1386
1387 /*
1388 * If unsharing signal handlers and the task was created
1389 * using CLONE_THREAD, then must unshare the thread
1390 */
1391 if ((*flags_ptr & CLONE_SIGHAND) &&
1392 (atomic_read(&current->signal->count) > 1))
1393 *flags_ptr |= CLONE_THREAD;
1394
1395 /*
1396 * If unsharing namespace, must also unshare filesystem information.
1397 */
1398 if (*flags_ptr & CLONE_NEWNS)
1399 *flags_ptr |= CLONE_FS;
1400}
1401
1402/*
1403 * Unsharing of tasks created with CLONE_THREAD is not supported yet
1404 */
1405static int unshare_thread(unsigned long unshare_flags)
1406{
1407 if (unshare_flags & CLONE_THREAD)
1408 return -EINVAL;
1409
1410 return 0;
1411}
1412
1413/*
1414 * Unshare the filesystem structure if it is being shared
1415 */
1416static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)
1417{
1418 struct fs_struct *fs = current->fs;
1419
1420 if ((unshare_flags & CLONE_FS) &&
1421 (fs && atomic_read(&fs->count) > 1)) {
1422 *new_fsp = __copy_fs_struct(current->fs);
1423 if (!*new_fsp)
1424 return -ENOMEM;
1425 }
1426
1427 return 0;
1428}
1429
1430/*
1431 * Unshare the namespace structure if it is being shared
1432 */
1433static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs)
1434{
1435 struct namespace *ns = current->namespace;
1436
1437 if ((unshare_flags & CLONE_NEWNS) &&
1438 (ns && atomic_read(&ns->count) > 1)) {
1439 if (!capable(CAP_SYS_ADMIN))
1440 return -EPERM;
1441
1442 *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs);
1443 if (!*new_nsp)
1444 return -ENOMEM;
1445 }
1446
1447 return 0;
1448}
1449
1450/*
1451 * Unsharing of sighand for tasks created with CLONE_SIGHAND is not
1452 * supported yet
1453 */
1454static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp)
1455{
1456 struct sighand_struct *sigh = current->sighand;
1457
1458 if ((unshare_flags & CLONE_SIGHAND) &&
1459 (sigh && atomic_read(&sigh->count) > 1))
1460 return -EINVAL;
1461 else
1462 return 0;
1463}
1464
1465/*
1466 * Unshare vm if it is being shared
1467 */
1468static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp)
1469{
1470 struct mm_struct *mm = current->mm;
1471
1472 if ((unshare_flags & CLONE_VM) &&
1473 (mm && atomic_read(&mm->mm_users) > 1)) {
1474 *new_mmp = dup_mm(current);
1475 if (!*new_mmp)
1476 return -ENOMEM;
1477 }
1478
1479 return 0;
1480}
1481
1482/*
1483 * Unshare file descriptor table if it is being shared
1484 */
1485static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp)
1486{
1487 struct files_struct *fd = current->files;
1488 int error = 0;
1489
1490 if ((unshare_flags & CLONE_FILES) &&
1491 (fd && atomic_read(&fd->count) > 1)) {
1492 *new_fdp = dup_fd(fd, &error);
1493 if (!*new_fdp)
1494 return error;
1495 }
1496
1497 return 0;
1498}
1499
1500/*
1501 * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not
1502 * supported yet
1503 */
1504static int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp)
1505{
1506 if (unshare_flags & CLONE_SYSVSEM)
1507 return -EINVAL;
1508
1509 return 0;
1510}
1511
1512/*
1513 * unshare allows a process to 'unshare' part of the process
1514 * context which was originally shared using clone. copy_*
1515 * functions used by do_fork() cannot be used here directly
1516 * because they modify an inactive task_struct that is being
1517 * constructed. Here we are modifying the current, active,
1518 * task_struct.
1519 */
1520asmlinkage long sys_unshare(unsigned long unshare_flags)
1521{
1522 int err = 0;
1523 struct fs_struct *fs, *new_fs = NULL;
1524 struct namespace *ns, *new_ns = NULL;
1525 struct sighand_struct *sigh, *new_sigh = NULL;
1526 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1527 struct files_struct *fd, *new_fd = NULL;
1528 struct sem_undo_list *new_ulist = NULL;
1529
1530 check_unshare_flags(&unshare_flags);
1531
1532 if ((err = unshare_thread(unshare_flags)))
1533 goto bad_unshare_out;
1534 if ((err = unshare_fs(unshare_flags, &new_fs)))
1535 goto bad_unshare_cleanup_thread;
1536 if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs)))
1537 goto bad_unshare_cleanup_fs;
1538 if ((err = unshare_sighand(unshare_flags, &new_sigh)))
1539 goto bad_unshare_cleanup_ns;
1540 if ((err = unshare_vm(unshare_flags, &new_mm)))
1541 goto bad_unshare_cleanup_sigh;
1542 if ((err = unshare_fd(unshare_flags, &new_fd)))
1543 goto bad_unshare_cleanup_vm;
1544 if ((err = unshare_semundo(unshare_flags, &new_ulist)))
1545 goto bad_unshare_cleanup_fd;
1546
1547 if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist) {
1548
1549 task_lock(current);
1550
1551 if (new_fs) {
1552 fs = current->fs;
1553 current->fs = new_fs;
1554 new_fs = fs;
1555 }
1556
1557 if (new_ns) {
1558 ns = current->namespace;
1559 current->namespace = new_ns;
1560 new_ns = ns;
1561 }
1562
1563 if (new_sigh) {
1564 sigh = current->sighand;
1565 current->sighand = new_sigh;
1566 new_sigh = sigh;
1567 }
1568
1569 if (new_mm) {
1570 mm = current->mm;
1571 active_mm = current->active_mm;
1572 current->mm = new_mm;
1573 current->active_mm = new_mm;
1574 activate_mm(active_mm, new_mm);
1575 new_mm = mm;
1576 }
1577
1578 if (new_fd) {
1579 fd = current->files;
1580 current->files = new_fd;
1581 new_fd = fd;
1582 }
1583
1584 task_unlock(current);
1585 }
1586
1587bad_unshare_cleanup_fd:
1588 if (new_fd)
1589 put_files_struct(new_fd);
1590
1591bad_unshare_cleanup_vm:
1592 if (new_mm)
1593 mmput(new_mm);
1594
1595bad_unshare_cleanup_sigh:
1596 if (new_sigh)
1597 if (atomic_dec_and_test(&new_sigh->count))
1598 kmem_cache_free(sighand_cachep, new_sigh);
1599
1600bad_unshare_cleanup_ns:
1601 if (new_ns)
1602 put_namespace(new_ns);
1603
1604bad_unshare_cleanup_fs:
1605 if (new_fs)
1606 put_fs_struct(new_fs);
1607
1608bad_unshare_cleanup_thread:
1609bad_unshare_out:
1610 return err;
1611}
diff --git a/kernel/module.c b/kernel/module.c
index e058aedf6b93..5aad477ddc79 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1670,6 +1670,9 @@ static struct module *load_module(void __user *umod,
1670 goto free_mod; 1670 goto free_mod;
1671 } 1671 }
1672 1672
1673 /* Userspace could have altered the string after the strlen_user() */
1674 args[arglen - 1] = '\0';
1675
1673 if (find_module(mod->name)) { 1676 if (find_module(mod->name)) {
1674 err = -EEXIST; 1677 err = -EEXIST;
1675 goto free_mod; 1678 goto free_mod;
diff --git a/kernel/power/console.c b/kernel/power/console.c
index 579d239d129f..623786d44159 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -9,7 +9,9 @@
9#include <linux/console.h> 9#include <linux/console.h>
10#include "power.h" 10#include "power.h"
11 11
12#ifdef SUSPEND_CONSOLE 12#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
13#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
14
13static int orig_fgconsole, orig_kmsg; 15static int orig_fgconsole, orig_kmsg;
14 16
15int pm_prepare_console(void) 17int pm_prepare_console(void)
diff --git a/kernel/power/power.h b/kernel/power/power.h
index d8f0d1a76bae..388dba680841 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -1,14 +1,6 @@
1#include <linux/suspend.h> 1#include <linux/suspend.h>
2#include <linux/utsname.h> 2#include <linux/utsname.h>
3 3
4/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but
5 we probably do not take enough locks for switching consoles, etc,
6 so bad things might happen.
7*/
8#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
9#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
10#endif
11
12struct swsusp_info { 4struct swsusp_info {
13 struct new_utsname uts; 5 struct new_utsname uts;
14 u32 version_code; 6 u32 version_code;
@@ -42,14 +34,6 @@ static struct subsys_attribute _name##_attr = { \
42 34
43extern struct subsystem power_subsys; 35extern struct subsystem power_subsys;
44 36
45#ifdef SUSPEND_CONSOLE
46extern int pm_prepare_console(void);
47extern void pm_restore_console(void);
48#else
49static int pm_prepare_console(void) { return 0; }
50static void pm_restore_console(void) {}
51#endif
52
53/* References to section boundaries */ 37/* References to section boundaries */
54extern const void __nosave_begin, __nosave_end; 38extern const void __nosave_begin, __nosave_end;
55 39
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 59c91c148e82..4e90905f0e87 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page)
743 if (!bio) 743 if (!bio)
744 return -ENOMEM; 744 return -ENOMEM;
745 bio->bi_sector = page_off * (PAGE_SIZE >> 9); 745 bio->bi_sector = page_off * (PAGE_SIZE >> 9);
746 bio_get(bio);
747 bio->bi_bdev = resume_bdev; 746 bio->bi_bdev = resume_bdev;
748 bio->bi_end_io = end_io; 747 bio->bi_end_io = end_io;
749 748
@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page)
753 goto Done; 752 goto Done;
754 } 753 }
755 754
756 if (rw == WRITE)
757 bio_set_pages_dirty(bio);
758 755
759 atomic_set(&io_done, 1); 756 atomic_set(&io_done, 1);
760 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 757 submit_bio(rw | (1 << BIO_RW_SYNC), bio);
761 while (atomic_read(&io_done)) 758 while (atomic_read(&io_done))
762 yield(); 759 yield();
763 760 if (rw == READ)
761 bio_set_pages_dirty(bio);
764 Done: 762 Done:
765 bio_put(bio); 763 bio_put(bio);
766 return error; 764 return error;
diff --git a/kernel/sys.c b/kernel/sys.c
index 0929c698affc..f91218a5463e 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -428,7 +428,7 @@ void kernel_kexec(void)
428{ 428{
429#ifdef CONFIG_KEXEC 429#ifdef CONFIG_KEXEC
430 struct kimage *image; 430 struct kimage *image;
431 image = xchg(&kexec_image, 0); 431 image = xchg(&kexec_image, NULL);
432 if (!image) { 432 if (!image) {
433 return; 433 return;
434 } 434 }
diff --git a/kernel/timer.c b/kernel/timer.c
index 4f1cb0ab5251..b9dad3994676 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -495,7 +495,7 @@ unsigned long next_timer_interrupt(void)
495 base = &__get_cpu_var(tvec_bases); 495 base = &__get_cpu_var(tvec_bases);
496 spin_lock(&base->t_base.lock); 496 spin_lock(&base->t_base.lock);
497 expires = base->timer_jiffies + (LONG_MAX >> 1); 497 expires = base->timer_jiffies + (LONG_MAX >> 1);
498 list = 0; 498 list = NULL;
499 499
500 /* Look for timer events in tv1. */ 500 /* Look for timer events in tv1. */
501 j = base->timer_jiffies & TVR_MASK; 501 j = base->timer_jiffies & TVR_MASK;
diff --git a/lib/kobject.c b/lib/kobject.c
index 7a0e6809490d..efe67fa96a71 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -72,6 +72,8 @@ static int get_kobj_path_length(struct kobject *kobj)
72 * Add 1 to strlen for leading '/' of each level. 72 * Add 1 to strlen for leading '/' of each level.
73 */ 73 */
74 do { 74 do {
75 if (kobject_name(parent) == NULL)
76 return 0;
75 length += strlen(kobject_name(parent)) + 1; 77 length += strlen(kobject_name(parent)) + 1;
76 parent = parent->parent; 78 parent = parent->parent;
77 } while (parent); 79 } while (parent);
@@ -107,6 +109,8 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
107 int len; 109 int len;
108 110
109 len = get_kobj_path_length(kobj); 111 len = get_kobj_path_length(kobj);
112 if (len == 0)
113 return NULL;
110 path = kmalloc(len, gfp_mask); 114 path = kmalloc(len, gfp_mask);
111 if (!path) 115 if (!path)
112 return NULL; 116 return NULL;
@@ -162,6 +166,11 @@ int kobject_add(struct kobject * kobj)
162 return -ENOENT; 166 return -ENOENT;
163 if (!kobj->k_name) 167 if (!kobj->k_name)
164 kobj->k_name = kobj->name; 168 kobj->k_name = kobj->name;
169 if (!kobj->k_name) {
170 pr_debug("kobject attempted to be registered with no name!\n");
171 WARN_ON(1);
172 return -EINVAL;
173 }
165 parent = kobject_get(kobj->parent); 174 parent = kobject_get(kobj->parent);
166 175
167 pr_debug("kobject %s: registering. parent: %s, set: %s\n", 176 pr_debug("kobject %s: registering. parent: %s, set: %s\n",
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index f56e27ae9d52..1b1985c136ec 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -22,7 +22,7 @@
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <net/sock.h> 23#include <net/sock.h>
24 24
25#define BUFFER_SIZE 1024 /* buffer for the variables */ 25#define BUFFER_SIZE 2048 /* buffer for the variables */
26#define NUM_ENVP 32 /* number of env pointers */ 26#define NUM_ENVP 32 /* number of env pointers */
27 27
28#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 28#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index c8bb8cc899d7..d8b6bb419d49 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -72,9 +72,9 @@ static void __spin_lock_debug(spinlock_t *lock)
72 72
73 for (;;) { 73 for (;;) {
74 for (i = 0; i < loops_per_jiffy * HZ; i++) { 74 for (i = 0; i < loops_per_jiffy * HZ; i++) {
75 cpu_relax();
76 if (__raw_spin_trylock(&lock->raw_lock)) 75 if (__raw_spin_trylock(&lock->raw_lock))
77 return; 76 return;
77 __delay(1);
78 } 78 }
79 /* lockup suspected: */ 79 /* lockup suspected: */
80 if (print_once) { 80 if (print_once) {
@@ -144,9 +144,9 @@ static void __read_lock_debug(rwlock_t *lock)
144 144
145 for (;;) { 145 for (;;) {
146 for (i = 0; i < loops_per_jiffy * HZ; i++) { 146 for (i = 0; i < loops_per_jiffy * HZ; i++) {
147 cpu_relax();
148 if (__raw_read_trylock(&lock->raw_lock)) 147 if (__raw_read_trylock(&lock->raw_lock))
149 return; 148 return;
149 __delay(1);
150 } 150 }
151 /* lockup suspected: */ 151 /* lockup suspected: */
152 if (print_once) { 152 if (print_once) {
@@ -217,9 +217,9 @@ static void __write_lock_debug(rwlock_t *lock)
217 217
218 for (;;) { 218 for (;;) {
219 for (i = 0; i < loops_per_jiffy * HZ; i++) { 219 for (i = 0; i < loops_per_jiffy * HZ; i++) {
220 cpu_relax();
221 if (__raw_write_trylock(&lock->raw_lock)) 220 if (__raw_write_trylock(&lock->raw_lock))
222 return; 221 return;
222 __delay(1);
223 } 223 }
224 /* lockup suspected: */ 224 /* lockup suspected: */
225 if (print_once) { 225 if (print_once) {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ceb3ebb3c399..67f29516662a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -107,7 +107,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
107 set_page_count(page, 1); 107 set_page_count(page, 1);
108 page[1].mapping = (void *)free_huge_page; 108 page[1].mapping = (void *)free_huge_page;
109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) 109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
110 clear_highpage(&page[i]); 110 clear_user_highpage(&page[i], addr);
111 return page; 111 return page;
112} 112}
113 113
@@ -391,12 +391,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
391 391
392 if (!new_page) { 392 if (!new_page) {
393 page_cache_release(old_page); 393 page_cache_release(old_page);
394 394 return VM_FAULT_OOM;
395 /* Logically this is OOM, not a SIGBUS, but an OOM
396 * could cause the kernel to go killing other
397 * processes which won't help the hugepage situation
398 * at all (?) */
399 return VM_FAULT_SIGBUS;
400 } 395 }
401 396
402 spin_unlock(&mm->page_table_lock); 397 spin_unlock(&mm->page_table_lock);
@@ -444,15 +439,7 @@ retry:
444 page = alloc_huge_page(vma, address); 439 page = alloc_huge_page(vma, address);
445 if (!page) { 440 if (!page) {
446 hugetlb_put_quota(mapping); 441 hugetlb_put_quota(mapping);
447 /* 442 ret = VM_FAULT_OOM;
448 * No huge pages available. So this is an OOM
449 * condition but we do not want to trigger the OOM
450 * killer, so we return VM_FAULT_SIGBUS.
451 *
452 * A program using hugepages may fault with Bus Error
453 * because no huge pages are available in the cpuset, per
454 * memory policy or because all are in use!
455 */
456 goto out; 443 goto out;
457 } 444 }
458 445
diff --git a/mm/slob.c b/mm/slob.c
index 1c240c4b71d9..a1f42bdc0245 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(slab_reclaim_pages);
336 336
337#ifdef CONFIG_SMP 337#ifdef CONFIG_SMP
338 338
339void *__alloc_percpu(size_t size, size_t align) 339void *__alloc_percpu(size_t size)
340{ 340{
341 int i; 341 int i;
342 struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL); 342 struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL);
diff --git a/mm/swap.c b/mm/swap.c
index bc2442a7b0ee..76247424dea1 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -34,19 +34,22 @@
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
37void put_page(struct page *page) 37static void put_compound_page(struct page *page)
38{ 38{
39 if (unlikely(PageCompound(page))) { 39 page = (struct page *)page_private(page);
40 page = (struct page *)page_private(page); 40 if (put_page_testzero(page)) {
41 if (put_page_testzero(page)) { 41 void (*dtor)(struct page *page);
42 void (*dtor)(struct page *page);
43 42
44 dtor = (void (*)(struct page *))page[1].mapping; 43 dtor = (void (*)(struct page *))page[1].mapping;
45 (*dtor)(page); 44 (*dtor)(page);
46 }
47 return;
48 } 45 }
49 if (put_page_testzero(page)) 46}
47
48void put_page(struct page *page)
49{
50 if (unlikely(PageCompound(page)))
51 put_compound_page(page);
52 else if (put_page_testzero(page))
50 __page_cache_release(page); 53 __page_cache_release(page);
51} 54}
52EXPORT_SYMBOL(put_page); 55EXPORT_SYMBOL(put_page);
@@ -244,6 +247,15 @@ void release_pages(struct page **pages, int nr, int cold)
244 struct page *page = pages[i]; 247 struct page *page = pages[i];
245 struct zone *pagezone; 248 struct zone *pagezone;
246 249
250 if (unlikely(PageCompound(page))) {
251 if (zone) {
252 spin_unlock_irq(&zone->lru_lock);
253 zone = NULL;
254 }
255 put_compound_page(page);
256 continue;
257 }
258
247 if (!put_page_testzero(page)) 259 if (!put_page_testzero(page))
248 continue; 260 continue;
249 261
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index d2b5933b4510..add3cae65e2d 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -15,7 +15,6 @@
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18#include <asm/bug.h>
19#include <asm/div64.h> 18#include <asm/div64.h>
20 19
21#include "tfrc.h" 20#include "tfrc.h"
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 0b4e95f93dad..64ce52bf0485 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1578,7 +1578,7 @@ static int sf_setstate(struct ip_mc_list *pmc)
1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0;
1579 if (new_in) { 1579 if (new_in) {
1580 if (!psf->sf_oldin) { 1580 if (!psf->sf_oldin) {
1581 struct ip_sf_list *prev = 0; 1581 struct ip_sf_list *prev = NULL;
1582 1582
1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { 1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) {
1584 if (dpsf->sf_inaddr == psf->sf_inaddr) 1584 if (dpsf->sf_inaddr == psf->sf_inaddr)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 42196ba3b0b9..45f7ae58f2c0 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -8,7 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#include <asm/bug.h>
12#include <linux/compiler.h> 11#include <linux/compiler.h>
13#include <linux/config.h> 12#include <linux/config.h>
14#include <linux/inetdevice.h> 13#include <linux/inetdevice.h>
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1db50487916b..b7d8822c1be4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2165,6 +2165,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2165 dev->name); 2165 dev->name);
2166 break; 2166 break;
2167 } 2167 }
2168
2169 if (idev)
2170 idev->if_flags |= IF_READY;
2168 } else { 2171 } else {
2169 if (!netif_carrier_ok(dev)) { 2172 if (!netif_carrier_ok(dev)) {
2170 /* device is still not ready. */ 2173 /* device is still not ready. */
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 4420948a1bfe..807c021d64a2 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1978,7 +1978,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
1978 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1978 new_in = psf->sf_count[MCAST_INCLUDE] != 0;
1979 if (new_in) { 1979 if (new_in) {
1980 if (!psf->sf_oldin) { 1980 if (!psf->sf_oldin) {
1981 struct ip6_sf_list *prev = 0; 1981 struct ip6_sf_list *prev = NULL;
1982 1982
1983 for (dpsf=pmc->mca_tomb; dpsf; 1983 for (dpsf=pmc->mca_tomb; dpsf;
1984 dpsf=dpsf->sf_next) { 1984 dpsf=dpsf->sf_next) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 66f1d12ea578..738376cf0c51 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -35,7 +35,6 @@
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/ioctls.h> 37#include <asm/ioctls.h>
38#include <asm/bug.h>
39 38
40#include <net/ip.h> 39#include <net/ip.h>
41#include <net/sock.h> 40#include <net/sock.h>
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 69bd957380e7..91cce8b2d7a5 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <asm/bug.h>
15#include <linux/compiler.h> 14#include <linux/compiler.h>
16#include <linux/config.h> 15#include <linux/config.h>
17#include <linux/netdevice.h> 16#include <linux/netdevice.h>
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 077bbf9fb9b7..dbf4620768d6 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -13,7 +13,6 @@
13 * 13 *
14 */ 14 */
15 15
16#include <asm/bug.h>
17#include <linux/config.h> 16#include <linux/config.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/kmod.h> 18#include <linux/kmod.h>
diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig
index 502f78f13f5f..f636f53ca544 100644
--- a/security/selinux/Kconfig
+++ b/security/selinux/Kconfig
@@ -1,6 +1,6 @@
1config SECURITY_SELINUX 1config SECURITY_SELINUX
2 bool "NSA SELinux Support" 2 bool "NSA SELinux Support"
3 depends on SECURITY_NETWORK && NET && INET 3 depends on SECURITY_NETWORK && AUDIT && NET && INET
4 default n 4 default n
5 help 5 help
6 This selects NSA Security-Enhanced Linux (SELinux). 6 This selects NSA Security-Enhanced Linux (SELinux).
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 53d6c7bbf564..ac5d69bb3377 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -43,13 +43,11 @@ static const struct av_perm_to_string
43#undef S_ 43#undef S_
44}; 44};
45 45
46#ifdef CONFIG_AUDIT
47static const char *class_to_string[] = { 46static const char *class_to_string[] = {
48#define S_(s) s, 47#define S_(s) s,
49#include "class_to_string.h" 48#include "class_to_string.h"
50#undef S_ 49#undef S_
51}; 50};
52#endif
53 51
54#define TB_(s) static const char * s [] = { 52#define TB_(s) static const char * s [] = {
55#define TE_(s) }; 53#define TE_(s) };
diff --git a/sound/oss/dmasound/tas_common.h b/sound/oss/dmasound/tas_common.h
index 3a6d48666db0..0741c28e56ce 100644
--- a/sound/oss/dmasound/tas_common.h
+++ b/sound/oss/dmasound/tas_common.h
@@ -178,10 +178,10 @@ tas_write_register( struct tas_data_t *self,
178 if (write_mode & WRITE_SHADOW) 178 if (write_mode & WRITE_SHADOW)
179 memcpy(self->shadow[reg_num],data,reg_width); 179 memcpy(self->shadow[reg_num],data,reg_width);
180 if (write_mode & WRITE_HW) { 180 if (write_mode & WRITE_HW) {
181 rc=i2c_smbus_write_block_data(self->client, 181 rc=i2c_smbus_write_i2c_block_data(self->client,
182 reg_num, 182 reg_num,
183 reg_width, 183 reg_width,
184 data); 184 data);
185 if (rc < 0) { 185 if (rc < 0) {
186 printk("tas: I2C block write failed \n"); 186 printk("tas: I2C block write failed \n");
187 return rc; 187 return rc;
@@ -199,10 +199,10 @@ tas_sync_register( struct tas_data_t *self,
199 199
200 if (reg_width==0 || self==NULL) 200 if (reg_width==0 || self==NULL)
201 return -EINVAL; 201 return -EINVAL;
202 rc=i2c_smbus_write_block_data(self->client, 202 rc=i2c_smbus_write_i2c_block_data(self->client,
203 reg_num, 203 reg_num,
204 reg_width, 204 reg_width,
205 self->shadow[reg_num]); 205 self->shadow[reg_num]);
206 if (rc < 0) { 206 if (rc < 0) {
207 printk("tas: I2C block write failed \n"); 207 printk("tas: I2C block write failed \n");
208 return rc; 208 return rc;
diff --git a/sound/oss/emu10k1/recmgr.c b/sound/oss/emu10k1/recmgr.c
index 67c3fd04cfdd..2ce56180e7d4 100644
--- a/sound/oss/emu10k1/recmgr.c
+++ b/sound/oss/emu10k1/recmgr.c
@@ -29,7 +29,7 @@
29 ********************************************************************** 29 **********************************************************************
30 */ 30 */
31 31
32#include <asm/delay.h> 32#include <linux/delay.h>
33#include "8010.h" 33#include "8010.h"
34#include "recmgr.h" 34#include "recmgr.h"
35 35
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 4988f873a7ba..aa57170101fd 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -66,7 +66,7 @@ static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, i
66 66
67static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) 67static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec)
68{ 68{
69 if (rec) { 69 if (rec->space) {
70 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); 70 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
71 71
72 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); 72 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base);
@@ -881,6 +881,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
881 chip->can_capture = 1; 881 chip->can_capture = 1;
882 chip->num_freqs = ARRAY_SIZE(awacs_freqs); 882 chip->num_freqs = ARRAY_SIZE(awacs_freqs);
883 chip->freq_table = awacs_freqs; 883 chip->freq_table = awacs_freqs;
884 chip->pdev = NULL;
884 885
885 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ 886 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */
886 887
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 15c63cb2ccba..838fc113c441 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
239 block[4] = (right_vol >> 8) & 0xff; 239 block[4] = (right_vol >> 8) & 0xff;
240 block[5] = (right_vol >> 0) & 0xff; 240 block[5] = (right_vol >> 0) & 0xff;
241 241
242 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL, 242 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6,
243 6, block) < 0) { 243 block) < 0) {
244 snd_printk("failed to set volume \n"); 244 snd_printk("failed to set volume \n");
245 return -EINVAL; 245 return -EINVAL;
246 } 246 }
@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
345 val[1] = 0; 345 val[1] = 0;
346 } 346 }
347 347
348 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 348 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
349 2, val) < 0) { 349 2, val) < 0) {
350 snd_printk("failed to set DRC\n"); 350 snd_printk("failed to set DRC\n");
351 return -EINVAL; 351 return -EINVAL;
352 } 352 }
@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
381 val[4] = 0x60; 381 val[4] = 0x60;
382 val[5] = 0xa0; 382 val[5] = 0xa0;
383 383
384 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 384 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
385 6, val) < 0) { 385 6, val) < 0) {
386 snd_printk("failed to set DRC\n"); 386 snd_printk("failed to set DRC\n");
387 return -EINVAL; 387 return -EINVAL;
388 } 388 }
@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
492 vol = info->table[vol]; 492 vol = info->table[vol];
493 for (i = 0; i < info->bytes; i++) 493 for (i = 0; i < info->bytes; i++)
494 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; 494 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
495 if (i2c_smbus_write_block_data(mix->i2c.client, info->reg, 495 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg,
496 info->bytes, block) < 0) { 496 info->bytes, block) < 0) {
497 snd_printk("failed to set mono volume %d\n", info->index); 497 snd_printk("failed to set mono volume %d\n", info->index);
498 return -EINVAL; 498 return -EINVAL;
499 } 499 }
@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r
625 for (j = 0; j < 3; j++) 625 for (j = 0; j < 3; j++)
626 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; 626 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
627 } 627 }
628 if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) { 628 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg,
629 9, block) < 0) {
629 snd_printk("failed to set mono volume %d\n", reg); 630 snd_printk("failed to set mono volume %d\n", reg);
630 return -EINVAL; 631 return -EINVAL;
631 } 632 }